diff --git a/posterita/.classpath b/posterita/.classpath new file mode 100644 index 0000000000..3d9cd643fa --- /dev/null +++ b/posterita/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/.project b/posterita/.project new file mode 100644 index 0000000000..74ab5b9df6 --- /dev/null +++ b/posterita/.project @@ -0,0 +1,18 @@ + + + posterita + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + com.sysdeo.eclipse.tomcat.tomcatnature + + diff --git a/posterita/.settings/org.eclipse.jdt.core.prefs b/posterita/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..850ee4c73b --- /dev/null +++ b/posterita/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,328 @@ +#Mon Apr 14 16:31:16 MUT 2008 (Ashley G Ramdass) +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +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.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=true +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +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_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=next_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=next_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_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.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.format_guardian_clause_on_one_line=false +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=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=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=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=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=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.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=80 +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=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/posterita/.settings/org.eclipse.jdt.ui.prefs b/posterita/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000..5a515244bf --- /dev/null +++ b/posterita/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,10 @@ +#Tue May 27 10:52:59 MUT 2008 (Ashley G Ramdass) +eclipse.preferences.version=1 +formatter_profile=_Posterita +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/posterita/.tomcatplugin b/posterita/.tomcatplugin new file mode 100644 index 0000000000..2b55a22921 --- /dev/null +++ b/posterita/.tomcatplugin @@ -0,0 +1,11 @@ + + + / + false + true + true + true + + + /posterita + diff --git a/posterita/commons/BuildPatch/Adempiere/jboss/bin/run.conf b/posterita/commons/BuildPatch/Adempiere/jboss/bin/run.conf new file mode 100644 index 0000000000..518084d856 --- /dev/null +++ b/posterita/commons/BuildPatch/Adempiere/jboss/bin/run.conf @@ -0,0 +1,53 @@ +## -*- shell-script -*- ###################################################### +## ## +## JBoss Bootstrap Script Configuration ## +## ## +############################################################################## + +### $Id: run.conf,v 1.3 2005/09/04 17:52:33 jjanke Exp $ + +# +# This file is optional; it may be removed if not needed. +# + +# +# Specify the maximum file descriptor limit, use "max" or "maximum" to use +# the default, as queried by the system. +# +# Defaults to "maximum" +# +#MAX_FD="maximum" + +# +# Specify the profiler configuration file to load. +# +# Default is to not load profiler configuration file. +# +#PROFILER="" + +# +# Specify the location of the Java home directory. If set then $JAVA will +# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java". +# +#JAVA_HOME="/opt/java/jdk" + +# +# Specify the exact Java VM executable to use. +# +#JAVA="" + +# +# Specify options to pass to the Java VM. +# +if [ "x$JAVA_OPTS" = "x" ]; then + JAVA_OPTS="-server -Xms128m -Xmx128m" +fi + +# Sample JPDA settings for remote socket debuging +#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y" + +# Sample JPDA settings for shared memory debugging +#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss" + +# AspectJ integration +JAVA_OPTS="$JAVA_OPTS -javaagent:$ADEMPIERE_HOME/lib/aspectjweaver.jar" diff --git a/posterita/commons/Migration/1.0-1.5 (AD331b)/build.xml b/posterita/commons/Migration/1.0-1.5 (AD331b)/build.xml new file mode 100644 index 0000000000..c0b65f816f --- /dev/null +++ b/posterita/commons/Migration/1.0-1.5 (AD331b)/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File ${file.name} status ${sqlplus.result} + + + + + + diff --git a/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/001_ad_changes.sql b/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/001_ad_changes.sql new file mode 100644 index 0000000000..6336c6c293 --- /dev/null +++ b/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/001_ad_changes.sql @@ -0,0 +1,32 @@ +INSERT INTO ad_element +(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, +columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) +VALUES(52027, 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, 'isPresentForProduct', +'U', 'isPresentForProduct', 'Present for Product', NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO ad_column +(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, + description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, + ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, +isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, +ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic) + VALUES( 52071, 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, 100, +'isPresentForProduct', 'Price List appears in Product Screen', '', 0, 'U', 'isPresentForProduct', + 255, 20, NULL, NULL, 1, NULL, 'N', 'N', 'N', 'Y', NULL, +'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', + 52027, NULL, 'N', 'N', NULL, NULL); + +INSERT INTO ad_column +(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, + name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, +ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, +isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, +valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, +isalwaysupdateable, columnsql, mandatorylogic) + VALUES(52072 , +0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, 100, 'Mandatory', 'Data entry is required in this column', +'The field must have a value for the record to be saved to the database.', 0, 'U', 'IsMandatory', +255, 20, NULL, NULL, 1, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', + 392, NULL, 'N', 'N', NULL, NULL); + + diff --git a/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/002_ad_message.sql b/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/002_ad_message.sql new file mode 100644 index 0000000000..73d279f394 --- /dev/null +++ b/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/002_ad_message.sql @@ -0,0 +1,65 @@ +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52441 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.price.list', 'Price List', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52442 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pmenu.help', 'Help', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52443 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'list.price', 'List Price', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52444 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'standard.price', 'Standard Price', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52445 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'limit.price', 'Limit Price', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52446 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'tax.incl', 'Tax Incl', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52447 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'tax.excl', 'Tax Excl', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52448 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'type.of.price.list', 'Type of Price List', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52449 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'purchase', 'Purchase', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52450 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'sales', 'Sales', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52451 , 0, 0, 'Y', TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_DATE('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'isPresentForProduct', 'Present for Product', ' ', 'I', 'D'); diff --git a/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/003_m_pricelist.sql b/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/003_m_pricelist.sql new file mode 100644 index 0000000000..753cec73ea --- /dev/null +++ b/posterita/commons/Migration/1.0-1.5 (AD331b)/oracle/003_m_pricelist.sql @@ -0,0 +1,5 @@ +ALTER TABLE m_pricelist ADD ismandatory char(1) DEFAULT 'N'; + +ALTER TABLE m_pricelist ADD ispresentforproduct char(1) DEFAULT 'N'; + + diff --git a/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/001_ad_changes.sql b/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/001_ad_changes.sql new file mode 100644 index 0000000000..ea9358ee4d --- /dev/null +++ b/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/001_ad_changes.sql @@ -0,0 +1,32 @@ +INSERT INTO ad_element +(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, +columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) +VALUES(52027, 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, 'isPresentForProduct', +'U', 'isPresentForProduct', 'Present for Product', NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO ad_column +(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, + description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, + ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, +isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, +ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic) + VALUES( 52071, 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, 100, +'isPresentForProduct', 'Price List appears in Product Screen', '', 0, 'U', 'isPresentForProduct', + 255, 20, NULL, NULL, 1, NULL, 'N', 'N', 'N', 'Y', NULL, +'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', + 52027, NULL, 'N', 'N', NULL, NULL); + +INSERT INTO ad_column +(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, + name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, +ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, +isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, +valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, +isalwaysupdateable, columnsql, mandatorylogic) + VALUES(52072 , +0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, 100, 'Mandatory', 'Data entry is required in this column', +'The field must have a value for the record to be saved to the database.', 0, 'U', 'IsMandatory', +255, 20, NULL, NULL, 1, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', + 392, NULL, 'N', 'N', NULL, NULL); + + diff --git a/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/002_ad_message.sql b/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/002_ad_message.sql new file mode 100644 index 0000000000..baf54a2aa5 --- /dev/null +++ b/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/002_ad_message.sql @@ -0,0 +1,65 @@ +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52441 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.price.list', 'Price List', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52442 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pmenu.help', 'Help', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52443 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'list.price', 'List Price', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52444 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'standard.price', 'Standard Price', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52445 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'limit.price', 'Limit Price', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52446 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'tax.incl', 'Tax Incl', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52447 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'tax.excl', 'Tax Excl', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52448 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'type.of.price.list', 'Type of Price List', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52449 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'purchase', 'Purchase', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52450 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'sales', 'Sales', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52451 , 0, 0, 'Y', TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-03-28 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'isPresentForProduct', 'Present for Product', ' ', 'I', 'D'); diff --git a/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/003_m_pricelist.sql b/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/003_m_pricelist.sql new file mode 100644 index 0000000000..fe0893a52e --- /dev/null +++ b/posterita/commons/Migration/1.0-1.5 (AD331b)/postgresql/003_m_pricelist.sql @@ -0,0 +1,5 @@ +ALTER TABLE m_pricelist ADD COLUMN ismandatory char(1) DEFAULT 'N'; + +ALTER TABLE m_pricelist ADD COLUMN ispresentforproduct char(1) DEFAULT 'N'; + + diff --git a/posterita/commons/Migration/1.6(AD340)/build.xml b/posterita/commons/Migration/1.6(AD340)/build.xml new file mode 100644 index 0000000000..219ea01d3b --- /dev/null +++ b/posterita/commons/Migration/1.6(AD340)/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File ${file.name} status ${sqlplus.result} + + + + + + diff --git a/posterita/commons/Migration/1.6(AD340)/oracle/001_ad_Changes for C_Currency.sql b/posterita/commons/Migration/1.6(AD340)/oracle/001_ad_Changes for C_Currency.sql new file mode 100644 index 0000000000..1d921d56e4 --- /dev/null +++ b/posterita/commons/Migration/1.6(AD340)/oracle/001_ad_Changes for C_Currency.sql @@ -0,0 +1,14 @@ +INSERT INTO AD_Element +(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, +columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) +VALUES(52073, 0, 0, 'Y', TO_TIMESTAMP('2008-04-17 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-04-17 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'RoundOffFactor', 'U', 'Round Off Factor', 'Round Off Factor', 'Used to Round Off Payment Amount', NULL, NULL, NULL, NULL, NULL); + +INSERT INTO ad_column +(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, +description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, +ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, +isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, +ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic) +VALUES(52074, 0, 0, 'Y', TO_TIMESTAMP('2008-04-17 16:00:00','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2008-04-17 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, 100, 'RoundOffFactor' , 'Used to Round Off Payment Amount', NULL, 0, 'U', 'RoundOffFactor', 141, 22, NULL, NULL, 14, 1, 'N', 'N', 'Y', 'Y', NULL, +'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52073, NULL, 'N', 'N', NULL, NULL); diff --git a/posterita/commons/Migration/1.6(AD340)/oracle/002_ad_message.sql b/posterita/commons/Migration/1.6(AD340)/oracle/002_ad_message.sql new file mode 100644 index 0000000000..a0c8df625c --- /dev/null +++ b/posterita/commons/Migration/1.6(AD340)/oracle/002_ad_message.sql @@ -0,0 +1,11 @@ +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52467 , 0, 0, 'Y', TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.currency', 'Currency', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52468 , 0, 0, 'Y', TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.delete.price.on.pricelist', 'Delete Price On Price List', ' ', 'I', 'D'); diff --git a/posterita/commons/Migration/1.6(AD340)/oracle/003_C_Currency.sql b/posterita/commons/Migration/1.6(AD340)/oracle/003_C_Currency.sql new file mode 100644 index 0000000000..8ac2e6a7fd --- /dev/null +++ b/posterita/commons/Migration/1.6(AD340)/oracle/003_C_Currency.sql @@ -0,0 +1,2 @@ +ALTER TABLE C_Currency ADD roundOffFactor NUMBER; + diff --git a/posterita/commons/Migration/1.6(AD340)/postgresql/001_ad_Changes for C_Currency.sql b/posterita/commons/Migration/1.6(AD340)/postgresql/001_ad_Changes for C_Currency.sql new file mode 100644 index 0000000000..1d921d56e4 --- /dev/null +++ b/posterita/commons/Migration/1.6(AD340)/postgresql/001_ad_Changes for C_Currency.sql @@ -0,0 +1,14 @@ +INSERT INTO AD_Element +(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, +columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) +VALUES(52073, 0, 0, 'Y', TO_TIMESTAMP('2008-04-17 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-04-17 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, +'RoundOffFactor', 'U', 'Round Off Factor', 'Round Off Factor', 'Used to Round Off Payment Amount', NULL, NULL, NULL, NULL, NULL); + +INSERT INTO ad_column +(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, +description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, +ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, +isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, +ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic) +VALUES(52074, 0, 0, 'Y', TO_TIMESTAMP('2008-04-17 16:00:00','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2008-04-17 16:00:00','YYYY-MM-DD HH24:MI:SS'), 100, 100, 'RoundOffFactor' , 'Used to Round Off Payment Amount', NULL, 0, 'U', 'RoundOffFactor', 141, 22, NULL, NULL, 14, 1, 'N', 'N', 'Y', 'Y', NULL, +'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52073, NULL, 'N', 'N', NULL, NULL); diff --git a/posterita/commons/Migration/1.6(AD340)/postgresql/002_ad_message.sql b/posterita/commons/Migration/1.6(AD340)/postgresql/002_ad_message.sql new file mode 100644 index 0000000000..9ca9c4eee5 --- /dev/null +++ b/posterita/commons/Migration/1.6(AD340)/postgresql/002_ad_message.sql @@ -0,0 +1,18 @@ +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52467 , 0, 0, 'Y', TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.currency', 'Currency', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52468 , 0, 0, 'Y', TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.delete.price.on.pricelist', 'Delete Price On Price List', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52469 , 0, 0, 'Y', TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-04-25 14:30:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.organisation', 'Organisation', ' ', 'I', 'D'); + diff --git a/posterita/commons/Migration/1.6(AD340)/postgresql/003_C_Currency.sql b/posterita/commons/Migration/1.6(AD340)/postgresql/003_C_Currency.sql new file mode 100644 index 0000000000..1743c49096 --- /dev/null +++ b/posterita/commons/Migration/1.6(AD340)/postgresql/003_C_Currency.sql @@ -0,0 +1,2 @@ +ALTER TABLE C_Currency ADD COLUMN roundOffFactor NUMERIC; + diff --git a/posterita/commons/Migration/1.7.0/build.xml b/posterita/commons/Migration/1.7.0/build.xml new file mode 100644 index 0000000000..2a97b78db4 --- /dev/null +++ b/posterita/commons/Migration/1.7.0/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File ${file.name} status ${sqlplus.result} + + + + + + diff --git a/posterita/commons/Migration/1.7.0/oracle/001_MixedPayment.sql b/posterita/commons/Migration/1.7.0/oracle/001_MixedPayment.sql new file mode 100644 index 0000000000..266516c722 --- /dev/null +++ b/posterita/commons/Migration/1.7.0/oracle/001_MixedPayment.sql @@ -0,0 +1,24 @@ +-- May 22, 2008 10:57:07 AM GMT+04:00 +-- Create Mixed in the payment rules list +INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,195,52000,TO_DATE('2008-05-22 10:55:30','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Mixed',TO_DATE('2008-05-22 10:55:30','YYYY-MM-DD HH24:MI:SS'),100,'M') +; + +-- May 22, 2008 10:57:11 AM GMT+04:00 +-- Update the translation +INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=52000 AND EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Ref_List_ID!=t.AD_Ref_List_ID) +; + +-- May 22, 2008 11:28:12 AM GMT+04:00 +-- Creates new Validation rule so that rich client does not get Mixed rule +INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52002,'AD_Ref_List.Value <> ''M''',TO_DATE('2008-05-22 11:28:12','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','All_Payment Rule - No mixed','S',TO_DATE('2008-05-22 11:28:12','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 22, 2008 11:30:02 AM GMT+04:00 +-- Updates all columns in AD where the payment rule list is used with the validation created earlier +UPDATE AD_Column SET AD_Val_Rule_ID=52002 WHERE AD_Reference_Value_ID=195 AND AD_Val_Rule_ID IS NULL +; + +-- May 22, 2008 11:31:15 AM GMT+04:00 +-- Updates all columns in AD where an existing validation rule exist and set it to ignore the Mixed rule +UPDATE AD_Val_Rule SET Code='AD_Ref_List.Value <> ''B'' AND AD_Ref_List.Value <> ''M''' WHERE AD_Val_Rule_ID=161 +; diff --git a/posterita/commons/Migration/1.7.0/oracle/002_Terminals_newTableStructure.sql b/posterita/commons/Migration/1.7.0/oracle/002_Terminals_newTableStructure.sql new file mode 100644 index 0000000000..0c4aaf8e63 --- /dev/null +++ b/posterita/commons/Migration/1.7.0/oracle/002_Terminals_newTableStructure.sql @@ -0,0 +1,629 @@ +-- Jun 2, 2008 9:19:48 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Table (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Table_ID,CopyColumnsFromTable,Created,CreatedBy,EntityType,ImportTable,IsActive,IsChangeLog,IsDeleteable,IsHighVolume,IsSecurityEnabled,IsView,LoadSeq,Name,ReplicationType,TableName,Updated,UpdatedBy) VALUES ('1',0,0,52004,'N',TO_DATE('2008-06-02 21:19:47','YYYY-MM-DD HH24:MI:SS'),100,'A','N','Y','N','Y','N','N','N',0,'POS Terminal','L','U_POSTerminal',TO_DATE('2008-06-02 21:19:47','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:19:48 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=52004 AND EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Table_ID!=t.AD_Table_ID) +; + +-- Jun 2, 2008 9:21:23 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52077,102,0,19,52004,129,'AD_Client_ID',TO_DATE('2008-06-02 21:21:22','YYYY-MM-DD HH24:MI:SS'),100,'@#AD_Client_ID@','Client/Tenant for this installation.','A',22,'A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','Y','N','N','N','N','Y','N','N','N','N','Y','Client',0,TO_DATE('2008-06-02 21:21:22','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:21:23 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52077 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:22:32 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52078,113,0,19,52004,130,'AD_Org_ID',TO_DATE('2008-06-02 21:22:32','YYYY-MM-DD HH24:MI:SS'),100,'@#AD_Org_ID@','Organizational entity within client','A',22,'An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y','N','N','N','N','Y','N','N','N','N','Y','Organization',0,TO_DATE('2008-06-02 21:22:32','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:22:32 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52078 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + + +-- Jun 2, 2008 9:23:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52030,0,'AutoLock',TO_DATE('2008-06-02 21:23:51','YYYY-MM-DD HH24:MI:SS'),100,'Whether to automatically lock the terminal when till is closed','A','Y','Auto Lock','Auto Lock',TO_DATE('2008-06-02 21:23:51','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:23:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52030 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:24:30 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52079,52030,0,20,52004,'AutoLock',TO_DATE('2008-06-02 21:24:30','YYYY-MM-DD HH24:MI:SS'),100,'N','Whether to automatically lock the terminal when till is closed','A',1,'Y','N','N','N','N','Y','N','N','N','N','Y','Auto Lock',0,TO_DATE('2008-06-02 21:24:30','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:24:30 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52079 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:26:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52031,0,'CashBookTransferType',TO_DATE('2008-06-02 21:26:51','YYYY-MM-DD HH24:MI:SS'),100,'Where the money in the cash book should be transfered to. Either a Bank Account or another Cash Book','A','Y','Cash Book Transfer Type','Cash Book Transfer Type',TO_DATE('2008-06-02 21:26:51','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:26:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52031 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:29:14 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,52002,TO_DATE('2008-06-02 21:29:14','YYYY-MM-DD HH24:MI:SS'),100,'Where money should be transfered to','A','Y','_TransferType',TO_DATE('2008-06-02 21:29:14','YYYY-MM-DD HH24:MI:SS'),100,'L') +; + +-- Jun 2, 2008 9:29:14 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=52002 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- Jun 2, 2008 9:29:42 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,52002,52001,TO_DATE('2008-06-02 21:29:42','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Bank Account',TO_DATE('2008-06-02 21:29:42','YYYY-MM-DD HH24:MI:SS'),100,'B') +; + +-- Jun 2, 2008 9:29:42 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=52001 AND EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Ref_List_ID!=t.AD_Ref_List_ID) +; + +-- Jun 2, 2008 9:29:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,52002,52002,TO_DATE('2008-06-02 21:29:51','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','CashBook',TO_DATE('2008-06-02 21:29:51','YYYY-MM-DD HH24:MI:SS'),100,'C') +; + +-- Jun 2, 2008 9:29:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=52002 AND EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Ref_List_ID!=t.AD_Ref_List_ID) +; + +-- Jun 2, 2008 9:30:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52080,52031,0,17,52002,52004,'CashBookTransferType',TO_DATE('2008-06-02 21:30:13','YYYY-MM-DD HH24:MI:SS'),100,'Where the money in the cash book should be transfered to. Either a Bank Account or another Cash Book','A',1,'Y','N','N','N','N','Y','N','N','N','N','Y','Cash Book Transfer Type',0,TO_DATE('2008-06-02 21:30:13','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:30:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52080 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:32:22 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52032,0,'CashTransferBankAccount_ID',TO_DATE('2008-06-02 21:32:22','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account on which to transfer all Cash transactions','A','Y','Transfer Cash trx to','Transfer Cash trx to',TO_DATE('2008-06-02 21:32:22','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:32:22 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52032 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:33:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,52003,TO_DATE('2008-06-02 21:33:15','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','C_BankAccount',TO_DATE('2008-06-02 21:33:15','YYYY-MM-DD HH24:MI:SS'),100,'T') +; + +-- Jun 2, 2008 9:33:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=52003 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- Jun 2, 2008 9:33:52 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,WhereClause) VALUES (0,3074,3077,0,52003,297,TO_DATE('2008-06-02 21:33:52','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','N',TO_DATE('2008-06-02 21:33:52','YYYY-MM-DD HH24:MI:SS'),100,'C_BankAccount.IsActive=''Y''') +; + +-- Jun 2, 2008 9:34:10 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52081,52032,0,18,52003,52004,'CashTransferBankAccount_ID',TO_DATE('2008-06-02 21:34:10','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account on which to transfer all Cash transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Cash trx to',0,TO_DATE('2008-06-02 21:34:10','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:34:10 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52081 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:35:28 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52033,0,'CashTransferCashBook_ID',TO_DATE('2008-06-02 21:35:28','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Cash transactions','A','Y','Transfer Cash trx to','Transfer Cash trx to',TO_DATE('2008-06-02 21:35:28','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:35:28 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52033 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:36:18 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,52004,TO_DATE('2008-06-02 21:36:18','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','C_CashBook',TO_DATE('2008-06-02 21:36:18','YYYY-MM-DD HH24:MI:SS'),100,'T') +; + +-- Jun 2, 2008 9:36:18 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=52004 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- Jun 2, 2008 9:36:54 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,WhereClause) VALUES (0,5268,5260,0,52004,408,TO_DATE('2008-06-02 21:36:54','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','N',TO_DATE('2008-06-02 21:36:54','YYYY-MM-DD HH24:MI:SS'),100,'C_CashBook.IsActive=''Y''') +; + +-- Jun 2, 2008 9:37:11 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52082,52033,0,18,52004,52004,'CashTransferCashBook_ID',TO_DATE('2008-06-02 21:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Cash transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Cash trx to',0,TO_DATE('2008-06-02 21:37:11','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:37:11 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52082 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:37:53 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52083,1463,0,19,52004,'C_CashBook_ID',TO_DATE('2008-06-02 21:37:53','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book for recording petty cash transactions','A',22,'The Cash Book identifies a unique cash book. The cash book is used to record cash transactions.','Y','N','N','N','N','Y','N','N','N','N','Y','Cash Book',0,TO_DATE('2008-06-02 21:37:53','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:37:53 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52083 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:39:00 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52034,0,'C_CashBPartner_ID',TO_DATE('2008-06-02 21:39:00','YYYY-MM-DD HH24:MI:SS'),100,'BPartner to be used for Cash transactions','A','Y','Cash BPartner','Cash BPartner',TO_DATE('2008-06-02 21:39:00','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:39:00 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52034 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:39:32 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52084,52034,0,18,173,52004,'C_CashBPartner_ID',TO_DATE('2008-06-02 21:39:32','YYYY-MM-DD HH24:MI:SS'),100,'BPartner to be used for Cash transactions','A',22,'Y','N','N','N','N','Y','N','N','N','N','Y','Cash BPartner',0,TO_DATE('2008-06-02 21:39:32','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:39:32 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52084 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:41:11 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52035,0,'Check_BankAccount_ID',TO_DATE('2008-06-02 21:41:11','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account to be used for processing Check transactions','A','Y','Check Bank Account','Check Bank Account',TO_DATE('2008-06-02 21:41:11','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:41:11 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52035 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:41:34 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52085,52035,0,18,52003,52004,'Check_BankAccount_ID',TO_DATE('2008-06-02 21:41:34','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account to be used for processing Check transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Check Bank Account',0,TO_DATE('2008-06-02 21:41:34','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:41:34 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52085 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:42:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52036,0,'CheckTransferBankAccount_ID',TO_DATE('2008-06-02 21:42:50','YYYY-MM-DD HH24:MI:SS'),100,'Bank account on which to transfer Check transactions','A','Y','Tranfer Check trx to','Transfer Check trx to',TO_DATE('2008-06-02 21:42:50','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:42:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52036 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:43:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52086,52036,0,18,52003,52004,'CheckTransferBankAccount_ID',TO_DATE('2008-06-02 21:43:15','YYYY-MM-DD HH24:MI:SS'),100,'Bank account on which to transfer Check transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Tranfer Check trx to',0,TO_DATE('2008-06-02 21:43:15','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:43:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52086 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:44:12 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52037,0,'CheckTransferType',TO_DATE('2008-06-02 21:44:12','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Check Transfer Type','Check Transfer Type',TO_DATE('2008-06-02 21:44:12','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:44:12 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52037 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:44:39 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52087,52037,0,17,52002,52004,'CheckTransferType',TO_DATE('2008-06-02 21:44:39','YYYY-MM-DD HH24:MI:SS'),100,'A',1,'Y','N','N','N','N','N','N','N','N','N','Y','Check Transfer Type',0,TO_DATE('2008-06-02 21:44:39','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:44:39 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52087 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:46:05 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52038,0,'Card_BankAccount_ID',TO_DATE('2008-06-02 21:46:05','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account on which card transactions will be processed','A','Y','Card Bank Account','Card Bank Account',TO_DATE('2008-06-02 21:46:05','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:46:05 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52038 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:46:28 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52088,52038,0,18,52003,52004,'Card_BankAccount_ID',TO_DATE('2008-06-02 21:46:28','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account on which card transactions will be processed','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Card Bank Account',0,TO_DATE('2008-06-02 21:46:28','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:46:28 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52088 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:47:33 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52039,0,'CardTransferBankAccount_ID',TO_DATE('2008-06-02 21:47:33','YYYY-MM-DD HH24:MI:SS'),100,'Bank account on which to transfer Card transactions','A','Y','Transfer Card trx to','Transfer Card trx to',TO_DATE('2008-06-02 21:47:33','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:47:33 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52039 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:47:59 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52089,52039,0,18,52003,52004,'CardTransferBankAccount_ID',TO_DATE('2008-06-02 21:47:59','YYYY-MM-DD HH24:MI:SS'),100,'Bank account on which to transfer Card transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Card trx to',0,TO_DATE('2008-06-02 21:47:59','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:47:59 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52089 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:48:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52040,0,'CardTransferCashBook_ID',TO_DATE('2008-06-02 21:48:55','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Card transactions','A','Y','Transfer Card trx to','Transfer Card trx to',TO_DATE('2008-06-02 21:48:55','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:48:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52040 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:49:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52090,52040,0,18,52004,52004,'CardTransferCashBook_ID',TO_DATE('2008-06-02 21:49:35','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Card transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Card trx to',0,TO_DATE('2008-06-02 21:49:35','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:49:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52090 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:50:21 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52041,0,'CardTransferType',TO_DATE('2008-06-02 21:50:21','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Card Transfer Type','Card Transfer Type',TO_DATE('2008-06-02 21:50:21','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:50:21 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52041 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:50:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52091,52041,0,17,52002,52004,'CardTransferType',TO_DATE('2008-06-02 21:50:40','YYYY-MM-DD HH24:MI:SS'),100,'A',1,'Y','N','N','N','N','N','N','N','N','N','Y','Card Transfer Type',0,TO_DATE('2008-06-02 21:50:40','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:50:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52091 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:51:10 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52092,245,0,16,52004,'Created',TO_DATE('2008-06-02 21:51:10','YYYY-MM-DD HH24:MI:SS'),100,'Date this record was created','A',7,'The Created field indicates the date that this record was created.','Y','N','N','N','N','Y','N','N','N','N','N','Created',0,TO_DATE('2008-06-02 21:51:10','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:51:10 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52092 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:52:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52093,246,0,18,110,52004,'CreatedBy',TO_DATE('2008-06-02 21:52:01','YYYY-MM-DD HH24:MI:SS'),100,'User who created this records','A',22,'The Created By field indicates the user who created this record.','Y','N','N','N','N','Y','N','N','N','N','N','Created By',0,TO_DATE('2008-06-02 21:52:01','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:52:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52093 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:53:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52042,0,'C_TemplateBPartner_ID',TO_DATE('2008-06-02 21:53:39','YYYY-MM-DD HH24:MI:SS'),100,'BPartner that is to be used as template when new customers are created','A','Y','Template BPartner','Template BPartner',TO_DATE('2008-06-02 21:53:39','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:53:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52042 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:54:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52094,52042,0,18,173,52004,'C_TemplateBPartner_ID',TO_DATE('2008-06-02 21:54:16','YYYY-MM-DD HH24:MI:SS'),100,'BPartner that is to be used as template when new customers are created','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Template BPartner',0,TO_DATE('2008-06-02 21:54:16','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:54:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52094 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:55:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52095,275,0,10,52004,'Description',TO_DATE('2008-06-02 21:55:01','YYYY-MM-DD HH24:MI:SS'),100,'Optional short description of the record','A',255,'A description is limited to 255 characters.','Y','N','N','N','N','N','N','N','N','N','Y','Description',0,TO_DATE('2008-06-02 21:55:01','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:55:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52095 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:55:37 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52096,326,0,14,52004,'Help',TO_DATE('2008-06-02 21:55:37','YYYY-MM-DD HH24:MI:SS'),100,'Comment or Hint','A',2000,'The Help field contains a hint, comment or help about the use of this item.','Y','N','N','N','N','N','N','N','N','N','Y','Comment/Help',0,TO_DATE('2008-06-02 21:55:37','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:55:37 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52096 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:56:03 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52097,348,0,20,52004,'IsActive',TO_DATE('2008-06-02 21:56:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','The record is active in the system','A',1,'There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.','Y','N','N','N','N','N','N','N','N','N','Y','Active',0,TO_DATE('2008-06-02 21:56:02','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:56:03 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52097 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:56:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52043,0,'LastLockTime',TO_DATE('2008-06-02 21:56:55','YYYY-MM-DD HH24:MI:SS'),100,'Last time at which the terminal was locked','A','Y','Last Lock Time','Last Lock Time',TO_DATE('2008-06-02 21:56:55','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:56:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52043 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:57:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52098,52043,0,16,52004,'LastLockTime',TO_DATE('2008-06-02 21:57:13','YYYY-MM-DD HH24:MI:SS'),100,'Last time at which the terminal was locked','A',7,'Y','N','N','N','N','N','N','N','N','N','Y','Last Lock Time',0,TO_DATE('2008-06-02 21:57:13','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:57:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52098 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:58:06 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52044,0,'Locked',TO_DATE('2008-06-02 21:58:06','YYYY-MM-DD HH24:MI:SS'),100,'Whether the terminal is locked','A','Y','Locked','Locked',TO_DATE('2008-06-02 21:58:06','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:58:06 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52044 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:58:26 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52099,52044,0,20,52004,'Locked',TO_DATE('2008-06-02 21:58:26','YYYY-MM-DD HH24:MI:SS'),100,'N','Whether the terminal is locked','A',1,'Y','N','N','N','N','N','N','N','N','N','Y','Locked',0,TO_DATE('2008-06-02 21:58:26','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:58:26 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52099 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:59:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52045,0,'LockTime',TO_DATE('2008-06-02 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Time in minutes the terminal should be kept in a locked state.','A','Y','Lock Time','Lock Time',TO_DATE('2008-06-02 21:59:13','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:59:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52045 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:59:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,ValueMin,Version) VALUES (0,52100,52045,0,11,52004,'LockTime',TO_DATE('2008-06-02 21:59:40','YYYY-MM-DD HH24:MI:SS'),100,'Time in minutes the terminal should be kept in a locked state.','A',10,'Y','N','N','N','N','N','N','N','N','N','Y','Lock Time',0,TO_DATE('2008-06-02 21:59:40','YYYY-MM-DD HH24:MI:SS'),100,'0',0) +; + +-- Jun 2, 2008 9:59:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52100 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:00:25 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52101,459,0,19,52004,'M_Warehouse_ID',TO_DATE('2008-06-02 22:00:24','YYYY-MM-DD HH24:MI:SS'),100,'Storage Warehouse and Service Point','A',22,'The Warehouse identifies a unique Warehouse where products are stored or Services are provided.','Y','N','N','N','N','N','N','N','N','N','Y','Warehouse',0,TO_DATE('2008-06-02 22:00:24','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:00:25 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52101 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:00:44 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52102,469,0,10,52004,'Name',TO_DATE('2008-06-02 22:00:44','YYYY-MM-DD HH24:MI:SS'),100,'Alphanumeric identifier of the entity','A',60,'The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.','Y','N','N','N','N','N','N','N','N','N','Y','Name',0,TO_DATE('2008-06-02 22:00:44','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:00:44 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52102 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:02:07 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52103,480,0,18,166,52004,'PO_PriceList_ID',TO_DATE('2008-06-02 22:02:07','YYYY-MM-DD HH24:MI:SS'),100,'Price List used by this Business Partner','A',22,'Identifies the price list used by a Vendor for products purchased by this organization.','Y','N','N','N','N','N','N','N','N','N','Y','Purchase Pricelist',0,TO_DATE('2008-06-02 22:02:07','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:02:07 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52103 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:02:37 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52104,2051,0,10,52004,'PrinterName',TO_DATE('2008-06-02 22:02:37','YYYY-MM-DD HH24:MI:SS'),100,'Name of the Printer','A',60,'Internal (Opereating System) Name of the Printer; Please mote that the printer name may be different on different clients. Enter a printer name, which applies to ALL clients (e.g. printer on a server).

+If none is entered, the default printer is used. You specify your default printer when you log in. You can also change the default printer in Preferences.','Y','N','N','N','N','N','N','N','N','N','Y','Printer Name',0,TO_DATE('2008-06-02 22:02:37','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:02:37 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52104 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:03:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52105,1063,0,18,316,52004,'SalesRep_ID',TO_DATE('2008-06-02 22:03:16','YYYY-MM-DD HH24:MI:SS'),100,'Sales Representative or Company Agent','A',22,'The Sales Representative indicates the Sales Rep for this Region. Any Sales Rep must be a valid internal user.','Y','N','N','N','N','N','N','N','N','N','Y','Sales Representative',0,TO_DATE('2008-06-02 22:03:16','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:03:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52105 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:04:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52046,0,'SO_PriceList_ID',TO_DATE('2008-06-02 22:04:15','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Sales Pricelist','Sales Pricelist',TO_DATE('2008-06-02 22:04:15','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 10:04:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52046 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 10:04:46 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52106,52046,0,18,166,52004,'SO_PriceList_ID',TO_DATE('2008-06-02 22:04:46','YYYY-MM-DD HH24:MI:SS'),100,'A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Sales Pricelist',0,TO_DATE('2008-06-02 22:04:46','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:04:46 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52106 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:05:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52047,0,'UnlockingTime',TO_DATE('2008-06-02 22:05:16','YYYY-MM-DD HH24:MI:SS'),100,'Time at which the terminal should be unlocked','A','Y','UnlockingTime','UnlockingTime',TO_DATE('2008-06-02 22:05:16','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 10:05:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52047 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 10:05:34 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52107,52047,0,16,52004,'UnlockingTime',TO_DATE('2008-06-02 22:05:34','YYYY-MM-DD HH24:MI:SS'),100,'Time at which the terminal should be unlocked','A',7,'Y','N','N','N','N','N','N','N','N','N','Y','UnlockingTime',0,TO_DATE('2008-06-02 22:05:34','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:05:34 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52107 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:05:58 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52108,607,0,16,52004,'Updated',TO_DATE('2008-06-02 22:05:58','YYYY-MM-DD HH24:MI:SS'),100,'Date this record was updated','A',7,'The Updated field indicates the date that this record was updated.','Y','N','N','N','N','Y','N','N','N','N','N','Updated',0,TO_DATE('2008-06-02 22:05:58','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:05:58 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52108 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:06:30 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52109,608,0,18,110,52004,'UpdatedBy',TO_DATE('2008-06-02 22:06:30','YYYY-MM-DD HH24:MI:SS'),100,'User who updated this records','A',22,'The Updated By field indicates the user who updated this record.','Y','N','N','N','N','N','N','N','N','N','Y','Updated By',0,TO_DATE('2008-06-02 22:06:30','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:06:30 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52109 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:29:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52048,0,'U_POSTerminal_ID',TO_DATE('2008-06-02 22:29:01','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','POS Terminal','POS Terminal',TO_DATE('2008-06-02 22:29:01','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 10:29:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52048 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 10:29:54 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52110,52048,0,13,52004,'U_POSTerminal_ID',TO_DATE('2008-06-02 22:29:54','YYYY-MM-DD HH24:MI:SS'),100,'A',22,'Y','N','N','N','Y','Y','N','N','N','N','N','POS Terminal',0,TO_DATE('2008-06-02 22:29:54','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:29:54 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52110 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:48:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52049,0,'CheckTransferCashBook_ID',TO_DATE('2008-06-02 22:48:55','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Check transactions','A','Y','Transfer Check trx to','Transfer Check trx to',TO_DATE('2008-06-02 22:48:55','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 10:48:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52049 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 10:49:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52111,52049,0,18,52004,52004,'CheckTransferCashBook_ID',TO_DATE('2008-06-02 22:49:35','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Check transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Check trx to',0,TO_DATE('2008-06-02 22:49:35','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:49:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52111 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 3, 2008 2:27:59 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Sequence (AD_Client_ID,AD_Org_ID,AD_Sequence_ID,Created,CreatedBy,CurrentNext,CurrentNextSys,Description,IncrementNo,IsActive,IsAudited,IsAutoSequence,IsTableID,Name,StartNewYear,StartNo,Updated,UpdatedBy) VALUES (0,0,52006,TO_DATE('2008-06-03 14:27:59','YYYY-MM-DD HH24:MI:SS'),100,1000000,100,'Table U_POSTerminal',1,'Y','N','Y','Y','U_POSTerminal','N',1000000,TO_DATE('2008-06-03 14:27:59','YYYY-MM-DD HH24:MI:SS'),100) +; \ No newline at end of file diff --git a/posterita/commons/Migration/1.7.0/oracle/003_Terminals_TransferConfiguration.sql b/posterita/commons/Migration/1.7.0/oracle/003_Terminals_TransferConfiguration.sql new file mode 100644 index 0000000000..79f6330932 --- /dev/null +++ b/posterita/commons/Migration/1.7.0/oracle/003_Terminals_TransferConfiguration.sql @@ -0,0 +1,75 @@ +ALTER TABLE AD_OrgInfo ADD TransferBank_ID NUMBER(10); +ALTER TABLE AD_OrgInfo ADD TransferCashBook_ID NUMBER(10); + +ALTER TABLE AD_OrgInfo + ADD CONSTRAINT "cbank_adorginfo" + FOREIGN KEY(TransferBank_ID) + REFERENCES C_Bank(C_Bank_ID); + + +ALTER TABLE AD_OrgInfo + ADD CONSTRAINT "ccashbook_adorginfo" + FOREIGN KEY(TransferCashBook_ID) + REFERENCES C_CashBook(C_CashBook_ID); + + + + +-- May 26, 2008 23:25:51 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52028,0,'TransferBank_ID',TO_DATE('2008-05-26 23:25:50','YYYY-MM-DD HH24:MI:SS'),100,'Bank account depending on currency will be used from this bank for doing transfers','D','Y','Bank for transfers','Bank for transfers',TO_DATE('2008-05-26 23:25:50','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 26, 2008 23:25:51 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52028 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- May 26, 2008 23:26:38 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,52001,TO_DATE('2008-05-26 23:26:38','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','C_Bank',TO_DATE('2008-05-26 23:26:38','YYYY-MM-DD HH24:MI:SS'),100,'T') +; + +-- May 26, 2008 23:26:38 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=52001 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- May 26, 2008 23:28:08 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,WhereClause) VALUES (0,3039,3031,0,52001,296,TO_DATE('2008-05-26 23:28:08','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N',TO_DATE('2008-05-26 23:28:08','YYYY-MM-DD HH24:MI:SS'),100,'C_Bank.IsOwnBank=''Y''') +; + +-- May 26, 2008 23:28:33 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52075,52028,0,18,52001,228,'TransferBank_ID',TO_DATE('2008-05-26 23:28:33','YYYY-MM-DD HH24:MI:SS'),100,'Bank account depending on currency will be used from this bank for doing transfers','D',22,'Y','N','N','N','N','N','N','N','N','N','Y','Bank for transfers',0,TO_DATE('2008-05-26 23:28:33','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- May 26, 2008 23:28:33 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52075 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + + + +-- Cash Book + +-- May 26, 2008 23:29:40 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52029,0,'TransferCashBook_ID',TO_DATE('2008-05-23 23:29:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','CashBook for transfers','CashBook for transfers',TO_DATE('2008-05-23 23:29:40','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 26, 2008 23:29:40 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52029 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- May 26, 2008 23:30:32 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52076,52029,0,18,52004,228,'TransferCashBook_ID',TO_DATE('2008-05-23 23:30:31','YYYY-MM-DD HH24:MI:SS'),100,'D',22,'Y','N','N','N','N','N','N','N','N','N','Y','CashBook for transfers',0,TO_DATE('2008-05-23 23:30:31','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- May 26, 2008 23:30:32 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52076 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; diff --git a/posterita/commons/Migration/1.7.0/oracle/004_Terminals_newTableDDL.sql b/posterita/commons/Migration/1.7.0/oracle/004_Terminals_newTableDDL.sql new file mode 100644 index 0000000000..61e4efab46 --- /dev/null +++ b/posterita/commons/Migration/1.7.0/oracle/004_Terminals_newTableDDL.sql @@ -0,0 +1,4 @@ +-- Jun 2, 2008 23:58:02 AM GMT+04:00 +-- Default comment for updating dictionary +CREATE TABLE U_POSTerminal (AD_Client_ID NUMBER(10) DEFAULT NULL NOT NULL, AD_Org_ID NUMBER(10) DEFAULT NULL NOT NULL, AutoLock CHAR(1) DEFAULT 'N' CHECK (AutoLock IN ('Y','N')) NOT NULL, Card_BankAccount_ID NUMBER(10), CardTransferBankAccount_ID NUMBER(10), CardTransferCashBook_ID NUMBER(10), CardTransferType CHAR(1), CashBookTransferType CHAR(1) NOT NULL, CashTransferBankAccount_ID NUMBER(10), CashTransferCashBook_ID NUMBER(10), C_CashBook_ID NUMBER(10) NOT NULL, C_CashBPartner_ID NUMBER(10) NOT NULL, Check_BankAccount_ID NUMBER(10), CheckTransferBankAccount_ID NUMBER(10), CheckTransferCashBook_ID NUMBER(10), CheckTransferType CHAR(1), Created DATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, C_TemplateBPartner_ID NUMBER(10), Description NVARCHAR2(255), Help NVARCHAR2(2000), IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')), LastLockTime DATE, Locked CHAR(1) DEFAULT 'N' CHECK (Locked IN ('Y','N')), LockTime NUMBER(10), M_Warehouse_ID NUMBER(10), Name NVARCHAR2(60), PO_PriceList_ID NUMBER(10), PrinterName NVARCHAR2(60), SalesRep_ID NUMBER(10), SO_PriceList_ID NUMBER(10), UnlockingTime DATE, Updated DATE NOT NULL, UpdatedBy NUMBER(10), U_POSTerminal_ID NUMBER(10) NOT NULL, CONSTRAINT U_POSTerminal_Key PRIMARY KEY (U_POSTerminal_ID)) +; \ No newline at end of file diff --git a/posterita/commons/Migration/1.7.0/oracle/005_Messages.sql b/posterita/commons/Migration/1.7.0/oracle/005_Messages.sql new file mode 100644 index 0000000000..3f4c27d750 --- /dev/null +++ b/posterita/commons/Migration/1.7.0/oracle/005_Messages.sql @@ -0,0 +1,190 @@ +-- Jun 9, 2008 1:24:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52452,0,TO_DATE('2008-06-09 13:24:35','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Organisation','I',TO_DATE('2008-06-09 13:24:35','YYYY-MM-DD HH24:MI:SS'),100,'smenu.organisation') +; + +-- Jun 9, 2008 1:25:48 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52453,0,TO_DATE('2008-06-09 13:25:48','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Terminals','I',TO_DATE('2008-06-09 13:25:48','YYYY-MM-DD HH24:MI:SS'),100,'smenu.terminal') +; + +-- Jun 9, 2008 1:26:06 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52454,0,TO_DATE('2008-06-09 13:26:06','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Cash Books','I',TO_DATE('2008-06-09 13:26:06','YYYY-MM-DD HH24:MI:SS'),100,'smenu.cashbook') +; + +-- Jun 9, 2008 1:26:30 PM GMT+04:00 +-- Default comment for updating dictionary +UPDATE AD_Message SET MsgTip='Maintain POS Terminals',Updated=TO_DATE('2008-06-09 13:26:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=52453 +; + +-- Jun 9, 2008 1:26:39 PM GMT+04:00 +-- Default comment for updating dictionary +UPDATE AD_Message SET MsgTip='Maintain Cash Books',Updated=TO_DATE('2008-06-09 13:26:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=52454 +; + +-- Jun 9, 2008 1:27:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52455,0,TO_DATE('2008-06-09 13:27:15','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Completed','I',TO_DATE('2008-06-09 13:27:15','YYYY-MM-DD HH24:MI:SS'),100,'document.status.completed') +; + +-- Jun 9, 2008 1:28:05 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52456,0,TO_DATE('2008-06-09 13:28:04','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Drafted','I',TO_DATE('2008-06-09 13:28:04','YYYY-MM-DD HH24:MI:SS'),100,'document.status.drafted') +; + +-- Jun 9, 2008 1:28:27 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52457,0,TO_DATE('2008-06-09 13:28:27','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','In Progress','I',TO_DATE('2008-06-09 13:28:27','YYYY-MM-DD HH24:MI:SS'),100,'document.status.inprogress') +; + +-- Jun 9, 2008 1:28:44 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52458,0,TO_DATE('2008-06-09 13:28:44','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Invalid','I',TO_DATE('2008-06-09 13:28:44','YYYY-MM-DD HH24:MI:SS'),100,'document.status.invalid') +; + +-- Jun 9, 2008 1:28:58 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52459,0,TO_DATE('2008-06-09 13:28:58','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Closed','I',TO_DATE('2008-06-09 13:28:58','YYYY-MM-DD HH24:MI:SS'),100,'document.status.closed') +; + +-- Jun 9, 2008 1:29:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52460,0,TO_DATE('2008-06-09 13:29:15','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Cash','I',TO_DATE('2008-06-09 13:29:15','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.cash') +; + +-- Jun 9, 2008 1:29:27 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52461,0,TO_DATE('2008-06-09 13:29:27','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Card','I',TO_DATE('2008-06-09 13:29:27','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.card') +; + +-- Jun 9, 2008 1:29:42 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52462,0,TO_DATE('2008-06-09 13:29:41','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Cheque','I',TO_DATE('2008-06-09 13:29:41','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.cheque') +; + +-- Jun 9, 2008 1:29:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52463,0,TO_DATE('2008-06-09 13:29:55','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Mixed','I',TO_DATE('2008-06-09 13:29:55','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.mixed') +; + +-- Jun 9, 2008 1:30:14 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52464,0,TO_DATE('2008-06-09 13:30:13','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Credit','I',TO_DATE('2008-06-09 13:30:13','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.credit') +; + +-- Jun 9, 2008 1:30:46 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52465,0,TO_DATE('2008-06-09 13:30:46','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Amount Paid','I',TO_DATE('2008-06-09 13:30:46','YYYY-MM-DD HH24:MI:SS'),100,'AmountPaid') +; + +--------------------------------------------------------------------------------------------------------------------------------------------------- + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52470 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'html', 'HTML', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52471 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pdf', 'PDF', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52472 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'csv', 'CSV', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52473 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.sales.report', 'Sales Report', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52474 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.best.selling.items', 'Best Selling Items', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52475 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.stock.sales.report', 'Stock Sales Report', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52476 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.transfer.stock', 'Stock Transfer', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52477 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.inventory.move', 'Inventory Move', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52478 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.move.confirmation', 'Move Confirmation', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52479 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.barcode.printing', 'Barcode Printing', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52480 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'basePriceList', 'Base Price List', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52481, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'isDeleteOldRecords', 'Delete Old Records', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52482, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'sales.price.list', 'Sales Price List', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52483, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'purchase.price.list', 'Purchase Price List', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52484, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pos.terminal', 'Terminal', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52485, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pos.version', 'Version', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52486, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pmenu.new.reports', 'Reports', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52487, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'isCreatePriceList', 'Create Price List', ' ', 'I', 'D'); + diff --git a/posterita/commons/Migration/1.7.0/postgresql/001_MixedPayment.sql b/posterita/commons/Migration/1.7.0/postgresql/001_MixedPayment.sql new file mode 100644 index 0000000000..266516c722 --- /dev/null +++ b/posterita/commons/Migration/1.7.0/postgresql/001_MixedPayment.sql @@ -0,0 +1,24 @@ +-- May 22, 2008 10:57:07 AM GMT+04:00 +-- Create Mixed in the payment rules list +INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,195,52000,TO_DATE('2008-05-22 10:55:30','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Mixed',TO_DATE('2008-05-22 10:55:30','YYYY-MM-DD HH24:MI:SS'),100,'M') +; + +-- May 22, 2008 10:57:11 AM GMT+04:00 +-- Update the translation +INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=52000 AND EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Ref_List_ID!=t.AD_Ref_List_ID) +; + +-- May 22, 2008 11:28:12 AM GMT+04:00 +-- Creates new Validation rule so that rich client does not get Mixed rule +INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52002,'AD_Ref_List.Value <> ''M''',TO_DATE('2008-05-22 11:28:12','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','All_Payment Rule - No mixed','S',TO_DATE('2008-05-22 11:28:12','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 22, 2008 11:30:02 AM GMT+04:00 +-- Updates all columns in AD where the payment rule list is used with the validation created earlier +UPDATE AD_Column SET AD_Val_Rule_ID=52002 WHERE AD_Reference_Value_ID=195 AND AD_Val_Rule_ID IS NULL +; + +-- May 22, 2008 11:31:15 AM GMT+04:00 +-- Updates all columns in AD where an existing validation rule exist and set it to ignore the Mixed rule +UPDATE AD_Val_Rule SET Code='AD_Ref_List.Value <> ''B'' AND AD_Ref_List.Value <> ''M''' WHERE AD_Val_Rule_ID=161 +; diff --git a/posterita/commons/Migration/1.7.0/postgresql/002_Terminals_newTableStructure.sql b/posterita/commons/Migration/1.7.0/postgresql/002_Terminals_newTableStructure.sql new file mode 100644 index 0000000000..0c4aaf8e63 --- /dev/null +++ b/posterita/commons/Migration/1.7.0/postgresql/002_Terminals_newTableStructure.sql @@ -0,0 +1,629 @@ +-- Jun 2, 2008 9:19:48 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Table (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Table_ID,CopyColumnsFromTable,Created,CreatedBy,EntityType,ImportTable,IsActive,IsChangeLog,IsDeleteable,IsHighVolume,IsSecurityEnabled,IsView,LoadSeq,Name,ReplicationType,TableName,Updated,UpdatedBy) VALUES ('1',0,0,52004,'N',TO_DATE('2008-06-02 21:19:47','YYYY-MM-DD HH24:MI:SS'),100,'A','N','Y','N','Y','N','N','N',0,'POS Terminal','L','U_POSTerminal',TO_DATE('2008-06-02 21:19:47','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:19:48 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=52004 AND EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Table_ID!=t.AD_Table_ID) +; + +-- Jun 2, 2008 9:21:23 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52077,102,0,19,52004,129,'AD_Client_ID',TO_DATE('2008-06-02 21:21:22','YYYY-MM-DD HH24:MI:SS'),100,'@#AD_Client_ID@','Client/Tenant for this installation.','A',22,'A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','Y','N','N','N','N','Y','N','N','N','N','Y','Client',0,TO_DATE('2008-06-02 21:21:22','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:21:23 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52077 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:22:32 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52078,113,0,19,52004,130,'AD_Org_ID',TO_DATE('2008-06-02 21:22:32','YYYY-MM-DD HH24:MI:SS'),100,'@#AD_Org_ID@','Organizational entity within client','A',22,'An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y','N','N','N','N','Y','N','N','N','N','Y','Organization',0,TO_DATE('2008-06-02 21:22:32','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:22:32 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52078 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + + +-- Jun 2, 2008 9:23:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52030,0,'AutoLock',TO_DATE('2008-06-02 21:23:51','YYYY-MM-DD HH24:MI:SS'),100,'Whether to automatically lock the terminal when till is closed','A','Y','Auto Lock','Auto Lock',TO_DATE('2008-06-02 21:23:51','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:23:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52030 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:24:30 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52079,52030,0,20,52004,'AutoLock',TO_DATE('2008-06-02 21:24:30','YYYY-MM-DD HH24:MI:SS'),100,'N','Whether to automatically lock the terminal when till is closed','A',1,'Y','N','N','N','N','Y','N','N','N','N','Y','Auto Lock',0,TO_DATE('2008-06-02 21:24:30','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:24:30 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52079 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:26:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52031,0,'CashBookTransferType',TO_DATE('2008-06-02 21:26:51','YYYY-MM-DD HH24:MI:SS'),100,'Where the money in the cash book should be transfered to. Either a Bank Account or another Cash Book','A','Y','Cash Book Transfer Type','Cash Book Transfer Type',TO_DATE('2008-06-02 21:26:51','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:26:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52031 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:29:14 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,52002,TO_DATE('2008-06-02 21:29:14','YYYY-MM-DD HH24:MI:SS'),100,'Where money should be transfered to','A','Y','_TransferType',TO_DATE('2008-06-02 21:29:14','YYYY-MM-DD HH24:MI:SS'),100,'L') +; + +-- Jun 2, 2008 9:29:14 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=52002 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- Jun 2, 2008 9:29:42 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,52002,52001,TO_DATE('2008-06-02 21:29:42','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Bank Account',TO_DATE('2008-06-02 21:29:42','YYYY-MM-DD HH24:MI:SS'),100,'B') +; + +-- Jun 2, 2008 9:29:42 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=52001 AND EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Ref_List_ID!=t.AD_Ref_List_ID) +; + +-- Jun 2, 2008 9:29:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,52002,52002,TO_DATE('2008-06-02 21:29:51','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','CashBook',TO_DATE('2008-06-02 21:29:51','YYYY-MM-DD HH24:MI:SS'),100,'C') +; + +-- Jun 2, 2008 9:29:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=52002 AND EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Ref_List_ID!=t.AD_Ref_List_ID) +; + +-- Jun 2, 2008 9:30:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52080,52031,0,17,52002,52004,'CashBookTransferType',TO_DATE('2008-06-02 21:30:13','YYYY-MM-DD HH24:MI:SS'),100,'Where the money in the cash book should be transfered to. Either a Bank Account or another Cash Book','A',1,'Y','N','N','N','N','Y','N','N','N','N','Y','Cash Book Transfer Type',0,TO_DATE('2008-06-02 21:30:13','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:30:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52080 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:32:22 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52032,0,'CashTransferBankAccount_ID',TO_DATE('2008-06-02 21:32:22','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account on which to transfer all Cash transactions','A','Y','Transfer Cash trx to','Transfer Cash trx to',TO_DATE('2008-06-02 21:32:22','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:32:22 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52032 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:33:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,52003,TO_DATE('2008-06-02 21:33:15','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','C_BankAccount',TO_DATE('2008-06-02 21:33:15','YYYY-MM-DD HH24:MI:SS'),100,'T') +; + +-- Jun 2, 2008 9:33:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=52003 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- Jun 2, 2008 9:33:52 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,WhereClause) VALUES (0,3074,3077,0,52003,297,TO_DATE('2008-06-02 21:33:52','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','N',TO_DATE('2008-06-02 21:33:52','YYYY-MM-DD HH24:MI:SS'),100,'C_BankAccount.IsActive=''Y''') +; + +-- Jun 2, 2008 9:34:10 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52081,52032,0,18,52003,52004,'CashTransferBankAccount_ID',TO_DATE('2008-06-02 21:34:10','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account on which to transfer all Cash transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Cash trx to',0,TO_DATE('2008-06-02 21:34:10','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:34:10 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52081 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:35:28 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52033,0,'CashTransferCashBook_ID',TO_DATE('2008-06-02 21:35:28','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Cash transactions','A','Y','Transfer Cash trx to','Transfer Cash trx to',TO_DATE('2008-06-02 21:35:28','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:35:28 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52033 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:36:18 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,52004,TO_DATE('2008-06-02 21:36:18','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','C_CashBook',TO_DATE('2008-06-02 21:36:18','YYYY-MM-DD HH24:MI:SS'),100,'T') +; + +-- Jun 2, 2008 9:36:18 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=52004 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- Jun 2, 2008 9:36:54 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,WhereClause) VALUES (0,5268,5260,0,52004,408,TO_DATE('2008-06-02 21:36:54','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','N',TO_DATE('2008-06-02 21:36:54','YYYY-MM-DD HH24:MI:SS'),100,'C_CashBook.IsActive=''Y''') +; + +-- Jun 2, 2008 9:37:11 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52082,52033,0,18,52004,52004,'CashTransferCashBook_ID',TO_DATE('2008-06-02 21:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Cash transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Cash trx to',0,TO_DATE('2008-06-02 21:37:11','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:37:11 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52082 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:37:53 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52083,1463,0,19,52004,'C_CashBook_ID',TO_DATE('2008-06-02 21:37:53','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book for recording petty cash transactions','A',22,'The Cash Book identifies a unique cash book. The cash book is used to record cash transactions.','Y','N','N','N','N','Y','N','N','N','N','Y','Cash Book',0,TO_DATE('2008-06-02 21:37:53','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:37:53 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52083 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:39:00 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52034,0,'C_CashBPartner_ID',TO_DATE('2008-06-02 21:39:00','YYYY-MM-DD HH24:MI:SS'),100,'BPartner to be used for Cash transactions','A','Y','Cash BPartner','Cash BPartner',TO_DATE('2008-06-02 21:39:00','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:39:00 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52034 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:39:32 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52084,52034,0,18,173,52004,'C_CashBPartner_ID',TO_DATE('2008-06-02 21:39:32','YYYY-MM-DD HH24:MI:SS'),100,'BPartner to be used for Cash transactions','A',22,'Y','N','N','N','N','Y','N','N','N','N','Y','Cash BPartner',0,TO_DATE('2008-06-02 21:39:32','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:39:32 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52084 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:41:11 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52035,0,'Check_BankAccount_ID',TO_DATE('2008-06-02 21:41:11','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account to be used for processing Check transactions','A','Y','Check Bank Account','Check Bank Account',TO_DATE('2008-06-02 21:41:11','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:41:11 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52035 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:41:34 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52085,52035,0,18,52003,52004,'Check_BankAccount_ID',TO_DATE('2008-06-02 21:41:34','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account to be used for processing Check transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Check Bank Account',0,TO_DATE('2008-06-02 21:41:34','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:41:34 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52085 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:42:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52036,0,'CheckTransferBankAccount_ID',TO_DATE('2008-06-02 21:42:50','YYYY-MM-DD HH24:MI:SS'),100,'Bank account on which to transfer Check transactions','A','Y','Tranfer Check trx to','Transfer Check trx to',TO_DATE('2008-06-02 21:42:50','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:42:51 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52036 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:43:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52086,52036,0,18,52003,52004,'CheckTransferBankAccount_ID',TO_DATE('2008-06-02 21:43:15','YYYY-MM-DD HH24:MI:SS'),100,'Bank account on which to transfer Check transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Tranfer Check trx to',0,TO_DATE('2008-06-02 21:43:15','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:43:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52086 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:44:12 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52037,0,'CheckTransferType',TO_DATE('2008-06-02 21:44:12','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Check Transfer Type','Check Transfer Type',TO_DATE('2008-06-02 21:44:12','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:44:12 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52037 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:44:39 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52087,52037,0,17,52002,52004,'CheckTransferType',TO_DATE('2008-06-02 21:44:39','YYYY-MM-DD HH24:MI:SS'),100,'A',1,'Y','N','N','N','N','N','N','N','N','N','Y','Check Transfer Type',0,TO_DATE('2008-06-02 21:44:39','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:44:39 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52087 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:46:05 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52038,0,'Card_BankAccount_ID',TO_DATE('2008-06-02 21:46:05','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account on which card transactions will be processed','A','Y','Card Bank Account','Card Bank Account',TO_DATE('2008-06-02 21:46:05','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:46:05 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52038 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:46:28 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52088,52038,0,18,52003,52004,'Card_BankAccount_ID',TO_DATE('2008-06-02 21:46:28','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account on which card transactions will be processed','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Card Bank Account',0,TO_DATE('2008-06-02 21:46:28','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:46:28 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52088 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:47:33 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52039,0,'CardTransferBankAccount_ID',TO_DATE('2008-06-02 21:47:33','YYYY-MM-DD HH24:MI:SS'),100,'Bank account on which to transfer Card transactions','A','Y','Transfer Card trx to','Transfer Card trx to',TO_DATE('2008-06-02 21:47:33','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:47:33 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52039 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:47:59 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52089,52039,0,18,52003,52004,'CardTransferBankAccount_ID',TO_DATE('2008-06-02 21:47:59','YYYY-MM-DD HH24:MI:SS'),100,'Bank account on which to transfer Card transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Card trx to',0,TO_DATE('2008-06-02 21:47:59','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:47:59 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52089 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:48:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52040,0,'CardTransferCashBook_ID',TO_DATE('2008-06-02 21:48:55','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Card transactions','A','Y','Transfer Card trx to','Transfer Card trx to',TO_DATE('2008-06-02 21:48:55','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:48:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52040 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:49:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52090,52040,0,18,52004,52004,'CardTransferCashBook_ID',TO_DATE('2008-06-02 21:49:35','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Card transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Card trx to',0,TO_DATE('2008-06-02 21:49:35','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:49:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52090 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:50:21 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52041,0,'CardTransferType',TO_DATE('2008-06-02 21:50:21','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Card Transfer Type','Card Transfer Type',TO_DATE('2008-06-02 21:50:21','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:50:21 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52041 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:50:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52091,52041,0,17,52002,52004,'CardTransferType',TO_DATE('2008-06-02 21:50:40','YYYY-MM-DD HH24:MI:SS'),100,'A',1,'Y','N','N','N','N','N','N','N','N','N','Y','Card Transfer Type',0,TO_DATE('2008-06-02 21:50:40','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:50:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52091 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:51:10 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52092,245,0,16,52004,'Created',TO_DATE('2008-06-02 21:51:10','YYYY-MM-DD HH24:MI:SS'),100,'Date this record was created','A',7,'The Created field indicates the date that this record was created.','Y','N','N','N','N','Y','N','N','N','N','N','Created',0,TO_DATE('2008-06-02 21:51:10','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:51:10 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52092 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:52:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52093,246,0,18,110,52004,'CreatedBy',TO_DATE('2008-06-02 21:52:01','YYYY-MM-DD HH24:MI:SS'),100,'User who created this records','A',22,'The Created By field indicates the user who created this record.','Y','N','N','N','N','Y','N','N','N','N','N','Created By',0,TO_DATE('2008-06-02 21:52:01','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:52:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52093 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:53:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52042,0,'C_TemplateBPartner_ID',TO_DATE('2008-06-02 21:53:39','YYYY-MM-DD HH24:MI:SS'),100,'BPartner that is to be used as template when new customers are created','A','Y','Template BPartner','Template BPartner',TO_DATE('2008-06-02 21:53:39','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:53:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52042 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:54:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52094,52042,0,18,173,52004,'C_TemplateBPartner_ID',TO_DATE('2008-06-02 21:54:16','YYYY-MM-DD HH24:MI:SS'),100,'BPartner that is to be used as template when new customers are created','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Template BPartner',0,TO_DATE('2008-06-02 21:54:16','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:54:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52094 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:55:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52095,275,0,10,52004,'Description',TO_DATE('2008-06-02 21:55:01','YYYY-MM-DD HH24:MI:SS'),100,'Optional short description of the record','A',255,'A description is limited to 255 characters.','Y','N','N','N','N','N','N','N','N','N','Y','Description',0,TO_DATE('2008-06-02 21:55:01','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:55:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52095 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:55:37 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52096,326,0,14,52004,'Help',TO_DATE('2008-06-02 21:55:37','YYYY-MM-DD HH24:MI:SS'),100,'Comment or Hint','A',2000,'The Help field contains a hint, comment or help about the use of this item.','Y','N','N','N','N','N','N','N','N','N','Y','Comment/Help',0,TO_DATE('2008-06-02 21:55:37','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:55:37 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52096 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:56:03 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52097,348,0,20,52004,'IsActive',TO_DATE('2008-06-02 21:56:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','The record is active in the system','A',1,'There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.','Y','N','N','N','N','N','N','N','N','N','Y','Active',0,TO_DATE('2008-06-02 21:56:02','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:56:03 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52097 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:56:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52043,0,'LastLockTime',TO_DATE('2008-06-02 21:56:55','YYYY-MM-DD HH24:MI:SS'),100,'Last time at which the terminal was locked','A','Y','Last Lock Time','Last Lock Time',TO_DATE('2008-06-02 21:56:55','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:56:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52043 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:57:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52098,52043,0,16,52004,'LastLockTime',TO_DATE('2008-06-02 21:57:13','YYYY-MM-DD HH24:MI:SS'),100,'Last time at which the terminal was locked','A',7,'Y','N','N','N','N','N','N','N','N','N','Y','Last Lock Time',0,TO_DATE('2008-06-02 21:57:13','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:57:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52098 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:58:06 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52044,0,'Locked',TO_DATE('2008-06-02 21:58:06','YYYY-MM-DD HH24:MI:SS'),100,'Whether the terminal is locked','A','Y','Locked','Locked',TO_DATE('2008-06-02 21:58:06','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:58:06 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52044 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:58:26 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52099,52044,0,20,52004,'Locked',TO_DATE('2008-06-02 21:58:26','YYYY-MM-DD HH24:MI:SS'),100,'N','Whether the terminal is locked','A',1,'Y','N','N','N','N','N','N','N','N','N','Y','Locked',0,TO_DATE('2008-06-02 21:58:26','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 9:58:26 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52099 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 9:59:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52045,0,'LockTime',TO_DATE('2008-06-02 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Time in minutes the terminal should be kept in a locked state.','A','Y','Lock Time','Lock Time',TO_DATE('2008-06-02 21:59:13','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 9:59:13 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52045 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 9:59:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,ValueMin,Version) VALUES (0,52100,52045,0,11,52004,'LockTime',TO_DATE('2008-06-02 21:59:40','YYYY-MM-DD HH24:MI:SS'),100,'Time in minutes the terminal should be kept in a locked state.','A',10,'Y','N','N','N','N','N','N','N','N','N','Y','Lock Time',0,TO_DATE('2008-06-02 21:59:40','YYYY-MM-DD HH24:MI:SS'),100,'0',0) +; + +-- Jun 2, 2008 9:59:40 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52100 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:00:25 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52101,459,0,19,52004,'M_Warehouse_ID',TO_DATE('2008-06-02 22:00:24','YYYY-MM-DD HH24:MI:SS'),100,'Storage Warehouse and Service Point','A',22,'The Warehouse identifies a unique Warehouse where products are stored or Services are provided.','Y','N','N','N','N','N','N','N','N','N','Y','Warehouse',0,TO_DATE('2008-06-02 22:00:24','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:00:25 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52101 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:00:44 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52102,469,0,10,52004,'Name',TO_DATE('2008-06-02 22:00:44','YYYY-MM-DD HH24:MI:SS'),100,'Alphanumeric identifier of the entity','A',60,'The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.','Y','N','N','N','N','N','N','N','N','N','Y','Name',0,TO_DATE('2008-06-02 22:00:44','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:00:44 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52102 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:02:07 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52103,480,0,18,166,52004,'PO_PriceList_ID',TO_DATE('2008-06-02 22:02:07','YYYY-MM-DD HH24:MI:SS'),100,'Price List used by this Business Partner','A',22,'Identifies the price list used by a Vendor for products purchased by this organization.','Y','N','N','N','N','N','N','N','N','N','Y','Purchase Pricelist',0,TO_DATE('2008-06-02 22:02:07','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:02:07 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52103 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:02:37 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52104,2051,0,10,52004,'PrinterName',TO_DATE('2008-06-02 22:02:37','YYYY-MM-DD HH24:MI:SS'),100,'Name of the Printer','A',60,'Internal (Opereating System) Name of the Printer; Please mote that the printer name may be different on different clients. Enter a printer name, which applies to ALL clients (e.g. printer on a server).

+If none is entered, the default printer is used. You specify your default printer when you log in. You can also change the default printer in Preferences.','Y','N','N','N','N','N','N','N','N','N','Y','Printer Name',0,TO_DATE('2008-06-02 22:02:37','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:02:37 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52104 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:03:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52105,1063,0,18,316,52004,'SalesRep_ID',TO_DATE('2008-06-02 22:03:16','YYYY-MM-DD HH24:MI:SS'),100,'Sales Representative or Company Agent','A',22,'The Sales Representative indicates the Sales Rep for this Region. Any Sales Rep must be a valid internal user.','Y','N','N','N','N','N','N','N','N','N','Y','Sales Representative',0,TO_DATE('2008-06-02 22:03:16','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:03:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52105 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:04:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52046,0,'SO_PriceList_ID',TO_DATE('2008-06-02 22:04:15','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Sales Pricelist','Sales Pricelist',TO_DATE('2008-06-02 22:04:15','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 10:04:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52046 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 10:04:46 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52106,52046,0,18,166,52004,'SO_PriceList_ID',TO_DATE('2008-06-02 22:04:46','YYYY-MM-DD HH24:MI:SS'),100,'A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Sales Pricelist',0,TO_DATE('2008-06-02 22:04:46','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:04:46 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52106 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:05:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52047,0,'UnlockingTime',TO_DATE('2008-06-02 22:05:16','YYYY-MM-DD HH24:MI:SS'),100,'Time at which the terminal should be unlocked','A','Y','UnlockingTime','UnlockingTime',TO_DATE('2008-06-02 22:05:16','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 10:05:16 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52047 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 10:05:34 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52107,52047,0,16,52004,'UnlockingTime',TO_DATE('2008-06-02 22:05:34','YYYY-MM-DD HH24:MI:SS'),100,'Time at which the terminal should be unlocked','A',7,'Y','N','N','N','N','N','N','N','N','N','Y','UnlockingTime',0,TO_DATE('2008-06-02 22:05:34','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:05:34 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52107 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:05:58 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52108,607,0,16,52004,'Updated',TO_DATE('2008-06-02 22:05:58','YYYY-MM-DD HH24:MI:SS'),100,'Date this record was updated','A',7,'The Updated field indicates the date that this record was updated.','Y','N','N','N','N','Y','N','N','N','N','N','Updated',0,TO_DATE('2008-06-02 22:05:58','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:05:58 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52108 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:06:30 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52109,608,0,18,110,52004,'UpdatedBy',TO_DATE('2008-06-02 22:06:30','YYYY-MM-DD HH24:MI:SS'),100,'User who updated this records','A',22,'The Updated By field indicates the user who updated this record.','Y','N','N','N','N','N','N','N','N','N','Y','Updated By',0,TO_DATE('2008-06-02 22:06:30','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:06:30 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52109 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:29:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52048,0,'U_POSTerminal_ID',TO_DATE('2008-06-02 22:29:01','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','POS Terminal','POS Terminal',TO_DATE('2008-06-02 22:29:01','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 10:29:01 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52048 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 10:29:54 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52110,52048,0,13,52004,'U_POSTerminal_ID',TO_DATE('2008-06-02 22:29:54','YYYY-MM-DD HH24:MI:SS'),100,'A',22,'Y','N','N','N','Y','Y','N','N','N','N','N','POS Terminal',0,TO_DATE('2008-06-02 22:29:54','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:29:54 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52110 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 2, 2008 10:48:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52049,0,'CheckTransferCashBook_ID',TO_DATE('2008-06-02 22:48:55','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Check transactions','A','Y','Transfer Check trx to','Transfer Check trx to',TO_DATE('2008-06-02 22:48:55','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 2, 2008 10:48:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52049 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jun 2, 2008 10:49:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52111,52049,0,18,52004,52004,'CheckTransferCashBook_ID',TO_DATE('2008-06-02 22:49:35','YYYY-MM-DD HH24:MI:SS'),100,'Cash Book on which to transfer all Check transactions','A',22,'Y','N','N','N','N','N','N','N','N','N','Y','Transfer Check trx to',0,TO_DATE('2008-06-02 22:49:35','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Jun 2, 2008 10:49:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52111 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jun 3, 2008 2:27:59 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Sequence (AD_Client_ID,AD_Org_ID,AD_Sequence_ID,Created,CreatedBy,CurrentNext,CurrentNextSys,Description,IncrementNo,IsActive,IsAudited,IsAutoSequence,IsTableID,Name,StartNewYear,StartNo,Updated,UpdatedBy) VALUES (0,0,52006,TO_DATE('2008-06-03 14:27:59','YYYY-MM-DD HH24:MI:SS'),100,1000000,100,'Table U_POSTerminal',1,'Y','N','Y','Y','U_POSTerminal','N',1000000,TO_DATE('2008-06-03 14:27:59','YYYY-MM-DD HH24:MI:SS'),100) +; \ No newline at end of file diff --git a/posterita/commons/Migration/1.7.0/postgresql/003_Terminals_TransferConfiguration.sql b/posterita/commons/Migration/1.7.0/postgresql/003_Terminals_TransferConfiguration.sql new file mode 100644 index 0000000000..dab9bf8b1b --- /dev/null +++ b/posterita/commons/Migration/1.7.0/postgresql/003_Terminals_TransferConfiguration.sql @@ -0,0 +1,75 @@ +ALTER TABLE AD_OrgInfo ADD COLUMN TransferBank_ID NUMERIC; +ALTER TABLE AD_OrgInfo ADD COLUMN TransferCashBook_ID NUMERIC; + +ALTER TABLE AD_OrgInfo + ADD CONSTRAINT "cbank_adorginfo" + FOREIGN KEY(TransferBank_ID) + REFERENCES C_Bank(C_Bank_ID); + + +ALTER TABLE AD_OrgInfo + ADD CONSTRAINT "ccashbook_adorginfo" + FOREIGN KEY(TransferCashBook_ID) + REFERENCES C_CashBook(C_CashBook_ID); + + + + +-- May 26, 2008 23:25:51 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52028,0,'TransferBank_ID',TO_DATE('2008-05-26 23:25:50','YYYY-MM-DD HH24:MI:SS'),100,'Bank account depending on currency will be used from this bank for doing transfers','D','Y','Bank for transfers','Bank for transfers',TO_DATE('2008-05-26 23:25:50','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 26, 2008 23:25:51 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52028 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- May 26, 2008 23:26:38 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,52001,TO_DATE('2008-05-26 23:26:38','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','C_Bank',TO_DATE('2008-05-26 23:26:38','YYYY-MM-DD HH24:MI:SS'),100,'T') +; + +-- May 26, 2008 23:26:38 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=52001 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- May 26, 2008 23:28:08 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,WhereClause) VALUES (0,3039,3031,0,52001,296,TO_DATE('2008-05-26 23:28:08','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N',TO_DATE('2008-05-26 23:28:08','YYYY-MM-DD HH24:MI:SS'),100,'C_Bank.IsOwnBank=''Y''') +; + +-- May 26, 2008 23:28:33 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52075,52028,0,18,52001,228,'TransferBank_ID',TO_DATE('2008-05-26 23:28:33','YYYY-MM-DD HH24:MI:SS'),100,'Bank account depending on currency will be used from this bank for doing transfers','D',22,'Y','N','N','N','N','N','N','N','N','N','Y','Bank for transfers',0,TO_DATE('2008-05-26 23:28:33','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- May 26, 2008 23:28:33 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52075 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + + + +-- Cash Book + +-- May 26, 2008 23:29:40 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,52029,0,'TransferCashBook_ID',TO_DATE('2008-05-23 23:29:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','CashBook for transfers','CashBook for transfers',TO_DATE('2008-05-23 23:29:40','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- May 26, 2008 23:29:40 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=52029 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- May 26, 2008 23:30:32 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,52076,52029,0,18,52004,228,'TransferCashBook_ID',TO_DATE('2008-05-23 23:30:31','YYYY-MM-DD HH24:MI:SS'),100,'D',22,'Y','N','N','N','N','N','N','N','N','N','Y','CashBook for transfers',0,TO_DATE('2008-05-23 23:30:31','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- May 26, 2008 23:30:32 AM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52076 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; diff --git a/posterita/commons/Migration/1.7.0/postgresql/004_Terminals_newTableDDL.sql b/posterita/commons/Migration/1.7.0/postgresql/004_Terminals_newTableDDL.sql new file mode 100644 index 0000000000..408b569bfa --- /dev/null +++ b/posterita/commons/Migration/1.7.0/postgresql/004_Terminals_newTableDDL.sql @@ -0,0 +1,4 @@ +-- Jun 2, 2008 23:58:02 AM GMT+04:00 +-- Default comment for updating dictionary +CREATE TABLE U_POSTerminal (AD_Client_ID NUMERIC(10) DEFAULT NULL NOT NULL, AD_Org_ID NUMERIC(10) DEFAULT NULL NOT NULL, AutoLock CHAR(1) DEFAULT 'N' CHECK (AutoLock IN ('Y','N')) NOT NULL, Card_BankAccount_ID NUMERIC(10), CardTransferBankAccount_ID NUMERIC(10), CardTransferCashBook_ID NUMERIC(10), CardTransferType CHAR(1), CashBookTransferType CHAR(1) NOT NULL, CashTransferBankAccount_ID NUMERIC(10), CashTransferCashBook_ID NUMERIC(10), C_CashBook_ID NUMERIC(10) NOT NULL, C_CashBPartner_ID NUMERIC(10) NOT NULL, Check_BankAccount_ID NUMERIC(10), CheckTransferBankAccount_ID NUMERIC(10), CheckTransferCashBook_ID NUMERIC(10), CheckTransferType CHAR(1), Created TIMESTAMP NOT NULL, CreatedBy NUMERIC(10) NOT NULL, C_TemplateBPartner_ID NUMERIC(10), Description VARCHAR(255), Help VARCHAR(2000), IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')), LastLockTime TIMESTAMP, Locked CHAR(1) DEFAULT 'N' CHECK (Locked IN ('Y','N')), LockTime NUMERIC(10), M_Warehouse_ID NUMERIC(10), Name VARCHAR(60), PO_PriceList_ID NUMERIC(10), PrinterName VARCHAR(60), SalesRep_ID NUMERIC(10), SO_PriceList_ID NUMERIC(10), UnlockingTime TIMESTAMP, Updated TIMESTAMP NOT NULL, UpdatedBy NUMERIC(10), U_POSTerminal_ID NUMERIC(10) NOT NULL, CONSTRAINT U_POSTerminal_Key PRIMARY KEY (U_POSTerminal_ID)) +; \ No newline at end of file diff --git a/posterita/commons/Migration/1.7.0/postgresql/005_Messages.sql b/posterita/commons/Migration/1.7.0/postgresql/005_Messages.sql new file mode 100644 index 0000000000..10f0b71a0b --- /dev/null +++ b/posterita/commons/Migration/1.7.0/postgresql/005_Messages.sql @@ -0,0 +1,189 @@ +-- Jun 9, 2008 1:24:35 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52452,0,TO_DATE('2008-06-09 13:24:35','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Organisation','I',TO_DATE('2008-06-09 13:24:35','YYYY-MM-DD HH24:MI:SS'),100,'smenu.organisation') +; + +-- Jun 9, 2008 1:25:48 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52453,0,TO_DATE('2008-06-09 13:25:48','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Terminals','I',TO_DATE('2008-06-09 13:25:48','YYYY-MM-DD HH24:MI:SS'),100,'smenu.terminal') +; + +-- Jun 9, 2008 1:26:06 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52454,0,TO_DATE('2008-06-09 13:26:06','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Cash Books','I',TO_DATE('2008-06-09 13:26:06','YYYY-MM-DD HH24:MI:SS'),100,'smenu.cashbook') +; + +-- Jun 9, 2008 1:26:30 PM GMT+04:00 +-- Default comment for updating dictionary +UPDATE AD_Message SET MsgTip='Maintain POS Terminals',Updated=TO_DATE('2008-06-09 13:26:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=52453 +; + +-- Jun 9, 2008 1:26:39 PM GMT+04:00 +-- Default comment for updating dictionary +UPDATE AD_Message SET MsgTip='Maintain Cash Books',Updated=TO_DATE('2008-06-09 13:26:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=52454 +; + +-- Jun 9, 2008 1:27:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52455,0,TO_DATE('2008-06-09 13:27:15','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Completed','I',TO_DATE('2008-06-09 13:27:15','YYYY-MM-DD HH24:MI:SS'),100,'document.status.completed') +; + +-- Jun 9, 2008 1:28:05 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52456,0,TO_DATE('2008-06-09 13:28:04','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Drafted','I',TO_DATE('2008-06-09 13:28:04','YYYY-MM-DD HH24:MI:SS'),100,'document.status.drafted') +; + +-- Jun 9, 2008 1:28:27 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52457,0,TO_DATE('2008-06-09 13:28:27','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','In Progress','I',TO_DATE('2008-06-09 13:28:27','YYYY-MM-DD HH24:MI:SS'),100,'document.status.inprogress') +; + +-- Jun 9, 2008 1:28:44 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52458,0,TO_DATE('2008-06-09 13:28:44','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Invalid','I',TO_DATE('2008-06-09 13:28:44','YYYY-MM-DD HH24:MI:SS'),100,'document.status.invalid') +; + +-- Jun 9, 2008 1:28:58 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52459,0,TO_DATE('2008-06-09 13:28:58','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Closed','I',TO_DATE('2008-06-09 13:28:58','YYYY-MM-DD HH24:MI:SS'),100,'document.status.closed') +; + +-- Jun 9, 2008 1:29:15 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52460,0,TO_DATE('2008-06-09 13:29:15','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Cash','I',TO_DATE('2008-06-09 13:29:15','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.cash') +; + +-- Jun 9, 2008 1:29:27 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52461,0,TO_DATE('2008-06-09 13:29:27','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Card','I',TO_DATE('2008-06-09 13:29:27','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.card') +; + +-- Jun 9, 2008 1:29:42 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52462,0,TO_DATE('2008-06-09 13:29:41','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Cheque','I',TO_DATE('2008-06-09 13:29:41','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.cheque') +; + +-- Jun 9, 2008 1:29:55 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52463,0,TO_DATE('2008-06-09 13:29:55','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Mixed','I',TO_DATE('2008-06-09 13:29:55','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.mixed') +; + +-- Jun 9, 2008 1:30:14 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52464,0,TO_DATE('2008-06-09 13:30:13','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Credit','I',TO_DATE('2008-06-09 13:30:13','YYYY-MM-DD HH24:MI:SS'),100,'payment.rule.credit') +; + +-- Jun 9, 2008 1:30:46 PM GMT+04:00 +-- Default comment for updating dictionary +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,52465,0,TO_DATE('2008-06-09 13:30:46','YYYY-MM-DD HH24:MI:SS'),100,'A','Y','Amount Paid','I',TO_DATE('2008-06-09 13:30:46','YYYY-MM-DD HH24:MI:SS'),100,'AmountPaid') +; + +-------------------------------------------------------------------------------------------------------------------------------------------------- +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52470 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'html', 'HTML', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52471 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pdf', 'PDF', ' ', 'I', 'D'); + +INSERT INTO AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52472 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'csv', 'CSV', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52473 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.sales.report', 'Sales Report', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52474 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.best.selling.items', 'Best Selling Items', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52475 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.stock.sales.report', 'Stock Sales Report', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52476 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.transfer.stock', 'Stock Transfer', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52477 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.inventory.move', 'Inventory Move', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52478 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.move.confirmation', 'Move Confirmation', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52479 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'smenu.barcode.printing', 'Barcode Printing', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52480 , 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'basePriceList', 'Base Price List', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52481, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'isDeleteOldRecords', 'Delete Old Records', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52482, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'sales.price.list', 'Sales Price List', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52483, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'purchase.price.list', 'Purchase Price List', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52484, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pos.terminal', 'Terminal', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52485, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pos.version', 'Version', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52486, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'pmenu.new.reports', 'Reports', ' ', 'I', 'D'); + +INSERT INTO adempiere.AD_MESSAGE +(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, +updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype) +VALUES(52487, 0, 0, 'Y', TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, TO_TIMESTAMP('2008-06-20 10:40:00','YYYY-MM-DD HH24:MI:SS'), 100, +'isCreatePriceList', 'Create Price List', ' ', 'I', 'D'); + diff --git a/posterita/commons/Migration/1.7.1/build.xml b/posterita/commons/Migration/1.7.1/build.xml new file mode 100644 index 0000000000..2d4b5fad85 --- /dev/null +++ b/posterita/commons/Migration/1.7.1/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File ${file.name} status ${sqlplus.result} + + + + + + diff --git a/posterita/commons/Migration/1.7.1/oracle/001_M_Inventory.sql b/posterita/commons/Migration/1.7.1/oracle/001_M_Inventory.sql new file mode 100644 index 0000000000..545cf9f12e --- /dev/null +++ b/posterita/commons/Migration/1.7.1/oracle/001_M_Inventory.sql @@ -0,0 +1,2 @@ +-- Add QtyCsv in M_inventoryLine +ALTER TABLE M_INVENTORYLINE ADD ( QTYCSV NUMBER(10, 0) DEFAULT 0 NOT NULL); diff --git a/posterita/commons/Migration/1.7.1/postgresql/001_M_Inventory.sql b/posterita/commons/Migration/1.7.1/postgresql/001_M_Inventory.sql new file mode 100644 index 0000000000..cf41dc0d88 --- /dev/null +++ b/posterita/commons/Migration/1.7.1/postgresql/001_M_Inventory.sql @@ -0,0 +1,2 @@ +--Add QtyCSV +ALTER TABLE m_inventoryline ADD COLUMN qtycsv numeric NOT NULL DEFAULT 0; \ No newline at end of file diff --git a/posterita/commons/Migration/1.7.2/build.xml b/posterita/commons/Migration/1.7.2/build.xml new file mode 100644 index 0000000000..6426742ad6 --- /dev/null +++ b/posterita/commons/Migration/1.7.2/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File ${file.name} status ${sqlplus.result} + + + + + + diff --git a/posterita/commons/Migration/1.7.2/oracle/001_ADRole.sql b/posterita/commons/Migration/1.7.2/oracle/001_ADRole.sql new file mode 100644 index 0000000000..eae1b645aa --- /dev/null +++ b/posterita/commons/Migration/1.7.2/oracle/001_ADRole.sql @@ -0,0 +1,3 @@ +-- Additional Role Configuration for Discount +ALTER TABLE AD_ROLE ADD (IsDiscountUptoLimitPrice char(1) DEFAULT 'N' NOT NULL); +ALTER TABLE AD_ROLE ADD (IsDiscountAllowedOnTotal char(1) DEFAULT 'N' NOT NULL); \ No newline at end of file diff --git a/posterita/commons/Migration/1.7.2/postgresql/001_ADRole.sql b/posterita/commons/Migration/1.7.2/postgresql/001_ADRole.sql new file mode 100644 index 0000000000..0117237506 --- /dev/null +++ b/posterita/commons/Migration/1.7.2/postgresql/001_ADRole.sql @@ -0,0 +1,3 @@ +-- Additional Role Configuration for Discount +ALTER TABLE ad_role ADD COLUMN IsDiscountUptoLimitPrice char(1) NOT NULL DEFAULT 'N'; +ALTER TABLE ad_role ADD COLUMN IsDiscountAllowedOnTotal char(1) NOT NULL DEFAULT 'N'; \ No newline at end of file diff --git a/posterita/commons/Migration/oracle.properties b/posterita/commons/Migration/oracle.properties new file mode 100644 index 0000000000..2feedd7454 --- /dev/null +++ b/posterita/commons/Migration/oracle.properties @@ -0,0 +1,6 @@ +#ORACLE_HOME +#Example Value: oracle.home=C:/oracle/xe/app/oracle/product/10.2.0/server +oracle.home=C:/adempiere-cd/progs/oracle-xe/app/oracle/product/10.2.0/server + +#sqlplus connection string +oracle.connect.param=ademstbl/adempiere \ No newline at end of file diff --git a/posterita/commons/Migration/oracle.properties.template b/posterita/commons/Migration/oracle.properties.template new file mode 100644 index 0000000000..37b4aec842 --- /dev/null +++ b/posterita/commons/Migration/oracle.properties.template @@ -0,0 +1,6 @@ +#ORACLE_HOME +#Example Value: oracle.home=C:/oracle/xe/app/oracle/product/10.2.0/server +oracle.home=C:/adempiere-cd/progs/oracle-xe/app/oracle/product/10.2.0/server + +#sqlplus connection string +oracle.connect.param=adempiere/adempiere \ No newline at end of file diff --git a/posterita/commons/Migration/trunk/build.xml b/posterita/commons/Migration/trunk/build.xml new file mode 100644 index 0000000000..f9f01b20f0 --- /dev/null +++ b/posterita/commons/Migration/trunk/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File ${file.name} status ${sqlplus.result} + + + + + + diff --git a/posterita/commons/Migration/trunk/oracle/002_ADMessage.sql b/posterita/commons/Migration/trunk/oracle/002_ADMessage.sql new file mode 100644 index 0000000000..35e47626c5 --- /dev/null +++ b/posterita/commons/Migration/trunk/oracle/002_ADMessage.sql @@ -0,0 +1,14 @@ +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52488, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'discount.upto.price.limit', 'Enforce Discount Upto Limit Price', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52489, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'over.ride.limit.price', 'Enforce Overide Limit Price', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52490, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'discount.allowed.total', 'Allowed Discount On Total Sales', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52491, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'smenu.pos.purchase.report', 'Purchases Report', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52492, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'smenu.settle.payment.credit.purchase', 'Settle Payment For Purchases On Credit', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52493, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'smenu.user.manual', 'User Manual', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52494, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'smenu.contactus', 'Contact Us', NULL, 'I', 'U'); diff --git a/posterita/commons/Migration/trunk/oracle/003_AD_OrgInfo.sql b/posterita/commons/Migration/trunk/oracle/003_AD_OrgInfo.sql new file mode 100644 index 0000000000..4d39cae971 --- /dev/null +++ b/posterita/commons/Migration/trunk/oracle/003_AD_OrgInfo.sql @@ -0,0 +1 @@ +ALTER TABLE ad_orginfo ADD (receiptfootermsg varchar(1023)); diff --git a/posterita/commons/Migration/trunk/oracle/004_AD_Changes for AD_OrgInfo.sql b/posterita/commons/Migration/trunk/oracle/004_AD_Changes for AD_OrgInfo.sql new file mode 100644 index 0000000000..cdd020cb42 --- /dev/null +++ b/posterita/commons/Migration/trunk/oracle/004_AD_Changes for AD_OrgInfo.sql @@ -0,0 +1,15 @@ +INSERT INTO AD_Element +(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, +columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) +VALUES(52050, 0, 0, 'Y', sysdate, 100, sysdate, 100, +'ReceiptFooterMsg', 'U', 'Receipt Footer Msg', 'Receipt Footer Msg', 'This message will be displayed at the bottom of a receipt when doing a sales or purchase', NULL, NULL, NULL, NULL, NULL); + + +INSERT INTO ad_column +(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, +description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, +ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, +isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, +ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic) +VALUES(52112, 0, 0, 'Y', sysdate, sysdate, 100, 100, 'ReceiptFooterMsg' , 'This message will be displayed at the bottom of a receipt when doing a sales or purchase', NULL, 0, 'U', 'ReceiptFooterMsg', 228, 10, NULL, NULL, 1024, 1, 'N', 'N', 'Y', 'Y', NULL, +'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52050, NULL, 'N', 'N', NULL, NULL); diff --git a/posterita/commons/Migration/trunk/oracle/005_MissingIDs.sql b/posterita/commons/Migration/trunk/oracle/005_MissingIDs.sql new file mode 100644 index 0000000000..c2142b123d --- /dev/null +++ b/posterita/commons/Migration/trunk/oracle/005_MissingIDs.sql @@ -0,0 +1,20 @@ +-- Missing Ids for M_InventoryLine & AD_Role +-- AD Element +INSERT INTO ad_element(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) + VALUES(52051, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'IsDiscountUptoLimitPrice', 'U', 'IsDiscountUptoLimitPrice', 'IsDiscountUptoLimitPrice', NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO ad_element(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) + VALUES(52052, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'IsDiscountAllowedOnTotal', 'U', 'IsDiscountAllowedOnTotal', 'IsDiscountAllowedOnTotal', NULL, NULL, NULL, NULL, NULL, NULL); + +-- AD Column +INSERT INTO ad_column(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic, infofactoryclass) + VALUES(52113, 0, 0, 'Y', sysdate, sysdate, 100, 100, 'IsDiscountUptoLimitPrice', NULL, NULL, 0, 'U', 'IsDiscountUptoLimitPrice', 156, 20, NULL, NULL, 1, NULL, 'N', 'N', 'Y', 'Y', NULL, 'N', NULL, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52051, NULL, 'N', 'N', NULL, NULL, NULL); +INSERT INTO ad_column(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic, infofactoryclass) + VALUES(52114, 0, 0, 'Y', sysdate, sysdate, 100, 100, 'IsDiscountAllowedOnTotal', NULL, NULL, 0, 'U', 'IsDiscountAllowedOnTotal', 156, 20, NULL, NULL, 1, NULL, 'N', 'N', 'Y', 'Y', NULL, 'N', NULL, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52052, NULL, 'N', 'N', NULL, NULL, NULL); + +-- AD Element +INSERT INTO ad_element(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) + VALUES(52053, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'QtyCsv', 'U', 'QtyCsv', 'QtyCsv', NULL, NULL, NULL, NULL, NULL, NULL); + +-- AD Column +INSERT INTO ad_column(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic, infofactoryclass) + VALUES(52115, 0, 0, 'Y', sysdate, sysdate, 100, 100, 'QtyCsv', NULL, NULL, 0, 'U', 'QtyCsv', 322, 29, NULL, NULL, 131089, NULL, 'N', 'N', 'Y', 'Y', NULL, 'N', NULL, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52053, NULL, 'N', 'N', NULL, NULL, NULL); diff --git a/posterita/commons/Migration/trunk/oracle/006_PackSize_MProduct.sql b/posterita/commons/Migration/trunk/oracle/006_PackSize_MProduct.sql new file mode 100644 index 0000000000..b4e2943c21 --- /dev/null +++ b/posterita/commons/Migration/trunk/oracle/006_PackSize_MProduct.sql @@ -0,0 +1,10 @@ +-- The Units Per Pack indicates the no of units of a product packed together. +ALTER TABLE M_Product ADD (UnitsPerPack number(10,0) default 1 not null ); + +-- AD Element -- +INSERT INTO AD_ELEMENT(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) + VALUES(52054, 0, 0, 'Y', sysdate, 100, sysdate, 100, 'UnitsPerPack', 'U', 'UnitsPerPack', 'UnitsPerPack', 'The Units Per Pack indicates the no of units of a product packed together.', NULL, NULL, NULL, NULL, NULL); + +-- AD Column -- +INSERT INTO AD_COLUMN(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic, infofactoryclass) + VALUES(52116, 0, 0, 'Y', sysdate, sysdate, 100, 100, 'UnitsPerPack', 'The Units Per Pack indicates the no of units of a product packed together.', NULL, 0, 'U', 'UnitsPerPack', 208, 11, NULL, NULL, 14, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52054, NULL, 'N', 'N', NULL, NULL, NULL); diff --git a/posterita/commons/Migration/trunk/oracle/007_CashPayment.sql b/posterita/commons/Migration/trunk/oracle/007_CashPayment.sql new file mode 100644 index 0000000000..6a20e40e85 --- /dev/null +++ b/posterita/commons/Migration/trunk/oracle/007_CashPayment.sql @@ -0,0 +1,85 @@ +--- Alter table -- oracle +--- Table: C_Payment ----------------------------------------------------------- +ALTER TABLE C_Payment +MODIFY C_BankAccount_ID NUMBER(10,0) NULL; + + +ALTER TABLE C_Payment +ADD C_CashBook_ID NUMBER(10,0); + +ALTER TABLE C_Payment +ADD CONSTRAINT C_Payment__C_CashBo_C_CashBook +FOREIGN KEY(C_CashBook_ID) REFERENCES C_CashBook(C_CashBook_ID); + +-------------------------------------------------------------------------------- +ALTER TABLE C_CashLine +ADD C_Payment_ID NUMBER(10); + +--- Migration scripts ---------------------------------------------------------- +-- Aug 26, 2008 11:49:31 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) +VALUES (0,52117,1463,0,19,335,'C_CashBook_ID',sysdate,100,'Cash Book for recording petty cash transactions','U',10,'The Cash Book identifies a unique cash book. The cash book is used to record cash transactions.','Y','N','N','N','N','N','N','N','N','Y','Cash Book',sysdate,100,0); + +-- Aug 26, 2008 11:49:31 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52117 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID); + + +-- Aug 26, 2008 11:50:27 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Column SET IsMandatory='N',Updated=sysdate,UpdatedBy=100 WHERE AD_Column_ID=3880; + + +-- Aug 26, 2008 11:50:27 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET Name='Bank Account', Description='Account at the Bank', Help='The Bank Account identifies an account at this Bank.' WHERE AD_Column_ID=3880 AND IsCentrallyMaintained='Y'; + + +-- Aug 26, 2008 11:51:40 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) +VALUES (0,52117,52052,0,330,sysdate,100,'Cash Book for recording petty cash transactions',10,'U','The Cash Book identifies a unique cash book. The cash book is used to record cash transactions.','Y','Y','Y','N','N','N','N','N','Cash Book',sysdate,100); + + +-- Aug 26, 2008 11:51:40 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=52052 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID); + + +-- Aug 26, 2008 11:51:40 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) +VALUES (0,13705,52053,0,330,sysdate,100,10,'D','Y','Y','Y','N','N','N','N','N','Referenced Payment',sysdate,100); + + +-- Aug 26, 2008 11:51:40 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=52053 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID); + + +-- Aug 26, 2008 11:52:11 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=52053; + + +-- Aug 26, 2008 11:52:11 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET SeqNo=660,IsDisplayed='Y' WHERE AD_Field_ID=52052; + + +-- Aug 26, 2008 11:52:56 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET DisplayLogic='@TenderType@ !''X''',Updated=sysdate,UpdatedBy=100 WHERE AD_Field_ID=4030; + + +-- Aug 26, 2008 11:54:17 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET DisplayLength=14, DisplayLogic='@TenderType@=''X''', IsSameLine='Y',Updated=sysdate,UpdatedBy=100 WHERE AD_Field_ID=52052; + + +-- Aug 26, 2008 11:54:42 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Tab SET WhereClause=NULL,Updated=sysdate,UpdatedBy=100 WHERE AD_Tab_ID=330; + + diff --git a/posterita/commons/Migration/trunk/postgresql/002_ADMessage.sql b/posterita/commons/Migration/trunk/postgresql/002_ADMessage.sql new file mode 100644 index 0000000000..3b2096d498 --- /dev/null +++ b/posterita/commons/Migration/trunk/postgresql/002_ADMessage.sql @@ -0,0 +1,18 @@ +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52488, 0, 0, 'Y', now(), 100, now(), 100, 'discount.upto.price.limit', 'Enforce Discount Upto Limit Price', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52489, 0, 0, 'Y', now(), 100, now(), 100, 'over.ride.limit.price', 'Enforce Overide Limit Price', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52490, 0, 0, 'Y', now(), 100, now(), 100, 'discount.allowed.total', 'Allowed Discount On Total Sales', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52491, 0, 0, 'Y', now(), 100, now(), 100, 'smenu.pos.purchase.report', 'Purchases Report', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52492, 0, 0, 'Y', now(), 100, now(), 100, 'smenu.settle.payment.credit.purchase', 'Settle Payment For Purchases On Credit', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52493, 0, 0, 'Y', now(), 100, now(), 100, 'smenu.user.manual', 'User Manual', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52494, 0, 0, 'Y', now(), 100, now(), 100, 'smenu.contactus', 'Contact Us', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52495, 0, 0, 'Y', now(), 100, now(), 100, 'discount.amt.order.level', 'Discount Amount', NULL, 'I', 'U'); +INSERT INTO ad_message(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, value, msgtext, msgtip, msgtype, entitytype) + VALUES(52496, 0, 0, 'Y', now(), 100, now(), 100, 'write.off.amt.order.level', 'Writeoff Amount', NULL, 'I', 'U'); diff --git a/posterita/commons/Migration/trunk/postgresql/003_AD_OrgInfo.sql b/posterita/commons/Migration/trunk/postgresql/003_AD_OrgInfo.sql new file mode 100644 index 0000000000..b4d0793838 --- /dev/null +++ b/posterita/commons/Migration/trunk/postgresql/003_AD_OrgInfo.sql @@ -0,0 +1 @@ +ALTER TABLE ad_orginfo ADD COLUMN receiptfootermsg varchar(1023); diff --git a/posterita/commons/Migration/trunk/postgresql/004_AD_Changes for AD_OrgInfo.sql b/posterita/commons/Migration/trunk/postgresql/004_AD_Changes for AD_OrgInfo.sql new file mode 100644 index 0000000000..ab403e3f47 --- /dev/null +++ b/posterita/commons/Migration/trunk/postgresql/004_AD_Changes for AD_OrgInfo.sql @@ -0,0 +1,15 @@ +INSERT INTO AD_Element +(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, +columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) +VALUES(52050, 0, 0, 'Y', now() , 100, now(), 100, +'ReceiptFooterMsg', 'U', 'Receipt Footer Msg', 'Receipt Footer Msg', 'This message will be displayed at the bottom of a receipt when doing a sales or purchase', NULL, NULL, NULL, NULL, NULL); + + +INSERT INTO ad_column +(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, +description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, +ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, +isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, +ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic) +VALUES(52112, 0, 0, 'Y', now(), now(), 100, 100, 'ReceiptFooterMsg' , 'This message will be displayed at the bottom of a receipt when doing a sales or purchase', NULL, 0, 'U', 'ReceiptFooterMsg', 228, 10, NULL, NULL, 1024, 1, 'N', 'N', 'Y', 'Y', NULL, +'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52050, NULL, 'N', 'N', NULL, NULL); diff --git a/posterita/commons/Migration/trunk/postgresql/005_MissingIDs.sql b/posterita/commons/Migration/trunk/postgresql/005_MissingIDs.sql new file mode 100644 index 0000000000..230c7a4b97 --- /dev/null +++ b/posterita/commons/Migration/trunk/postgresql/005_MissingIDs.sql @@ -0,0 +1,20 @@ +-- Missing Ids for M_InventoryLine & AD_Role +-- AD Element +INSERT INTO ad_element(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) + VALUES(52051, 0, 0, 'Y', now(), 100, now(), 100, 'IsDiscountUptoLimitPrice', 'U', 'IsDiscountUptoLimitPrice', 'IsDiscountUptoLimitPrice', NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO ad_element(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) + VALUES(52052, 0, 0, 'Y', now(), 100, now(), 100, 'IsDiscountAllowedOnTotal', 'U', 'IsDiscountAllowedOnTotal', 'IsDiscountAllowedOnTotal', NULL, NULL, NULL, NULL, NULL, NULL); + +-- AD Column +INSERT INTO ad_column(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic, infofactoryclass) + VALUES(52113, 0, 0, 'Y', now(), now(), 100, 100, 'IsDiscountUptoLimitPrice', NULL, NULL, 0, 'U', 'IsDiscountUptoLimitPrice', 156, 20, NULL, NULL, 1, NULL, 'N', 'N', 'Y', 'Y', NULL, 'N', NULL, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52051, NULL, 'N', 'N', NULL, NULL, NULL); +INSERT INTO ad_column(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic, infofactoryclass) + VALUES(52114, 0, 0, 'Y', now(), now(), 100, 100, 'IsDiscountAllowedOnTotal', NULL, NULL, 0, 'U', 'IsDiscountAllowedOnTotal', 156, 20, NULL, NULL, 1, NULL, 'N', 'N', 'Y', 'Y', NULL, 'N', NULL, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52052, NULL, 'N', 'N', NULL, NULL, NULL); + +-- AD Element +INSERT INTO ad_element(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) + VALUES(52053, 0, 0, 'Y', now(), 100, now(), 100, 'QtyCsv', 'U', 'QtyCsv', 'QtyCsv', NULL, NULL, NULL, NULL, NULL, NULL); + +-- AD Column +INSERT INTO ad_column(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic, infofactoryclass) + VALUES(52115, 0, 0, 'Y', now(), now(), 100, 100, 'QtyCsv', NULL, NULL, 0, 'U', 'QtyCsv', 322, 29, NULL, NULL, 131089, NULL, 'N', 'N', 'Y', 'Y', NULL, 'N', NULL, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52053, NULL, 'N', 'N', NULL, NULL, NULL); diff --git a/posterita/commons/Migration/trunk/postgresql/006_PackSize_MProduct.sql b/posterita/commons/Migration/trunk/postgresql/006_PackSize_MProduct.sql new file mode 100644 index 0000000000..d324689318 --- /dev/null +++ b/posterita/commons/Migration/trunk/postgresql/006_PackSize_MProduct.sql @@ -0,0 +1,10 @@ +-- The Units Per Pack indicates the no of units of a product packed together. +ALTER TABLE M_Product ADD COLUMN UnitsPerPack numeric(10,0) not null default 1; + +-- AD Element -- +INSERT INTO ad_element(ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, columnname, entitytype, name, printname, description, help, po_name, po_printname, po_description, po_help) + VALUES(52054, 0, 0, 'Y', now(), 100, now(), 100, 'UnitsPerPack', 'U', 'UnitsPerPack', 'UnitsPerPack', 'The Units Per Pack indicates the no of units of a product packed together.', NULL, NULL, NULL, NULL, NULL); + +-- AD Column -- +INSERT INTO ad_column(ad_column_id, ad_client_id, ad_org_id, isactive, created, updated, createdby, updatedby, name, description, help, version, entitytype, columnname, ad_table_id, ad_reference_id, ad_reference_value_id, ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory, isupdateable, readonlylogic, isidentifier, seqno, istranslated, isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn, ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable, columnsql, mandatorylogic, infofactoryclass) + VALUES(52116, 0, 0, 'Y', now(), now(), 100, 100, 'UnitsPerPack', 'The Units Per Pack indicates the no of units of a product packed together.', NULL, 0, 'U', 'UnitsPerPack', 208, 11, NULL, NULL, 14, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 52054, NULL, 'N', 'N', NULL, NULL, NULL); diff --git a/posterita/commons/Migration/trunk/postgresql/007_CashPayment.sql b/posterita/commons/Migration/trunk/postgresql/007_CashPayment.sql new file mode 100644 index 0000000000..365ee8e988 --- /dev/null +++ b/posterita/commons/Migration/trunk/postgresql/007_CashPayment.sql @@ -0,0 +1,87 @@ +-- Alter table -- postgres + +--- Table: C_Payment ----------------------------------------------------------- +ALTER TABLE C_Payment +ALTER COLUMN C_BankAccount_ID DROP NOT NULL; + + +ALTER TABLE C_Payment +ADD C_CashBook_ID NUMERIC(10); + +ALTER TABLE C_Payment +ADD CONSTRAINT C_Payment__C_CashBo_C_CashBook +FOREIGN KEY(C_CashBook_ID) REFERENCES C_CashBook(C_CashBook_ID); + +-------------------------------------------------------------------------------- +ALTER TABLE C_CashLine +ADD C_Payment_ID NUMERIC(10); + +--- Migration scripts ---------------------------------------------------------- +-- Aug 26, 2008 11:49:31 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) +VALUES (0,52117,1463,0,19,335,'C_CashBook_ID',now(),100,'Cash Book for recording petty cash transactions','U',10,'The Cash Book identifies a unique cash book. The cash book is used to record cash transactions.','Y','N','N','N','N','N','N','N','N','Y','Cash Book',now(),100,0) +; + +-- Aug 26, 2008 11:49:31 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=52117 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Aug 26, 2008 11:50:27 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Column SET IsMandatory='N',Updated=now(),UpdatedBy=100 WHERE AD_Column_ID=3880 +; + +-- Aug 26, 2008 11:50:27 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET Name='Bank Account', Description='Account at the Bank', Help='The Bank Account identifies an account at this Bank.' WHERE AD_Column_ID=3880 AND IsCentrallyMaintained='Y' +; + +-- Aug 26, 2008 11:51:40 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) +VALUES (0,52117,52052,0,330,now(),100,'Cash Book for recording petty cash transactions',10,'U','The Cash Book identifies a unique cash book. The cash book is used to record cash transactions.','Y','Y','Y','N','N','N','N','N','Cash Book',now(),100) +; + +-- Aug 26, 2008 11:51:40 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=52052 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Aug 26, 2008 11:51:40 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) +VALUES (0,13705,52053,0,330,now(),100,10,'D','Y','Y','Y','N','N','N','N','N','Referenced Payment',now(),100) +; + +-- Aug 26, 2008 11:51:40 AM MUT +-- Default comment for updating dictionary +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=52053 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Aug 26, 2008 11:52:11 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=52053 +; + +-- Aug 26, 2008 11:52:11 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET SeqNo=660,IsDisplayed='Y' WHERE AD_Field_ID=52052 +; + +-- Aug 26, 2008 11:52:56 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET DisplayLogic='@TenderType@ !''X''',Updated=now(),UpdatedBy=100 WHERE AD_Field_ID=4030 +; + +-- Aug 26, 2008 11:54:17 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Field SET DisplayLength=14, DisplayLogic='@TenderType@=''X''', IsSameLine='Y',Updated=now(),UpdatedBy=100 WHERE AD_Field_ID=52052 +; + +-- Aug 26, 2008 11:54:42 AM MUT +-- Default comment for updating dictionary +UPDATE AD_Tab SET WhereClause=NULL,Updated=now(),UpdatedBy=100 WHERE AD_Tab_ID=330 +; + diff --git a/posterita/commons/build.xml b/posterita/commons/build.xml new file mode 100644 index 0000000000..c3a2633ba2 --- /dev/null +++ b/posterita/commons/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/commons/properties.xml b/posterita/commons/properties.xml new file mode 100644 index 0000000000..be1e2401c9 --- /dev/null +++ b/posterita/commons/properties.xml @@ -0,0 +1,17 @@ + + + + This project file sets all properties needed during build and + installation. This file is imported in all other build.xml + files. This file provides a central place for managing + properties. + + + + + + + + + + diff --git a/posterita/posterita/build.properties b/posterita/posterita/build.properties new file mode 100644 index 0000000000..096807e0fc --- /dev/null +++ b/posterita/posterita/build.properties @@ -0,0 +1 @@ +posterita.dev.home= diff --git a/posterita/posterita/build.xml b/posterita/posterita/build.xml new file mode 100644 index 0000000000..359b104ea6 --- /dev/null +++ b/posterita/posterita/build.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/properties.xml b/posterita/posterita/properties.xml new file mode 100644 index 0000000000..be1e2401c9 --- /dev/null +++ b/posterita/posterita/properties.xml @@ -0,0 +1,17 @@ + + + + This project file sets all properties needed during build and + installation. This file is imported in all other build.xml + files. This file provides a central place for managing + properties. + + + + + + + + + + diff --git a/posterita/posterita/src/aspect/org/posterita/aspect/POAspect.aj b/posterita/posterita/src/aspect/org/posterita/aspect/POAspect.aj new file mode 100644 index 0000000000..186fe56bf3 --- /dev/null +++ b/posterita/posterita/src/aspect/org/posterita/aspect/POAspect.aj @@ -0,0 +1,83 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ + +package org.posterita.aspect; + +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.exceptions.POException; +import org.posterita.exceptions.TerminalLockedException; +import org.compiere.model.PO; +import org.compiere.model.X_C_Order; +import org.compiere.process.DocAction; +import org.compiere.util.CLogger; +import org.compiere.util.ValueNamePair; + +/** + * @author ashley + */ +public aspect POAspect +{ + pointcut savePO(): + call(public boolean PO.save()); + + boolean around() : savePO() + { + if (thisJoinPoint.getTarget() instanceof X_C_Order) + { + X_C_Order order = (X_C_Order)thisJointPoint.getTarget(); + int terminalId = order.getC_POS_ID(); + + if (terminalId > 0 && POSTerminalManager.isTerminalLocked(po.getCtx(), terminalId)) + { + throw new POException("Terminal is locked"); + } + } + + boolean val = proceed(); + + if (!val) + { + Exception ex = CLogger.retrieveException(); + ValueNamePair err = CLogger.retrieveError(); + String msg; + + if (ex != null) + { + msg = ex.getMessage(); + } + else if (err != null) + { + msg = err.getValue() + " " + err.getName(); + } + else if (thisJoinPoint.getTarget() instanceof DocAction) + { + msg = ((DocAction)thisJoinPoint.getTarget()).getProcessMsg(); + } + else + { + msg = "Unknown"; + } + + throw new POException("Could not save PO - Class: " + thisJoinPoint.getTarget().getClass().getName() + " Cause: " + msg); + } + + return val; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/aspect/org/posterita/aspect/TrxAspect.aj b/posterita/posterita/src/aspect/org/posterita/aspect/TrxAspect.aj new file mode 100644 index 0000000000..059b06abac --- /dev/null +++ b/posterita/posterita/src/aspect/org/posterita/aspect/TrxAspect.aj @@ -0,0 +1,36 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.aspect; + +import org.compiere.util.Trx; + +/** + * @author ashley + */ +public aspect TrxAspect +{ + pointcut closeTrx(): + call(public boolean Trx.close()); + + before() : closeTrx() + { + ((Trx)thisJoinPoint.getTarget()).rollback(); + } +} diff --git a/posterita/posterita/src/ear/application.xml b/posterita/posterita/src/ear/application.xml new file mode 100644 index 0000000000..924d1f2574 --- /dev/null +++ b/posterita/posterita/src/ear/application.xml @@ -0,0 +1,24 @@ + + + + Web POS + webPOS + + AdempiereSLib.jar + + + Adempiere.jar + + + adempiereApps.jar + + + + posterita.war + /posterita + + + diff --git a/posterita/posterita/src/main/ApproveOrderEmailTemplate.properties b/posterita/posterita/src/main/ApproveOrderEmailTemplate.properties new file mode 100644 index 0000000000..043228afef --- /dev/null +++ b/posterita/posterita/src/main/ApproveOrderEmailTemplate.properties @@ -0,0 +1,6 @@ +subject=Tamak Webstore - Order Approved +action=action +content=,
Your order has been approved. +signin.info=Order Information +link=Your products will be shipped shortly. An email will be sent to notify you when it has been shipped. +emailRegards=Regards,
Tamak Webmaster \ No newline at end of file diff --git a/posterita/posterita/src/main/CreateCustomerEmailTemplate.properties b/posterita/posterita/src/main/CreateCustomerEmailTemplate.properties new file mode 100644 index 0000000000..b5d2c7c746 --- /dev/null +++ b/posterita/posterita/src/main/CreateCustomerEmailTemplate.properties @@ -0,0 +1,12 @@ +subject=Tamak Webstore Account +action=action +&email=&username +&password=&password +signin.info=Your Login Information +login=Login: +password=Password: +content=Thank you for creating an account on Tamak.com + +link=Please click on the link below to automatically log you on Tamak.com. Enjoy! + +emailRegards=Regards,
Tamak Webmaster diff --git a/posterita/posterita/src/main/CreateOrderEmailTemplate.properties b/posterita/posterita/src/main/CreateOrderEmailTemplate.properties new file mode 100644 index 0000000000..6da43c37d7 --- /dev/null +++ b/posterita/posterita/src/main/CreateOrderEmailTemplate.properties @@ -0,0 +1,6 @@ +subject=Tamak Webstore - New Order Received +action=action +content=has created a new order on Tamak Webstore +signin.info=New Order Information +link=Please login on the Administration section to view the order for approval and shipping. +emailRegards=Regards,
Tamak Webmaster diff --git a/posterita/posterita/src/main/Factory.properties b/posterita/posterita/src/main/Factory.properties new file mode 100644 index 0000000000..0cc35a30ec --- /dev/null +++ b/posterita/posterita/src/main/Factory.properties @@ -0,0 +1,127 @@ +#Factory +#Mon Oct 24 12:14:38 GST 2005 +attribute.car.model.id=1016505 +smenu.order.history=1025273 +smenu.product.restriction.id=1056362 +smenu.dealer.transfer.request.id=1050047 +attributeset.car.id=1003664 +smenintu.dealer.transfer.history.id=1050050 +attributeset.bike.id=1003665 +pmenu.dealer.transfer.id=1050045 +smenu.view.all.users.id=1056370 +smenu.messagessent.id=1050002 +discountschema.id=1004556 +pmenu.ordersreceived.id=1050030 +taxCategory.default.id=1003155 +smenu.purchase.order.create.id=1050019 +attribute.bike.modelGroup.id=1016511 +smenu.dealer.order.history=1031333 +smenu.messagescompose.id=1050003 +smenu.movement.id=1056365 +smenu.createsco.id=1050028 +attribute.bike.model.id=1016510 +menu.createLocator.id=1056361 +productCategory.car.id=1003699 +smenu.mmovement.id=1031380 +smenu.allocation.edit.id=1050073 +smenu.view.all.banks.id=1056360 +attribute.bike.trx.id=1016513 +car.assetgroup.id=1000621 +role.HsafAutoAdmin.id=1016896 +smenu.purchase.order.history.id=1050021 +smenu.receive.new.vehicles.id=1050040 +smenu.group.models.id=1056369 +productCategory.usedCar.id=1003700 +pmenu.natis.release.id=1031345 +smenu.inquire.on.vin.number.id=1050014 +superUser.id=1016038 +smenu.createBankAccount.id=1056366 +role.udiAdmin.id=1016895 +smenu.inquiry.id=1031329 +smenu.role.id=1056373 +attribute.car.year.id=1016509 +smenu.view.wholesale.report.id=1050082 +smenu.special.colour.order.received.id=1031337 +smenu.dealer.order.received.id=1050052 +smenu.sell.release.vehicle.id=1050057 +smenu.view.sco.products.id=1031390 +smenu.allocation.orders.view.id=1050075 +smenu.my.certificates.id=1050059 +smenu.release.vehicle.id=1031347 +smenu.my.stock.id=1050012 +wholesale.priceList.purchase.id=1005554 +priceLV.sales.id=1005891 +role.stock.controller.id=1016893 +smenu.search.vin.number.id=1056374 +smenu.dealer.order.reeived.id=1031336 +smenu.view.all.orgs.id=1056371 +smenu.price.listing=1056372 +smenu.view.retail.report.id=1050081 +smenu.licensing.district.id=1031346 +pmenu.sales.id=1050055 +pmenu.stock.inquiry.id=1050008 +role.test.id=1016894 +smenu.view.sales.report.without.trans.id=1050080 +smenu.sco.history.id=1050027 +pmenu.invoice.id=1031338 +smenu.warehouse.id=1056359 +attribute.car.colour.id=1016507 +pmenu.my.details.id=1050004 +smenu.allocation.create.id=1050068 +pmenu.home.id=1049999 +pmenu.messages.id=1050000 +pmenu.payment.id=1031340 +attribute.car.make.id=1016504 +smenu.payment.history=1031341 +attribute.bike.colour.id=1016512 +role.sales.person.id=1016892 +smenu.create.customer.id=1056375 +smenu.new.car.stock.inquiry.id=1050009 +smenu.create.target.sales.id=1056368 +priceLV.purchase.id=1005889 +smenu.allocation.history.id=1050077 +smenu.invoice.history=1031339 +smenu.wholesale.order.history=1050038 +attribute.car.modelGroup.id=1016506 +smenu.productAttribute.id=1056367 +smenu.messagesinbox.id=1050001 +smenu.allocations.view.id=1031354 +role.sales.manager.id=1016891 +smenu.view.certificate.id=1031348 +smenu.upload.cvs.file.id=1050042 +pmenu.dealer.order.id=1050017 +attribute.car.trx.id=1016508 +role.system.administrator.id=1016889 +pmenu.specialcolourorder.id=1050025 +smenu.changeemail.id=1050007 +pricelist.sales.id=1005553 +pricelist.purchase.id=1005552 +pmenu.reports.id=1050078 +smenu.specialcolourorderreceived.id=1050034 +pmenu.admin.id=1050084 +smenu.allocation.order.create.id=1050071 +wholesale.priceLV.purchase.id=1005890 +smenu.create.shipper.id=1056376 +role.HsafWingAdmin.id=1016897 +smenu.view.my.details.ic=1050005 +pmenu.allocation.id=1050065 +smenu.my.used.car.stock.id=1050011 +smenu.sales.history.id=1050063 +smenu.createProduct.id=1056364 +tax.default.id=1002758 +smenu.view.receipt.history=1031344 +pmenu.logout.id=1056377 +smenu.trade.in.id=1050061 +usedCar.assetgroup.id=1000627 +pmenu.inOut.id=1031342 +smenu.view.sales.report.with.trans.id=1050079 +role.dealer.principal.id=1016890 +smenu.view.shipment.history=1031343 +smenu.closemenu.id=1031363 +smenu.changeuserpassword.id=1050006 +smenu.product.inquiry=1031373 +attribute.bike.year.id=1016514 +pmenu.allocations.id=1031350 +pmenu.wholesaler.order.id=1050036 +pmenu.history.id=1050083 +menu.createBPartner.id=1056358 diff --git a/posterita/posterita/src/main/MessageResources.properties b/posterita/posterita/src/main/MessageResources.properties new file mode 100644 index 0000000000..e909b58b6b --- /dev/null +++ b/posterita/posterita/src/main/MessageResources.properties @@ -0,0 +1,1262 @@ +asset.natisrelease.no=NaTIS Release No +asset.natiscontrol.no=NaTIS Control No +asset.register.no=Register No + +assetstatus.hsaf.stock=In Stock +assetstatus.onwater.stock=On Water +assetstatus.retailed=Retailed +assetStatus.wholesaled=Wholesaled + +#Tamak specific +#footer.copyright=All Contents ©2006 Tamak ICT +#title.welcome=Welcome to Tamak POS +#title.POS=Tamak POS + +footer.copyright=All Contents ©2006 Tamak ICT +title.welcome=Welcome to Tamak POS +title.POS=Tamak POS + + + +scostatus.update =Update SCO Status + +# -- standard errors -- +errors.header=

+# -- validator -- + +error.minlength.customerID=Customer ID should be of 13 digits +error.natiscustomer.alreadyexist=This customer already exists on your database.Please select the link "Existing Customer?" and choose the customer. +error.dataAccessException=Your request cannot be processed because some important data is missing. Please contact the System Administrator for more details. +error.operationException=Please specify an order to view +error.systemException=An error has been detected. Please contact the System Administrator for more information. +error.runtimeException=An runtime error has occurred. Please contact the System Administrator for more details +errorpage.title=Errror Page +errorpage.heading=You have performed an illegal operation. +errors.invalid={0} is invalid. +error.required={0} is required. +error.match={0} do not match. +error.date.prior.today=ArrivalDate cannot be prior to today's date. +error.dateRangeNotValidException=Date range is not valid. Please try another one +error.match.password=Your passwords do not match. Please retype your new password. +error.match.newPassword=Your passwords do not match. Please retype your new password. +error.match.newEmail=Your emails do not match. Please retype your new email. +errors.maxlength={0} can not be greater than {1} characters. +errors.minlength={0} can not be less than {1} characters. +errors.range={0} is not in the range {1} through {2}. +errors.required={0} is required. +errors.byte={0} must be a byte. +errors.date={0} is not a date. +errors.double={0} must be a double. +errors.float={0} must be a float. +errors.integer={0} must be an integer. +errors.long={0} must be a long. +errors.short={0} must be a short. +errors.creditcard={0} is not a valid credit card number. +errors.email={0} is an invalid e-mail address. +error.numberformatexception.quantity=Please enter a numeric value for quantity. +error.numberformatexception.customerIdBookNumber=Please enter a numeric value for customer ID Book Number. +error.numberformatexception.customerID=Please enter numeric values only for customerID. +error.role.Invalid=Role cannot be found. Please try login again with another role. Contact your System Administrator if the problem persists. +error.illegal.access=You cannot view this order because it does not belong to you. +error.noStock.Available=Quantity available in stock is less than input quantity for {0} {1} {2} {3} +error.webstore.noStock.Available=Quantity available for {0} is {1}. You cannot order for an amount more than {1} +error.orderedQuantity.invalid=Ordered quantity must be greater than 0 +error.productquantity.invalid=Ordered quantiry must be greater than 0. +error.invoice.nolineselected=Please select at least one line to generate invoice. +error.csvfile.invalid=There are errors in File, please delete the old file and download again to see the errors. +error.file.not.found=Please attach a file +error.stock.not.available=The Required Stock is Not Available. {0} +error.inventory=No Inventory Available. {0} +error.inventory.not.available=Insufficient Inventory Available. {0} +error.vehicle.alreadyReleased=The vehicle has already been released. +error.shipper.alreadyExists=Shipper already exists. Please choose another name. +error.allocationname.alreadyused=The name you supplied has already been used. Please input another one. +error.notallvins.available=Not all VIN numbers are currently available. +error.poReference.invalid=Please enter a valid reference number. +error.ftp.file=The file contains a VIN number that is already present in the system. This file may have already been processed. +error.naamsaModelCode.exist=The code you have entered already exist. Please enter another one. +error.naamsaDealerCode.exist=The code you have entered already exist. Please enter another one. +error.salesrep.required = Please select a sales representative. +error.date.notselected = Please choose a date. +error.emptycart = Your cart is empty! +error.trackingNo.not.found=Please Specify the Tracking Number of FedEx. +error.in.file=There is an error in the file, Please check for the for the ";" in the file and replace it by ","
and no field should be empty
If there is no discount and limit price, please make them same a the one for the List Price.
also check whether the tax rate that has been defined in the file exists. +error.invalid.address=The Customer does not has any address, Please Edit the customer. +error.invalid.orderType=The Order is not a POS Order, Please check the Document No +error.no.checkbox.selected=Please select a checkbox + +error.client.alreadyexist=Client with the name provided already exist +error.client.create=Could not create client with the details provided.
Please contact POSterita (info@posterita.org) for support.
Cause:{0} + + +error.allocation.notclosable=Cannot close allocation because one or more lines are not Accepted yet +error.allocation.report.notselected=Please select an allocation to generate report. +error.allocation.notselected=Please select an allocation to generate order. +error.vin.already.exists=VIN number has already been used. +error.role.already.exists = The name has already been used. Please enter another name. +error.role.edit=Could not edit role +error.attributevalue.description.exception = Please enter a description +error.too.many.invoice=Only one invoice at a time can be allocated with payments and credit memo. +error.allocation.amt.exceeds.openamt=Allocation amount is more than the open amount for invoice, can not allocate +error.no.invoice.to.allocate=Please select an invoice to allocate. +error.securityException=You are trying to view an order, that does not belong to your organisation. +error.required.agreement=You must agree to the terms and conditions before confirmation. +error.required.checkbox=Please make a selection. +error.required.sernoAttributeSetInstanceIds=Please select a product. + +error.notfound={0} not found. +error.required.productChange={0} +error.required.model=model. +error.required.colour=colour. +error.required.transmission=transmission. +error.required.year=year. +error.required.bpartnerId=Please enter the customer +error.required.amount.given=Please enter the amount given +error.required.paymentTermId=Please select a Payment term +error.product.name.required=Please enter a product +error.cannot.deactivate.paymentTermName=Cannot Deactivate PaymentTerm, Some customers are associated with it; + +error.required.username=Name is required. +error.required.userSurname=Surname is required. +error.required.password=Password is required. +error.required.oldPassword=Please enter your old password. +error.required.newPassword=Please enter your new password. +error.required.confirmPassword = Please confirm your new password. +error.required.creditCardNumber=Credit Card Number is required. +error.required.address1=Address is required +error.required.city = City is required +error.required.postalAddress = Postal Address is required +error.required.email = Please enter Email Address. +error.required.newEmail=Please enter your new email address. +error.required.confirmEmail=Please confirm your new email address. +error.wrong.old.password=The Old Password is wrong. +error.wrong.password.matching=The passwords do not match +error.wrong.password.length=The passweod should be at least six characters long + +error.required.warehouseName = Warehouse Name is required. +error.required.orgName = Organisation Name is required +error.required.poReference = Please enter a reference no. +error.required.orderId=Please enter a valid order Id +error.update.sequence=An error has been encountered while updating sequence, Please check database connection + +error.required.poreference=Please enter the purchase order number. +error.required.assetID=Please choose a VIN number. +error.required.description= Please enter description. +error.required.priceEntered=Please enter purchase price. +error.required.vinNumber=Please enter a VIN Number. +error.numberformatexception.priceEntered=Please enter a numeric value for purchase price. +error.invalid.barcode=Invalid Barcode! Barcode is either empty or null. + +error.required.name=Please enter name. +error.required.Surname=Please enter surname. +error.required.custIdNumber=Please enter customerID. +error.required.physicalCity=Please enter physical city. +error.required.physicalPostalCode=Please enter physical postal code. +error.required.physicalStreet1=Please enter physical street1. +error.required.postalCity=Please enter postal city. +error.required.postalPostalCode=Please enter postal code. +error.required.phone1=Please enter home Tel. +error.required.phoneNo=Please enter work tel. +error.required.cell=Please enter cell no. +error.required.aaCardnumber=Please enter card AA No. +error.natisRelease.firebird=Your vehicle has been transmitted to NaTIS and is queued for release. +error.duplicate.reference=You have already used this reference. Please use another one. +error.usernameAlreadyUsed=The username you provided already exists. Please choose another username. +error.name.exists=The name and surname you provided already exists. Please login with your email address. +error.email.exists=The email already exists. Please use another email address. +error.customer.id=Only numeric values are allowed for Customer Id Number. +error.email=Email has not been sent +error.duplicate.vin=You have selected vehicles with the same VIN number. Please make sure that all vehicles have been assigned different VIN numbers. +error.warehouse.alreadyexists = Warehouse already exists. Please choose another name. +error.targetQuantity.invalid = Please enter valid quantity. + +error.cannot.delete.order=Cannot Delete order as it has been invoiced +error.bp.alreadyexist=This customer already exists in your database. Please select the link /"Existing Customer" and choose the correct customer. +error.model.alreadyGrouped = Model already grouped +error.bank.already.exist=Bank already exists +error.attributevalue.alreadyexist = Value already exists +error.year.attributevalue.invalid = Please enter a valid year +error.product.alreadyexist = Product Already Exists, Please enter a new one +error.year.attributevalue.formatting.exception = Please enter numerical values for year +error.year.length.invalid = Invalid year. Length should be 4. +error.product.not.selected = Please select a product +error.bp.notselected=Please choose a Customer +error.no.vin.number=Please Specify a complete VIN Number +error.invalid.period=Start date should not be greater than end date. +error.required.fromDate = Please select start date. +error.required.toDate = Please select end date. +error.already.released= The Vehicle is already released, Can not swap the Vehicle +error.product.selected.not.same.warehouse=Warehouse of the selected products are different,please select the products from same warehouse +error.cannot.create.inventory.line==Cannot create Inventory line for the products which are service,
Please make the product item and then make a purchase. +error.ftp.novehicles = There is no vehicle for your Organisation in the FTP file uploaded + +error.vehicle.vinAlreadyPresent = The vin number entered is already present in the system. +error.vehicle.unitNumberPresent = The unit number entered is already present in the system. +error.numberformatexception.enginePower = Please enter a numeric value for Engine Power. +error.numberformatexception.natisModelNo = Please enter a numeric value for NaTIS Model Number. +error.numberformatexception.noOfWheels = Please enter a numeric value for No. of wheels. +error.numberformatexception.tare = Please enter a numeric value for Tare. +error.numberformatexception.engineCapacity = Please enter a numeric value for Engine Capacity. + + +error.modelmatching.notfound = Model Matching not found. +error.modelmatching.alreadyexist = Model Matching already exist +error.deactivatingproductinstock = Cannot deactivate product(s) as there are still some in HSAF or Dealers' stock. +error.orderId.null = Please enter an Order Id. +error.order.notExist = The Order does not exist. Please enter a valid Order Id. +error.order.noOrderline.selected = Please select at least one orderline to delete. + +error.product.keywords.required=Keywords are mandatory. Please set them before making a product featured in Webstore. + +error.colourmatching.alreadyexist=Colour Code Matching Already Exist +error.colourmatching.invalid=Colour Code Matching is invalid +error.colourmatching.errorsave=Could not save Colour Code Matching details + +error.import.nolineselected=You should choose at least one import line for processing +error.invalid.inputQty=Please enter a quantity greater than 0 +error.invalid.totalQty=Please enter a quantity per Size! +error.quantity.notAvailable=Entered quantity not available for {0} +error.updating.product=Could not update the status of the selected products +error.product.not.found=Product Not Found! +error.check.inserted.value=Please check the value inserted qty and the barcode should be separated by + sign +error.product.attributes.different=Cannot update Products with different attributes +error.updating.attribute=Could not change the specified Attribute Value +error.product.price.not.found=Product is Not On PriceList {0} +error.product.already.exists=Product already exists +error.barcode.already.exists=Barcode already exists +error.barcode.required = Barcode is required +error.reason.required = Please type in the reason +error.qty.required = Quantity is required +error.total.zero = Please check total amount. Cannot be zero +error.product.cannot.inactivate=product cannot be inactivated /Make it Services {0} +error.invalid.content= The Content of the uploaded file are wrong, should be an image +error.pos.no.orderline=There are no orderline in the order, please create a new order +error.no.transfer.amount=Please enter some amount +error.transferAmt.exceeds.endingBalance=Amount exceeding the ending balance, can not create transaction +error.cannot.close.till=The Till is already closed, can not transfer any amount until a new cash order is created
To transfer only card and cheque amount insert transfer amount as 0 and press submit +error.invalid.number=Please insert a valid number +tax.rate.not.defined=The Tax rate is not defined,Please define it {0} +error.required.revenue.recognition=Please enter Revenue Recognition +error.duplicate.product=Duplicate product name in the file Or the product already exists in the system {0} +error.duplicate.barcode=Duplicate barcode in the file Or the barcode already exists in the system {0} +error.cannot.adjust.till=The till is closed,cannot adjust the amount now +error.till.already.close=The Till is closed, can not close it again
To transfer only card and cheque amount just press submit +error.duplicate.userpin=The User Pin Already exists. +error.paymentTermName.duplicate=The Payment Term Name already Exists. +error.net.days.cannot.be.negative=Net Days cannot be negative or null. +error.name.mandatory = Please type the name +error.bpartner.over.credit.limit=Customer exceeds Credit Limit
{0} +error.bpartner.no.payment.term=Customer does not has a Payment Term,Please create one +error.insufficient.qty={0} +error.limit.price.violated={0} + +error.taxname.duplicate=Tax name already exists +error.taxrate.duplicate=Tax rate already exists +error.name.required=Please Insert the Name +error.required.field=field required {0} +error.tax.rate.nagative=tax rate cannot be negative +error.discount.nagative=Discount(s) cannot be negative +cannot.inactivate.tax=Cannot deactivate tax, some products have this tax + + +error.pos.payment.invalidCashAmount=Please enter a numeric value for Cash Amt. +error.pos.payment.invalidCardAmount=Please enter a numeric value for Card Amt. +error.pos.payment.invalidChequeAmount=Please enter a numeric value for Cheque Amt. +error.pos.incorrect.tendered.amount=Please enter the exact tender amount. +error.paymentamount.mandatory=Please enter Payment Amount. +error.allocate.amt.exceeds=Allocated Amt. exceeds the open amt of Invoice {0} +error.allocate.amt.payamt.notequal=Allocated Amt is not equal to the Payment Amt {0} + +error.collection.dir=Image Collection directory does not exist: {0} +error.inactive.collection.dir=Inactive Image Collection directory does not exist: {0} +error.errors.dir=Error image directory does not exist: {0} +error.synchronize.products.collection=Could not synchronize product collections: {0} + +error.related.product=No product found related with this attribute value +error.invalid.datetime=The date and time provided is invalid + +error.order.delete=Could not delete this order + +error.sessions.exceeded=You cannot log into the system.
Number of Licensed Sessions, ({0}), will be exceeded.
Please contact your administrator for further details. +error.requests.exceeded=The number of operations that you have performed has exceeded the limit that has been set for your license of Tamak ICT POS.
Please contact your administrator for further details. +error.license.invalid=Your license is invalid. Please change your licensing details as appropriate. +error.license.unexpected=An unexpected error has occurred. Please try to perform again all the operations that caused this error.
In case this error occurs again, please contact your administrator.
Details: {0} +error.licensinginfo.update=Licensing information could not be updated. Cause\: {0} +login.passwordError= Password is invalid +error.invalid.pin=Invalid User PIN +error.duplicate.pin=More than one user has the same PIN +error.customer.not.exists=The customer is either not present or is not active +error.vendor.not.exists=The vendor is either not present or is not active +# -- other -- +errors.cancel=Operation cancelled. +errors.detail={0} +errors.general=The process did not complete. Details should follow. +errors.token=Request could not be completed. Operation is not in sequence. + +error.required.vin.number=Please enter a VIN number +error.invalid.orderId=Order does not exist! +error.invoke.status=Cannot invoke order with status: {0} +# -- welcome -- + + +address = Address: +postaladdress = Postal Address: +city = City: +region = Region: + +welcome.title=Struts Blank Application +welcome.heading=Welcome! +welcome.message=To get started on your own application, copy the struts-blank.war to a new WAR file using the name for your application. Place it in your container's "webapp" folder (or equivalent), and let your container auto-deploy the application. Edit the skeleton configuration files as needed, restart your container, and you are on your way! (You can find the application.properties file with this message in the /WEB-INF/src/java/resources folder.) +login.emailNotFound=There is no email set for you please check with your administrator +login.userNotFound=Your Username can not be found on the system. +login.alreadyLogin=You are already logged in! Please logout before you attempt to login again. + +admin.changeEmail.title=Change My Email Address +admin.changeEmail.oldEmail=Old Email Address: +admin.changeEmail.newEmail=New Email Address: +admin.changeEmail.confirmEmail=Retype New Email Address: +admin.viewRoles.title=View All Roles + +admin.changePassword.title=Change My Password +admin.changePassword.old=Old Password: +admin.changePassword.new=New Password\: +admin.changePassword.confirm=Retype New Password\: + +admin.home.title=Dealer Admin - Document Storage +admin.home.link.stocks=My Stock +admin.home.link.certificates=My Certificates +admin.home.link.invoices=Invoices +admin.home.link.creditNotes=Credit Notes +admin.home.link.statements=Statements +admin.home.link.rebates=Rebates +admin.home.link.other=Other +admin.home.link.changePassword=Change Password +admin.home.link.changeEmail=Change Email Address +admin.home.link.viewMyDetails=View My Details +admin.invalidEmailError=You entered an invalid email address. +admin.wrongPasswordError=You wrongly entered your old password. + +admin.emailChanged.title=Email Address changed +admin.emailChanged.message=Your email has been changed. +admin.myCertificates.title=My Certificates +admin.myStocks.title=Available Stock - Not Yet Released +admin.passwordChanged.title=Password changed +admin.passwordChanged.message=Your password has been changed. +admin.userDeleted.title=User deleted +admin.userDeleted.message=You have successfully deleted the User. +admin.userDetails.title=User Details +admin.userForm.title=Create User +admin.userForm.select=Select User Role: +admin.viewMyDetails.title=My Details +admin.viewMyDetails.email=Email Address\: +admin.viewMyDetails.dealerName=Dealer Name: +admin.viewMyDetails.dealerCode=Dealer Code: +admin.viewMyDetails.phone=Phone Number: +admin.viewMyDetails.fax=Fax Number: +admin.viewMyDetails.deliveryAddress=Delivery Address: +admin.viewUsers.title=View All Users +admin.viewUsers.username=Username +admin.viewUsers.userRole=User Role +admin.viewUsers.editDelete=Edit/Delete User + +allocation.home.title=Allocations +allocation.home.link.result=Allocations +allocation.home.link.request=Allocation Requests +allocation.home.link.swap=Swap +allocation.request.confirm=Please confirm your allocation request +allocation.results.title=Allocations +allocation.results.vehicle.allocation=Your vehicle allocations for March 2005 are as follows: +allocation.results.eta=ETA +allocation.results.action=Action +allocation.results.accept=Accept +allocation.results.reject=Reject + +mmovement.title=Material Movement\t\t\t\t\t\t\t +mmovement.warehouse=Warehouse +mmovement.documentNo=Document No: +mmovement.description=Description: +mmovement.locator=Locator: +mmovement.destinationLocator=Destination Locator: +mmovement.header=Material Movement +mmovement.product.name=Name +mmovement.product.details=Details +mmovement.product.quantity=Quantity +mmovement.product.move=Move +mmovement.region=Region +mmovement.move=Move +mmovement.track=Track +mmovement.allWarehouses=All +mmovement.selectWarehouse=Move to Warehouse: +mmovement.button.confirm=Confirm +mmovement.button.complete=Complete +mmovement.button.delete=Delete +mmovement.button.cancel=Cancel +mmovement.documentStatus=Document Status: + + +mmovement.track.title=Track Material Movement +mmovement.track.header=Track Material Movement + +allocation.results.time.remaining=Time Remaining for this allocation: +allocation.results.time.numDays=22 days +allocation.results.swap.allocation=*NB: Should you choose to swap an allocated vehicle, the system will automatically accept that allocation. +allocation.resultsConfirm.title=Allocation - Allocation submitted +allocation.resultsConfirm.message=Thank You. Your allocations have been submitted. +allocation.status=Allocation Status +allocation.swap.title=Vehicle Allocation Request +allocation.swap.heading=Vehicle Allocation Request +allocation.swap.vehicles=Vehicles available for swap +allocation.swapConfirm.submit=Your request for swap has been submitted. +allocation.swapProcess.title=Swap Process +allocation.swap=Swap + +asset.status= Asset Status + +days.old=Days Old + +button.add=Add +button.cancel=Cancel +button.confirm=Confirm +button.create=Create Order +button.delete=Delete +button.edit=Edit User +button.process=Process Order +button.search=Search +button.submit=Submit +button.save=Save +button.reply = Reply +button.complete=Complete +button.createwarehouse=Create Warehouse +button.invoice = Create Invoice + + +dealer.order=Order +dealerOrder.cancelOrder.title=Dealer Order - Order cancelled +dealerOrder.cancelOrder.message=This order has been cancelled. +dealerOrder.createOrder.title=Dealer Order +dealerOrder.home.title=Orders +dealerOrder.home.link.result=Dealer Orders +dealerOrder.home.link.specialColour=Special Colour Orders +dealerOrder.home.printOrder=Dealer Order - Print Order +dealerOrder.input.all=Please input all values. +dealerOrder.process.title=Dealer Order - Order processed +dealerOrder.process.message=Thank You, Your orders have been processed +dealerOrder.results.title=Dealer Order - Results +dealerOrder.specialColour.title=Special Colour Orders +dealerOrder.specialColour.submission=*NB: Must be submitted four months in advance for Accord, All other models - 3 months in advance. +dealerOrder.createSpecialColour.title=Create Special Colour Order + +dealerOrder.terms.title=Dealer Order - Terms and Conditions +dealerOrder.terms.heading=Terms and Conditions +dealerOrder.terms.term1=All orders placed by the dealer (whose name and details appear on this order form) ("the Dealer") shall be final and binding on the Dealer once the Dealer has signed this order form and delivered the original signed order form or a copy thereof to Honda South Africa (Pty) Ltd (registration number 2000/010675/07) ("HSAF"). The Dealer shall not be entitled to cancel its order, return any of the Honda Products reflected on this order form or obtain a credit for Honda Products without HSAF's prior written consent. + +dealerOrder.terms.term2=The Dealer's order shall not be binding on HSAF until acceptance thereof by HSAF (whether in whole or in part) by the duly authorized HSAF divisional manager signing this order form in the space provided therefor. + +dealerOrder.terms.term3=Ownership in and to Honda Products forming the subject matter of this order form shall remain vested with HSAF until those Honda Products have been delivered to or collected by the Dealer, as the case may be, and HSAF has received payment in full of the total amounts reflected on this order form. The risk of loss and damage to the Honda Products reflected on this order form shall pass to the Dealer upon the collection or the delivery of those Honda Products to the Dealer, notwithstanding the fact that the Dealer has not paid HSAF in full for those Honda Products and that the Dealer is not the owner of those Honda Products. + +dealerOrder.terms.term4=Any purported variation on this order form of the provisions of any written agreement(s) concluded between HSAF and the Dealer in respect of the Honda Products shall not take precedence over the terms of those written agreements, notwithstanding HSAF's signature on this order form. + +dealerOrder.terms.term5=By the Dealer's signature of this order form, the Dealer acknowledges and agrees that it has read and understood the terms and conditions set out on this order form and agrees to be bound to those terms and conditions. + +dealerOrder.terms.term6=HSAF reserves the right at any time and from time to time to change or modify, without notice, the terms and conditions set out in this order form. + +dealerOrder.terms.term7=Notwithstanding the signature hereof by HSAF, HSAF will have obligation, under any circumstances, to accept orders for any Honda Products which are not in this current inventory. + +dealerOrder.terms.term8=For the purposes of this order form, Honda products means: +dealerOrder.terms.term8a=such new motorcycles and automobiles as are from time to time offered for sale by HSAF to Dealer for resale as part of HSAF's motorcycle or automobile line as determined by HSAF in its sole discretion; and/or + +dealerOrder.terms.term8b=all industrial and domestic engines manufactured by HSAF which form part of HSAF's engine line as determined by HSAF in its sole discretion; and/or\t\t\t + +dealerOrder.terms.term8c=all power products which form part of HSAF's power product line as determined by HSAF in its sole discretion, including without limitation, all HSAF generators, lawn mowers, brushcutters and water pumps; and/or + +dealerOrder.terms.term8d=all parts, accessories and optional equipment marketed by HSAF for use of with motorcycles, engines, automobiles and power products referred to above. + + +dealerOrder.qty.greaterThanZero=The quantity specified must be greater than zero. +dealerOrder.noOrders=Please add at least an order. + +dealerOrder.must.agree=You must agree to the terms and conditions before confirmation. + + +include.footer.poweredBy=Powered by UDI Technology +include.footer.allContent=All Content © 2005 Honda South Africa +include.header.link.loginSuccess=  Home +include.header.link.stockAction=  Stock Inquiries +include.header.link.dealerOrderHome=  Dealer Orders +include.header.link.natisReleaseHome=  NaTIS Release +include.header.link.allocationHome=  Allocations +include.header.link.interDealerHome=  Inter Dealer Transfers +include.header.link.adminHome=  Dealer Admin +include.header.link.loginActionNoInput=  Logout +include.header.link.myorders=My Orders + +interdealer.transfer=Transfer +interDealer.cancelTransfer.message=You have cancelled this request. +interDealer.dealerTransferOrder.title = Inter Dealer Transfer +interDealer.dealerTransferOrder.heading = Dealer Transfer: Request +interDealer.home.title=Dealer Transfers +interDealer.home.link.request=Request +interDealer.home.link.receiving=Receiving +interDealer.process.title=Dealer Transfer - Request sent +interDealer.process.message=Your request has been transmitted. +interDealer.request.title=Dealer Transfer - Requests +interDealer.receiving.title=Dealer Transfer - Receiving +interDealer.receiving.from=From: +interDealer.receiving.accept=Accept +interDealer.receiving.reject=Reject +interDealer.receiving.reason=Reason for rejection + +login.choose.title=Please choose a User from any of these Dealers +login.forgot.forgotPassword=Forgot your password?
Please enter your username and we will send your password to your email address +login.forgot.username=Username\: +login.forgot.sendPassword=Send Password +login.home.title=Welcome to Posterita POS +login.home.title.part1=Welcome to +login.home.title.part2=Posterita POS +login.home.login=Please Login +login.home.username=Username\: +login.home.password=Password: +login.home.loginButton=Login +login.home.loginForgot=Forgot password? +login.loginForm.message=Please enter your username and password.Remember your email is your username
NB: Case sensitive. +login.logout.logoutSuccess=You have successfully logged out. +login.logout.backToLogin=  Click Here to go back to the Login Screen +login.password.passwordSent=Your password has been sent you should receive it in a few minutes +login.password.backToLogin=  Click Here to go back to the Login Screen +login.password.emailTitle= Your password reminder. +login.password.emailSubject=The password to log in into the POS System is: +login.success.welcome=Welcome to Posterita
POS System +login.userInactive=Your user has been set inactive. + +menu.title = Menu +menu.close = Close Menu +menu.closed = Menu Closed +menu.isActive = Is Active +menu.list = List of Menu +menu.description = Description + +#============Email Errors============ +email.subject.error = Please enter a subject for the email +email.message.error = Please enter your message +email.send.error = Email cannot be sent. Please Check if you have properly configured your smtp host. + +#==================================== + +message.title = Create Message +message.from = From: +message.to = To: +message.recto = To +message.subject = Subject: +message.recsubject = Subject +message.writemessage = Message: +message.senttitle = Message Sent +message.sent = Your Message has been sent +message.sentmessages = Sent Messages +message.mymessages = My Messages +message.received = Received Messages +message.sender = Sender +message.date = Date +message.viewdate = Date: +message.view = View Message +message.markas = Mark as +message.delete = Delete +message.reply = Reply Message +message.viewreceivedmessage = View Received Message +message.viewsentmessage = View Sent Message +message.sendbutton = Send +message.goback = Go Back + +myorders.home.title=My Orders - Home +myorders.home.heading=My Orders + +myorders.orders.dealerorders.link=Dealer Orders +myorders.orders.scoorders.link=Special Colour Orders +myorders.orders.requesttransferorders.link=Dealer Transfer Orders + +myorders.purchaseorders.home.link=Purchase Orders +upload.file = Please attach the file for creating orders +download.file=Download file + +myorders.result.title=My Orders Result +myorders.result.heading=My Orders - Result +myorders.result.dateOrdered=Date Ordered +myorders.result.bpartnerName=Dealer +myorders.result.docStatus=Doc Status +myorders.result.hsafRef=HSAF Ref ID +myorders.result.poreference=PO Reference +myorders.result.grandTotal=Grand Total +myorders.result.viewOrder=View Order +myorders.result.orderfrom=Ordered From + + + +myorders.salesorders.home.link=Sales Orders +myorders.purchase.order= Purchase Order + +mycertificate.title = My Certificates +mycertificate.viewCertificate = View Certificate + + +natisRelease.home.title=NaTIS Release +natisRelease.process.title=NaTIS Release - Vehicle released +natisRelease.process.message=Thank you, the Vehicle has been released +natisRelease.release.name=Name +natisRelease.release.surname=Surname +natisRelease.release.idNumber=ID Number\: +natisRelease.release.physicalAddress=Physical Address +natisRelease.release.postalAddress=Postal Address +natisRelease.release.homeTelephone=Home Telephone +natisRelease.release.workTelephone=Work Telephone +natisRelease.release.cell=Cell +natisRelease.release.fax=Fax +natisRelease.viewCertificate.title=View Certificate +natisRelease.viewCertificate.message=Your NaTIS Certificate for this vehicle has been released. +natisRelease.viewCertificate.download=Click here for your certificate. +natis.order.history = NaTIS Release Sales History + +order.dealerPONo=Dealer Purchase Order No:  +order.HSAFRefNo=HSAF Ref No:  +order.terms=Terms and Conditions compulsory +order.specialColour=Special Colour Order +order.print=Printer Friendly Version + +orderView.orderFooter.use=FOR OFFICE USE +orderView.orderFooter.roNo=R/O NUMBER +orderView.orderFooter.invoiceNo=INVOICE NUMBER +orderView.orderFooter.dealerAuthor=DEALER AUTHORISATION: +orderView.orderFooter.signature=SIGNATURE: +orderView.orderFooter.recvBy=HSAF RECEIVED BY: +orderView.orderFooter.divMgr=AUTHORISED DIV MANAGER:  (Name & Sign.) + +orderView.orderHeader.honda=HONDA S.A AUTOMOBILE
DEALER ORDER +orderView.orderHeader.att=ATT: +orderView.orderHeader.fax=FAX: +orderView.orderHeader.tel=TEL: +orderView.orderHeader.date=DATE: +orderView.orderHeader.orderNo=DEALER ORDER NO: +orderView.orderHeader.dealerCode=DEALER CODE: +orderView.orderHeader.dealerName=DEALER NAME: +orderView.orderHeader.delAddress=DELIVERY ADDRESS: + +orderView.orderPriceDetails.subTotal=SUB TOTAL +orderView.orderPriceDetails.vat=VAT +orderView.orderPriceDetails.orderTotal=ORDER TOTAL + +product.create.car = Create New Car +product.create.bike = Create New Bike +product.create.usedcar = Create Used Car +product.create.usedbike = Create Used Bike +product.create.usedcar.attributevalue = Create Used Car Attribute Value +product.create.usedbike.attributevalue = Create Used Bike Attribute Value +product.create.car.attributevalue = Create New Car Attribute Value +product.create.bike.attributevalue = Create New Bike Attribute Value + +product.create = Create Product +product.details = Product Details +product.make=Make +product.model=Model +product.colour=Colour +product.transmission=Transmission +product.year =Year +product.purchase.price = Purchase Price +product.sales.price = Sales Price +product.wholesale.price= Wholesale Price +product.retail.price= Retail Price +product.quantity=Quantity +product.price=Price +product.vinNo=VIN No. +product.order=Order +product.salesRegion=Sales Region +product.request=Request +product.sendRequest=Send Request +product.release=Release +product.reserved=Reserved +product.status=Status +product.all=All +product.umodel=MODEL +product.ucolour=COLOUR +product.utransmission=TRANS +product.frameNo=FRAME NUMBER +product.uquantity=QTY +product.uprice=PRICE Ex VAT +product.uVAT=VAT +product.dealer=DEALER +product.uTotal=TOTAL +product.colourType=Colour Type +product.colour.group=Colour Group +product.wholesaleDate=Wholesale Date +product.natisApplicationDate=NaTIS Application Date +product.hide=Hide +product.refNo=Reference No +product.ordId=Order ID +product.ordBy=Order By +product.ordDate=Date Ordered +product.doctype=Doc Type +product.type = Product Type +product.home.title = Select Products For Order +product.isNatisReleased = Is NaTIS Released +product.description = Description +product.restriction = Product Restriction +product.name = Product Name +product.restrict = Restrict +product.pricelist = Pricelist +product.newprice = New Price +product.oldprice = Old Price +product.price.edit = Edit Product Price + +reprice.orders=Reprice Orders + + +customer.details=Customer's Details +customer.licensing.desc=Licensing Option Description +customer.finance.option=Finance Option Description +trade.in.make=Trade In Make +trade.in.makeModel=Trade In Make Model +trade.in.year=Trade In Year +customer.idBookNo=ID Book Number +engine.no=Engine Number +maintenance.contract=Maintenance Contract +registration.status=Registration Status + +sc.dealerOrder.home.quantity=Quantity + +target.sales.title = Target Sales +target.sales.month = Month +target.sales.year = Year +target.sales.ModelGroup = Model Group +target.sales.Quantity = Quantity +target.sales.organisation = Organisation + +stock.home.title=Stock Inquiry +stock.inquiry.show=Show ONLY stock from HSAF +stock.not.reserved.show=Show ONLY available stock +stock.process.title=Stock Inquiry - Request sent +stock.process.message=Thank You, your request has been sent +stock.filter.by=Filter by: + +error.workflow.violation=You can only progress in this application using the buttons and the menu that are offered. Hitting the browser's reload button or using the back button is not allowed. + +user.create = Create User +user.created = User Created +user.username=Username: +user.role=User Role: +user.password=Password: +user.address = Address: +user.city = City: +user.postaladdress = Postal Address: +user.region = Region +user.email=Email Address: +user.phone = Phone No: +user.cellphone=Cell Phone: +user.confirmPassword=Confirm Password: +user.isActive = Is Active +user.isSalesRep = Is Sales Representative +user.details = User Details +user.pin=User PIN +user.docBasisType=Document Basis for Commission +user.comm.per=% Commission for the sales rep +user.comm.fre=Calculation Frequency +user.substract.amt=Substract Amt** +user.substract.exp=**The Subtract Amount indicates the amount to subtract from the total amount prior to calculation of commission + +choose.VIN=Choose VIN Number + +select.month=Month +select.year=Year +select.status=Status +view.all=All + +calendar.day.default=Day +calendar.month.default=Month +calendar.year.default=Year +calendar.month1=Jan +calendar.month2=Feb +calendar.month3=Mar +calendar.month4=Apr +calendar.month5=May +calendar.month6=Jun +calendar.month7=Jul +calendar.month8=Aug +calendar.month9=Sep +calendar.month10=Oct +calendar.month11=Nov +calendar.month12=Dec +asset.owner=Owned By +queryVinNo.title=Query VIN No. +vinNo.search=Search VIN No. +vinNo.query=Query on the Status of VIN Number +vinNoDetails.title=VIN Number Details +searchOrderByRef.title=Query Order Reference Number +search.orderID=Search Order Ref No. +text.yes=Yes +text.no=No +query.dealers.stock.title=Query Dealers Stock + +bPartner.title = Business Partner +bPartner.create = Create Business Partner +bpartner.details = Business Partner Details +bpartner.name = Name +bpartner.name2 = Name2 +bPartner.address = Address +bPartner.address1 = Address1 +bPartner.address2 = Address2 +bPartner.postal.address = Postal Address +bPartner.city = City +bPartner.phone=Phone Number +bPartner.fax=Fax Number +bpartner.edit = Edit +bpartner.view = View +bPartner.isActive = Is Active: +bPartner.isCustomer = Is Customer: +bPartner.isVendor = Is Vendor: +bPartner.isEmployee = Is Employee: +bPartner.isSalesRep = Is Sales Rep: +bPartner.region = Region +bPartner.edit = Edit Business Partner Details +bPartner.credit.limit = Credit Limit +bPartner.credit.status = Credit Status +bPartner.dunning = Dunning + +bank.create = Create Bank +bank.name = Bank Name +bank.address = Address +bank.postaladdress = Postal Address +postal.address = Postal Address +bank.city = City +bank.routingnumber = Routing Number +bank.details = Bank Details + +locator.details = Locator Details +locator.create = Create Locator +locator.warehouse = Warehouse +locator.aisle = Aisle +locator.bin = Bin +locator.level = Level +locator.default = Is Default + +bAccount.create = Create Bank Account +bAccount.bank.name = Bank Name +bAccount.no = Account Number +bAccount.type = Account Type +bAccount.current.balance = Current Balance +bAccount.type.checking = Checking +bAccount.type.saving = Saving +bAccount.details=Bank Account Details + +order.history = Order History +invoice.history = Invoice History +payment.history = Payment History +inout.shipment.history = Shipment History +inout.receipt.history = Receipt History + + +history.receiptNumber = Receipt Number +history.shipmentNumber = Shipment Number +history.orderNumber = Order Number +history.invoiceNumber = Invoice Number +history.documentNumber = Document Number +history.documentStatus = Document Status +history.dealerName = Dealer Name +history.date = Date +history.dateInvoiced = Date Invoiced +history.dateOrdered = Date Ordered +history.grandTotal = Grand Total +history.isDelivered = Is Delivered +history.isInvoiced = Is Invoiced +history.isPaid = Is Paid +history.isReceipt = Is Receipt +history.paymentId = Payment Id +history.paymentAmt = Payment Amt \t +history.transactionDate = Transaction Date +history.orderReference = Order Reference +history.isSotrx = Is Sales Order + +warehouse.create = Create Warehouse +warehouse.created = Warehouse Created +warehouse.details = Warehouse Details +warehouse.wname = Warehouse Name +warehouse.name = Warehouse +warehouse.address = Address: +warehouse.postaladdress = Postal Address: +warehouse.city = City: +warehouse.region = Region +warehouse.isPublic = Is Accesible to Dealers +warehouse.isActive= Is Active +is.warehouse.allocation= Is Allocation Warehouse +warehouse.type=Warehouse Type +warehouse.all = All Warehouses +product.attribute.create = Create Product Attribute Value +product.attribute.set = Vehicle +product.attribute.name = Attribute +product.attribute.value = Value +product.attribute.value.created = Product Attribute Value Created +product.attribute.existingValues = Existing values +product.selected = Selected Products +quantity = Quantity + +engine.number= Engine Number +natis.application.date=NaTIS Application Date +natis.release.date=NaTIS Release Date +natis.control.number=NaTIS Control Number +natis.model.number=NaTIS Model Number +natis.unit.number=NaTIS Unit Number +natis.release.id=NaTIS Release Id +org.name=Dealer Name\: +register.number= Register Number + +customer.create.new=Create new customer +customer.information =NaTIS Release-Customer Information +customer.name = Customer Name: +customer.surname=Surname: +customer.id.number=ID Number: +customer.phy.add = Physical Address: +customer.street1 = Street 1: +customer.street2 = Street 2: +customer.city = city: +customer.postal.address = Postal Address: +postal.street1=Postal Street +postal.city=Postal city +postal.code = Postal Code: +customer.home.telephone =Home Telephone No: +customer.work.telephone =Work Telephone No: +customer.cell= Customer Cell\: \t +customer.aa.car.number=AA Card No\: \t +customer.maintenance.contract.number=Maintenance Contract No: +invoice.it = Invoice +unreserve.stock = Unreserve Stock +shipment.material.receipt=Shipment/Material Receipt + +#vehicle.createVehicle=Create Vehicle +#vehicle.unitNumber=Unit Number +#vehicle.vinNumber=Vin Number +#vehicle.engineNumber=Engine Number +#vehicle.natisModelDesc=Natis Model Desc +#vehicle.enginePower=Engine Power +#vehicle.engineCapacity=Engine Capacity +#vehicle.tare=Tare +#vehicle.noOfWheels=No. of Wheels +#vehicle.cntryOfImport=Country Of Import +#vehicle.colourCdHES=Colour Code HES +#vehicle.mainColourCd=Main Colour Code +#vehicle.natisModelNum=Natis Model Number + + +#========= DMS Messages + +error.required.attributeValue = Value is required +error.required.orgType = Choose a dealer type +error.required.vehicleType = Choose a product type +error.required.locator = Destination Locator required +error.required.warehouse = Destination Warehouse required +error.no.order.exists=The Order is already completed, Please make a new one + +org.create=Create Dealer +org.details = Dealer Details +reserved.for=Reserved For the Dealer: +org.type=Dealer Type: +org.product.type=Product Type: +click.order.id=Click this OrderId to get the Order: +org.retailer= Is Retailer: +org.wholesaler=Is Wholesaler: +org.automobile= Is Automobile: +org.motocycle=Is Motocycle: +org.address=Address: +org.address1=Address1: +org.address2=Address2: +org.city=City: +org.postalAddress=Postal Address: +org.region=Region: +org.isActive= Is Active +org.isVisible= Is Visible + +dealer.details = Dealer Details +dealer.name = Dealer Name +dealer.location = Location +dealer.phone = Phone +dealer.fax = Fax + +role.create = Create Role +role.name = Name +role.superuser = Access to all Dealers +role.accessibleToAll = Access to all Dealers +role.isActive = Is Active + +pos.name= POS Name +pos.begining.balance=Beginning Balance +pos.net.transaction=Net Cash Transaction +pos.cash.total=Cash Amount +pos.card.total=Card Amount +pos.cheque.total=Cheque Amount +pos.grandtotal=Grand Total +pos.current.till.balance= Current Till Balance + + +groupModel.title = Group Models +groupModel.group = Model Group +groupModel.model = Model + +licensing.district = Licensing District +licensing.district.code = Licensing District Code +licensing.district.description = Description +licensing.district.area = Licensing Area +licensing.district.area.domestic = Domestic +licensing.district.area.export = Export + +price.listing = Price Listing +pricelist.Version = PriceList Version +pricelist.name = PriceList Name +pricelist.listPrice = List Price + +error.required.currentBalance = Current Balance is required +error.required.accountNo = Account Number is required +error.required.accountType = Account Type is required +error.required.partnerName = Business Partner Name is required +error.required.supplierName = Vendor Name is required +error.required.sizes = Please select some sizes or enter a custom size + + +error.required.stdPurchasePrice = Purchase Price is required +error.required.stdSalesPrice = Sales Price is required + +error.numberformatexception.currentBalance=Only numeric values are supported for Current Balance +error.numberformatexception=Please Enter a Numeric Value +error.numberformatexception.stdSalesPrice= Sales prices should be numeric +error.numberformatexception.stdPurchasePrice=Purchase prices should be numeric +error.numberformatexception.price=Please enter a numeric value for the prices +error.modelgroup.notExist=Please specify a Model Group +error.deactivatingattributeproductinstock = Unable to perform action. There are some products that use the attribute value. + +invoice.customer.print=Customer Invoice - Print +invoice.customer=Customer Invoice +invoice.no=Invoice No + +search.order = Search Order +search.order.title = Query Order ID +search.order.label = Order ID + +search.order.vin = Search Order For a VIN No. +search.order.vin.title = Search Order For a VIN No. +search.order.vin.label = Enter VIN No. +swap.vin.success=The vehicle has been swapped successfully +reprice.order.success=The Orders have been Repriced successfully + +error.orderId.not.found=Order Id not found +material.movement.success=The products have been moved successfully. +sequence.update.success= The sequences have been updated successfully +data.integrity.success=The data intregriy has been checked and mails have been send for the failed tests +naamsa.dealercode.create=Create NAAMSA Dealer Code +naamsa.dealercode.title=NAAMSA Dealer Code +naamsa.dealercode.edit.title=Edit NAAMSA Dealer Code +naamsa.dealer=Dealer +naamsa.dealercode=Dealer Code + +naamsa.modelcode=Model Code +naamsa.modelcode.create=Create NAAMSA Model Code +naamsa.modelcode.title=NAAMSA Model Code +naamsa.modelcode.edit.title=Edit NAAMSA Model Code + +wholesaleorder.ftp.title=Upload FTP File +wholesaleorder.csv.title=Create Wholesale Order +wholesaleorder.information=Please go to the following site and select the ftp file which consist of the vehicles which you want to insert in the system. +wholesaleorder.site=ftp://ftp.honda-eu.com +wholesaleorder.upload.button=Upload File +error.ftp.notvalid=The ftp file uploaded is not valid +wholesaleorder.csv.invalid=CSV File is invalid +wholesaleorder.csv.unknownerror=An Error has occurred, please contact your system administrator +error.ftp.novehicle=The FTP does not contain vehicles for your Organisation Type +wholesaleorder.csv.download=Download the CSV generated from the FTP file that you have input.
Check whether all the records are good. Take appropriate action for those that have error descriptions.
+wholesaleorder.csv.download1=Download the CSV generated from the FTP file that you have input.
Modify this file by inputing genuine information concerning the vehices.
+wholesaleorder.csv.information=Upload the CSV that you have modified in order to generate the wholesale order. +wholesaleorder.csv.uploadFile=CSV File to upload\: + +error.natis.release=Your request to release this vehicle is in progress.\n The system will automatically complete this order and release the vehicle on NaTIS after some time. +error.natis.release_old=Could not release vehicle on NaTIS. Please try again. \nIf the problem persists please contact the administrator. +vin.number.not.found=VIN number not found +error.vin.number.duplicate=Duplicate VIN number found. +natis.info.not.found=Natis info not found +natis.info.duplicate=Natis info duplicate +released.by=Released by + + + +modelmatch.title=Model Matching +modelmatch.natisModelDesc=Natis Model Desc +modelmatch.modelDesc=Model Desc +modelmatch.transmission=Transmission +modelmatch.year=Year +wesbank.status=Wesbank Status + + +colourmatch.title=Colour Code Matching +colourmatch.colourCode=Colour Code +colourmatch.colourDesc=Colour Description + +wesbank.ping.title=Ping WesBank +wesbank.response.action=Action +wesbank.response.recordtype=Record Type +wesbank.response.reason=Reason +wesbank.response.reasonDescription=Reason Description +wesbank.response.date=Date +wesbank.response.time=Time +wesbank.response.transId=Transaction Id +wesbank.response.status=Status +import.vehicleImported.title=Vehicle imported +import.vehicleUnimported.title=Vehicle Not Imported +import.vehicle.model=Model +import.vehicle.vinNumber=Vin Number +import.vehicle.engineNumber=Engine Number +import.vehicle.natisModelNo=Natis Model No +import.vehicle.colour=Colour +import.vehicle.transmission=Transmission +import.vehicle.year=Year +import.vehicle.natisModelDesc=Natis Model Desc +import.vehicle.modelMatchingDesc=Model Matching +import.vehicle.colourCode=Colour Code +import.vehicle.errorDesc=Error Description +import.vehicle.selProcess=Process +import.vehicle.selectAll=Select All +import.vehicle.reperformMatching=Reperform Matching +import.vehicle.importVehicle=Import Vehicles +error.attachment.empty = Please select a file +error.attachment.invalid.image = Please select an image +error.required.cvv=CVV is required. +error.creditCardExpMonth=Credit card expiry date cannot be prior to this month. Please enter a valid date. +error.required.creditCardExpMonth=Credit card expiry month required. +error.pos.shoppingcart.empty = Your shopping cart is empty. +error.required.accountName=Credit Card Owner name required. +error.required.paymentMethod=Please select the preferred payment method. +error.minlength.creditCardNumber=Please enter a valid credit card number (Length from 13 to 16) +error.minlength.cvv=Please enter a CVV number greater than 2 digits +error.sending.email=Error sending email +error.creditcard.number=Credit Card number is not valid +error.creditcard.type=Credit Card type is not supported +error.creditcard.expiry=Credit Card expiry is not valid +error.creditcard.cvv=Credit Card VV is not valid +error.required.startDate = Please select from date. +error.required.endDate = Please select to date. +error.pos.invoke.no.orderline=Cannot invoke order that has no orderlines. +error.access.not.allowed=you do not have the role to access the window, please contact your administrator +error.shipment.condition.required=Please specity whether the shipment should be generated along with the order and invoice + + +document.status.drafted=Drafted +document.status.inprogress=In Progress +document.status.completed=Completed +document.status.closed=Closed +document.status.invalid=Invalid +payment.rule.cash=Cash +payment.rule.card=Card +payment.rule.cheque=Cheque +payment.rule.mixed=Mixed + +error.store.default=Default Application could not be set. Cause: {0}.
If the problem persists please clear your browser cookies. + +########### CRM MESSAGES ########### + +## ERROR MESSAGES +error.request.view=Cannot view the desired request +error.request.assign=Could not assign request to the specified user +error.request.create=Could not create request +error.request.init.resolve=Could not initialise request for resolving +error.request.resolve=Could not resolve request +error.request.close=Could not close request +error.request.view.summary=Could not retrieve your requests, please contact you administrator + + +vendor.create=Create Vendor +vendor.details = Vendor Details +user.discount = %Discount Allowed + + +error.file.save=Error occurred when saving file. +error.source.file.notpresent=Source file not present. +error.create.bank.account=Error occurred while creating bank account +error.bank.not.found=Bank not found. +error.edit.bank=Editing bank information failed +error.get.partner.detail=Retrieval of partner details failed +error.getall.partners=Retrieval of all partner details failed +error.activate.customer=Could not activate customer +error.deactivate.customer=Could not deactivate customer +error.editing.user=Error occurred while editing user +error.activate.vendor=Could not activate vendor +error.deactivate.vendor=Could not deactivate vendor +error.orderid.notpresent=OrderId not present +error.creating.invoice=Could not create invoice +error.only.pos.order.supported=Only POS Orders are Supported, Please check the number +error.only.credit.order.supported=Only Credit Orders are Supported, Please check the number +error.credit.order.not.completed=The Credit Order is not completed, cannot create Credit Memo +error.pos.order.not.completed=The POS Order is not completed, cannot create Customer Return Order +error.pos.invalid.customerID = The Customer ID entered is not valid! +error.discountLimit.exceeded = Discount allowed limit has been exceeded! +error.print.fidelity.card = Cannot print fidelity card! Please select some active customers. + +error.bpartner.nolocation = Business Partner does not have a location, you should set it first to be able to complete the current operation. +error.userRegistration.failed = Registration failed. Problem with mail server. Please try later. +error.round.off.cannot.be.negative = Round Off Factor cannot be negative. +error.no.product.found.on.pricelist = No product found on price list. + +############Fidelity Card ##################### +fidelitycard.address= TAMAK GROUP,3 DRAPER AVE,Q.BORNES,MAURITIUS.EMAIL:tamak@tamak.com +fidelitycard.telephone=Office Tel: (230)4549555 -Fax: (230)454 1542 -Shop Tel: (230)427 0276 +fidelitycard.note1=THIS TAMAK FIDELITY CARD IS THE PROPERTY OF TAMAK +fidelitycard.note2=THIS CARD ENTITLES YOU TO SPECIAL DISCOUNTS OF 10% +fidelitycard.note3=APPLICABLE IN TAMAK WORLD & TAMAK SHOP. +fidelitycard.note4=NOT APPLICABLE ON DISCOUNTED ITEMS. +fidelitycard.customer.name=Nom: + +################### Messages for Receipt ###################### +receipt.VATRegNo=VAT 20176097 +receipt.company.name1=Tamak World +receipt.company.address=Rte St-Jean, Q.Bornes +receipt.company.phone=Tel:427-0276 +receipt.company.name2=(Tamak Retail LTD) + +################### Messages for POS ###################### +pos.description=Description +pos.qty=Qty +pos.price=Price +pos.VAT=VAT +pos.totalprice=Total Price +pos.discountpercentage=Discount % +pos.actualprice=Actual price +pos.tendertype=Tender Type +pos.cashamt=Cash Amt +pos.chequeamt=Cheque Amt +pos.chequeno=Cheque No +pos.cardamt=Card Amt +pos.cardno=Card No +pos.mixed=Mixed +pos.cash=Cash +pos.card=Card +pos.cheque=Cheque +pos.continue=Continue + +################### Messages for POS ###################### +message.product.saved = Product updated successfully + +################## User Registration ###################### +success.userRegistration.successful = Registration Successful +success.product.prices.on.pricelist.deleted.successfully = Product prices on price list deleted successfully +success.currency.updated.successfully = Currency updated successfully + + +error.process=Fail to process your request. Cause : {0} +error.precision=Precision entered is not valid. {0} +error.import.uom.not.present={0} +error.import.uom.precision.not.valid={0} +error.role.org.access.edit=Error occurred while trying to update Role Organisation Access. Please contact the Administrator. +error.no.edit.access=You do not have the right organisational access for editing +error.import.file.data={0} +error.import.uom.duplicate={0} +error.no.materialmovement.exists=The Material Movement is already completed, Please make a new one +error.terminal.locked=Terminal is locked +error.no.cashjournal.present=There is no Cash Journal present in the system. Please check whether you have done a transaction yet +current.terminal.updated=The current terminal has been updated.
Log out and Log in to be able to create transactions on the terminal. +current.terminal.reset=The current terminal has been reset.
Log out and Log in to chose again the current terminal from the list of available terminals. +error.operation=An error has occured while executing the operation you requested.
Please make sure that all data are correctly entered and try again. +error.terminal.cashbook=The cash book assigned on this terminal is already assigned to another terminal +error.deactivate.cashbook=Cash book cannot be deactivated as it is being used on a terminal +error.deactivate.terminal=Terminal cannot be deactivated as no active terminal will be available for login diff --git a/posterita/posterita/src/main/ShipmentDispatchedEmailTemplate.properties b/posterita/posterita/src/main/ShipmentDispatchedEmailTemplate.properties new file mode 100644 index 0000000000..f2fc39fcfc --- /dev/null +++ b/posterita/posterita/src/main/ShipmentDispatchedEmailTemplate.properties @@ -0,0 +1,6 @@ +subject=Tamak Webstore - Shipment In Transit +action=action +content=,
Your order has been shipped. +signin.info=Order Information +link=Your will receive the product(s) shortly. +emailRegards=Regards,
Tamak Webmaster \ No newline at end of file diff --git a/posterita/posterita/src/main/displaytag.properties b/posterita/posterita/src/main/displaytag.properties new file mode 100644 index 0000000000..5b1eeee4b1 --- /dev/null +++ b/posterita/posterita/src/main/displaytag.properties @@ -0,0 +1,20 @@ +#sort.behavior=list +#sort.amount=list +#basic.empty.showtable=true +#basic.msg.empty_list=No results matched your criteria. +#paging.banner.placement=top +#paging.banner.onepage= +export.types=csv pdf rtf +export.excel=false +export.csv=true +export.xml=false +export.pdf=true +export.rtf=true +export.excel.class=org.displaytag.export.excel.ExcelView +export.pdf.class=org.displaytag.export.PdfView +export.rtf.class=org.displaytag.export.DefaultRtfExportView +decorator.media.html=org.posterita.decorator.HistoryWrapper +decorator.media.csv=org.posterita.decorator.HistoryCsvExportWrapper +decorator.media.pdf=org.posterita.decorator.HistoryPdfExportWrapper +decorator.media.rtf=org.posterita.decorator.HistoryRtfExportWrapper +locale.provider=org.posterita.core.I18nAdapter \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/I_AD_OrgInfo.java b/posterita/posterita/src/main/org/compiere/model/I_AD_OrgInfo.java new file mode 100644 index 0000000000..633eccd9cd --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_AD_OrgInfo.java @@ -0,0 +1,203 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for AD_OrgInfo + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_AD_OrgInfo +{ + + /** TableName=AD_OrgInfo */ + public static final String Table_Name = "AD_OrgInfo"; + + /** AD_Table_ID=228 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 7 - System - Client - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(7); + + /** Load Meta Data */ + + /** Column name AD_OrgType_ID */ + public static final String COLUMNNAME_AD_OrgType_ID = "AD_OrgType_ID"; + + /** Set Organization Type. + * Organization Type allows you to categorize your organizations + */ + public void setAD_OrgType_ID (int AD_OrgType_ID); + + /** Get Organization Type. + * Organization Type allows you to categorize your organizations + */ + public int getAD_OrgType_ID(); + + public I_AD_OrgType getAD_OrgType() throws Exception; + + /** Column name C_Location_ID */ + public static final String COLUMNNAME_C_Location_ID = "C_Location_ID"; + + /** Set Address. + * Location or Address + */ + public void setC_Location_ID (int C_Location_ID); + + /** Get Address. + * Location or Address + */ + public int getC_Location_ID(); + + /** Column name DUNS */ + public static final String COLUMNNAME_DUNS = "DUNS"; + + /** Set D-U-N-S. + * Dun & Bradstreet Number + */ + public void setDUNS (String DUNS); + + /** Get D-U-N-S. + * Dun & Bradstreet Number + */ + public String getDUNS(); + + /** Column name M_Warehouse_ID */ + public static final String COLUMNNAME_M_Warehouse_ID = "M_Warehouse_ID"; + + /** Set Warehouse. + * Storage Warehouse and Service Point + */ + public void setM_Warehouse_ID (int M_Warehouse_ID); + + /** Get Warehouse. + * Storage Warehouse and Service Point + */ + public int getM_Warehouse_ID(); + + public I_M_Warehouse getM_Warehouse() throws Exception; + + /** Column name PA_Goal_ID */ + public static final String COLUMNNAME_PA_Goal_ID = "PA_Goal_ID"; + + /** Set Goal. + * Performance Goal + */ + public void setPA_Goal_ID (int PA_Goal_ID); + + /** Get Goal. + * Performance Goal + */ + public int getPA_Goal_ID(); + + public I_PA_Goal getPA_Goal() throws Exception; + + /** Column name Parent_Org_ID */ + public static final String COLUMNNAME_Parent_Org_ID = "Parent_Org_ID"; + + /** Set Parent Organization. + * Parent (superior) Organization + */ + public void setParent_Org_ID (int Parent_Org_ID); + + /** Get Parent Organization. + * Parent (superior) Organization + */ + public int getParent_Org_ID(); + + /** Column name ReceiptFooterMsg */ + public static final String COLUMNNAME_ReceiptFooterMsg = "ReceiptFooterMsg"; + + /** Set Receipt Footer Msg. + * This message will be displayed at the bottom of a receipt when doing a sales or purchase + */ + public void setReceiptFooterMsg (String ReceiptFooterMsg); + + /** Get Receipt Footer Msg. + * This message will be displayed at the bottom of a receipt when doing a sales or purchase + */ + public String getReceiptFooterMsg(); + + /** Column name Supervisor_ID */ + public static final String COLUMNNAME_Supervisor_ID = "Supervisor_ID"; + + /** Set Supervisor. + * Supervisor for this user/organization - used for escalation and approval + */ + public void setSupervisor_ID (int Supervisor_ID); + + /** Get Supervisor. + * Supervisor for this user/organization - used for escalation and approval + */ + public int getSupervisor_ID(); + + /** Column name TaxID */ + public static final String COLUMNNAME_TaxID = "TaxID"; + + /** Set Tax ID. + * Tax Identification + */ + public void setTaxID (String TaxID); + + /** Get Tax ID. + * Tax Identification + */ + public String getTaxID(); + + /** Column name TransferBank_ID */ + public static final String COLUMNNAME_TransferBank_ID = "TransferBank_ID"; + + /** Set Bank for transfers. + * Bank account depending on currency will be used from this bank for doing transfers + */ + public void setTransferBank_ID (int TransferBank_ID); + + /** Get Bank for transfers. + * Bank account depending on currency will be used from this bank for doing transfers + */ + public int getTransferBank_ID(); + + /** Column name TransferCashBook_ID */ + public static final String COLUMNNAME_TransferCashBook_ID = "TransferCashBook_ID"; + + /** Set CashBook for transfers */ + public void setTransferCashBook_ID (int TransferCashBook_ID); + + /** Get CashBook for transfers */ + public int getTransferCashBook_ID(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_AD_Role.java b/posterita/posterita/src/main/org/compiere/model/I_AD_Role.java new file mode 100644 index 0000000000..841342136f --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_AD_Role.java @@ -0,0 +1,498 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for AD_Role + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_AD_Role +{ + + /** TableName=AD_Role */ + public static final String Table_Name = "AD_Role"; + + /** AD_Table_ID=156 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 6 - System - Client + */ + BigDecimal accessLevel = BigDecimal.valueOf(6); + + /** Load Meta Data */ + + /** Column name AD_Role_ID */ + public static final String COLUMNNAME_AD_Role_ID = "AD_Role_ID"; + + /** Set Role. + * Responsibility Role + */ + public void setAD_Role_ID (int AD_Role_ID); + + /** Get Role. + * Responsibility Role + */ + public int getAD_Role_ID(); + + /** Column name AD_Tree_Menu_ID */ + public static final String COLUMNNAME_AD_Tree_Menu_ID = "AD_Tree_Menu_ID"; + + /** Set Menu Tree. + * Tree of the menu + */ + public void setAD_Tree_Menu_ID (int AD_Tree_Menu_ID); + + /** Get Menu Tree. + * Tree of the menu + */ + public int getAD_Tree_Menu_ID(); + + /** Column name AD_Tree_Org_ID */ + public static final String COLUMNNAME_AD_Tree_Org_ID = "AD_Tree_Org_ID"; + + /** Set Organization Tree. + * Tree to determine organizational hierarchy + */ + public void setAD_Tree_Org_ID (int AD_Tree_Org_ID); + + /** Get Organization Tree. + * Tree to determine organizational hierarchy + */ + public int getAD_Tree_Org_ID(); + + /** Column name Allow_Info_Account */ + public static final String COLUMNNAME_Allow_Info_Account = "Allow_Info_Account"; + + /** Set Allow Info Account */ + public void setAllow_Info_Account (boolean Allow_Info_Account); + + /** Get Allow Info Account */ + public boolean isAllow_Info_Account(); + + /** Column name Allow_Info_Asset */ + public static final String COLUMNNAME_Allow_Info_Asset = "Allow_Info_Asset"; + + /** Set Allow Info Asset */ + public void setAllow_Info_Asset (boolean Allow_Info_Asset); + + /** Get Allow Info Asset */ + public boolean isAllow_Info_Asset(); + + /** Column name Allow_Info_BPartner */ + public static final String COLUMNNAME_Allow_Info_BPartner = "Allow_Info_BPartner"; + + /** Set Allow Info BPartner */ + public void setAllow_Info_BPartner (boolean Allow_Info_BPartner); + + /** Get Allow Info BPartner */ + public boolean isAllow_Info_BPartner(); + + /** Column name Allow_Info_CashJournal */ + public static final String COLUMNNAME_Allow_Info_CashJournal = "Allow_Info_CashJournal"; + + /** Set Allow Info CashJournal */ + public void setAllow_Info_CashJournal (boolean Allow_Info_CashJournal); + + /** Get Allow Info CashJournal */ + public boolean isAllow_Info_CashJournal(); + + /** Column name Allow_Info_InOut */ + public static final String COLUMNNAME_Allow_Info_InOut = "Allow_Info_InOut"; + + /** Set Allow Info InOut */ + public void setAllow_Info_InOut (boolean Allow_Info_InOut); + + /** Get Allow Info InOut */ + public boolean isAllow_Info_InOut(); + + /** Column name Allow_Info_Invoice */ + public static final String COLUMNNAME_Allow_Info_Invoice = "Allow_Info_Invoice"; + + /** Set Allow Info Invoice */ + public void setAllow_Info_Invoice (boolean Allow_Info_Invoice); + + /** Get Allow Info Invoice */ + public boolean isAllow_Info_Invoice(); + + /** Column name Allow_Info_Order */ + public static final String COLUMNNAME_Allow_Info_Order = "Allow_Info_Order"; + + /** Set Allow Info Order */ + public void setAllow_Info_Order (boolean Allow_Info_Order); + + /** Get Allow Info Order */ + public boolean isAllow_Info_Order(); + + /** Column name Allow_Info_Payment */ + public static final String COLUMNNAME_Allow_Info_Payment = "Allow_Info_Payment"; + + /** Set Allow Info Payment */ + public void setAllow_Info_Payment (boolean Allow_Info_Payment); + + /** Get Allow Info Payment */ + public boolean isAllow_Info_Payment(); + + /** Column name Allow_Info_Product */ + public static final String COLUMNNAME_Allow_Info_Product = "Allow_Info_Product"; + + /** Set Allow Info Product */ + public void setAllow_Info_Product (boolean Allow_Info_Product); + + /** Get Allow Info Product */ + public boolean isAllow_Info_Product(); + + /** Column name Allow_Info_Resource */ + public static final String COLUMNNAME_Allow_Info_Resource = "Allow_Info_Resource"; + + /** Set Allow Info Resource */ + public void setAllow_Info_Resource (boolean Allow_Info_Resource); + + /** Get Allow Info Resource */ + public boolean isAllow_Info_Resource(); + + /** Column name Allow_Info_Schedule */ + public static final String COLUMNNAME_Allow_Info_Schedule = "Allow_Info_Schedule"; + + /** Set Allow Info Schedule */ + public void setAllow_Info_Schedule (boolean Allow_Info_Schedule); + + /** Get Allow Info Schedule */ + public boolean isAllow_Info_Schedule(); + + /** Column name AmtApproval */ + public static final String COLUMNNAME_AmtApproval = "AmtApproval"; + + /** Set Approval Amount. + * The approval amount limit for this role + */ + public void setAmtApproval (BigDecimal AmtApproval); + + /** Get Approval Amount. + * The approval amount limit for this role + */ + public BigDecimal getAmtApproval(); + + /** Column name C_Currency_ID */ + public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID"; + + /** Set Currency. + * The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID); + + /** Get Currency. + * The Currency for this record + */ + public int getC_Currency_ID(); + + public I_C_Currency getC_Currency() throws Exception; + + /** Column name ConfirmQueryRecords */ + public static final String COLUMNNAME_ConfirmQueryRecords = "ConfirmQueryRecords"; + + /** Set Confirm Query Records. + * Require Confirmation if more records will be returned by the query (If not defined 500) + */ + public void setConfirmQueryRecords (int ConfirmQueryRecords); + + /** Get Confirm Query Records. + * Require Confirmation if more records will be returned by the query (If not defined 500) + */ + public int getConfirmQueryRecords(); + + /** Column name ConnectionProfile */ + public static final String COLUMNNAME_ConnectionProfile = "ConnectionProfile"; + + /** Set Connection Profile. + * How a Java Client connects to the server(s) + */ + public void setConnectionProfile (String ConnectionProfile); + + /** Get Connection Profile. + * How a Java Client connects to the server(s) + */ + public String getConnectionProfile(); + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name IsAccessAllOrgs */ + public static final String COLUMNNAME_IsAccessAllOrgs = "IsAccessAllOrgs"; + + /** Set Access all Orgs. + * Access all Organizations (no org access control) of the client + */ + public void setIsAccessAllOrgs (boolean IsAccessAllOrgs); + + /** Get Access all Orgs. + * Access all Organizations (no org access control) of the client + */ + public boolean isAccessAllOrgs(); + + /** Column name IsCanApproveOwnDoc */ + public static final String COLUMNNAME_IsCanApproveOwnDoc = "IsCanApproveOwnDoc"; + + /** Set Approve own Documents. + * Users with this role can approve their own documents + */ + public void setIsCanApproveOwnDoc (boolean IsCanApproveOwnDoc); + + /** Get Approve own Documents. + * Users with this role can approve their own documents + */ + public boolean isCanApproveOwnDoc(); + + /** Column name IsCanExport */ + public static final String COLUMNNAME_IsCanExport = "IsCanExport"; + + /** Set Can Export. + * Users with this role can export data + */ + public void setIsCanExport (boolean IsCanExport); + + /** Get Can Export. + * Users with this role can export data + */ + public boolean isCanExport(); + + /** Column name IsCanReport */ + public static final String COLUMNNAME_IsCanReport = "IsCanReport"; + + /** Set Can Report. + * Users with this role can create reports + */ + public void setIsCanReport (boolean IsCanReport); + + /** Get Can Report. + * Users with this role can create reports + */ + public boolean isCanReport(); + + /** Column name IsChangeLog */ + public static final String COLUMNNAME_IsChangeLog = "IsChangeLog"; + + /** Set Maintain Change Log. + * Maintain a log of changes + */ + public void setIsChangeLog (boolean IsChangeLog); + + /** Get Maintain Change Log. + * Maintain a log of changes + */ + public boolean isChangeLog(); + + /** Column name IsDiscountAllowedOnTotal */ + public static final String COLUMNNAME_IsDiscountAllowedOnTotal = "IsDiscountAllowedOnTotal"; + + /** Set IsDiscountAllowedOnTotal */ + public void setIsDiscountAllowedOnTotal (boolean IsDiscountAllowedOnTotal); + + /** Get IsDiscountAllowedOnTotal */ + public boolean isDiscountAllowedOnTotal(); + + /** Column name IsDiscountUptoLimitPrice */ + public static final String COLUMNNAME_IsDiscountUptoLimitPrice = "IsDiscountUptoLimitPrice"; + + /** Set IsDiscountUptoLimitPrice */ + public void setIsDiscountUptoLimitPrice (boolean IsDiscountUptoLimitPrice); + + /** Get IsDiscountUptoLimitPrice */ + public boolean isDiscountUptoLimitPrice(); + + /** Column name IsManual */ + public static final String COLUMNNAME_IsManual = "IsManual"; + + /** Set Manual. + * This is a manual process + */ + public void setIsManual (boolean IsManual); + + /** Get Manual. + * This is a manual process + */ + public boolean isManual(); + + /** Column name IsPersonalAccess */ + public static final String COLUMNNAME_IsPersonalAccess = "IsPersonalAccess"; + + /** Set Personal Access. + * Allow access to all personal records + */ + public void setIsPersonalAccess (boolean IsPersonalAccess); + + /** Get Personal Access. + * Allow access to all personal records + */ + public boolean isPersonalAccess(); + + /** Column name IsPersonalLock */ + public static final String COLUMNNAME_IsPersonalLock = "IsPersonalLock"; + + /** Set Personal Lock. + * Allow users with role to lock access to personal records + */ + public void setIsPersonalLock (boolean IsPersonalLock); + + /** Get Personal Lock. + * Allow users with role to lock access to personal records + */ + public boolean isPersonalLock(); + + /** Column name IsShowAcct */ + public static final String COLUMNNAME_IsShowAcct = "IsShowAcct"; + + /** Set Show Accounting. + * Users with this role can see accounting information + */ + public void setIsShowAcct (boolean IsShowAcct); + + /** Get Show Accounting. + * Users with this role can see accounting information + */ + public boolean isShowAcct(); + + /** Column name IsUseUserOrgAccess */ + public static final String COLUMNNAME_IsUseUserOrgAccess = "IsUseUserOrgAccess"; + + /** Set Use User Org Access. + * Use Org Access defined by user instead of Role Org Access + */ + public void setIsUseUserOrgAccess (boolean IsUseUserOrgAccess); + + /** Get Use User Org Access. + * Use Org Access defined by user instead of Role Org Access + */ + public boolean isUseUserOrgAccess(); + + /** Column name MaxQueryRecords */ + public static final String COLUMNNAME_MaxQueryRecords = "MaxQueryRecords"; + + /** Set Max Query Records. + * If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public void setMaxQueryRecords (int MaxQueryRecords); + + /** Get Max Query Records. + * If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords(); + + /** Column name Name */ + public static final String COLUMNNAME_Name = "Name"; + + /** Set Name. + * Alphanumeric identifier of the entity + */ + public void setName (String Name); + + /** Get Name. + * Alphanumeric identifier of the entity + */ + public String getName(); + + /** Column name OverwritePriceLimit */ + public static final String COLUMNNAME_OverwritePriceLimit = "OverwritePriceLimit"; + + /** Set Overwrite Price Limit. + * Overwrite Price Limit if the Price List enforces the Price Limit + */ + public void setOverwritePriceLimit (boolean OverwritePriceLimit); + + /** Get Overwrite Price Limit. + * Overwrite Price Limit if the Price List enforces the Price Limit + */ + public boolean isOverwritePriceLimit(); + + /** Column name PreferenceType */ + public static final String COLUMNNAME_PreferenceType = "PreferenceType"; + + /** Set Preference Level. + * Determines what preferences the user can set + */ + public void setPreferenceType (String PreferenceType); + + /** Get Preference Level. + * Determines what preferences the user can set + */ + public String getPreferenceType(); + + /** Column name Supervisor_ID */ + public static final String COLUMNNAME_Supervisor_ID = "Supervisor_ID"; + + /** Set Supervisor. + * Supervisor for this user/organization - used for escalation and approval + */ + public void setSupervisor_ID (int Supervisor_ID); + + /** Get Supervisor. + * Supervisor for this user/organization - used for escalation and approval + */ + public int getSupervisor_ID(); + + /** Column name UserDiscount */ + public static final String COLUMNNAME_UserDiscount = "UserDiscount"; + + /** Set UserDiscount */ + public void setUserDiscount (BigDecimal UserDiscount); + + /** Get UserDiscount */ + public BigDecimal getUserDiscount(); + + /** Column name UserLevel */ + public static final String COLUMNNAME_UserLevel = "UserLevel"; + + /** Set User Level. + * System Client Organization + */ + public void setUserLevel (String UserLevel); + + /** Get User Level. + * System Client Organization + */ + public String getUserLevel(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_C_CashLine.java b/posterita/posterita/src/main/org/compiere/model/I_C_CashLine.java new file mode 100644 index 0000000000..0a92c2e874 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_C_CashLine.java @@ -0,0 +1,265 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for C_CashLine + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_C_CashLine +{ + + /** TableName=C_CashLine */ + public static final String Table_Name = "C_CashLine"; + + /** AD_Table_ID=410 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 3 - Client - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(3); + + /** Load Meta Data */ + + /** Column name Amount */ + public static final String COLUMNNAME_Amount = "Amount"; + + /** Set Amount. + * Amount in a defined currency + */ + public void setAmount (BigDecimal Amount); + + /** Get Amount. + * Amount in a defined currency + */ + public BigDecimal getAmount(); + + /** Column name CashType */ + public static final String COLUMNNAME_CashType = "CashType"; + + /** Set Cash Type. + * Source of Cash + */ + public void setCashType (String CashType); + + /** Get Cash Type. + * Source of Cash + */ + public String getCashType(); + + /** Column name C_BankAccount_ID */ + public static final String COLUMNNAME_C_BankAccount_ID = "C_BankAccount_ID"; + + /** Set Bank Account. + * Account at the Bank + */ + public void setC_BankAccount_ID (int C_BankAccount_ID); + + /** Get Bank Account. + * Account at the Bank + */ + public int getC_BankAccount_ID(); + + public I_C_BankAccount getC_BankAccount() throws Exception; + + /** Column name C_Cash_ID */ + public static final String COLUMNNAME_C_Cash_ID = "C_Cash_ID"; + + /** Set Cash Journal. + * Cash Journal + */ + public void setC_Cash_ID (int C_Cash_ID); + + /** Get Cash Journal. + * Cash Journal + */ + public int getC_Cash_ID(); + + public I_C_Cash getC_Cash() throws Exception; + + /** Column name C_CashLine_ID */ + public static final String COLUMNNAME_C_CashLine_ID = "C_CashLine_ID"; + + /** Set Cash Journal Line. + * Cash Journal Line + */ + public void setC_CashLine_ID (int C_CashLine_ID); + + /** Get Cash Journal Line. + * Cash Journal Line + */ + public int getC_CashLine_ID(); + + /** Column name C_Charge_ID */ + public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID"; + + /** Set Charge. + * Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID); + + /** Get Charge. + * Additional document charges + */ + public int getC_Charge_ID(); + + public I_C_Charge getC_Charge() throws Exception; + + /** Column name C_Currency_ID */ + public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID"; + + /** Set Currency. + * The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID); + + /** Get Currency. + * The Currency for this record + */ + public int getC_Currency_ID(); + + public I_C_Currency getC_Currency() throws Exception; + + /** Column name C_Invoice_ID */ + public static final String COLUMNNAME_C_Invoice_ID = "C_Invoice_ID"; + + /** Set Invoice. + * Invoice Identifier + */ + public void setC_Invoice_ID (int C_Invoice_ID); + + /** Get Invoice. + * Invoice Identifier + */ + public int getC_Invoice_ID(); + + public I_C_Invoice getC_Invoice() throws Exception; + + /** Column name C_Payment_ID */ + public static final String COLUMNNAME_C_Payment_ID = "C_Payment_ID"; + + /** Set Payment. + * Payment identifier + */ + public void setC_Payment_ID (int C_Payment_ID); + + /** Get Payment. + * Payment identifier + */ + public int getC_Payment_ID(); + + public I_C_Payment getC_Payment() throws Exception; + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name DiscountAmt */ + public static final String COLUMNNAME_DiscountAmt = "DiscountAmt"; + + /** Set Discount Amount. + * Calculated amount of discount + */ + public void setDiscountAmt (BigDecimal DiscountAmt); + + /** Get Discount Amount. + * Calculated amount of discount + */ + public BigDecimal getDiscountAmt(); + + /** Column name IsGenerated */ + public static final String COLUMNNAME_IsGenerated = "IsGenerated"; + + /** Set Generated. + * This Line is generated + */ + public void setIsGenerated (boolean IsGenerated); + + /** Get Generated. + * This Line is generated + */ + public boolean isGenerated(); + + /** Column name Line */ + public static final String COLUMNNAME_Line = "Line"; + + /** Set Line No. + * Unique line for this document + */ + public void setLine (int Line); + + /** Get Line No. + * Unique line for this document + */ + public int getLine(); + + /** Column name Processed */ + public static final String COLUMNNAME_Processed = "Processed"; + + /** Set Processed. + * The document has been processed + */ + public void setProcessed (boolean Processed); + + /** Get Processed. + * The document has been processed + */ + public boolean isProcessed(); + + /** Column name WriteOffAmt */ + public static final String COLUMNNAME_WriteOffAmt = "WriteOffAmt"; + + /** Set Write-off Amount. + * Amount to write-off + */ + public void setWriteOffAmt (BigDecimal WriteOffAmt); + + /** Get Write-off Amount. + * Amount to write-off + */ + public BigDecimal getWriteOffAmt(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_C_Currency.java b/posterita/posterita/src/main/org/compiere/model/I_C_Currency.java new file mode 100644 index 0000000000..aa605355cf --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_C_Currency.java @@ -0,0 +1,202 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for C_Currency + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_C_Currency +{ + + /** TableName=C_Currency */ + public static final String Table_Name = "C_Currency"; + + /** AD_Table_ID=141 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 6 - System - Client + */ + BigDecimal accessLevel = BigDecimal.valueOf(6); + + /** Load Meta Data */ + + /** Column name C_Currency_ID */ + public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID"; + + /** Set Currency. + * The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID); + + /** Get Currency. + * The Currency for this record + */ + public int getC_Currency_ID(); + + /** Column name CostingPrecision */ + public static final String COLUMNNAME_CostingPrecision = "CostingPrecision"; + + /** Set Costing Precision. + * Rounding used costing calculations + */ + public void setCostingPrecision (int CostingPrecision); + + /** Get Costing Precision. + * Rounding used costing calculations + */ + public int getCostingPrecision(); + + /** Column name CurSymbol */ + public static final String COLUMNNAME_CurSymbol = "CurSymbol"; + + /** Set Symbol. + * Symbol of the currency (opt used for printing only) + */ + public void setCurSymbol (String CurSymbol); + + /** Get Symbol. + * Symbol of the currency (opt used for printing only) + */ + public String getCurSymbol(); + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name EMUEntryDate */ + public static final String COLUMNNAME_EMUEntryDate = "EMUEntryDate"; + + /** Set EMU Entry Date. + * Date when the currency joined / will join the EMU + */ + public void setEMUEntryDate (Timestamp EMUEntryDate); + + /** Get EMU Entry Date. + * Date when the currency joined / will join the EMU + */ + public Timestamp getEMUEntryDate(); + + /** Column name EMURate */ + public static final String COLUMNNAME_EMURate = "EMURate"; + + /** Set EMU Rate. + * Official rate to the Euro + */ + public void setEMURate (BigDecimal EMURate); + + /** Get EMU Rate. + * Official rate to the Euro + */ + public BigDecimal getEMURate(); + + /** Column name IsEMUMember */ + public static final String COLUMNNAME_IsEMUMember = "IsEMUMember"; + + /** Set EMU Member. + * This currency is member if the European Monetary Union + */ + public void setIsEMUMember (boolean IsEMUMember); + + /** Get EMU Member. + * This currency is member if the European Monetary Union + */ + public boolean isEMUMember(); + + /** Column name IsEuro */ + public static final String COLUMNNAME_IsEuro = "IsEuro"; + + /** Set The Euro Currency. + * This currency is the Euro + */ + public void setIsEuro (boolean IsEuro); + + /** Get The Euro Currency. + * This currency is the Euro + */ + public boolean isEuro(); + + /** Column name ISO_Code */ + public static final String COLUMNNAME_ISO_Code = "ISO_Code"; + + /** Set ISO Currency Code. + * Three letter ISO 4217 Code of the Currency + */ + public void setISO_Code (String ISO_Code); + + /** Get ISO Currency Code. + * Three letter ISO 4217 Code of the Currency + */ + public String getISO_Code(); + + /** Column name RoundOffFactor */ + public static final String COLUMNNAME_RoundOffFactor = "RoundOffFactor"; + + /** Set RoundOffFactor. + * Used to Round Off Payment Amount + */ + public void setRoundOffFactor (BigDecimal RoundOffFactor); + + /** Get RoundOffFactor. + * Used to Round Off Payment Amount + */ + public BigDecimal getRoundOffFactor(); + + /** Column name StdPrecision */ + public static final String COLUMNNAME_StdPrecision = "StdPrecision"; + + /** Set Standard Precision. + * Rule for rounding calculated amounts + */ + public void setStdPrecision (int StdPrecision); + + /** Get Standard Precision. + * Rule for rounding calculated amounts + */ + public int getStdPrecision(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_C_Invoice.java b/posterita/posterita/src/main/org/compiere/model/I_C_Invoice.java new file mode 100644 index 0000000000..4f5859dd59 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_C_Invoice.java @@ -0,0 +1,803 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for C_Invoice + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_C_Invoice +{ + + /** TableName=C_Invoice */ + public static final String Table_Name = "C_Invoice"; + + /** AD_Table_ID=318 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 1 - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(1); + + /** Load Meta Data */ + + /** Column name AD_OrgTrx_ID */ + public static final String COLUMNNAME_AD_OrgTrx_ID = "AD_OrgTrx_ID"; + + /** Set Trx Organization. + * Performing or initiating organization + */ + public void setAD_OrgTrx_ID (int AD_OrgTrx_ID); + + /** Get Trx Organization. + * Performing or initiating organization + */ + public int getAD_OrgTrx_ID(); + + /** Column name AD_User_ID */ + public static final String COLUMNNAME_AD_User_ID = "AD_User_ID"; + + /** Set User/Contact. + * User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID); + + /** Get User/Contact. + * User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID(); + + public I_AD_User getAD_User() throws Exception; + + /** Column name C_Activity_ID */ + public static final String COLUMNNAME_C_Activity_ID = "C_Activity_ID"; + + /** Set Activity. + * Business Activity + */ + public void setC_Activity_ID (int C_Activity_ID); + + /** Get Activity. + * Business Activity + */ + public int getC_Activity_ID(); + + public I_C_Activity getC_Activity() throws Exception; + + /** Column name C_BPartner_ID */ + public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID"; + + /** Set Business Partner . + * Identifies a Business Partner + */ + public void setC_BPartner_ID (int C_BPartner_ID); + + /** Get Business Partner . + * Identifies a Business Partner + */ + public int getC_BPartner_ID(); + + public I_C_BPartner getC_BPartner() throws Exception; + + /** Column name C_BPartner_Location_ID */ + public static final String COLUMNNAME_C_BPartner_Location_ID = "C_BPartner_Location_ID"; + + /** Set Partner Location. + * Identifies the (ship to) address for this Business Partner + */ + public void setC_BPartner_Location_ID (int C_BPartner_Location_ID); + + /** Get Partner Location. + * Identifies the (ship to) address for this Business Partner + */ + public int getC_BPartner_Location_ID(); + + public I_C_BPartner_Location getC_BPartner_Location() throws Exception; + + /** Column name C_Campaign_ID */ + public static final String COLUMNNAME_C_Campaign_ID = "C_Campaign_ID"; + + /** Set Campaign. + * Marketing Campaign + */ + public void setC_Campaign_ID (int C_Campaign_ID); + + /** Get Campaign. + * Marketing Campaign + */ + public int getC_Campaign_ID(); + + public I_C_Campaign getC_Campaign() throws Exception; + + /** Column name C_CashLine_ID */ + public static final String COLUMNNAME_C_CashLine_ID = "C_CashLine_ID"; + + /** Set Cash Journal Line. + * Cash Journal Line + */ + public void setC_CashLine_ID (int C_CashLine_ID); + + /** Get Cash Journal Line. + * Cash Journal Line + */ + public int getC_CashLine_ID(); + + public I_C_CashLine getC_CashLine() throws Exception; + + /** Column name C_Charge_ID */ + public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID"; + + /** Set Charge. + * Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID); + + /** Get Charge. + * Additional document charges + */ + public int getC_Charge_ID(); + + /** Column name C_ConversionType_ID */ + public static final String COLUMNNAME_C_ConversionType_ID = "C_ConversionType_ID"; + + /** Set Currency Type. + * Currency Conversion Rate Type + */ + public void setC_ConversionType_ID (int C_ConversionType_ID); + + /** Get Currency Type. + * Currency Conversion Rate Type + */ + public int getC_ConversionType_ID(); + + public I_C_ConversionType getC_ConversionType() throws Exception; + + /** Column name C_Currency_ID */ + public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID"; + + /** Set Currency. + * The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID); + + /** Get Currency. + * The Currency for this record + */ + public int getC_Currency_ID(); + + public I_C_Currency getC_Currency() throws Exception; + + /** Column name C_DocType_ID */ + public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID"; + + /** Set Document Type. + * Document type or rules + */ + public void setC_DocType_ID (int C_DocType_ID); + + /** Get Document Type. + * Document type or rules + */ + public int getC_DocType_ID(); + + public I_C_DocType getC_DocType() throws Exception; + + /** Column name C_DocTypeTarget_ID */ + public static final String COLUMNNAME_C_DocTypeTarget_ID = "C_DocTypeTarget_ID"; + + /** Set Target Document Type. + * Target document type for conversing documents + */ + public void setC_DocTypeTarget_ID (int C_DocTypeTarget_ID); + + /** Get Target Document Type. + * Target document type for conversing documents + */ + public int getC_DocTypeTarget_ID(); + + /** Column name C_DunningLevel_ID */ + public static final String COLUMNNAME_C_DunningLevel_ID = "C_DunningLevel_ID"; + + /** Set Dunning Level */ + public void setC_DunningLevel_ID (int C_DunningLevel_ID); + + /** Get Dunning Level */ + public int getC_DunningLevel_ID(); + + public I_C_DunningLevel getC_DunningLevel() throws Exception; + + /** Column name ChargeAmt */ + public static final String COLUMNNAME_ChargeAmt = "ChargeAmt"; + + /** Set Charge amount. + * Charge Amount + */ + public void setChargeAmt (BigDecimal ChargeAmt); + + /** Get Charge amount. + * Charge Amount + */ + public BigDecimal getChargeAmt(); + + /** Column name C_Invoice_ID */ + public static final String COLUMNNAME_C_Invoice_ID = "C_Invoice_ID"; + + /** Set Invoice. + * Invoice Identifier + */ + public void setC_Invoice_ID (int C_Invoice_ID); + + /** Get Invoice. + * Invoice Identifier + */ + public int getC_Invoice_ID(); + + /** Column name CopyFrom */ + public static final String COLUMNNAME_CopyFrom = "CopyFrom"; + + /** Set Copy From. + * Copy From Record + */ + public void setCopyFrom (String CopyFrom); + + /** Get Copy From. + * Copy From Record + */ + public String getCopyFrom(); + + /** Column name C_Order_ID */ + public static final String COLUMNNAME_C_Order_ID = "C_Order_ID"; + + /** Set Order. + * Order + */ + public void setC_Order_ID (int C_Order_ID); + + /** Get Order. + * Order + */ + public int getC_Order_ID(); + + public I_C_Order getC_Order() throws Exception; + + /** Column name C_Payment_ID */ + public static final String COLUMNNAME_C_Payment_ID = "C_Payment_ID"; + + /** Set Payment. + * Payment identifier + */ + public void setC_Payment_ID (int C_Payment_ID); + + /** Get Payment. + * Payment identifier + */ + public int getC_Payment_ID(); + + public I_C_Payment getC_Payment() throws Exception; + + /** Column name C_PaymentTerm_ID */ + public static final String COLUMNNAME_C_PaymentTerm_ID = "C_PaymentTerm_ID"; + + /** Set Payment Term. + * The terms of Payment (timing, discount) + */ + public void setC_PaymentTerm_ID (int C_PaymentTerm_ID); + + /** Get Payment Term. + * The terms of Payment (timing, discount) + */ + public int getC_PaymentTerm_ID(); + + public I_C_PaymentTerm getC_PaymentTerm() throws Exception; + + /** Column name C_Project_ID */ + public static final String COLUMNNAME_C_Project_ID = "C_Project_ID"; + + /** Set Project. + * Financial Project + */ + public void setC_Project_ID (int C_Project_ID); + + /** Get Project. + * Financial Project + */ + public int getC_Project_ID(); + + public I_C_Project getC_Project() throws Exception; + + /** Column name CreateFrom */ + public static final String COLUMNNAME_CreateFrom = "CreateFrom"; + + /** Set Create lines from. + * Process which will generate a new document lines based on an existing document + */ + public void setCreateFrom (String CreateFrom); + + /** Get Create lines from. + * Process which will generate a new document lines based on an existing document + */ + public String getCreateFrom(); + + /** Column name DateAcct */ + public static final String COLUMNNAME_DateAcct = "DateAcct"; + + /** Set Account Date. + * Accounting Date + */ + public void setDateAcct (Timestamp DateAcct); + + /** Get Account Date. + * Accounting Date + */ + public Timestamp getDateAcct(); + + /** Column name DateInvoiced */ + public static final String COLUMNNAME_DateInvoiced = "DateInvoiced"; + + /** Set Date Invoiced. + * Date printed on Invoice + */ + public void setDateInvoiced (Timestamp DateInvoiced); + + /** Get Date Invoiced. + * Date printed on Invoice + */ + public Timestamp getDateInvoiced(); + + /** Column name DateOrdered */ + public static final String COLUMNNAME_DateOrdered = "DateOrdered"; + + /** Set Date Ordered. + * Date of Order + */ + public void setDateOrdered (Timestamp DateOrdered); + + /** Get Date Ordered. + * Date of Order + */ + public Timestamp getDateOrdered(); + + /** Column name DatePrinted */ + public static final String COLUMNNAME_DatePrinted = "DatePrinted"; + + /** Set Date printed. + * Date the document was printed. + */ + public void setDatePrinted (Timestamp DatePrinted); + + /** Get Date printed. + * Date the document was printed. + */ + public Timestamp getDatePrinted(); + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name DocAction */ + public static final String COLUMNNAME_DocAction = "DocAction"; + + /** Set Document Action. + * The targeted status of the document + */ + public void setDocAction (String DocAction); + + /** Get Document Action. + * The targeted status of the document + */ + public String getDocAction(); + + /** Column name DocStatus */ + public static final String COLUMNNAME_DocStatus = "DocStatus"; + + /** Set Document Status. + * The current status of the document + */ + public void setDocStatus (String DocStatus); + + /** Get Document Status. + * The current status of the document + */ + public String getDocStatus(); + + /** Column name DocumentNo */ + public static final String COLUMNNAME_DocumentNo = "DocumentNo"; + + /** Set Document No. + * Document sequence number of the document + */ + public void setDocumentNo (String DocumentNo); + + /** Get Document No. + * Document sequence number of the document + */ + public String getDocumentNo(); + + /** Column name DunningGrace */ + public static final String COLUMNNAME_DunningGrace = "DunningGrace"; + + /** Set Dunning Grace */ + public void setDunningGrace (Timestamp DunningGrace); + + /** Get Dunning Grace */ + public Timestamp getDunningGrace(); + + /** Column name GenerateTo */ + public static final String COLUMNNAME_GenerateTo = "GenerateTo"; + + /** Set Generate To. + * Generate To + */ + public void setGenerateTo (String GenerateTo); + + /** Get Generate To. + * Generate To + */ + public String getGenerateTo(); + + /** Column name GrandTotal */ + public static final String COLUMNNAME_GrandTotal = "GrandTotal"; + + /** Set Grand Total. + * Total amount of document + */ + public void setGrandTotal (BigDecimal GrandTotal); + + /** Get Grand Total. + * Total amount of document + */ + public BigDecimal getGrandTotal(); + + /** Column name InvoiceCollectionType */ + public static final String COLUMNNAME_InvoiceCollectionType = "InvoiceCollectionType"; + + /** Set Collection Status. + * Invoice Collection Status + */ + public void setInvoiceCollectionType (String InvoiceCollectionType); + + /** Get Collection Status. + * Invoice Collection Status + */ + public String getInvoiceCollectionType(); + + /** Column name IsApproved */ + public static final String COLUMNNAME_IsApproved = "IsApproved"; + + /** Set Approved. + * Indicates if this document requires approval + */ + public void setIsApproved (boolean IsApproved); + + /** Get Approved. + * Indicates if this document requires approval + */ + public boolean isApproved(); + + /** Column name IsDiscountPrinted */ + public static final String COLUMNNAME_IsDiscountPrinted = "IsDiscountPrinted"; + + /** Set Discount Printed. + * Print Discount on Invoice and Order + */ + public void setIsDiscountPrinted (boolean IsDiscountPrinted); + + /** Get Discount Printed. + * Print Discount on Invoice and Order + */ + public boolean isDiscountPrinted(); + + /** Column name IsInDispute */ + public static final String COLUMNNAME_IsInDispute = "IsInDispute"; + + /** Set In Dispute. + * Document is in dispute + */ + public void setIsInDispute (boolean IsInDispute); + + /** Get In Dispute. + * Document is in dispute + */ + public boolean isInDispute(); + + /** Column name IsPaid */ + public static final String COLUMNNAME_IsPaid = "IsPaid"; + + /** Set Paid. + * The document is paid + */ + public void setIsPaid (boolean IsPaid); + + /** Get Paid. + * The document is paid + */ + public boolean isPaid(); + + /** Column name IsPayScheduleValid */ + public static final String COLUMNNAME_IsPayScheduleValid = "IsPayScheduleValid"; + + /** Set Pay Schedule valid. + * Is the Payment Schedule is valid + */ + public void setIsPayScheduleValid (boolean IsPayScheduleValid); + + /** Get Pay Schedule valid. + * Is the Payment Schedule is valid + */ + public boolean isPayScheduleValid(); + + /** Column name IsPrinted */ + public static final String COLUMNNAME_IsPrinted = "IsPrinted"; + + /** Set Printed. + * Indicates if this document / line is printed + */ + public void setIsPrinted (boolean IsPrinted); + + /** Get Printed. + * Indicates if this document / line is printed + */ + public boolean isPrinted(); + + /** Column name IsSelfService */ + public static final String COLUMNNAME_IsSelfService = "IsSelfService"; + + /** Set Self-Service. + * This is a Self-Service entry or this entry can be changed via Self-Service + */ + public void setIsSelfService (boolean IsSelfService); + + /** Get Self-Service. + * This is a Self-Service entry or this entry can be changed via Self-Service + */ + public boolean isSelfService(); + + /** Column name IsSOTrx */ + public static final String COLUMNNAME_IsSOTrx = "IsSOTrx"; + + /** Set Sales Transaction. + * This is a Sales Transaction + */ + public void setIsSOTrx (boolean IsSOTrx); + + /** Get Sales Transaction. + * This is a Sales Transaction + */ + public boolean isSOTrx(); + + /** Column name IsTaxIncluded */ + public static final String COLUMNNAME_IsTaxIncluded = "IsTaxIncluded"; + + /** Set Price includes Tax. + * Tax is included in the price + */ + public void setIsTaxIncluded (boolean IsTaxIncluded); + + /** Get Price includes Tax. + * Tax is included in the price + */ + public boolean isTaxIncluded(); + + /** Column name IsTransferred */ + public static final String COLUMNNAME_IsTransferred = "IsTransferred"; + + /** Set Transferred. + * Transferred to General Ledger (i.e. accounted) + */ + public void setIsTransferred (boolean IsTransferred); + + /** Get Transferred. + * Transferred to General Ledger (i.e. accounted) + */ + public boolean isTransferred(); + + /** Column name M_PriceList_ID */ + public static final String COLUMNNAME_M_PriceList_ID = "M_PriceList_ID"; + + /** Set Price List. + * Unique identifier of a Price List + */ + public void setM_PriceList_ID (int M_PriceList_ID); + + /** Get Price List. + * Unique identifier of a Price List + */ + public int getM_PriceList_ID(); + + public I_M_PriceList getM_PriceList() throws Exception; + + /** Column name M_RMA_ID */ + public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID"; + + /** Set RMA. + * Return Material Authorization + */ + public void setM_RMA_ID (int M_RMA_ID); + + /** Get RMA. + * Return Material Authorization + */ + public int getM_RMA_ID(); + + public I_M_RMA getM_RMA() throws Exception; + + /** Column name PaymentRule */ + public static final String COLUMNNAME_PaymentRule = "PaymentRule"; + + /** Set Payment Rule. + * How you pay the invoice + */ + public void setPaymentRule (String PaymentRule); + + /** Get Payment Rule. + * How you pay the invoice + */ + public String getPaymentRule(); + + /** Column name POReference */ + public static final String COLUMNNAME_POReference = "POReference"; + + /** Set Order Reference. + * Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner + */ + public void setPOReference (String POReference); + + /** Get Order Reference. + * Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner + */ + public String getPOReference(); + + /** Column name Posted */ + public static final String COLUMNNAME_Posted = "Posted"; + + /** Set Posted. + * Posting status + */ + public void setPosted (boolean Posted); + + /** Get Posted. + * Posting status + */ + public boolean isPosted(); + + /** Column name Processed */ + public static final String COLUMNNAME_Processed = "Processed"; + + /** Set Processed. + * The document has been processed + */ + public void setProcessed (boolean Processed); + + /** Get Processed. + * The document has been processed + */ + public boolean isProcessed(); + + /** Column name Processing */ + public static final String COLUMNNAME_Processing = "Processing"; + + /** Set Process Now */ + public void setProcessing (boolean Processing); + + /** Get Process Now */ + public boolean isProcessing(); + + /** Column name Ref_Invoice_ID */ + public static final String COLUMNNAME_Ref_Invoice_ID = "Ref_Invoice_ID"; + + /** Set Referenced Invoice */ + public void setRef_Invoice_ID (int Ref_Invoice_ID); + + /** Get Referenced Invoice */ + public int getRef_Invoice_ID(); + + /** Column name SalesRep_ID */ + public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID"; + + /** Set Sales Representative. + * Sales Representative or Company Agent + */ + public void setSalesRep_ID (int SalesRep_ID); + + /** Get Sales Representative. + * Sales Representative or Company Agent + */ + public int getSalesRep_ID(); + + /** Column name SendEMail */ + public static final String COLUMNNAME_SendEMail = "SendEMail"; + + /** Set Send EMail. + * Enable sending Document EMail + */ + public void setSendEMail (boolean SendEMail); + + /** Get Send EMail. + * Enable sending Document EMail + */ + public boolean isSendEMail(); + + /** Column name TotalLines */ + public static final String COLUMNNAME_TotalLines = "TotalLines"; + + /** Set Total Lines. + * Total of all document lines + */ + public void setTotalLines (BigDecimal TotalLines); + + /** Get Total Lines. + * Total of all document lines + */ + public BigDecimal getTotalLines(); + + /** Column name User1_ID */ + public static final String COLUMNNAME_User1_ID = "User1_ID"; + + /** Set User List 1. + * User defined list element #1 + */ + public void setUser1_ID (int User1_ID); + + /** Get User List 1. + * User defined list element #1 + */ + public int getUser1_ID(); + + /** Column name User2_ID */ + public static final String COLUMNNAME_User2_ID = "User2_ID"; + + /** Set User List 2. + * User defined list element #2 + */ + public void setUser2_ID (int User2_ID); + + /** Get User List 2. + * User defined list element #2 + */ + public int getUser2_ID(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_C_Order.java b/posterita/posterita/src/main/org/compiere/model/I_C_Order.java new file mode 100644 index 0000000000..35acc2e482 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_C_Order.java @@ -0,0 +1,977 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for C_Order + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_C_Order +{ + + /** TableName=C_Order */ + public static final String Table_Name = "C_Order"; + + /** AD_Table_ID=259 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 1 - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(1); + + /** Load Meta Data */ + + /** Column name AD_OrgTrx_ID */ + public static final String COLUMNNAME_AD_OrgTrx_ID = "AD_OrgTrx_ID"; + + /** Set Trx Organization. + * Performing or initiating organization + */ + public void setAD_OrgTrx_ID (int AD_OrgTrx_ID); + + /** Get Trx Organization. + * Performing or initiating organization + */ + public int getAD_OrgTrx_ID(); + + /** Column name AD_User_ID */ + public static final String COLUMNNAME_AD_User_ID = "AD_User_ID"; + + /** Set User/Contact. + * User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID); + + /** Get User/Contact. + * User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID(); + + public I_AD_User getAD_User() throws Exception; + + /** Column name AmountRefunded */ + public static final String COLUMNNAME_AmountRefunded = "AmountRefunded"; + + /** Set AmountRefunded */ + public void setAmountRefunded (BigDecimal AmountRefunded); + + /** Get AmountRefunded */ + public BigDecimal getAmountRefunded(); + + /** Column name AmountTendered */ + public static final String COLUMNNAME_AmountTendered = "AmountTendered"; + + /** Set AmountTendered */ + public void setAmountTendered (BigDecimal AmountTendered); + + /** Get AmountTendered */ + public BigDecimal getAmountTendered(); + + /** Column name Bill_BPartner_ID */ + public static final String COLUMNNAME_Bill_BPartner_ID = "Bill_BPartner_ID"; + + /** Set Invoice Partner. + * Business Partner to be invoiced + */ + public void setBill_BPartner_ID (int Bill_BPartner_ID); + + /** Get Invoice Partner. + * Business Partner to be invoiced + */ + public int getBill_BPartner_ID(); + + /** Column name Bill_Location_ID */ + public static final String COLUMNNAME_Bill_Location_ID = "Bill_Location_ID"; + + /** Set Invoice Location. + * Business Partner Location for invoicing + */ + public void setBill_Location_ID (int Bill_Location_ID); + + /** Get Invoice Location. + * Business Partner Location for invoicing + */ + public int getBill_Location_ID(); + + /** Column name Bill_User_ID */ + public static final String COLUMNNAME_Bill_User_ID = "Bill_User_ID"; + + /** Set Invoice Contact. + * Business Partner Contact for invoicing + */ + public void setBill_User_ID (int Bill_User_ID); + + /** Get Invoice Contact. + * Business Partner Contact for invoicing + */ + public int getBill_User_ID(); + + /** Column name C_Activity_ID */ + public static final String COLUMNNAME_C_Activity_ID = "C_Activity_ID"; + + /** Set Activity. + * Business Activity + */ + public void setC_Activity_ID (int C_Activity_ID); + + /** Get Activity. + * Business Activity + */ + public int getC_Activity_ID(); + + public I_C_Activity getC_Activity() throws Exception; + + /** Column name C_BPartner_ID */ + public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID"; + + /** Set Business Partner . + * Identifies a Business Partner + */ + public void setC_BPartner_ID (int C_BPartner_ID); + + /** Get Business Partner . + * Identifies a Business Partner + */ + public int getC_BPartner_ID(); + + public I_C_BPartner getC_BPartner() throws Exception; + + /** Column name C_BPartner_Location_ID */ + public static final String COLUMNNAME_C_BPartner_Location_ID = "C_BPartner_Location_ID"; + + /** Set Partner Location. + * Identifies the (ship to) address for this Business Partner + */ + public void setC_BPartner_Location_ID (int C_BPartner_Location_ID); + + /** Get Partner Location. + * Identifies the (ship to) address for this Business Partner + */ + public int getC_BPartner_Location_ID(); + + public I_C_BPartner_Location getC_BPartner_Location() throws Exception; + + /** Column name C_Campaign_ID */ + public static final String COLUMNNAME_C_Campaign_ID = "C_Campaign_ID"; + + /** Set Campaign. + * Marketing Campaign + */ + public void setC_Campaign_ID (int C_Campaign_ID); + + /** Get Campaign. + * Marketing Campaign + */ + public int getC_Campaign_ID(); + + public I_C_Campaign getC_Campaign() throws Exception; + + /** Column name C_CashLine_ID */ + public static final String COLUMNNAME_C_CashLine_ID = "C_CashLine_ID"; + + /** Set Cash Journal Line. + * Cash Journal Line + */ + public void setC_CashLine_ID (int C_CashLine_ID); + + /** Get Cash Journal Line. + * Cash Journal Line + */ + public int getC_CashLine_ID(); + + public I_C_CashLine getC_CashLine() throws Exception; + + /** Column name C_Charge_ID */ + public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID"; + + /** Set Charge. + * Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID); + + /** Get Charge. + * Additional document charges + */ + public int getC_Charge_ID(); + + /** Column name C_ConversionType_ID */ + public static final String COLUMNNAME_C_ConversionType_ID = "C_ConversionType_ID"; + + /** Set Currency Type. + * Currency Conversion Rate Type + */ + public void setC_ConversionType_ID (int C_ConversionType_ID); + + /** Get Currency Type. + * Currency Conversion Rate Type + */ + public int getC_ConversionType_ID(); + + public I_C_ConversionType getC_ConversionType() throws Exception; + + /** Column name C_Currency_ID */ + public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID"; + + /** Set Currency. + * The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID); + + /** Get Currency. + * The Currency for this record + */ + public int getC_Currency_ID(); + + public I_C_Currency getC_Currency() throws Exception; + + /** Column name C_DocType_ID */ + public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID"; + + /** Set Document Type. + * Document type or rules + */ + public void setC_DocType_ID (int C_DocType_ID); + + /** Get Document Type. + * Document type or rules + */ + public int getC_DocType_ID(); + + public I_C_DocType getC_DocType() throws Exception; + + /** Column name C_DocTypeTarget_ID */ + public static final String COLUMNNAME_C_DocTypeTarget_ID = "C_DocTypeTarget_ID"; + + /** Set Target Document Type. + * Target document type for conversing documents + */ + public void setC_DocTypeTarget_ID (int C_DocTypeTarget_ID); + + /** Get Target Document Type. + * Target document type for conversing documents + */ + public int getC_DocTypeTarget_ID(); + + /** Column name ChargeAmt */ + public static final String COLUMNNAME_ChargeAmt = "ChargeAmt"; + + /** Set Charge amount. + * Charge Amount + */ + public void setChargeAmt (BigDecimal ChargeAmt); + + /** Get Charge amount. + * Charge Amount + */ + public BigDecimal getChargeAmt(); + + /** Column name CopyFrom */ + public static final String COLUMNNAME_CopyFrom = "CopyFrom"; + + /** Set Copy From. + * Copy From Record + */ + public void setCopyFrom (String CopyFrom); + + /** Get Copy From. + * Copy From Record + */ + public String getCopyFrom(); + + /** Column name C_Order_ID */ + public static final String COLUMNNAME_C_Order_ID = "C_Order_ID"; + + /** Set Order. + * Order + */ + public void setC_Order_ID (int C_Order_ID); + + /** Get Order. + * Order + */ + public int getC_Order_ID(); + + /** Column name C_Payment_ID */ + public static final String COLUMNNAME_C_Payment_ID = "C_Payment_ID"; + + /** Set Payment. + * Payment identifier + */ + public void setC_Payment_ID (int C_Payment_ID); + + /** Get Payment. + * Payment identifier + */ + public int getC_Payment_ID(); + + public I_C_Payment getC_Payment() throws Exception; + + /** Column name C_PaymentTerm_ID */ + public static final String COLUMNNAME_C_PaymentTerm_ID = "C_PaymentTerm_ID"; + + /** Set Payment Term. + * The terms of Payment (timing, discount) + */ + public void setC_PaymentTerm_ID (int C_PaymentTerm_ID); + + /** Get Payment Term. + * The terms of Payment (timing, discount) + */ + public int getC_PaymentTerm_ID(); + + public I_C_PaymentTerm getC_PaymentTerm() throws Exception; + + /** Column name C_POS_ID */ + public static final String COLUMNNAME_C_POS_ID = "C_POS_ID"; + + /** Set POS Terminal. + * Point of Sales Terminal + */ + public void setC_POS_ID (int C_POS_ID); + + /** Get POS Terminal. + * Point of Sales Terminal + */ + public int getC_POS_ID(); + + public I_C_POS getC_POS() throws Exception; + + /** Column name C_Project_ID */ + public static final String COLUMNNAME_C_Project_ID = "C_Project_ID"; + + /** Set Project. + * Financial Project + */ + public void setC_Project_ID (int C_Project_ID); + + /** Get Project. + * Financial Project + */ + public int getC_Project_ID(); + + public I_C_Project getC_Project() throws Exception; + + /** Column name DateAcct */ + public static final String COLUMNNAME_DateAcct = "DateAcct"; + + /** Set Account Date. + * Accounting Date + */ + public void setDateAcct (Timestamp DateAcct); + + /** Get Account Date. + * Accounting Date + */ + public Timestamp getDateAcct(); + + /** Column name DateOrdered */ + public static final String COLUMNNAME_DateOrdered = "DateOrdered"; + + /** Set Date Ordered. + * Date of Order + */ + public void setDateOrdered (Timestamp DateOrdered); + + /** Get Date Ordered. + * Date of Order + */ + public Timestamp getDateOrdered(); + + /** Column name DatePrinted */ + public static final String COLUMNNAME_DatePrinted = "DatePrinted"; + + /** Set Date printed. + * Date the document was printed. + */ + public void setDatePrinted (Timestamp DatePrinted); + + /** Get Date printed. + * Date the document was printed. + */ + public Timestamp getDatePrinted(); + + /** Column name DatePromised */ + public static final String COLUMNNAME_DatePromised = "DatePromised"; + + /** Set Date Promised. + * Date Order was promised + */ + public void setDatePromised (Timestamp DatePromised); + + /** Get Date Promised. + * Date Order was promised + */ + public Timestamp getDatePromised(); + + /** Column name DeliveryRule */ + public static final String COLUMNNAME_DeliveryRule = "DeliveryRule"; + + /** Set Delivery Rule. + * Defines the timing of Delivery + */ + public void setDeliveryRule (String DeliveryRule); + + /** Get Delivery Rule. + * Defines the timing of Delivery + */ + public String getDeliveryRule(); + + /** Column name DeliveryViaRule */ + public static final String COLUMNNAME_DeliveryViaRule = "DeliveryViaRule"; + + /** Set Delivery Via. + * How the order will be delivered + */ + public void setDeliveryViaRule (String DeliveryViaRule); + + /** Get Delivery Via. + * How the order will be delivered + */ + public String getDeliveryViaRule(); + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name DocAction */ + public static final String COLUMNNAME_DocAction = "DocAction"; + + /** Set Document Action. + * The targeted status of the document + */ + public void setDocAction (String DocAction); + + /** Get Document Action. + * The targeted status of the document + */ + public String getDocAction(); + + /** Column name DocStatus */ + public static final String COLUMNNAME_DocStatus = "DocStatus"; + + /** Set Document Status. + * The current status of the document + */ + public void setDocStatus (String DocStatus); + + /** Get Document Status. + * The current status of the document + */ + public String getDocStatus(); + + /** Column name DocumentNo */ + public static final String COLUMNNAME_DocumentNo = "DocumentNo"; + + /** Set Document No. + * Document sequence number of the document + */ + public void setDocumentNo (String DocumentNo); + + /** Get Document No. + * Document sequence number of the document + */ + public String getDocumentNo(); + + /** Column name FreightAmt */ + public static final String COLUMNNAME_FreightAmt = "FreightAmt"; + + /** Set Freight Amount. + * Freight Amount + */ + public void setFreightAmt (BigDecimal FreightAmt); + + /** Get Freight Amount. + * Freight Amount + */ + public BigDecimal getFreightAmt(); + + /** Column name FreightCostRule */ + public static final String COLUMNNAME_FreightCostRule = "FreightCostRule"; + + /** Set Freight Cost Rule. + * Method for charging Freight + */ + public void setFreightCostRule (String FreightCostRule); + + /** Get Freight Cost Rule. + * Method for charging Freight + */ + public String getFreightCostRule(); + + /** Column name GrandTotal */ + public static final String COLUMNNAME_GrandTotal = "GrandTotal"; + + /** Set Grand Total. + * Total amount of document + */ + public void setGrandTotal (BigDecimal GrandTotal); + + /** Get Grand Total. + * Total amount of document + */ + public BigDecimal getGrandTotal(); + + /** Column name InvoiceRule */ + public static final String COLUMNNAME_InvoiceRule = "InvoiceRule"; + + /** Set Invoice Rule. + * Frequency and method of invoicing + */ + public void setInvoiceRule (String InvoiceRule); + + /** Get Invoice Rule. + * Frequency and method of invoicing + */ + public String getInvoiceRule(); + + /** Column name IsApproved */ + public static final String COLUMNNAME_IsApproved = "IsApproved"; + + /** Set Approved. + * Indicates if this document requires approval + */ + public void setIsApproved (boolean IsApproved); + + /** Get Approved. + * Indicates if this document requires approval + */ + public boolean isApproved(); + + /** Column name IsCreditApproved */ + public static final String COLUMNNAME_IsCreditApproved = "IsCreditApproved"; + + /** Set Credit Approved. + * Credit has been approved + */ + public void setIsCreditApproved (boolean IsCreditApproved); + + /** Get Credit Approved. + * Credit has been approved + */ + public boolean isCreditApproved(); + + /** Column name IsDelivered */ + public static final String COLUMNNAME_IsDelivered = "IsDelivered"; + + /** Set Delivered */ + public void setIsDelivered (boolean IsDelivered); + + /** Get Delivered */ + public boolean isDelivered(); + + /** Column name IsDiscountPrinted */ + public static final String COLUMNNAME_IsDiscountPrinted = "IsDiscountPrinted"; + + /** Set Discount Printed. + * Print Discount on Invoice and Order + */ + public void setIsDiscountPrinted (boolean IsDiscountPrinted); + + /** Get Discount Printed. + * Print Discount on Invoice and Order + */ + public boolean isDiscountPrinted(); + + /** Column name IsDropShip */ + public static final String COLUMNNAME_IsDropShip = "IsDropShip"; + + /** Set Drop Shipment. + * Drop Shipments are sent from the Vendor directly to the Customer + */ + public void setIsDropShip (boolean IsDropShip); + + /** Get Drop Shipment. + * Drop Shipments are sent from the Vendor directly to the Customer + */ + public boolean isDropShip(); + + /** Column name IsInvoiced */ + public static final String COLUMNNAME_IsInvoiced = "IsInvoiced"; + + /** Set Invoiced. + * Is this invoiced? + */ + public void setIsInvoiced (boolean IsInvoiced); + + /** Get Invoiced. + * Is this invoiced? + */ + public boolean isInvoiced(); + + /** Column name IsPrinted */ + public static final String COLUMNNAME_IsPrinted = "IsPrinted"; + + /** Set Printed. + * Indicates if this document / line is printed + */ + public void setIsPrinted (boolean IsPrinted); + + /** Get Printed. + * Indicates if this document / line is printed + */ + public boolean isPrinted(); + + /** Column name IsSelected */ + public static final String COLUMNNAME_IsSelected = "IsSelected"; + + /** Set Selected */ + public void setIsSelected (boolean IsSelected); + + /** Get Selected */ + public boolean isSelected(); + + /** Column name IsSelfService */ + public static final String COLUMNNAME_IsSelfService = "IsSelfService"; + + /** Set Self-Service. + * This is a Self-Service entry or this entry can be changed via Self-Service + */ + public void setIsSelfService (boolean IsSelfService); + + /** Get Self-Service. + * This is a Self-Service entry or this entry can be changed via Self-Service + */ + public boolean isSelfService(); + + /** Column name IsSOTrx */ + public static final String COLUMNNAME_IsSOTrx = "IsSOTrx"; + + /** Set Sales Transaction. + * This is a Sales Transaction + */ + public void setIsSOTrx (boolean IsSOTrx); + + /** Get Sales Transaction. + * This is a Sales Transaction + */ + public boolean isSOTrx(); + + /** Column name IsTaxIncluded */ + public static final String COLUMNNAME_IsTaxIncluded = "IsTaxIncluded"; + + /** Set Price includes Tax. + * Tax is included in the price + */ + public void setIsTaxIncluded (boolean IsTaxIncluded); + + /** Get Price includes Tax. + * Tax is included in the price + */ + public boolean isTaxIncluded(); + + /** Column name IsTransferred */ + public static final String COLUMNNAME_IsTransferred = "IsTransferred"; + + /** Set Transferred. + * Transferred to General Ledger (i.e. accounted) + */ + public void setIsTransferred (boolean IsTransferred); + + /** Get Transferred. + * Transferred to General Ledger (i.e. accounted) + */ + public boolean isTransferred(); + + /** Column name M_PriceList_ID */ + public static final String COLUMNNAME_M_PriceList_ID = "M_PriceList_ID"; + + /** Set Price List. + * Unique identifier of a Price List + */ + public void setM_PriceList_ID (int M_PriceList_ID); + + /** Get Price List. + * Unique identifier of a Price List + */ + public int getM_PriceList_ID(); + + public I_M_PriceList getM_PriceList() throws Exception; + + /** Column name M_Shipper_ID */ + public static final String COLUMNNAME_M_Shipper_ID = "M_Shipper_ID"; + + /** Set Shipper. + * Method or manner of product delivery + */ + public void setM_Shipper_ID (int M_Shipper_ID); + + /** Get Shipper. + * Method or manner of product delivery + */ + public int getM_Shipper_ID(); + + public I_M_Shipper getM_Shipper() throws Exception; + + /** Column name M_Warehouse_ID */ + public static final String COLUMNNAME_M_Warehouse_ID = "M_Warehouse_ID"; + + /** Set Warehouse. + * Storage Warehouse and Service Point + */ + public void setM_Warehouse_ID (int M_Warehouse_ID); + + /** Get Warehouse. + * Storage Warehouse and Service Point + */ + public int getM_Warehouse_ID(); + + public I_M_Warehouse getM_Warehouse() throws Exception; + + /** Column name OrderType */ + public static final String COLUMNNAME_OrderType = "OrderType"; + + /** Set OrderType */ + public void setOrderType (String OrderType); + + /** Get OrderType */ + public String getOrderType(); + + /** Column name Pay_BPartner_ID */ + public static final String COLUMNNAME_Pay_BPartner_ID = "Pay_BPartner_ID"; + + /** Set Payment BPartner. + * Business Partner responsible for the payment + */ + public void setPay_BPartner_ID (int Pay_BPartner_ID); + + /** Get Payment BPartner. + * Business Partner responsible for the payment + */ + public int getPay_BPartner_ID(); + + /** Column name Pay_Location_ID */ + public static final String COLUMNNAME_Pay_Location_ID = "Pay_Location_ID"; + + /** Set Payment Location. + * Location of the Business Partner responsible for the payment + */ + public void setPay_Location_ID (int Pay_Location_ID); + + /** Get Payment Location. + * Location of the Business Partner responsible for the payment + */ + public int getPay_Location_ID(); + + /** Column name PaymentRule */ + public static final String COLUMNNAME_PaymentRule = "PaymentRule"; + + /** Set Payment Rule. + * How you pay the invoice + */ + public void setPaymentRule (String PaymentRule); + + /** Get Payment Rule. + * How you pay the invoice + */ + public String getPaymentRule(); + + /** Column name POReference */ + public static final String COLUMNNAME_POReference = "POReference"; + + /** Set Order Reference. + * Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner + */ + public void setPOReference (String POReference); + + /** Get Order Reference. + * Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner + */ + public String getPOReference(); + + /** Column name Posted */ + public static final String COLUMNNAME_Posted = "Posted"; + + /** Set Posted. + * Posting status + */ + public void setPosted (boolean Posted); + + /** Get Posted. + * Posting status + */ + public boolean isPosted(); + + /** Column name PriorityRule */ + public static final String COLUMNNAME_PriorityRule = "PriorityRule"; + + /** Set Priority. + * Priority of a document + */ + public void setPriorityRule (String PriorityRule); + + /** Get Priority. + * Priority of a document + */ + public String getPriorityRule(); + + /** Column name Processed */ + public static final String COLUMNNAME_Processed = "Processed"; + + /** Set Processed. + * The document has been processed + */ + public void setProcessed (boolean Processed); + + /** Get Processed. + * The document has been processed + */ + public boolean isProcessed(); + + /** Column name Processing */ + public static final String COLUMNNAME_Processing = "Processing"; + + /** Set Process Now */ + public void setProcessing (boolean Processing); + + /** Get Process Now */ + public boolean isProcessing(); + + /** Column name Ref_Order_ID */ + public static final String COLUMNNAME_Ref_Order_ID = "Ref_Order_ID"; + + /** Set Referenced Order. + * Reference to corresponding Sales/Purchase Order + */ + public void setRef_Order_ID (int Ref_Order_ID); + + /** Get Referenced Order. + * Reference to corresponding Sales/Purchase Order + */ + public int getRef_Order_ID(); + + /** Column name SalesRep_ID */ + public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID"; + + /** Set Sales Representative. + * Sales Representative or Company Agent + */ + public void setSalesRep_ID (int SalesRep_ID); + + /** Get Sales Representative. + * Sales Representative or Company Agent + */ + public int getSalesRep_ID(); + + /** Column name SendEMail */ + public static final String COLUMNNAME_SendEMail = "SendEMail"; + + /** Set Send EMail. + * Enable sending Document EMail + */ + public void setSendEMail (boolean SendEMail); + + /** Get Send EMail. + * Enable sending Document EMail + */ + public boolean isSendEMail(); + + /** Column name TotalLines */ + public static final String COLUMNNAME_TotalLines = "TotalLines"; + + /** Set Total Lines. + * Total of all document lines + */ + public void setTotalLines (BigDecimal TotalLines); + + /** Get Total Lines. + * Total of all document lines + */ + public BigDecimal getTotalLines(); + + /** Column name User1_ID */ + public static final String COLUMNNAME_User1_ID = "User1_ID"; + + /** Set User List 1. + * User defined list element #1 + */ + public void setUser1_ID (int User1_ID); + + /** Get User List 1. + * User defined list element #1 + */ + public int getUser1_ID(); + + /** Column name User2_ID */ + public static final String COLUMNNAME_User2_ID = "User2_ID"; + + /** Set User List 2. + * User defined list element #2 + */ + public void setUser2_ID (int User2_ID); + + /** Get User List 2. + * User defined list element #2 + */ + public int getUser2_ID(); + + /** Column name Volume */ + public static final String COLUMNNAME_Volume = "Volume"; + + /** Set Volume. + * Volume of a product + */ + public void setVolume (BigDecimal Volume); + + /** Get Volume. + * Volume of a product + */ + public BigDecimal getVolume(); + + /** Column name Weight */ + public static final String COLUMNNAME_Weight = "Weight"; + + /** Set Weight. + * Weight of a product + */ + public void setWeight (BigDecimal Weight); + + /** Get Weight. + * Weight of a product + */ + public BigDecimal getWeight(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_C_Payment.java b/posterita/posterita/src/main/org/compiere/model/I_C_Payment.java new file mode 100644 index 0000000000..13b73bd96b --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_C_Payment.java @@ -0,0 +1,1093 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for C_Payment + * @author Trifon Trifonov (generated) + * @version Release 3.5.0 + */ +public interface I_C_Payment +{ + + /** TableName=C_Payment */ + public static final String Table_Name = "C_Payment"; + + /** AD_Table_ID=335 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 1 - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(1); + + /** Load Meta Data */ + + /** Column name AD_OrgTrx_ID */ + public static final String COLUMNNAME_AD_OrgTrx_ID = "AD_OrgTrx_ID"; + + /** Set Trx Organization. + * Performing or initiating organization + */ + public void setAD_OrgTrx_ID (int AD_OrgTrx_ID); + + /** Get Trx Organization. + * Performing or initiating organization + */ + public int getAD_OrgTrx_ID(); + + /** Column name A_City */ + public static final String COLUMNNAME_A_City = "A_City"; + + /** Set Account City. + * City or the Credit Card or Account Holder + */ + public void setA_City (String A_City); + + /** Get Account City. + * City or the Credit Card or Account Holder + */ + public String getA_City(); + + /** Column name A_Country */ + public static final String COLUMNNAME_A_Country = "A_Country"; + + /** Set Account Country. + * Country + */ + public void setA_Country (String A_Country); + + /** Get Account Country. + * Country + */ + public String getA_Country(); + + /** Column name A_EMail */ + public static final String COLUMNNAME_A_EMail = "A_EMail"; + + /** Set Account EMail. + * Email Address + */ + public void setA_EMail (String A_EMail); + + /** Get Account EMail. + * Email Address + */ + public String getA_EMail(); + + /** Column name A_Ident_DL */ + public static final String COLUMNNAME_A_Ident_DL = "A_Ident_DL"; + + /** Set Driver License. + * Payment Identification - Driver License + */ + public void setA_Ident_DL (String A_Ident_DL); + + /** Get Driver License. + * Payment Identification - Driver License + */ + public String getA_Ident_DL(); + + /** Column name A_Ident_SSN */ + public static final String COLUMNNAME_A_Ident_SSN = "A_Ident_SSN"; + + /** Set Social Security No. + * Payment Identification - Social Security No + */ + public void setA_Ident_SSN (String A_Ident_SSN); + + /** Get Social Security No. + * Payment Identification - Social Security No + */ + public String getA_Ident_SSN(); + + /** Column name A_Name */ + public static final String COLUMNNAME_A_Name = "A_Name"; + + /** Set Account Name. + * Name on Credit Card or Account holder + */ + public void setA_Name (String A_Name); + + /** Get Account Name. + * Name on Credit Card or Account holder + */ + public String getA_Name(); + + /** Column name A_State */ + public static final String COLUMNNAME_A_State = "A_State"; + + /** Set Account State. + * State of the Credit Card or Account holder + */ + public void setA_State (String A_State); + + /** Get Account State. + * State of the Credit Card or Account holder + */ + public String getA_State(); + + /** Column name A_Street */ + public static final String COLUMNNAME_A_Street = "A_Street"; + + /** Set Account Street. + * Street address of the Credit Card or Account holder + */ + public void setA_Street (String A_Street); + + /** Get Account Street. + * Street address of the Credit Card or Account holder + */ + public String getA_Street(); + + /** Column name A_Zip */ + public static final String COLUMNNAME_A_Zip = "A_Zip"; + + /** Set Account Zip/Postal. + * Zip Code of the Credit Card or Account Holder + */ + public void setA_Zip (String A_Zip); + + /** Get Account Zip/Postal. + * Zip Code of the Credit Card or Account Holder + */ + public String getA_Zip(); + + /** Column name AccountNo */ + public static final String COLUMNNAME_AccountNo = "AccountNo"; + + /** Set Account No. + * Account Number + */ + public void setAccountNo (String AccountNo); + + /** Get Account No. + * Account Number + */ + public String getAccountNo(); + + /** Column name C_Activity_ID */ + public static final String COLUMNNAME_C_Activity_ID = "C_Activity_ID"; + + /** Set Activity. + * Business Activity + */ + public void setC_Activity_ID (int C_Activity_ID); + + /** Get Activity. + * Business Activity + */ + public int getC_Activity_ID(); + + public I_C_Activity getC_Activity() throws Exception; + + /** Column name C_BP_BankAccount_ID */ + public static final String COLUMNNAME_C_BP_BankAccount_ID = "C_BP_BankAccount_ID"; + + /** Set Partner Bank Account. + * Bank Account of the Business Partner + */ + public void setC_BP_BankAccount_ID (int C_BP_BankAccount_ID); + + /** Get Partner Bank Account. + * Bank Account of the Business Partner + */ + public int getC_BP_BankAccount_ID(); + + public I_C_BP_BankAccount getC_BP_BankAccount() throws Exception; + + /** Column name C_BPartner_ID */ + public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID"; + + /** Set Business Partner . + * Identifies a Business Partner + */ + public void setC_BPartner_ID (int C_BPartner_ID); + + /** Get Business Partner . + * Identifies a Business Partner + */ + public int getC_BPartner_ID(); + + public I_C_BPartner getC_BPartner() throws Exception; + + /** Column name C_BankAccount_ID */ + public static final String COLUMNNAME_C_BankAccount_ID = "C_BankAccount_ID"; + + /** Set Bank Account. + * Account at the Bank + */ + public void setC_BankAccount_ID (int C_BankAccount_ID); + + /** Get Bank Account. + * Account at the Bank + */ + public int getC_BankAccount_ID(); + + public I_C_BankAccount getC_BankAccount() throws Exception; + + /** Column name C_Campaign_ID */ + public static final String COLUMNNAME_C_Campaign_ID = "C_Campaign_ID"; + + /** Set Campaign. + * Marketing Campaign + */ + public void setC_Campaign_ID (int C_Campaign_ID); + + /** Get Campaign. + * Marketing Campaign + */ + public int getC_Campaign_ID(); + + public I_C_Campaign getC_Campaign() throws Exception; + + /** Column name C_CashBook_ID */ + public static final String COLUMNNAME_C_CashBook_ID = "C_CashBook_ID"; + + /** Set Cash Book. + * Cash Book for recording petty cash transactions + */ + public void setC_CashBook_ID (int C_CashBook_ID); + + /** Get Cash Book. + * Cash Book for recording petty cash transactions + */ + public int getC_CashBook_ID(); + + public I_C_CashBook getC_CashBook() throws Exception; + + /** Column name C_Charge_ID */ + public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID"; + + /** Set Charge. + * Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID); + + /** Get Charge. + * Additional document charges + */ + public int getC_Charge_ID(); + + public I_C_Charge getC_Charge() throws Exception; + + /** Column name C_ConversionType_ID */ + public static final String COLUMNNAME_C_ConversionType_ID = "C_ConversionType_ID"; + + /** Set Currency Type. + * Currency Conversion Rate Type + */ + public void setC_ConversionType_ID (int C_ConversionType_ID); + + /** Get Currency Type. + * Currency Conversion Rate Type + */ + public int getC_ConversionType_ID(); + + public I_C_ConversionType getC_ConversionType() throws Exception; + + /** Column name C_Currency_ID */ + public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID"; + + /** Set Currency. + * The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID); + + /** Get Currency. + * The Currency for this record + */ + public int getC_Currency_ID(); + + public I_C_Currency getC_Currency() throws Exception; + + /** Column name C_DocType_ID */ + public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID"; + + /** Set Document Type. + * Document type or rules + */ + public void setC_DocType_ID (int C_DocType_ID); + + /** Get Document Type. + * Document type or rules + */ + public int getC_DocType_ID(); + + public I_C_DocType getC_DocType() throws Exception; + + /** Column name C_Invoice_ID */ + public static final String COLUMNNAME_C_Invoice_ID = "C_Invoice_ID"; + + /** Set Invoice. + * Invoice Identifier + */ + public void setC_Invoice_ID (int C_Invoice_ID); + + /** Get Invoice. + * Invoice Identifier + */ + public int getC_Invoice_ID(); + + public I_C_Invoice getC_Invoice() throws Exception; + + /** Column name C_Order_ID */ + public static final String COLUMNNAME_C_Order_ID = "C_Order_ID"; + + /** Set Order. + * Order + */ + public void setC_Order_ID (int C_Order_ID); + + /** Get Order. + * Order + */ + public int getC_Order_ID(); + + public I_C_Order getC_Order() throws Exception; + + /** Column name C_PaymentBatch_ID */ + public static final String COLUMNNAME_C_PaymentBatch_ID = "C_PaymentBatch_ID"; + + /** Set Payment Batch. + * Payment batch for EFT + */ + public void setC_PaymentBatch_ID (int C_PaymentBatch_ID); + + /** Get Payment Batch. + * Payment batch for EFT + */ + public int getC_PaymentBatch_ID(); + + public I_C_PaymentBatch getC_PaymentBatch() throws Exception; + + /** Column name C_Payment_ID */ + public static final String COLUMNNAME_C_Payment_ID = "C_Payment_ID"; + + /** Set Payment. + * Payment identifier + */ + public void setC_Payment_ID (int C_Payment_ID); + + /** Get Payment. + * Payment identifier + */ + public int getC_Payment_ID(); + + /** Column name C_Project_ID */ + public static final String COLUMNNAME_C_Project_ID = "C_Project_ID"; + + /** Set Project. + * Financial Project + */ + public void setC_Project_ID (int C_Project_ID); + + /** Get Project. + * Financial Project + */ + public int getC_Project_ID(); + + public I_C_Project getC_Project() throws Exception; + + /** Column name ChargeAmt */ + public static final String COLUMNNAME_ChargeAmt = "ChargeAmt"; + + /** Set Charge amount. + * Charge Amount + */ + public void setChargeAmt (BigDecimal ChargeAmt); + + /** Get Charge amount. + * Charge Amount + */ + public BigDecimal getChargeAmt(); + + /** Column name CheckNo */ + public static final String COLUMNNAME_CheckNo = "CheckNo"; + + /** Set Check No. + * Check Number + */ + public void setCheckNo (String CheckNo); + + /** Get Check No. + * Check Number + */ + public String getCheckNo(); + + /** Column name CreditCardExpMM */ + public static final String COLUMNNAME_CreditCardExpMM = "CreditCardExpMM"; + + /** Set Exp. Month. + * Expiry Month + */ + public void setCreditCardExpMM (int CreditCardExpMM); + + /** Get Exp. Month. + * Expiry Month + */ + public int getCreditCardExpMM(); + + /** Column name CreditCardExpYY */ + public static final String COLUMNNAME_CreditCardExpYY = "CreditCardExpYY"; + + /** Set Exp. Year. + * Expiry Year + */ + public void setCreditCardExpYY (int CreditCardExpYY); + + /** Get Exp. Year. + * Expiry Year + */ + public int getCreditCardExpYY(); + + /** Column name CreditCardNumber */ + public static final String COLUMNNAME_CreditCardNumber = "CreditCardNumber"; + + /** Set Number. + * Credit Card Number + */ + public void setCreditCardNumber (String CreditCardNumber); + + /** Get Number. + * Credit Card Number + */ + public String getCreditCardNumber(); + + /** Column name CreditCardType */ + public static final String COLUMNNAME_CreditCardType = "CreditCardType"; + + /** Set Credit Card. + * Credit Card (Visa, MC, AmEx) + */ + public void setCreditCardType (String CreditCardType); + + /** Get Credit Card. + * Credit Card (Visa, MC, AmEx) + */ + public String getCreditCardType(); + + /** Column name CreditCardVV */ + public static final String COLUMNNAME_CreditCardVV = "CreditCardVV"; + + /** Set Verification Code. + * Credit Card Verification code on credit card + */ + public void setCreditCardVV (String CreditCardVV); + + /** Get Verification Code. + * Credit Card Verification code on credit card + */ + public String getCreditCardVV(); + + /** Column name DateAcct */ + public static final String COLUMNNAME_DateAcct = "DateAcct"; + + /** Set Account Date. + * Accounting Date + */ + public void setDateAcct (Timestamp DateAcct); + + /** Get Account Date. + * Accounting Date + */ + public Timestamp getDateAcct(); + + /** Column name DateTrx */ + public static final String COLUMNNAME_DateTrx = "DateTrx"; + + /** Set Transaction Date. + * Transaction Date + */ + public void setDateTrx (Timestamp DateTrx); + + /** Get Transaction Date. + * Transaction Date + */ + public Timestamp getDateTrx(); + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name DiscountAmt */ + public static final String COLUMNNAME_DiscountAmt = "DiscountAmt"; + + /** Set Discount Amount. + * Calculated amount of discount + */ + public void setDiscountAmt (BigDecimal DiscountAmt); + + /** Get Discount Amount. + * Calculated amount of discount + */ + public BigDecimal getDiscountAmt(); + + /** Column name DocAction */ + public static final String COLUMNNAME_DocAction = "DocAction"; + + /** Set Document Action. + * The targeted status of the document + */ + public void setDocAction (String DocAction); + + /** Get Document Action. + * The targeted status of the document + */ + public String getDocAction(); + + /** Column name DocStatus */ + public static final String COLUMNNAME_DocStatus = "DocStatus"; + + /** Set Document Status. + * The current status of the document + */ + public void setDocStatus (String DocStatus); + + /** Get Document Status. + * The current status of the document + */ + public String getDocStatus(); + + /** Column name DocumentNo */ + public static final String COLUMNNAME_DocumentNo = "DocumentNo"; + + /** Set Document No. + * Document sequence number of the document + */ + public void setDocumentNo (String DocumentNo); + + /** Get Document No. + * Document sequence number of the document + */ + public String getDocumentNo(); + + /** Column name IsAllocated */ + public static final String COLUMNNAME_IsAllocated = "IsAllocated"; + + /** Set Allocated. + * Indicates if the payment has been allocated + */ + public void setIsAllocated (boolean IsAllocated); + + /** Get Allocated. + * Indicates if the payment has been allocated + */ + public boolean isAllocated(); + + /** Column name IsApproved */ + public static final String COLUMNNAME_IsApproved = "IsApproved"; + + /** Set Approved. + * Indicates if this document requires approval + */ + public void setIsApproved (boolean IsApproved); + + /** Get Approved. + * Indicates if this document requires approval + */ + public boolean isApproved(); + + /** Column name IsDelayedCapture */ + public static final String COLUMNNAME_IsDelayedCapture = "IsDelayedCapture"; + + /** Set Delayed Capture. + * Charge after Shipment + */ + public void setIsDelayedCapture (boolean IsDelayedCapture); + + /** Get Delayed Capture. + * Charge after Shipment + */ + public boolean isDelayedCapture(); + + /** Column name IsOnline */ + public static final String COLUMNNAME_IsOnline = "IsOnline"; + + /** Set Online Access. + * Can be accessed online + */ + public void setIsOnline (boolean IsOnline); + + /** Get Online Access. + * Can be accessed online + */ + public boolean isOnline(); + + /** Column name IsOverUnderPayment */ + public static final String COLUMNNAME_IsOverUnderPayment = "IsOverUnderPayment"; + + /** Set Over/Under Payment. + * Over-Payment (unallocated) or Under-Payment (partial payment) + */ + public void setIsOverUnderPayment (boolean IsOverUnderPayment); + + /** Get Over/Under Payment. + * Over-Payment (unallocated) or Under-Payment (partial payment) + */ + public boolean isOverUnderPayment(); + + /** Column name IsPrepayment */ + public static final String COLUMNNAME_IsPrepayment = "IsPrepayment"; + + /** Set Prepayment. + * The Payment/Receipt is a Prepayment + */ + public void setIsPrepayment (boolean IsPrepayment); + + /** Get Prepayment. + * The Payment/Receipt is a Prepayment + */ + public boolean isPrepayment(); + + /** Column name IsReceipt */ + public static final String COLUMNNAME_IsReceipt = "IsReceipt"; + + /** Set Receipt. + * This is a sales transaction (receipt) + */ + public void setIsReceipt (boolean IsReceipt); + + /** Get Receipt. + * This is a sales transaction (receipt) + */ + public boolean isReceipt(); + + /** Column name IsReconciled */ + public static final String COLUMNNAME_IsReconciled = "IsReconciled"; + + /** Set Reconciled. + * Payment is reconciled with bank statement + */ + public void setIsReconciled (boolean IsReconciled); + + /** Get Reconciled. + * Payment is reconciled with bank statement + */ + public boolean isReconciled(); + + /** Column name IsSelfService */ + public static final String COLUMNNAME_IsSelfService = "IsSelfService"; + + /** Set Self-Service. + * This is a Self-Service entry or this entry can be changed via Self-Service + */ + public void setIsSelfService (boolean IsSelfService); + + /** Get Self-Service. + * This is a Self-Service entry or this entry can be changed via Self-Service + */ + public boolean isSelfService(); + + /** Column name Micr */ + public static final String COLUMNNAME_Micr = "Micr"; + + /** Set Micr. + * Combination of routing no, account and check no + */ + public void setMicr (String Micr); + + /** Get Micr. + * Combination of routing no, account and check no + */ + public String getMicr(); + + /** Column name OProcessing */ + public static final String COLUMNNAME_OProcessing = "OProcessing"; + + /** Set Online Processing. + * This payment can be processed online + */ + public void setOProcessing (String OProcessing); + + /** Get Online Processing. + * This payment can be processed online + */ + public String getOProcessing(); + + /** Column name Orig_TrxID */ + public static final String COLUMNNAME_Orig_TrxID = "Orig_TrxID"; + + /** Set Original Transaction ID. + * Original Transaction ID + */ + public void setOrig_TrxID (String Orig_TrxID); + + /** Get Original Transaction ID. + * Original Transaction ID + */ + public String getOrig_TrxID(); + + /** Column name OverUnderAmt */ + public static final String COLUMNNAME_OverUnderAmt = "OverUnderAmt"; + + /** Set Over/Under Payment. + * Over-Payment (unallocated) or Under-Payment (partial payment) Amount + */ + public void setOverUnderAmt (BigDecimal OverUnderAmt); + + /** Get Over/Under Payment. + * Over-Payment (unallocated) or Under-Payment (partial payment) Amount + */ + public BigDecimal getOverUnderAmt(); + + /** Column name PONum */ + public static final String COLUMNNAME_PONum = "PONum"; + + /** Set PO Number. + * Purchase Order Number + */ + public void setPONum (String PONum); + + /** Get PO Number. + * Purchase Order Number + */ + public String getPONum(); + + /** Column name PayAmt */ + public static final String COLUMNNAME_PayAmt = "PayAmt"; + + /** Set Payment amount. + * Amount being paid + */ + public void setPayAmt (BigDecimal PayAmt); + + /** Get Payment amount. + * Amount being paid + */ + public BigDecimal getPayAmt(); + + /** Column name Posted */ + public static final String COLUMNNAME_Posted = "Posted"; + + /** Set Posted. + * Posting status + */ + public void setPosted (boolean Posted); + + /** Get Posted. + * Posting status + */ + public boolean isPosted(); + + /** Column name Processed */ + public static final String COLUMNNAME_Processed = "Processed"; + + /** Set Processed. + * The document has been processed + */ + public void setProcessed (boolean Processed); + + /** Get Processed. + * The document has been processed + */ + public boolean isProcessed(); + + /** Column name Processing */ + public static final String COLUMNNAME_Processing = "Processing"; + + /** Set Process Now */ + public void setProcessing (boolean Processing); + + /** Get Process Now */ + public boolean isProcessing(); + + /** Column name R_AuthCode */ + public static final String COLUMNNAME_R_AuthCode = "R_AuthCode"; + + /** Set Authorization Code. + * Authorization Code returned + */ + public void setR_AuthCode (String R_AuthCode); + + /** Get Authorization Code. + * Authorization Code returned + */ + public String getR_AuthCode(); + + /** Column name R_AuthCode_DC */ + public static final String COLUMNNAME_R_AuthCode_DC = "R_AuthCode_DC"; + + /** Set Authorization Code (DC). + * Authorization Code Delayed Capture returned + */ + public void setR_AuthCode_DC (String R_AuthCode_DC); + + /** Get Authorization Code (DC). + * Authorization Code Delayed Capture returned + */ + public String getR_AuthCode_DC(); + + /** Column name R_AvsAddr */ + public static final String COLUMNNAME_R_AvsAddr = "R_AvsAddr"; + + /** Set Address verified. + * This address has been verified + */ + public void setR_AvsAddr (String R_AvsAddr); + + /** Get Address verified. + * This address has been verified + */ + public String getR_AvsAddr(); + + /** Column name R_AvsZip */ + public static final String COLUMNNAME_R_AvsZip = "R_AvsZip"; + + /** Set Zip verified. + * The Zip Code has been verified + */ + public void setR_AvsZip (String R_AvsZip); + + /** Get Zip verified. + * The Zip Code has been verified + */ + public String getR_AvsZip(); + + /** Column name R_CVV2Match */ + public static final String COLUMNNAME_R_CVV2Match = "R_CVV2Match"; + + /** Set CVV Match. + * Credit Card Verification Code Match + */ + public void setR_CVV2Match (boolean R_CVV2Match); + + /** Get CVV Match. + * Credit Card Verification Code Match + */ + public boolean isR_CVV2Match(); + + /** Column name R_Info */ + public static final String COLUMNNAME_R_Info = "R_Info"; + + /** Set Info. + * Response info + */ + public void setR_Info (String R_Info); + + /** Get Info. + * Response info + */ + public String getR_Info(); + + /** Column name R_PnRef */ + public static final String COLUMNNAME_R_PnRef = "R_PnRef"; + + /** Set Reference. + * Payment reference + */ + public void setR_PnRef (String R_PnRef); + + /** Get Reference. + * Payment reference + */ + public String getR_PnRef(); + + /** Column name R_PnRef_DC */ + public static final String COLUMNNAME_R_PnRef_DC = "R_PnRef_DC"; + + /** Set Reference (DC). + * Payment Reference Delayed Capture + */ + public void setR_PnRef_DC (String R_PnRef_DC); + + /** Get Reference (DC). + * Payment Reference Delayed Capture + */ + public String getR_PnRef_DC(); + + /** Column name R_RespMsg */ + public static final String COLUMNNAME_R_RespMsg = "R_RespMsg"; + + /** Set Response Message. + * Response message + */ + public void setR_RespMsg (String R_RespMsg); + + /** Get Response Message. + * Response message + */ + public String getR_RespMsg(); + + /** Column name R_Result */ + public static final String COLUMNNAME_R_Result = "R_Result"; + + /** Set Result. + * Result of transmission + */ + public void setR_Result (String R_Result); + + /** Get Result. + * Result of transmission + */ + public String getR_Result(); + + /** Column name Ref_Payment_ID */ + public static final String COLUMNNAME_Ref_Payment_ID = "Ref_Payment_ID"; + + /** Set Referenced Payment */ + public void setRef_Payment_ID (int Ref_Payment_ID); + + /** Get Referenced Payment */ + public int getRef_Payment_ID(); + + /** Column name RoutingNo */ + public static final String COLUMNNAME_RoutingNo = "RoutingNo"; + + /** Set Routing No. + * Bank Routing Number + */ + public void setRoutingNo (String RoutingNo); + + /** Get Routing No. + * Bank Routing Number + */ + public String getRoutingNo(); + + /** Column name Swipe */ + public static final String COLUMNNAME_Swipe = "Swipe"; + + /** Set Swipe. + * Track 1 and 2 of the Credit Card + */ + public void setSwipe (String Swipe); + + /** Get Swipe. + * Track 1 and 2 of the Credit Card + */ + public String getSwipe(); + + /** Column name TaxAmt */ + public static final String COLUMNNAME_TaxAmt = "TaxAmt"; + + /** Set Tax Amount. + * Tax Amount for a document + */ + public void setTaxAmt (BigDecimal TaxAmt); + + /** Get Tax Amount. + * Tax Amount for a document + */ + public BigDecimal getTaxAmt(); + + /** Column name TenderType */ + public static final String COLUMNNAME_TenderType = "TenderType"; + + /** Set Tender type. + * Method of Payment + */ + public void setTenderType (String TenderType); + + /** Get Tender type. + * Method of Payment + */ + public String getTenderType(); + + /** Column name TrxType */ + public static final String COLUMNNAME_TrxType = "TrxType"; + + /** Set Transaction Type. + * Type of credit card transaction + */ + public void setTrxType (String TrxType); + + /** Get Transaction Type. + * Type of credit card transaction + */ + public String getTrxType(); + + /** Column name User1_ID */ + public static final String COLUMNNAME_User1_ID = "User1_ID"; + + /** Set User List 1. + * User defined list element #1 + */ + public void setUser1_ID (int User1_ID); + + /** Get User List 1. + * User defined list element #1 + */ + public int getUser1_ID(); + + /** Column name User2_ID */ + public static final String COLUMNNAME_User2_ID = "User2_ID"; + + /** Set User List 2. + * User defined list element #2 + */ + public void setUser2_ID (int User2_ID); + + /** Get User List 2. + * User defined list element #2 + */ + public int getUser2_ID(); + + /** Column name VoiceAuthCode */ + public static final String COLUMNNAME_VoiceAuthCode = "VoiceAuthCode"; + + /** Set Voice authorization code. + * Voice Authorization Code from credit card company + */ + public void setVoiceAuthCode (String VoiceAuthCode); + + /** Get Voice authorization code. + * Voice Authorization Code from credit card company + */ + public String getVoiceAuthCode(); + + /** Column name WriteOffAmt */ + public static final String COLUMNNAME_WriteOffAmt = "WriteOffAmt"; + + /** Set Write-off Amount. + * Amount to write-off + */ + public void setWriteOffAmt (BigDecimal WriteOffAmt); + + /** Get Write-off Amount. + * Amount to write-off + */ + public BigDecimal getWriteOffAmt(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_M_InventoryLine.java b/posterita/posterita/src/main/org/compiere/model/I_M_InventoryLine.java new file mode 100644 index 0000000000..660238fb1a --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_M_InventoryLine.java @@ -0,0 +1,266 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for M_InventoryLine + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_M_InventoryLine +{ + + /** TableName=M_InventoryLine */ + public static final String Table_Name = "M_InventoryLine"; + + /** AD_Table_ID=322 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 1 - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(1); + + /** Load Meta Data */ + + /** Column name C_Charge_ID */ + public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID"; + + /** Set Charge. + * Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID); + + /** Get Charge. + * Additional document charges + */ + public int getC_Charge_ID(); + + public I_C_Charge getC_Charge() throws Exception; + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name InventoryType */ + public static final String COLUMNNAME_InventoryType = "InventoryType"; + + /** Set Inventory Type. + * Type of inventory difference + */ + public void setInventoryType (String InventoryType); + + /** Get Inventory Type. + * Type of inventory difference + */ + public String getInventoryType(); + + /** Column name Line */ + public static final String COLUMNNAME_Line = "Line"; + + /** Set Line No. + * Unique line for this document + */ + public void setLine (int Line); + + /** Get Line No. + * Unique line for this document + */ + public int getLine(); + + /** Column name M_AttributeSetInstance_ID */ + public static final String COLUMNNAME_M_AttributeSetInstance_ID = "M_AttributeSetInstance_ID"; + + /** Set Attribute Set Instance. + * Product Attribute Set Instance + */ + public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID); + + /** Get Attribute Set Instance. + * Product Attribute Set Instance + */ + public int getM_AttributeSetInstance_ID(); + + /** Column name M_Inventory_ID */ + public static final String COLUMNNAME_M_Inventory_ID = "M_Inventory_ID"; + + /** Set Phys.Inventory. + * Parameters for a Physical Inventory + */ + public void setM_Inventory_ID (int M_Inventory_ID); + + /** Get Phys.Inventory. + * Parameters for a Physical Inventory + */ + public int getM_Inventory_ID(); + + public I_M_Inventory getM_Inventory() throws Exception; + + /** Column name M_InventoryLine_ID */ + public static final String COLUMNNAME_M_InventoryLine_ID = "M_InventoryLine_ID"; + + /** Set Phys.Inventory Line. + * Unique line in an Inventory document + */ + public void setM_InventoryLine_ID (int M_InventoryLine_ID); + + /** Get Phys.Inventory Line. + * Unique line in an Inventory document + */ + public int getM_InventoryLine_ID(); + + /** Column name M_Locator_ID */ + public static final String COLUMNNAME_M_Locator_ID = "M_Locator_ID"; + + /** Set Locator. + * Warehouse Locator + */ + public void setM_Locator_ID (int M_Locator_ID); + + /** Get Locator. + * Warehouse Locator + */ + public int getM_Locator_ID(); + + /** Column name M_Product_ID */ + public static final String COLUMNNAME_M_Product_ID = "M_Product_ID"; + + /** Set Product. + * Product, Service, Item + */ + public void setM_Product_ID (int M_Product_ID); + + /** Get Product. + * Product, Service, Item + */ + public int getM_Product_ID(); + + /** Column name Processed */ + public static final String COLUMNNAME_Processed = "Processed"; + + /** Set Processed. + * The document has been processed + */ + public void setProcessed (boolean Processed); + + /** Get Processed. + * The document has been processed + */ + public boolean isProcessed(); + + /** Column name QtyBook */ + public static final String COLUMNNAME_QtyBook = "QtyBook"; + + /** Set Quantity book. + * Book Quantity + */ + public void setQtyBook (BigDecimal QtyBook); + + /** Get Quantity book. + * Book Quantity + */ + public BigDecimal getQtyBook(); + + /** Column name QtyCount */ + public static final String COLUMNNAME_QtyCount = "QtyCount"; + + /** Set Quantity count. + * Counted Quantity + */ + public void setQtyCount (BigDecimal QtyCount); + + /** Get Quantity count. + * Counted Quantity + */ + public BigDecimal getQtyCount(); + + /** Column name qtycsv */ + public static final String COLUMNNAME_QtyCsv = "QtyCsv"; + + /** Set qtycsv */ + public void setQtyCsv (BigDecimal QtyCsv); + + /** Get qtycsv */ + public BigDecimal getQtyCsv(); + + /** Column name QtyInternalUse */ + public static final String COLUMNNAME_QtyInternalUse = "QtyInternalUse"; + + /** Set Internal Use Qty. + * Internal Use Quantity removed from Inventory + */ + public void setQtyInternalUse (BigDecimal QtyInternalUse); + + /** Get Internal Use Qty. + * Internal Use Quantity removed from Inventory + */ + public BigDecimal getQtyInternalUse(); + + /** Column name UPC */ + public static final String COLUMNNAME_UPC = "UPC"; + + /** Set UPC/EAN. + * Bar Code (Universal Product Code or its superset European Article Number) + */ + public void setUPC (String UPC); + + /** Get UPC/EAN. + * Bar Code (Universal Product Code or its superset European Article Number) + */ + public String getUPC(); + + /** Column name Value */ + public static final String COLUMNNAME_Value = "Value"; + + /** Set Search Key. + * Search key for the record in the format required - must be unique + */ + public void setValue (String Value); + + /** Get Search Key. + * Search key for the record in the format required - must be unique + */ + public String getValue(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_M_PriceList.java b/posterita/posterita/src/main/org/compiere/model/I_M_PriceList.java new file mode 100644 index 0000000000..e020d4dda6 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_M_PriceList.java @@ -0,0 +1,212 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for M_PriceList + * @author Trifon Trifonov (generated) + * @version Release 3.3.1b + */ +public interface I_M_PriceList +{ + + /** TableName=M_PriceList */ + public static final String Table_Name = "M_PriceList"; + + /** AD_Table_ID=255 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 3 - Client - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(3); + + /** Load Meta Data */ + + /** Column name BasePriceList_ID */ + public static final String COLUMNNAME_BasePriceList_ID = "BasePriceList_ID"; + + /** Set Base Pricelist. + * Pricelist to be used, if product not found on this pricelist + */ + public void setBasePriceList_ID (int BasePriceList_ID); + + /** Get Base Pricelist. + * Pricelist to be used, if product not found on this pricelist + */ + public int getBasePriceList_ID(); + + /** Column name C_Currency_ID */ + public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID"; + + /** Set Currency. + * The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID); + + /** Get Currency. + * The Currency for this record + */ + public int getC_Currency_ID(); + + public I_C_Currency getC_Currency() throws Exception; + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name EnforcePriceLimit */ + public static final String COLUMNNAME_EnforcePriceLimit = "EnforcePriceLimit"; + + /** Set Enforce price limit. + * Do not allow prices below the limit price + */ + public void setEnforcePriceLimit (boolean EnforcePriceLimit); + + /** Get Enforce price limit. + * Do not allow prices below the limit price + */ + public boolean isEnforcePriceLimit(); + + /** Column name IsDefault */ + public static final String COLUMNNAME_IsDefault = "IsDefault"; + + /** Set Default. + * Default value + */ + public void setIsDefault (boolean IsDefault); + + /** Get Default. + * Default value + */ + public boolean isDefault(); + + /** Column name IsMandatory */ + public static final String COLUMNNAME_IsMandatory = "IsMandatory"; + + /** Set Mandatory. + * Data entry is required in this column + */ + public void setIsMandatory (boolean IsMandatory); + + /** Get Mandatory. + * Data entry is required in this column + */ + public boolean isMandatory(); + + /** Column name isPresentForProduct */ + public static final String COLUMNNAME_isPresentForProduct = "isPresentForProduct"; + + /** Set isPresentForProduct */ + public void setisPresentForProduct (boolean isPresentForProduct); + + /** Get isPresentForProduct */ + public boolean isPresentForProduct(); + + /** Column name IsSOPriceList */ + public static final String COLUMNNAME_IsSOPriceList = "IsSOPriceList"; + + /** Set Sales Price list. + * This is a Sales Price List + */ + public void setIsSOPriceList (boolean IsSOPriceList); + + /** Get Sales Price list. + * This is a Sales Price List + */ + public boolean isSOPriceList(); + + /** Column name IsTaxIncluded */ + public static final String COLUMNNAME_IsTaxIncluded = "IsTaxIncluded"; + + /** Set Price includes Tax. + * Tax is included in the price + */ + public void setIsTaxIncluded (boolean IsTaxIncluded); + + /** Get Price includes Tax. + * Tax is included in the price + */ + public boolean isTaxIncluded(); + + /** Column name M_PriceList_ID */ + public static final String COLUMNNAME_M_PriceList_ID = "M_PriceList_ID"; + + /** Set Price List. + * Unique identifier of a Price List + */ + public void setM_PriceList_ID (int M_PriceList_ID); + + /** Get Price List. + * Unique identifier of a Price List + */ + public int getM_PriceList_ID(); + + /** Column name Name */ + public static final String COLUMNNAME_Name = "Name"; + + /** Set Name. + * Alphanumeric identifier of the entity + */ + public void setName (String Name); + + /** Get Name. + * Alphanumeric identifier of the entity + */ + public String getName(); + + /** Column name PricePrecision */ + public static final String COLUMNNAME_PricePrecision = "PricePrecision"; + + /** Set Price Precision. + * Precision (number of decimals) for the Price + */ + public void setPricePrecision (BigDecimal PricePrecision); + + /** Get Price Precision. + * Precision (number of decimals) for the Price + */ + public BigDecimal getPricePrecision(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_M_Product.java b/posterita/posterita/src/main/org/compiere/model/I_M_Product.java new file mode 100644 index 0000000000..1e00a2998c --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_M_Product.java @@ -0,0 +1,741 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for M_Product + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_M_Product +{ + + /** TableName=M_Product */ + public static final String Table_Name = "M_Product"; + + /** AD_Table_ID=208 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 3 - Client - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(3); + + /** Load Meta Data */ + + /** Column name Classification */ + public static final String COLUMNNAME_Classification = "Classification"; + + /** Set Classification. + * Classification for grouping + */ + public void setClassification (String Classification); + + /** Get Classification. + * Classification for grouping + */ + public String getClassification(); + + /** Column name C_RevenueRecognition_ID */ + public static final String COLUMNNAME_C_RevenueRecognition_ID = "C_RevenueRecognition_ID"; + + /** Set Revenue Recognition. + * Method for recording revenue + */ + public void setC_RevenueRecognition_ID (int C_RevenueRecognition_ID); + + /** Get Revenue Recognition. + * Method for recording revenue + */ + public int getC_RevenueRecognition_ID(); + + public I_C_RevenueRecognition getC_RevenueRecognition() throws Exception; + + /** Column name C_SubscriptionType_ID */ + public static final String COLUMNNAME_C_SubscriptionType_ID = "C_SubscriptionType_ID"; + + /** Set Subscription Type. + * Type of subscription + */ + public void setC_SubscriptionType_ID (int C_SubscriptionType_ID); + + /** Get Subscription Type. + * Type of subscription + */ + public int getC_SubscriptionType_ID(); + + /** Column name C_TaxCategory_ID */ + public static final String COLUMNNAME_C_TaxCategory_ID = "C_TaxCategory_ID"; + + /** Set Tax Category. + * Tax Category + */ + public void setC_TaxCategory_ID (int C_TaxCategory_ID); + + /** Get Tax Category. + * Tax Category + */ + public int getC_TaxCategory_ID(); + + public I_C_TaxCategory getC_TaxCategory() throws Exception; + + /** Column name C_UOM_ID */ + public static final String COLUMNNAME_C_UOM_ID = "C_UOM_ID"; + + /** Set UOM. + * Unit of Measure + */ + public void setC_UOM_ID (int C_UOM_ID); + + /** Get UOM. + * Unit of Measure + */ + public int getC_UOM_ID(); + + public I_C_UOM getC_UOM() throws Exception; + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name DescriptionURL */ + public static final String COLUMNNAME_DescriptionURL = "DescriptionURL"; + + /** Set Description URL. + * URL for the description + */ + public void setDescriptionURL (String DescriptionURL); + + /** Get Description URL. + * URL for the description + */ + public String getDescriptionURL(); + + /** Column name Discontinued */ + public static final String COLUMNNAME_Discontinued = "Discontinued"; + + /** Set Discontinued. + * This product is no longer available + */ + public void setDiscontinued (boolean Discontinued); + + /** Get Discontinued. + * This product is no longer available + */ + public boolean isDiscontinued(); + + /** Column name DiscontinuedBy */ + public static final String COLUMNNAME_DiscontinuedBy = "DiscontinuedBy"; + + /** Set Discontinued by. + * Discontinued By + */ + public void setDiscontinuedBy (Timestamp DiscontinuedBy); + + /** Get Discontinued by. + * Discontinued By + */ + public Timestamp getDiscontinuedBy(); + + /** Column name DocumentNote */ + public static final String COLUMNNAME_DocumentNote = "DocumentNote"; + + /** Set Document Note. + * Additional information for a Document + */ + public void setDocumentNote (String DocumentNote); + + /** Get Document Note. + * Additional information for a Document + */ + public String getDocumentNote(); + + /** Column name Group1 */ + public static final String COLUMNNAME_Group1 = "Group1"; + + /** Set Group1 */ + public void setGroup1 (String Group1); + + /** Get Group1 */ + public String getGroup1(); + + /** Column name Group2 */ + public static final String COLUMNNAME_Group2 = "Group2"; + + /** Set Group2 */ + public void setGroup2 (String Group2); + + /** Get Group2 */ + public String getGroup2(); + + /** Column name GuaranteeDays */ + public static final String COLUMNNAME_GuaranteeDays = "GuaranteeDays"; + + /** Set Guarantee Days. + * Number of days the product is guaranteed or available + */ + public void setGuaranteeDays (int GuaranteeDays); + + /** Get Guarantee Days. + * Number of days the product is guaranteed or available + */ + public int getGuaranteeDays(); + + /** Column name GuaranteeDaysMin */ + public static final String COLUMNNAME_GuaranteeDaysMin = "GuaranteeDaysMin"; + + /** Set Min Guarantee Days. + * Minumum number of guarantee days + */ + public void setGuaranteeDaysMin (int GuaranteeDaysMin); + + /** Get Min Guarantee Days. + * Minumum number of guarantee days + */ + public int getGuaranteeDaysMin(); + + /** Column name Help */ + public static final String COLUMNNAME_Help = "Help"; + + /** Set Comment/Help. + * Comment or Hint + */ + public void setHelp (String Help); + + /** Get Comment/Help. + * Comment or Hint + */ + public String getHelp(); + + /** Column name ImageURL */ + public static final String COLUMNNAME_ImageURL = "ImageURL"; + + /** Set Image URL. + * URL of image + */ + public void setImageURL (String ImageURL); + + /** Get Image URL. + * URL of image + */ + public String getImageURL(); + + /** Column name IsBOM */ + public static final String COLUMNNAME_IsBOM = "IsBOM"; + + /** Set Bill of Materials. + * Bill of Materials + */ + public void setIsBOM (boolean IsBOM); + + /** Get Bill of Materials. + * Bill of Materials + */ + public boolean isBOM(); + + /** Column name IsDropShip */ + public static final String COLUMNNAME_IsDropShip = "IsDropShip"; + + /** Set Drop Shipment. + * Drop Shipments are sent from the Vendor directly to the Customer + */ + public void setIsDropShip (boolean IsDropShip); + + /** Get Drop Shipment. + * Drop Shipments are sent from the Vendor directly to the Customer + */ + public boolean isDropShip(); + + /** Column name IsExcludeAutoDelivery */ + public static final String COLUMNNAME_IsExcludeAutoDelivery = "IsExcludeAutoDelivery"; + + /** Set Exclude Auto Delivery. + * Exclude from automatic Delivery + */ + public void setIsExcludeAutoDelivery (boolean IsExcludeAutoDelivery); + + /** Get Exclude Auto Delivery. + * Exclude from automatic Delivery + */ + public boolean isExcludeAutoDelivery(); + + /** Column name IsInvoicePrintDetails */ + public static final String COLUMNNAME_IsInvoicePrintDetails = "IsInvoicePrintDetails"; + + /** Set Print detail records on invoice . + * Print detail BOM elements on the invoice + */ + public void setIsInvoicePrintDetails (boolean IsInvoicePrintDetails); + + /** Get Print detail records on invoice . + * Print detail BOM elements on the invoice + */ + public boolean isInvoicePrintDetails(); + + /** Column name IsPickListPrintDetails */ + public static final String COLUMNNAME_IsPickListPrintDetails = "IsPickListPrintDetails"; + + /** Set Print detail records on pick list. + * Print detail BOM elements on the pick list + */ + public void setIsPickListPrintDetails (boolean IsPickListPrintDetails); + + /** Get Print detail records on pick list. + * Print detail BOM elements on the pick list + */ + public boolean isPickListPrintDetails(); + + /** Column name IsPurchased */ + public static final String COLUMNNAME_IsPurchased = "IsPurchased"; + + /** Set Purchased. + * Organization purchases this product + */ + public void setIsPurchased (boolean IsPurchased); + + /** Get Purchased. + * Organization purchases this product + */ + public boolean isPurchased(); + + /** Column name IsSelfService */ + public static final String COLUMNNAME_IsSelfService = "IsSelfService"; + + /** Set Self-Service. + * This is a Self-Service entry or this entry can be changed via Self-Service + */ + public void setIsSelfService (boolean IsSelfService); + + /** Get Self-Service. + * This is a Self-Service entry or this entry can be changed via Self-Service + */ + public boolean isSelfService(); + + /** Column name IsSold */ + public static final String COLUMNNAME_IsSold = "IsSold"; + + /** Set Sold. + * Organization sells this product + */ + public void setIsSold (boolean IsSold); + + /** Get Sold. + * Organization sells this product + */ + public boolean isSold(); + + /** Column name IsStocked */ + public static final String COLUMNNAME_IsStocked = "IsStocked"; + + /** Set Stocked. + * Organization stocks this product + */ + public void setIsStocked (boolean IsStocked); + + /** Get Stocked. + * Organization stocks this product + */ + public boolean isStocked(); + + /** Column name IsSummary */ + public static final String COLUMNNAME_IsSummary = "IsSummary"; + + /** Set Summary Level. + * This is a summary entity + */ + public void setIsSummary (boolean IsSummary); + + /** Get Summary Level. + * This is a summary entity + */ + public boolean isSummary(); + + /** Column name IsVerified */ + public static final String COLUMNNAME_IsVerified = "IsVerified"; + + /** Set Verified. + * The BOM configuration has been verified + */ + public void setIsVerified (boolean IsVerified); + + /** Get Verified. + * The BOM configuration has been verified + */ + public boolean isVerified(); + + /** Column name IsWebStoreFeatured */ + public static final String COLUMNNAME_IsWebStoreFeatured = "IsWebStoreFeatured"; + + /** Set Featured in Web Store. + * If selected, the product is displayed in the inital or any empy search + */ + public void setIsWebStoreFeatured (boolean IsWebStoreFeatured); + + /** Get Featured in Web Store. + * If selected, the product is displayed in the inital or any empy search + */ + public boolean isWebStoreFeatured(); + + /** Column name M_AttributeSet_ID */ + public static final String COLUMNNAME_M_AttributeSet_ID = "M_AttributeSet_ID"; + + /** Set Attribute Set. + * Product Attribute Set + */ + public void setM_AttributeSet_ID (int M_AttributeSet_ID); + + /** Get Attribute Set. + * Product Attribute Set + */ + public int getM_AttributeSet_ID(); + + public I_M_AttributeSet getM_AttributeSet() throws Exception; + + /** Column name M_AttributeSetInstance_ID */ + public static final String COLUMNNAME_M_AttributeSetInstance_ID = "M_AttributeSetInstance_ID"; + + /** Set Attribute Set Instance. + * Product Attribute Set Instance + */ + public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID); + + /** Get Attribute Set Instance. + * Product Attribute Set Instance + */ + public int getM_AttributeSetInstance_ID(); + + /** Column name M_FreightCategory_ID */ + public static final String COLUMNNAME_M_FreightCategory_ID = "M_FreightCategory_ID"; + + /** Set Freight Category. + * Category of the Freight + */ + public void setM_FreightCategory_ID (int M_FreightCategory_ID); + + /** Get Freight Category. + * Category of the Freight + */ + public int getM_FreightCategory_ID(); + + public I_M_FreightCategory getM_FreightCategory() throws Exception; + + /** Column name M_Locator_ID */ + public static final String COLUMNNAME_M_Locator_ID = "M_Locator_ID"; + + /** Set Locator. + * Warehouse Locator + */ + public void setM_Locator_ID (int M_Locator_ID); + + /** Get Locator. + * Warehouse Locator + */ + public int getM_Locator_ID(); + + /** Column name M_Product_Category_ID */ + public static final String COLUMNNAME_M_Product_Category_ID = "M_Product_Category_ID"; + + /** Set Product Category. + * Category of a Product + */ + public void setM_Product_Category_ID (int M_Product_Category_ID); + + /** Get Product Category. + * Category of a Product + */ + public int getM_Product_Category_ID(); + + public I_M_Product_Category getM_Product_Category() throws Exception; + + /** Column name M_Product_ID */ + public static final String COLUMNNAME_M_Product_ID = "M_Product_ID"; + + /** Set Product. + * Product, Service, Item + */ + public void setM_Product_ID (int M_Product_ID); + + /** Get Product. + * Product, Service, Item + */ + public int getM_Product_ID(); + + /** Column name Name */ + public static final String COLUMNNAME_Name = "Name"; + + /** Set Name. + * Alphanumeric identifier of the entity + */ + public void setName (String Name); + + /** Get Name. + * Alphanumeric identifier of the entity + */ + public String getName(); + + /** Column name Processing */ + public static final String COLUMNNAME_Processing = "Processing"; + + /** Set Process Now */ + public void setProcessing (boolean Processing); + + /** Get Process Now */ + public boolean isProcessing(); + + /** Column name ProductType */ + public static final String COLUMNNAME_ProductType = "ProductType"; + + /** Set Product Type. + * Type of product + */ + public void setProductType (String ProductType); + + /** Get Product Type. + * Type of product + */ + public String getProductType(); + + /** Column name R_MailText_ID */ + public static final String COLUMNNAME_R_MailText_ID = "R_MailText_ID"; + + /** Set Mail Template. + * Text templates for mailings + */ + public void setR_MailText_ID (int R_MailText_ID); + + /** Get Mail Template. + * Text templates for mailings + */ + public int getR_MailText_ID(); + + public I_R_MailText getR_MailText() throws Exception; + + /** Column name SalesRep_ID */ + public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID"; + + /** Set Sales Representative. + * Sales Representative or Company Agent + */ + public void setSalesRep_ID (int SalesRep_ID); + + /** Get Sales Representative. + * Sales Representative or Company Agent + */ + public int getSalesRep_ID(); + + /** Column name S_ExpenseType_ID */ + public static final String COLUMNNAME_S_ExpenseType_ID = "S_ExpenseType_ID"; + + /** Set Expense Type. + * Expense report type + */ + public void setS_ExpenseType_ID (int S_ExpenseType_ID); + + /** Get Expense Type. + * Expense report type + */ + public int getS_ExpenseType_ID(); + + public I_S_ExpenseType getS_ExpenseType() throws Exception; + + /** Column name ShelfDepth */ + public static final String COLUMNNAME_ShelfDepth = "ShelfDepth"; + + /** Set Shelf Depth. + * Shelf depth required + */ + public void setShelfDepth (int ShelfDepth); + + /** Get Shelf Depth. + * Shelf depth required + */ + public int getShelfDepth(); + + /** Column name ShelfHeight */ + public static final String COLUMNNAME_ShelfHeight = "ShelfHeight"; + + /** Set Shelf Height. + * Shelf height required + */ + public void setShelfHeight (int ShelfHeight); + + /** Get Shelf Height. + * Shelf height required + */ + public int getShelfHeight(); + + /** Column name ShelfWidth */ + public static final String COLUMNNAME_ShelfWidth = "ShelfWidth"; + + /** Set Shelf Width. + * Shelf width required + */ + public void setShelfWidth (int ShelfWidth); + + /** Get Shelf Width. + * Shelf width required + */ + public int getShelfWidth(); + + /** Column name SKU */ + public static final String COLUMNNAME_SKU = "SKU"; + + /** Set SKU. + * Stock Keeping Unit + */ + public void setSKU (String SKU); + + /** Get SKU. + * Stock Keeping Unit + */ + public String getSKU(); + + /** Column name S_Resource_ID */ + public static final String COLUMNNAME_S_Resource_ID = "S_Resource_ID"; + + /** Set Resource. + * Resource + */ + public void setS_Resource_ID (int S_Resource_ID); + + /** Get Resource. + * Resource + */ + public int getS_Resource_ID(); + + public I_S_Resource getS_Resource() throws Exception; + + /** Column name UnitsPerPack */ + public static final String COLUMNNAME_UnitsPerPack = "UnitsPerPack"; + + /** Set UnitsPerPack. + * The Units Per Pack indicates the no of units of a product packed together. + */ + public void setUnitsPerPack (int UnitsPerPack); + + /** Get UnitsPerPack. + * The Units Per Pack indicates the no of units of a product packed together. + */ + public int getUnitsPerPack(); + + /** Column name UnitsPerPallet */ + public static final String COLUMNNAME_UnitsPerPallet = "UnitsPerPallet"; + + /** Set Units Per Pallet. + * Units Per Pallet + */ + public void setUnitsPerPallet (int UnitsPerPallet); + + /** Get Units Per Pallet. + * Units Per Pallet + */ + public int getUnitsPerPallet(); + + /** Column name UPC */ + public static final String COLUMNNAME_UPC = "UPC"; + + /** Set UPC/EAN. + * Bar Code (Universal Product Code or its superset European Article Number) + */ + public void setUPC (String UPC); + + /** Get UPC/EAN. + * Bar Code (Universal Product Code or its superset European Article Number) + */ + public String getUPC(); + + /** Column name Value */ + public static final String COLUMNNAME_Value = "Value"; + + /** Set Search Key. + * Search key for the record in the format required - must be unique + */ + public void setValue (String Value); + + /** Get Search Key. + * Search key for the record in the format required - must be unique + */ + public String getValue(); + + /** Column name VersionNo */ + public static final String COLUMNNAME_VersionNo = "VersionNo"; + + /** Set Version No. + * Version Number + */ + public void setVersionNo (String VersionNo); + + /** Get Version No. + * Version Number + */ + public String getVersionNo(); + + /** Column name Volume */ + public static final String COLUMNNAME_Volume = "Volume"; + + /** Set Volume. + * Volume of a product + */ + public void setVolume (BigDecimal Volume); + + /** Get Volume. + * Volume of a product + */ + public BigDecimal getVolume(); + + /** Column name Weight */ + public static final String COLUMNNAME_Weight = "Weight"; + + /** Set Weight. + * Weight of a product + */ + public void setWeight (BigDecimal Weight); + + /** Get Weight. + * Weight of a product + */ + public BigDecimal getWeight(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/I_U_POSTerminal.java b/posterita/posterita/src/main/org/compiere/model/I_U_POSTerminal.java new file mode 100644 index 0000000000..1e3fb600b1 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/I_U_POSTerminal.java @@ -0,0 +1,411 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for U_POSTerminal + * @author Trifon Trifonov (generated) + * @version Release 3.4.0s + */ +public interface I_U_POSTerminal +{ + + /** TableName=U_POSTerminal */ + public static final String Table_Name = "U_POSTerminal"; + + /** AD_Table_ID=52004 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 1 - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(1); + + /** Load Meta Data */ + + /** Column name AutoLock */ + public static final String COLUMNNAME_AutoLock = "AutoLock"; + + /** Set Auto Lock. + * Whether to automatically lock the terminal when till is closed + */ + public void setAutoLock (boolean AutoLock); + + /** Get Auto Lock. + * Whether to automatically lock the terminal when till is closed + */ + public boolean isAutoLock(); + + /** Column name Card_BankAccount_ID */ + public static final String COLUMNNAME_Card_BankAccount_ID = "Card_BankAccount_ID"; + + /** Set Card Bank Account. + * Bank Account on which card transactions will be processed + */ + public void setCard_BankAccount_ID (int Card_BankAccount_ID); + + /** Get Card Bank Account. + * Bank Account on which card transactions will be processed + */ + public int getCard_BankAccount_ID(); + + /** Column name CardTransferBankAccount_ID */ + public static final String COLUMNNAME_CardTransferBankAccount_ID = "CardTransferBankAccount_ID"; + + /** Set Transfer Card trx to. + * Bank account on which to transfer Card transactions + */ + public void setCardTransferBankAccount_ID (int CardTransferBankAccount_ID); + + /** Get Transfer Card trx to. + * Bank account on which to transfer Card transactions + */ + public int getCardTransferBankAccount_ID(); + + /** Column name CardTransferCashBook_ID */ + public static final String COLUMNNAME_CardTransferCashBook_ID = "CardTransferCashBook_ID"; + + /** Set Transfer Card trx to. + * Cash Book on which to transfer all Card transactions + */ + public void setCardTransferCashBook_ID (int CardTransferCashBook_ID); + + /** Get Transfer Card trx to. + * Cash Book on which to transfer all Card transactions + */ + public int getCardTransferCashBook_ID(); + + /** Column name CardTransferType */ + public static final String COLUMNNAME_CardTransferType = "CardTransferType"; + + /** Set Card Transfer Type */ + public void setCardTransferType (String CardTransferType); + + /** Get Card Transfer Type */ + public String getCardTransferType(); + + /** Column name CashBookTransferType */ + public static final String COLUMNNAME_CashBookTransferType = "CashBookTransferType"; + + /** Set Cash Book Transfer Type. + * Where the money in the cash book should be transfered to. Either a Bank Account or another Cash Book + */ + public void setCashBookTransferType (String CashBookTransferType); + + /** Get Cash Book Transfer Type. + * Where the money in the cash book should be transfered to. Either a Bank Account or another Cash Book + */ + public String getCashBookTransferType(); + + /** Column name CashTransferBankAccount_ID */ + public static final String COLUMNNAME_CashTransferBankAccount_ID = "CashTransferBankAccount_ID"; + + /** Set Transfer Cash trx to. + * Bank Account on which to transfer all Cash transactions + */ + public void setCashTransferBankAccount_ID (int CashTransferBankAccount_ID); + + /** Get Transfer Cash trx to. + * Bank Account on which to transfer all Cash transactions + */ + public int getCashTransferBankAccount_ID(); + + /** Column name CashTransferCashBook_ID */ + public static final String COLUMNNAME_CashTransferCashBook_ID = "CashTransferCashBook_ID"; + + /** Set Transfer Cash trx to. + * Cash Book on which to transfer all Cash transactions + */ + public void setCashTransferCashBook_ID (int CashTransferCashBook_ID); + + /** Get Transfer Cash trx to. + * Cash Book on which to transfer all Cash transactions + */ + public int getCashTransferCashBook_ID(); + + /** Column name C_CashBook_ID */ + public static final String COLUMNNAME_C_CashBook_ID = "C_CashBook_ID"; + + /** Set Cash Book. + * Cash Book for recording petty cash transactions + */ + public void setC_CashBook_ID (int C_CashBook_ID); + + /** Get Cash Book. + * Cash Book for recording petty cash transactions + */ + public int getC_CashBook_ID(); + + public I_C_CashBook getC_CashBook() throws Exception; + + /** Column name C_CashBPartner_ID */ + public static final String COLUMNNAME_C_CashBPartner_ID = "C_CashBPartner_ID"; + + /** Set Cash BPartner. + * BPartner to be used for Cash transactions + */ + public void setC_CashBPartner_ID (int C_CashBPartner_ID); + + /** Get Cash BPartner. + * BPartner to be used for Cash transactions + */ + public int getC_CashBPartner_ID(); + + /** Column name Check_BankAccount_ID */ + public static final String COLUMNNAME_Check_BankAccount_ID = "Check_BankAccount_ID"; + + /** Set Check Bank Account. + * Bank Account to be used for processing Check transactions + */ + public void setCheck_BankAccount_ID (int Check_BankAccount_ID); + + /** Get Check Bank Account. + * Bank Account to be used for processing Check transactions + */ + public int getCheck_BankAccount_ID(); + + /** Column name CheckTransferBankAccount_ID */ + public static final String COLUMNNAME_CheckTransferBankAccount_ID = "CheckTransferBankAccount_ID"; + + /** Set Tranfer Check trx to. + * Bank account on which to transfer Check transactions + */ + public void setCheckTransferBankAccount_ID (int CheckTransferBankAccount_ID); + + /** Get Tranfer Check trx to. + * Bank account on which to transfer Check transactions + */ + public int getCheckTransferBankAccount_ID(); + + /** Column name CheckTransferCashBook_ID */ + public static final String COLUMNNAME_CheckTransferCashBook_ID = "CheckTransferCashBook_ID"; + + /** Set Transfer Check trx to. + * Cash Book on which to transfer all Check transactions + */ + public void setCheckTransferCashBook_ID (int CheckTransferCashBook_ID); + + /** Get Transfer Check trx to. + * Cash Book on which to transfer all Check transactions + */ + public int getCheckTransferCashBook_ID(); + + /** Column name CheckTransferType */ + public static final String COLUMNNAME_CheckTransferType = "CheckTransferType"; + + /** Set Check Transfer Type */ + public void setCheckTransferType (String CheckTransferType); + + /** Get Check Transfer Type */ + public String getCheckTransferType(); + + /** Column name C_TemplateBPartner_ID */ + public static final String COLUMNNAME_C_TemplateBPartner_ID = "C_TemplateBPartner_ID"; + + /** Set Template BPartner. + * BPartner that is to be used as template when new customers are created + */ + public void setC_TemplateBPartner_ID (int C_TemplateBPartner_ID); + + /** Get Template BPartner. + * BPartner that is to be used as template when new customers are created + */ + public int getC_TemplateBPartner_ID(); + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name Help */ + public static final String COLUMNNAME_Help = "Help"; + + /** Set Comment/Help. + * Comment or Hint + */ + public void setHelp (String Help); + + /** Get Comment/Help. + * Comment or Hint + */ + public String getHelp(); + + /** Column name LastLockTime */ + public static final String COLUMNNAME_LastLockTime = "LastLockTime"; + + /** Set Last Lock Time. + * Last time at which the terminal was locked + */ + public void setLastLockTime (Timestamp LastLockTime); + + /** Get Last Lock Time. + * Last time at which the terminal was locked + */ + public Timestamp getLastLockTime(); + + /** Column name Locked */ + public static final String COLUMNNAME_Locked = "Locked"; + + /** Set Locked. + * Whether the terminal is locked + */ + public void setLocked (boolean Locked); + + /** Get Locked. + * Whether the terminal is locked + */ + public boolean isLocked(); + + /** Column name LockTime */ + public static final String COLUMNNAME_LockTime = "LockTime"; + + /** Set Lock Time. + * Time in minutes the terminal should be kept in a locked state. + */ + public void setLockTime (int LockTime); + + /** Get Lock Time. + * Time in minutes the terminal should be kept in a locked state. + */ + public int getLockTime(); + + /** Column name M_Warehouse_ID */ + public static final String COLUMNNAME_M_Warehouse_ID = "M_Warehouse_ID"; + + /** Set Warehouse. + * Storage Warehouse and Service Point + */ + public void setM_Warehouse_ID (int M_Warehouse_ID); + + /** Get Warehouse. + * Storage Warehouse and Service Point + */ + public int getM_Warehouse_ID(); + + public I_M_Warehouse getM_Warehouse() throws Exception; + + /** Column name Name */ + public static final String COLUMNNAME_Name = "Name"; + + /** Set Name. + * Alphanumeric identifier of the entity + */ + public void setName (String Name); + + /** Get Name. + * Alphanumeric identifier of the entity + */ + public String getName(); + + /** Column name PO_PriceList_ID */ + public static final String COLUMNNAME_PO_PriceList_ID = "PO_PriceList_ID"; + + /** Set Purchase Pricelist. + * Price List used by this Business Partner + */ + public void setPO_PriceList_ID (int PO_PriceList_ID); + + /** Get Purchase Pricelist. + * Price List used by this Business Partner + */ + public int getPO_PriceList_ID(); + + /** Column name PrinterName */ + public static final String COLUMNNAME_PrinterName = "PrinterName"; + + /** Set Printer Name. + * Name of the Printer + */ + public void setPrinterName (String PrinterName); + + /** Get Printer Name. + * Name of the Printer + */ + public String getPrinterName(); + + /** Column name SalesRep_ID */ + public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID"; + + /** Set Sales Representative. + * Sales Representative or Company Agent + */ + public void setSalesRep_ID (int SalesRep_ID); + + /** Get Sales Representative. + * Sales Representative or Company Agent + */ + public int getSalesRep_ID(); + + /** Column name SO_PriceList_ID */ + public static final String COLUMNNAME_SO_PriceList_ID = "SO_PriceList_ID"; + + /** Set Sales Pricelist */ + public void setSO_PriceList_ID (int SO_PriceList_ID); + + /** Get Sales Pricelist */ + public int getSO_PriceList_ID(); + + /** Column name UnlockingTime */ + public static final String COLUMNNAME_UnlockingTime = "UnlockingTime"; + + /** Set UnlockingTime. + * Time at which the terminal should be unlocked + */ + public void setUnlockingTime (Timestamp UnlockingTime); + + /** Get UnlockingTime. + * Time at which the terminal should be unlocked + */ + public Timestamp getUnlockingTime(); + + /** Column name U_POSTerminal_ID */ + public static final String COLUMNNAME_U_POSTerminal_ID = "U_POSTerminal_ID"; + + /** Set POS Terminal */ + public void setU_POSTerminal_ID (int U_POSTerminal_ID); + + /** Get POS Terminal */ + public int getU_POSTerminal_ID(); +} diff --git a/posterita/posterita/src/main/org/compiere/model/MCash.java b/posterita/posterita/src/main/org/compiere/model/MCash.java new file mode 100644 index 0000000000..3ac5cc18dd --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MCash.java @@ -0,0 +1,780 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.io.File; +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.process.DocAction; +import org.compiere.process.DocumentEngine; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; + +/** + * Cash Journal Model + * + * @author Jorg Janke + * @version $Id: MCash.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ + * + * @author Teo Sarca, SC ARHIPAC SERVICE SRL + *
  • BF [ 1831997 ] Cash journal allocation reversed + *
  • BF [ 1894524 ] Pay an reversed invoice + */ +public class MCash extends X_C_Cash implements DocAction +{ + /** + * Get Cash Journal for currency, org and date + * @param ctx context + * @param C_Currency_ID currency + * @param AD_Org_ID org + * @param dateAcct date + * @param trxName transaction + * @return cash + */ + public static MCash get (Properties ctx, int AD_Org_ID, + Timestamp dateAcct, int C_Currency_ID, String trxName) + { + MCash retValue = null; + // Existing Journal + String sql; + sql = "SELECT * FROM C_Cash c " + + "WHERE c.AD_Org_ID=?" // #1 + + " AND TRUNC(c.StatementDate)=?" // #2 + + " AND c.Processed='N'" + + " AND EXISTS (SELECT * FROM C_CashBook cb " + + "WHERE c.C_CashBook_ID=cb.C_CashBook_ID AND cb.AD_Org_ID=c.AD_Org_ID" + + " AND cb.C_Currency_ID=?)"; // #3 + + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement (sql, trxName); + pstmt.setInt (1, AD_Org_ID); + pstmt.setTimestamp (2, TimeUtil.getDay(dateAcct)); + pstmt.setInt (3, C_Currency_ID); + rs = pstmt.executeQuery (); + if (rs.next ()) + retValue = new MCash (ctx, rs, trxName); + } + catch (Exception e) + { + s_log.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + if (retValue != null) + return retValue; + + // Get CashBook + MCashBook cb = MCashBook.get (ctx, AD_Org_ID, C_Currency_ID); + if (cb == null) + { + s_log.warning("No CashBook for AD_Org_ID=" + AD_Org_ID + ", C_Currency_ID=" + C_Currency_ID); + return null; + } + + // Create New Journal + retValue = new MCash (cb, dateAcct); + retValue.save(trxName); + return retValue; + } // get + + /** + * Get Cash Journal for CashBook and date + * @param ctx context + * @param C_CashBook_ID cashbook + * @param dateAcct date + * @param trxName transaction + * @return cash + */ + public static MCash get (Properties ctx, int C_CashBook_ID, + Timestamp dateAcct, String trxName) + { + MCash retValue = null; + // Existing Journal + String sql = "SELECT * FROM C_Cash c " + + "WHERE c.C_CashBook_ID=?" // #1 + + " AND TRUNC(c.StatementDate)=?" // #2 + + " AND c.Processed='N'"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement (sql, trxName); + pstmt.setInt (1, C_CashBook_ID); + pstmt.setTimestamp (2, TimeUtil.getDay(dateAcct)); + rs = pstmt.executeQuery (); + if (rs.next ()) + retValue = new MCash (ctx, rs, trxName); + } + catch (Exception e) + { + s_log.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + if (retValue != null) + return retValue; + + // Get CashBook + MCashBook cb = new MCashBook (ctx, C_CashBook_ID, trxName); + if (cb.get_ID() ==0) + { + s_log.warning("Not found C_CashBook_ID=" + C_CashBook_ID); + return null; + } + + // Create New Journal + retValue = new MCash (cb, dateAcct); + retValue.save(trxName); + return retValue; + } // get + + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (MCash.class); + + + /************************************************************************** + * Standard Constructor + * @param ctx context + * @param C_Cash_ID id + * @param trxName transaction + */ + public MCash (Properties ctx, int C_Cash_ID, String trxName) + { + super (ctx, C_Cash_ID, trxName); + if (C_Cash_ID == 0) + { + // setC_CashBook_ID (0); // FK + setBeginningBalance (Env.ZERO); + setEndingBalance (Env.ZERO); + setStatementDifference(Env.ZERO); + setDocAction(DOCACTION_Complete); + setDocStatus(DOCSTATUS_Drafted); + // + Timestamp today = TimeUtil.getDay(System.currentTimeMillis()); + setStatementDate (today); // @#Date@ + setDateAcct (today); // @#Date@ + String name = DisplayType.getDateFormat(DisplayType.Date).format(today) + + " " + MOrg.get(ctx, getAD_Org_ID()).getValue(); + setName (name); + setIsApproved(false); + setPosted (false); // N + setProcessed (false); + } + } // MCash + + /** + * Load Constructor + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MCash (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MCash + + /** + * Parent Constructor + * @param cb cash book + * @param today date - if null today + */ + public MCash (MCashBook cb, Timestamp today) + { + this (cb.getCtx(), 0, cb.get_TrxName()); + setClientOrg(cb); + setC_CashBook_ID(cb.getC_CashBook_ID()); + if (today != null) + { + setStatementDate (today); + setDateAcct (today); + String name = DisplayType.getDateFormat(DisplayType.Date).format(today) + + " " + cb.getName(); + setName (name); + } + m_book = cb; + } // MCash + + /** Lines */ + private MCashLine[] m_lines = null; + /** CashBook */ + private MCashBook m_book = null; + + /** + * Get Lines + * @param requery requery + * @return lines + */ + public MCashLine[] getLines (boolean requery) + { + if (m_lines != null && !requery) { + set_TrxName(m_lines, get_TrxName()); + return m_lines; + } + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM C_CashLine WHERE C_Cash_ID=? ORDER BY Line"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement (sql, get_TrxName()); + pstmt.setInt (1, getC_Cash_ID()); + rs = pstmt.executeQuery (); + while (rs.next ()) + list.add (new MCashLine (getCtx(), rs, get_TrxName())); + } + catch (Exception e) + { + log.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + + m_lines = new MCashLine[list.size ()]; + list.toArray (m_lines); + return m_lines; + } // getLines + + /** + * Get Cash Book + * @return cash book + */ + public MCashBook getCashBook() + { + if (m_book == null) + m_book = MCashBook.get(getCtx(), getC_CashBook_ID()); + return m_book; + } // getCashBook + + /** + * Get Document No + * @return name + */ + public String getDocumentNo() + { + return getName(); + } // getDocumentNo + + /** + * Get Document Info + * @return document info (untranslated) + */ + public String getDocumentInfo() + { + return Msg.getElement(getCtx(), "C_Cash_ID") + " " + getDocumentNo(); + } // getDocumentInfo + + /** + * Create PDF + * @return File or null + */ + public File createPDF () + { + try + { + File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf"); + return createPDF (temp); + } + catch (Exception e) + { + log.severe("Could not create PDF - " + e.getMessage()); + } + return null; + } // getPDF + + /** + * Create PDF file + * @param file output file + * @return file if success + */ + public File createPDF (File file) + { + // ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID()); + // if (re == null) + return null; + // return re.getPDF(file); + } // createPDF + + /** + * Before Save + * @param newRecord + * @return true + */ + protected boolean beforeSave (boolean newRecord) + { + setAD_Org_ID(getCashBook().getAD_Org_ID()); + if (getAD_Org_ID() == 0) + { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@AD_Org_ID@")); + return false; + } + // Calculate End Balance + setEndingBalance(getBeginningBalance().add(getStatementDifference())); + return true; + } // beforeSave + + + /************************************************************************** + * Process document + * @param processAction document action + * @return true if performed + */ + public boolean processIt (String processAction) + { + m_processMsg = null; + DocumentEngine engine = new DocumentEngine (this, getDocStatus()); + return engine.processIt (processAction, getDocAction()); + } // process + + /** Process Message */ + private String m_processMsg = null; + /** Just Prepared Flag */ + private boolean m_justPrepared = false; + + /** + * Unlock Document. + * @return true if success + */ + public boolean unlockIt() + { + log.info(toString()); + setProcessing(false); + return true; + } // unlockIt + + /** + * Invalidate Document + * @return true if success + */ + public boolean invalidateIt() + { + log.info(toString()); + setDocAction(DOCACTION_Prepare); + return true; + } // invalidateIt + + /** + * Prepare Document + * @return new status (In Progress or Invalid) + */ + public String prepareIt() + { + log.info(toString()); + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + // Std Period open? + if (!MPeriod.isOpen(getCtx(), getDateAcct(), MDocType.DOCBASETYPE_CashJournal)) + { + m_processMsg = "@PeriodClosed@"; + return DocAction.STATUS_Invalid; + } + MCashLine[] lines = getLines(false); + if (lines.length == 0) + { + m_processMsg = "@NoLines@"; + return DocAction.STATUS_Invalid; + } + // Add up Amounts + BigDecimal difference = Env.ZERO; + int C_Currency_ID = getC_Currency_ID(); + for (int i = 0; i < lines.length; i++) + { + MCashLine line = lines[i]; + if (!line.isActive()) + continue; + if (C_Currency_ID == line.getC_Currency_ID()) + difference = difference.add(line.getAmount()); + else + { + BigDecimal amt = MConversionRate.convert(getCtx(), line.getAmount(), + line.getC_Currency_ID(), C_Currency_ID, getDateAcct(), 0, + getAD_Client_ID(), getAD_Org_ID()); + if (amt == null) + { + m_processMsg = "No Conversion Rate found - @C_CashLine_ID@= " + line.getLine(); + return DocAction.STATUS_Invalid; + } + difference = difference.add(amt); + } + } + setStatementDifference(difference); + // setEndingBalance(getBeginningBalance().add(getStatementDifference())); + + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + m_justPrepared = true; + if (!DOCACTION_Complete.equals(getDocAction())) + setDocAction(DOCACTION_Complete); + return DocAction.STATUS_InProgress; + } // prepareIt + + /** + * Approve Document + * @return true if success + */ + public boolean approveIt() + { + log.info(toString()); + setIsApproved(true); + return true; + } // approveIt + + /** + * Reject Approval + * @return true if success + */ + public boolean rejectIt() + { + log.info(toString()); + setIsApproved(false); + return true; + } // rejectIt + + /** + * Complete Document + * @return new status (Complete, In Progress, Invalid, Waiting ..) + */ + public String completeIt() + { + // Re-Check + if (!m_justPrepared) + { + String status = prepareIt(); + if (!DocAction.STATUS_InProgress.equals(status)) + return status; + } + + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + + // Implicit Approval + if (!isApproved()) + approveIt(); + // + log.info(toString()); + + MCashLine[] lines = getLines(false); + for (int i = 0; i < lines.length; i++) + { + MCashLine line = lines[i]; + if (MCashLine.CASHTYPE_Invoice.equals(line.getCashType())) + { + // Check if the invoice is completed - teo_sarca BF [ 1894524 ] + MInvoice invoice = line.getInvoice(); + if (!MInvoice.DOCSTATUS_Completed.equals(invoice.getDocStatus()) + && !MInvoice.DOCSTATUS_Closed.equals(invoice.getDocStatus())) + { + m_processMsg = "@Line@ "+line.getLine()+": @InvoiceCreateDocNotCompleted@"; + return DocAction.STATUS_Invalid; + } + // + String name = Msg.translate(getCtx(), "C_Cash_ID") + ": " + getName() + + " - " + Msg.translate(getCtx(), "Line") + " " + line.getLine(); + MAllocationHdr hdr = new MAllocationHdr(getCtx(), false, + getDateAcct(), line.getC_Currency_ID(), + name, get_TrxName()); + hdr.setAD_Org_ID(getAD_Org_ID()); + if (!hdr.save()) + { + m_processMsg = CLogger.retrieveErrorString("Could not create Allocation Hdr"); + return DocAction.STATUS_Invalid; + } + // Allocation Line + MAllocationLine aLine = new MAllocationLine (hdr, line.getAmount(), + line.getDiscountAmt(), line.getWriteOffAmt(), Env.ZERO); + aLine.setC_Invoice_ID(line.getC_Invoice_ID()); + aLine.setC_CashLine_ID(line.getC_CashLine_ID()); + if (!aLine.save()) + { + m_processMsg = CLogger.retrieveErrorString("Could not create Allocation Line"); + return DocAction.STATUS_Invalid; + } + // Should start WF + if(!hdr.processIt(DocAction.ACTION_Complete)) { + m_processMsg = CLogger.retrieveErrorString("Could not process Allocation"); + return DocAction.STATUS_Invalid; + } + if (!hdr.save()) { + m_processMsg = CLogger.retrieveErrorString("Could not save Allocation"); + return DocAction.STATUS_Invalid; + } + } + else if (MCashLine.CASHTYPE_BankAccountTransfer.equals(line.getCashType())) + { + // Payment just as intermediate info + MPayment pay = new MPayment (getCtx(), 0, get_TrxName()); + pay.setAD_Org_ID(getAD_Org_ID()); + String documentNo = getName(); + pay.setDocumentNo(documentNo); + pay.setR_PnRef(documentNo); + pay.set_Value("TrxType", "X"); // Transfer + pay.set_Value("TenderType", "X"); + // + //Modification for cash payment + pay.setC_CashBook_ID(getC_CashBook_ID()); + //End of modification + + pay.setC_BankAccount_ID(line.getC_BankAccount_ID()); + pay.setC_DocType_ID(true); // Receipt + pay.setDateTrx(getStatementDate()); + pay.setDateAcct(getDateAcct()); + pay.setAmount(line.getC_Currency_ID(), line.getAmount().negate()); // Transfer + pay.setDescription(line.getDescription()); + pay.setDocStatus(MPayment.DOCSTATUS_Closed); + pay.setDocAction(MPayment.DOCACTION_None); + pay.setPosted(true); + pay.setIsAllocated(true); // Has No Allocation! + pay.setProcessed(true); + if (!pay.save()) + { + m_processMsg = CLogger.retrieveErrorString("Could not create Payment"); + return DocAction.STATUS_Invalid; + } + } + } + + // User Validation + String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); + if (valid != null) + { + m_processMsg = valid; + return DocAction.STATUS_Invalid; + } + // + setProcessed(true); + setDocAction(DOCACTION_Close); + return DocAction.STATUS_Completed; + } // completeIt + + /** + * Void Document. + * Same as Close. + * @return true if success + */ + public boolean voidIt() + { + log.info(toString()); + // Before Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID); + if (m_processMsg != null) + return false; + // After Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID); + if (m_processMsg != null) + return false; + setDocAction(DOCACTION_None); + return false; + } // voidIt + + /** + * Close Document. + * Cancel not delivered Qunatities + * @return true if success + */ + public boolean closeIt() + { + log.info(toString()); + // Before Close + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE); + if (m_processMsg != null) + return false; + // After Close + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE); + if (m_processMsg != null) + return false; + + setDocAction(DOCACTION_None); + return true; + } // closeIt + + /** + * Reverse Correction + * @return true if success + */ + public boolean reverseCorrectIt() + { + log.info(toString()); + // Before reverseCorrect + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT); + if (m_processMsg != null) + return false; + + // After reverseCorrect + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); + if (m_processMsg != null) + return false; + + return false; + } // reverseCorrectionIt + + /** + * Reverse Accrual - none + * @return true if success + */ + public boolean reverseAccrualIt() + { + log.info(toString()); + // Before reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL); + if (m_processMsg != null) + return false; + + // After reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); + if (m_processMsg != null) + return false; + + return false; + } // reverseAccrualIt + + /** + * Re-activate + * @return true if success + */ + public boolean reActivateIt() + { + log.info(toString()); + // Before reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE); + if (m_processMsg != null) + return false; + + setProcessed(false); + if (reverseCorrectIt()) + return true; + + // After reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE); + if (m_processMsg != null) + return false; + return false; + } // reActivateIt + + /** + * Set Processed + * @param processed processed + */ + public void setProcessed (boolean processed) + { + super.setProcessed (processed); + String sql = "UPDATE C_CashLine SET Processed='" + + (processed ? "Y" : "N") + + "' WHERE C_Cash_ID=" + getC_Cash_ID(); + int noLine = DB.executeUpdate (sql, get_TrxName()); + m_lines = null; + log.fine(processed + " - Lines=" + noLine); + } // setProcessed + + /** + * String Representation + * @return info + */ + public String toString () + { + StringBuffer sb = new StringBuffer ("MCash["); + sb.append (get_ID ()) + .append ("-").append (getName()) + .append(", Balance=").append(getBeginningBalance()) + .append("->").append(getEndingBalance()) + .append ("]"); + return sb.toString (); + } // toString + + /************************************************************************* + * Get Summary + * @return Summary of Document + */ + public String getSummary() + { + StringBuffer sb = new StringBuffer(); + sb.append(getName()); + // : Total Lines = 123.00 (#1) + sb.append(": ") + .append(Msg.translate(getCtx(),"BeginningBalance")).append("=").append(getBeginningBalance()) + .append(",") + .append(Msg.translate(getCtx(),"EndingBalance")).append("=").append(getEndingBalance()) + .append(" (#").append(getLines(false).length).append(")"); + // - Description + if (getDescription() != null && getDescription().length() > 0) + sb.append(" - ").append(getDescription()); + return sb.toString(); + } // getSummary + + /** + * Get Process Message + * @return clear text error message + */ + public String getProcessMsg() + { + return m_processMsg; + } // getProcessMsg + + /** + * Get Document Owner (Responsible) + * @return AD_User_ID + */ + public int getDoc_User_ID() + { + return getCreatedBy(); + } // getDoc_User_ID + + /** + * Get Document Approval Amount + * @return amount difference + */ + public BigDecimal getApprovalAmt() + { + return getStatementDifference(); + } // getApprovalAmt + + /** + * Get Currency + * @return Currency + */ + public int getC_Currency_ID () + { + return getCashBook().getC_Currency_ID(); + } // getC_Currency_ID + +} // MCash diff --git a/posterita/posterita/src/main/org/compiere/model/MCashBook.java b/posterita/posterita/src/main/org/compiere/model/MCashBook.java new file mode 100644 index 0000000000..f563eba26b --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MCashBook.java @@ -0,0 +1,170 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.sql.*; +import java.util.*; +import java.util.logging.*; +import org.compiere.util.*; + +/** + * Cash Book Model + * + * @author Jorg Janke + * @version $Id: MCashBook.java,v 1.3 2006/07/30 00:51:02 jjanke Exp $ + */ +public class MCashBook extends X_C_CashBook +{ + /** + * Get MCashBook from Cache + * @param ctx context + * @param C_CashBook_ID id + * @return MCashBook + */ + public static MCashBook get (Properties ctx, int C_CashBook_ID) + { + return get(ctx, C_CashBook_ID, null); + } // get + + /** + * Gets MCashBook from Cache under transaction scope + * @param ctx context + * @param C_CashBook_ID id of cashbook to load + * @param trxName transaction name + * @return Cashbook + */ + public static MCashBook get(Properties ctx, int C_CashBook_ID, String trxName) + { + Integer key = new Integer (C_CashBook_ID); + MCashBook retValue = (MCashBook) s_cache.get (key); + if (retValue != null) + return retValue; + retValue = new MCashBook (ctx, C_CashBook_ID, trxName); + if (retValue.get_ID () != 0) + s_cache.put (key, retValue); + return retValue; + } + /** + * Get CashBook for Org and Currency + * @param ctx context + * @param AD_Org_ID org + * @param C_Currency_ID currency + * @return cash book or null + */ + public static MCashBook get (Properties ctx, int AD_Org_ID, int C_Currency_ID) + { + // Try from cache + Iterator it = s_cache.values().iterator(); + while (it.hasNext()) + { + MCashBook cb = (MCashBook)it.next(); + if (cb.getAD_Org_ID() == AD_Org_ID && cb.getC_Currency_ID() == C_Currency_ID) + return cb; + } + + // Get from DB + MCashBook retValue = null; + String sql = "SELECT * FROM C_CashBook " + + "WHERE AD_Org_ID=? AND C_Currency_ID=? " + + "ORDER BY IsDefault DESC"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, null); + pstmt.setInt (1, AD_Org_ID); + pstmt.setInt (2, C_Currency_ID); + ResultSet rs = pstmt.executeQuery (); + if (rs.next ()) + { + retValue = new MCashBook (ctx, rs, null); + Integer key = new Integer (retValue.getC_CashBook_ID()); + s_cache.put (key, retValue); + } + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + s_log.log(Level.SEVERE, "get", e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + return retValue; + } // get + + + /** Cache */ + private static CCache s_cache + = new CCache("", 20); + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (MCashBook.class); + + /************************************************************************** + * Standard Constructor + * @param ctx context + * @param C_CashBook_ID id + * @param trxName transaction + */ + public MCashBook (Properties ctx, int C_CashBook_ID, String trxName) + { + super (ctx, C_CashBook_ID, trxName); + } // MCashBook + + /** + * Load Constructor + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MCashBook (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MCashBook + + /** + * After Save + * @param newRecord new + * @param success success + * @return success + */ + protected boolean afterSave (boolean newRecord, boolean success) + { + if (newRecord && success) + insert_Accounting("C_CashBook_Acct", "C_AcctSchema_Default", null); + + return success; + } // afterSave + + /** + * Before Delete + * @return true + */ + protected boolean beforeDelete () + { + return delete_Accounting("C_Cashbook_Acct"); + } // beforeDelete + +} // MCashBook diff --git a/posterita/posterita/src/main/org/compiere/model/MElementValue.java b/posterita/posterita/src/main/org/compiere/model/MElementValue.java new file mode 100644 index 0000000000..49b270b991 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MElementValue.java @@ -0,0 +1,262 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.sql.*; +import java.util.*; +import org.compiere.util.*; + +/** + * Natural Account + * + * @author Jorg Janke + * @version $Id: MElementValue.java,v 1.3 2006/07/30 00:58:37 jjanke Exp $ + */ +public class MElementValue extends X_C_ElementValue +{ + /** + * Standard Constructor + * @param ctx context + * @param C_ElementValue_ID ID or 0 for new + * @param trxName transaction + */ + public MElementValue(Properties ctx, int C_ElementValue_ID, String trxName) + { + super(ctx, C_ElementValue_ID, trxName); + if (C_ElementValue_ID == 0) + { + // setC_Element_ID (0); // Parent + // setName (null); + // setValue (null); + setIsSummary (false); + setAccountSign (ACCOUNTSIGN_Natural); + setAccountType (ACCOUNTTYPE_Expense); + setIsDocControlled(false); + setIsForeignCurrency(false); + setIsBankAccount(false); + // + setPostActual (true); + setPostBudget (true); + setPostEncumbrance (true); + setPostStatistical (true); + } + } // MElementValue + + /** + * Load Constructor + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MElementValue(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MElementValue + + /** + * Full Constructor + * @param ctx context + * @param Value value + * @param Name name + * @param Description description + * @param AccountType account type + * @param AccountSign account sign + * @param IsDocControlled doc controlled + * @param IsSummary summary + * @param trxName transaction + */ + public MElementValue (Properties ctx, String Value, String Name, String Description, + String AccountType, String AccountSign, + boolean IsDocControlled, boolean IsSummary, String trxName) + { + this (ctx, 0, trxName); + setValue(Value); + setName(Name); + setDescription(Description); + setAccountType(AccountType); + setAccountSign(AccountSign); + setIsDocControlled(IsDocControlled); + setIsSummary(IsSummary); + } // MElementValue + + /** + * Import Constructor + * @param imp import + */ + public MElementValue (X_I_ElementValue imp) + { + this (imp.getCtx(), 0, imp.get_TrxName()); + setClientOrg(imp); + set(imp); + } // MElementValue + + /** + * Set/Update Settings from import + * @param imp import + */ + public void set (X_I_ElementValue imp) + { + setValue(imp.getValue()); + setName(imp.getName()); + setDescription(imp.getDescription()); + setAccountType(imp.getAccountType()); + setAccountSign(imp.getAccountSign()); + setIsSummary(imp.isSummary()); + setIsDocControlled(imp.isDocControlled()); + setC_Element_ID(imp.getC_Element_ID()); + // + setPostActual(imp.isPostActual()); + setPostBudget(imp.isPostBudget()); + setPostEncumbrance(imp.isPostEncumbrance()); + setPostStatistical(imp.isPostStatistical()); + // + // setC_BankAccount_ID(imp.getC_BankAccount_ID()); + // setIsForeignCurrency(imp.isForeignCurrency()); + // setC_Currency_ID(imp.getC_Currency_ID()); + // setIsBankAccount(imp.isIsBankAccount()); + // setValidFrom(null); + // setValidTo(null); + } // set + + + + /** + * Is this a Balance Sheet Account + * @return boolean + */ + public boolean isBalanceSheet() + { + String accountType = getAccountType(); + return (ACCOUNTTYPE_Asset.equals(accountType) + || ACCOUNTTYPE_Liability.equals(accountType) + || ACCOUNTTYPE_OwnerSEquity.equals(accountType)); + } // isBalanceSheet + + /** + * Is this an Activa Account + * @return boolean + */ + public boolean isActiva() + { + return ACCOUNTTYPE_Asset.equals(getAccountType()); + } // isActive + + /** + * Is this a Passiva Account + * @return boolean + */ + public boolean isPassiva() + { + String accountType = getAccountType(); + return (ACCOUNTTYPE_Liability.equals(accountType) + || ACCOUNTTYPE_OwnerSEquity.equals(accountType)); + } // isPassiva + + /** + * User String Representation + * @return info value - name + */ + public String toString () + { + StringBuffer sb = new StringBuffer (); + sb.append(getValue()).append(" - ").append(getName()); + return sb.toString (); + } // toString + + /** + * Extended String Representation + * @return info + */ + public String toStringX () + { + StringBuffer sb = new StringBuffer ("MElementValue["); + sb.append(get_ID()).append(",").append(getValue()).append(" - ").append(getName()) + .append ("]"); + return sb.toString (); + } // toStringX + + + + /** + * Before Save + * @param newRecord + * @return true if ir can be saved + */ + protected boolean beforeSave (boolean newRecord) + { + if (getAD_Org_ID() != 0) + setAD_Org_ID(0); + // + if (!newRecord && isSummary() + && is_ValueChanged("IsSummary")) + { + String sql = "SELECT COUNT(*) FROM Fact_Acct WHERE Account_ID=?"; + int no = DB.getSQLValue(get_TrxName(), sql, getC_ElementValue_ID()); + if (no != 0) + { + log.saveError("Error", "Already posted to"); + return false; + } + } + return true; + } // beforeSave + + /** + * After Save + * @param newRecord new + * @param success success + * @return success + */ + protected boolean afterSave (boolean newRecord, boolean success) + { + if (newRecord) + { + // afalcone [Bugs #1837219] + // sendy (transaction scope included) + int ad_Tree_ID= (new MElement(getCtx(), getC_Element_ID(), get_TrxName())).getAD_Tree_ID(); + String treeType= (new MTree(getCtx(),ad_Tree_ID, get_TrxName())).getTreeType(); + insert_Tree(treeType, getC_Element_ID()); + // insert_Tree(MTree_Base.TREETYPE_ElementValue, getC_Element_ID()); Old + + } + + // Value/Name change + if (!newRecord && (is_ValueChanged("Value") || is_ValueChanged("Name"))) + { + MAccount.updateValueDescription(getCtx(), "Account_ID=" + getC_ElementValue_ID(),get_TrxName()); + if ("Y".equals(Env.getContext(getCtx(), "$Element_U1"))) + MAccount.updateValueDescription(getCtx(), "User1_ID=" + getC_ElementValue_ID(),get_TrxName()); + if ("Y".equals(Env.getContext(getCtx(), "$Element_U2"))) + MAccount.updateValueDescription(getCtx(), "User2_ID=" + getC_ElementValue_ID(),get_TrxName()); + } + + return success; + } // afterSave + + /** + * After Delete + * @param success + * @return deleted + */ + protected boolean afterDelete (boolean success) + { + if (success) + delete_Tree(MTree_Base.TREETYPE_ElementValue); + return success; + } // afterDelete + +} // MElementValue diff --git a/posterita/posterita/src/main/org/compiere/model/MInvoice.java b/posterita/posterita/src/main/org/compiere/model/MInvoice.java new file mode 100644 index 0000000000..b91a7270a0 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MInvoice.java @@ -0,0 +1,2370 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.io.*; +import java.math.*; +import java.sql.*; +import java.util.*; +import java.util.logging.*; +import org.compiere.print.*; +import org.compiere.process.*; +import org.compiere.util.*; + + +/** + * Invoice Model. + * Please do not set DocStatus and C_DocType_ID directly. + * They are set in the process() method. + * Use DocAction and C_DocTypeTarget_ID instead. + * + * @author Jorg Janke + * @version $Id: MInvoice.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $ + * + * Modifications: Added RMA functionality (Ashley Ramdass) + */ +public class MInvoice extends X_C_Invoice implements DocAction +{ + /** + * Get Payments Of BPartner + * @param ctx context + * @param C_BPartner_ID id + * @param trxName transaction + * @return array + */ + public static MInvoice[] getOfBPartner (Properties ctx, int C_BPartner_ID, String trxName) + { + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM C_Invoice WHERE C_BPartner_ID=?"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, trxName); + pstmt.setInt(1, C_BPartner_ID); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + list.add(new MInvoice(ctx,rs, trxName)); + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + s_log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + + // + MInvoice[] retValue = new MInvoice[list.size()]; + list.toArray(retValue); + return retValue; + } // getOfBPartner + + /** + * Create new Invoice by copying + * @param from invoice + * @param dateDoc date of the document date + * @param C_DocTypeTarget_ID target doc type + * @param isSOTrx sales order + * @param counter create counter links + * @param trxName trx + * @param setOrder set Order links + * @return Invoice + */ + public static MInvoice copyFrom (MInvoice from, Timestamp dateDoc, + int C_DocTypeTarget_ID, boolean isSOTrx, boolean counter, + String trxName, boolean setOrder) + { + MInvoice to = new MInvoice (from.getCtx(), 0, null); + to.set_TrxName(trxName); + PO.copyValues (from, to, from.getAD_Client_ID(), from.getAD_Org_ID()); + to.set_ValueNoCheck ("C_Invoice_ID", I_ZERO); + to.set_ValueNoCheck ("DocumentNo", null); + // + to.setDocStatus (DOCSTATUS_Drafted); // Draft + to.setDocAction(DOCACTION_Complete); + // + to.setC_DocType_ID(0); + to.setC_DocTypeTarget_ID (C_DocTypeTarget_ID); + to.setIsSOTrx(isSOTrx); + // + to.setDateInvoiced (dateDoc); + to.setDateAcct (dateDoc); + to.setDatePrinted(null); + to.setIsPrinted (false); + // + to.setIsApproved (false); + to.setC_Payment_ID(0); + to.setC_CashLine_ID(0); + to.setIsPaid (false); + to.setIsInDispute(false); + // + // Amounts are updated by trigger when adding lines + to.setGrandTotal(Env.ZERO); + to.setTotalLines(Env.ZERO); + // + to.setIsTransferred (false); + to.setPosted (false); + to.setProcessed (false); + //[ 1633721 ] Reverse Documents- Processing=Y + to.setProcessing(false); + // delete references + to.setIsSelfService(false); + if (!setOrder) + to.setC_Order_ID(0); + if (counter) + { + to.setRef_Invoice_ID(from.getC_Invoice_ID()); + // Try to find Order link + if (from.getC_Order_ID() != 0) + { + MOrder peer = new MOrder (from.getCtx(), from.getC_Order_ID(), from.get_TrxName()); + if (peer.getRef_Order_ID() != 0) + to.setC_Order_ID(peer.getRef_Order_ID()); + } + } + else + to.setRef_Invoice_ID(0); + + if (!to.save(trxName)) + throw new IllegalStateException("Could not create Invoice"); + if (counter) + from.setRef_Invoice_ID(to.getC_Invoice_ID()); + + // Lines + if (to.copyLinesFrom(from, counter, setOrder) == 0) + throw new IllegalStateException("Could not create Invoice Lines"); + + return to; + } // copyFrom + + /** + * Get PDF File Name + * @param documentDir directory + * @param C_Invoice_ID invoice + * @return file name + */ + public static String getPDFFileName (String documentDir, int C_Invoice_ID) + { + StringBuffer sb = new StringBuffer (documentDir); + if (sb.length() == 0) + sb.append("."); + if (!sb.toString().endsWith(File.separator)) + sb.append(File.separator); + sb.append("C_Invoice_ID_") + .append(C_Invoice_ID) + .append(".pdf"); + return sb.toString(); + } // getPDFFileName + + + /** + * Get MInvoice from Cache + * @param ctx context + * @param C_Invoice_ID id + * @return MInvoice + */ + public static MInvoice get (Properties ctx, int C_Invoice_ID) + { + Integer key = new Integer (C_Invoice_ID); + MInvoice retValue = (MInvoice) s_cache.get (key); + if (retValue != null) + return retValue; + retValue = new MInvoice (ctx, C_Invoice_ID, null); + if (retValue.get_ID () != 0) + s_cache.put (key, retValue); + return retValue; + } // get + + /** Cache */ + private static CCache s_cache = new CCache("C_Invoice", 20, 2); // 2 minutes + + + /************************************************************************** + * Invoice Constructor + * @param ctx context + * @param C_Invoice_ID invoice or 0 for new + * @param trxName trx name + */ + public MInvoice (Properties ctx, int C_Invoice_ID, String trxName) + { + super (ctx, C_Invoice_ID, trxName); + if (C_Invoice_ID == 0) + { + setDocStatus (DOCSTATUS_Drafted); // Draft + setDocAction (DOCACTION_Complete); + // + setPaymentRule(PAYMENTRULE_OnCredit); // Payment Terms + + setDateInvoiced (new Timestamp (System.currentTimeMillis ())); + setDateAcct (new Timestamp (System.currentTimeMillis ())); + // + setChargeAmt (Env.ZERO); + setTotalLines (Env.ZERO); + setGrandTotal (Env.ZERO); + // + setIsSOTrx (true); + setIsTaxIncluded (false); + setIsApproved (false); + setIsDiscountPrinted (false); + setIsPaid (false); + setSendEMail (false); + setIsPrinted (false); + setIsTransferred (false); + setIsSelfService(false); + setIsPayScheduleValid(false); + setIsInDispute(false); + setPosted(false); + super.setProcessed (false); + setProcessing(false); + } + } // MInvoice + + /** + * Load Constructor + * @param ctx context + * @param rs result set record + * @param trxName transaction + */ + public MInvoice (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MInvoice + + /** + * Create Invoice from Order + * @param order order + * @param C_DocTypeTarget_ID target document type + * @param invoiceDate date or null + */ + public MInvoice (MOrder order, int C_DocTypeTarget_ID, Timestamp invoiceDate) + { + this (order.getCtx(), 0, order.get_TrxName()); + setClientOrg(order); + setOrder(order); // set base settings + // + if (C_DocTypeTarget_ID == 0) + C_DocTypeTarget_ID = DB.getSQLValue(null, + "SELECT C_DocTypeInvoice_ID FROM C_DocType WHERE C_DocType_ID=?", + order.getC_DocType_ID()); + setC_DocTypeTarget_ID(C_DocTypeTarget_ID); + if (invoiceDate != null) + setDateInvoiced(invoiceDate); + setDateAcct(getDateInvoiced()); + // + setSalesRep_ID(order.getSalesRep_ID()); + // + setC_BPartner_ID(order.getBill_BPartner_ID()); + setC_BPartner_Location_ID(order.getBill_Location_ID()); + setAD_User_ID(order.getBill_User_ID()); + } // MInvoice + + /** + * Create Invoice from Shipment + * @param ship shipment + * @param invoiceDate date or null + */ + public MInvoice (MInOut ship, Timestamp invoiceDate) + { + this (ship.getCtx(), 0, ship.get_TrxName()); + setClientOrg(ship); + setShipment(ship); // set base settings + // + setC_DocTypeTarget_ID(); + if (invoiceDate != null) + setDateInvoiced(invoiceDate); + setDateAcct(getDateInvoiced()); + // + setSalesRep_ID(ship.getSalesRep_ID()); + setAD_User_ID(ship.getAD_User_ID()); + } // MInvoice + + /** + * Create Invoice from Batch Line + * @param batch batch + * @param line batch line + */ + public MInvoice (MInvoiceBatch batch, MInvoiceBatchLine line) + { + this (line.getCtx(), 0, line.get_TrxName()); + setClientOrg(line); + setDocumentNo(line.getDocumentNo()); + // + setIsSOTrx(batch.isSOTrx()); + MBPartner bp = new MBPartner (line.getCtx(), line.getC_BPartner_ID(), line.get_TrxName()); + setBPartner(bp); // defaults + // + setIsTaxIncluded(line.isTaxIncluded()); + // May conflict with default price list + setC_Currency_ID(batch.getC_Currency_ID()); + setC_ConversionType_ID(batch.getC_ConversionType_ID()); + // + // setPaymentRule(order.getPaymentRule()); + // setC_PaymentTerm_ID(order.getC_PaymentTerm_ID()); + // setPOReference(""); + setDescription(batch.getDescription()); + // setDateOrdered(order.getDateOrdered()); + // + setAD_OrgTrx_ID(line.getAD_OrgTrx_ID()); + setC_Project_ID(line.getC_Project_ID()); + // setC_Campaign_ID(line.getC_Campaign_ID()); + setC_Activity_ID(line.getC_Activity_ID()); + setUser1_ID(line.getUser1_ID()); + setUser2_ID(line.getUser2_ID()); + // + setC_DocTypeTarget_ID(line.getC_DocType_ID()); + setDateInvoiced(line.getDateInvoiced()); + setDateAcct(line.getDateAcct()); + // + setSalesRep_ID(batch.getSalesRep_ID()); + // + setC_BPartner_ID(line.getC_BPartner_ID()); + setC_BPartner_Location_ID(line.getC_BPartner_Location_ID()); + setAD_User_ID(line.getAD_User_ID()); + } // MInvoice + + /** Open Amount */ + private BigDecimal m_openAmt = null; + + /** Invoice Lines */ + private MInvoiceLine[] m_lines; + /** Invoice Taxes */ + private MInvoiceTax[] m_taxes; + /** Logger */ + private static CLogger s_log = CLogger.getCLogger(MInvoice.class); + + /** + * Overwrite Client/Org if required + * @param AD_Client_ID client + * @param AD_Org_ID org + */ + public void setClientOrg (int AD_Client_ID, int AD_Org_ID) + { + super.setClientOrg(AD_Client_ID, AD_Org_ID); + } // setClientOrg + + /** + * Set Business Partner Defaults & Details + * @param bp business partner + */ + public void setBPartner (MBPartner bp) + { + if (bp == null) + return; + + setC_BPartner_ID(bp.getC_BPartner_ID()); + // Set Defaults + int ii = 0; + if (isSOTrx()) + ii = bp.getC_PaymentTerm_ID(); + else + ii = bp.getPO_PaymentTerm_ID(); + if (ii != 0) + setC_PaymentTerm_ID(ii); + // + if (isSOTrx()) + ii = bp.getM_PriceList_ID(); + else + ii = bp.getPO_PriceList_ID(); + if (ii != 0) + setM_PriceList_ID(ii); + // + String ss = bp.getPaymentRule(); + if (ss != null) + setPaymentRule(ss); + + + // Set Locations + MBPartnerLocation[] locs = bp.getLocations(false); + if (locs != null) + { + for (int i = 0; i < locs.length; i++) + { + if ((locs[i].isBillTo() && isSOTrx()) + || (locs[i].isPayFrom() && !isSOTrx())) + setC_BPartner_Location_ID(locs[i].getC_BPartner_Location_ID()); + } + // set to first + if (getC_BPartner_Location_ID() == 0 && locs.length > 0) + setC_BPartner_Location_ID(locs[0].getC_BPartner_Location_ID()); + } + if (getC_BPartner_Location_ID() == 0) + log.log(Level.SEVERE, "Has no To Address: " + bp); + + // Set Contact + MUser[] contacts = bp.getContacts(false); + if (contacts != null && contacts.length > 0) // get first User + setAD_User_ID(contacts[0].getAD_User_ID()); + } // setBPartner + + /** + * Set Order References + * @param order order + */ + public void setOrder (MOrder order) + { + if (order == null) + return; + + setC_Order_ID(order.getC_Order_ID()); + setIsSOTrx(order.isSOTrx()); + setIsDiscountPrinted(order.isDiscountPrinted()); + setIsSelfService(order.isSelfService()); + setSendEMail(order.isSendEMail()); + // + setM_PriceList_ID(order.getM_PriceList_ID()); + setIsTaxIncluded(order.isTaxIncluded()); + setC_Currency_ID(order.getC_Currency_ID()); + setC_ConversionType_ID(order.getC_ConversionType_ID()); + // + setPaymentRule(order.getPaymentRule()); + setC_PaymentTerm_ID(order.getC_PaymentTerm_ID()); + setPOReference(order.getPOReference()); + setDescription(order.getDescription()); + setDateOrdered(order.getDateOrdered()); + // + setAD_OrgTrx_ID(order.getAD_OrgTrx_ID()); + setC_Project_ID(order.getC_Project_ID()); + setC_Campaign_ID(order.getC_Campaign_ID()); + setC_Activity_ID(order.getC_Activity_ID()); + setUser1_ID(order.getUser1_ID()); + setUser2_ID(order.getUser2_ID()); + } // setOrder + + /** + * Set Shipment References + * @param ship shipment + */ + public void setShipment (MInOut ship) + { + if (ship == null) + return; + + setIsSOTrx(ship.isSOTrx()); + // + MBPartner bp = new MBPartner (getCtx(), ship.getC_BPartner_ID(), null); + setBPartner (bp); + // + setSendEMail(ship.isSendEMail()); + // + setPOReference(ship.getPOReference()); + setDescription(ship.getDescription()); + setDateOrdered(ship.getDateOrdered()); + // + setAD_OrgTrx_ID(ship.getAD_OrgTrx_ID()); + setC_Project_ID(ship.getC_Project_ID()); + setC_Campaign_ID(ship.getC_Campaign_ID()); + setC_Activity_ID(ship.getC_Activity_ID()); + setUser1_ID(ship.getUser1_ID()); + setUser2_ID(ship.getUser2_ID()); + // + if (ship.getC_Order_ID() != 0) + { + setC_Order_ID(ship.getC_Order_ID()); + MOrder order = new MOrder (getCtx(), ship.getC_Order_ID(), get_TrxName()); + setIsDiscountPrinted(order.isDiscountPrinted()); + setM_PriceList_ID(order.getM_PriceList_ID()); + setIsTaxIncluded(order.isTaxIncluded()); + setC_Currency_ID(order.getC_Currency_ID()); + setC_ConversionType_ID(order.getC_ConversionType_ID()); + setPaymentRule(order.getPaymentRule()); + setC_PaymentTerm_ID(order.getC_PaymentTerm_ID()); + // + MDocType dt = MDocType.get(getCtx(), order.getC_DocType_ID()); + if (dt.getC_DocTypeInvoice_ID() != 0) + setC_DocTypeTarget_ID(dt.getC_DocTypeInvoice_ID()); + // Overwrite Invoice Address + setC_BPartner_Location_ID(order.getBill_Location_ID()); + } + // Check if Shipment/Receipt is based on RMA + if (ship.getM_RMA_ID() != 0) + { + MRMA rma = new MRMA(getCtx(), ship.getM_RMA_ID(), get_TrxName()); + MOrder rmaOrder = rma.getOriginalOrder(); + setM_RMA_ID(ship.getM_RMA_ID()); + setIsSOTrx(rma.isSOTrx()); + setM_PriceList_ID(rmaOrder.getM_PriceList_ID()); + setIsTaxIncluded(rmaOrder.isTaxIncluded()); + setC_Currency_ID(rmaOrder.getC_Currency_ID()); + setC_ConversionType_ID(rmaOrder.getC_ConversionType_ID()); + setPaymentRule(rmaOrder.getPaymentRule()); + setC_PaymentTerm_ID(rmaOrder.getC_PaymentTerm_ID()); + + // Retrieves the invoice DocType + MDocType dt = MDocType.get(getCtx(), rma.getC_DocType_ID()); + if (dt.getC_DocTypeInvoice_ID() != 0) + { + setC_DocTypeTarget_ID(dt.getC_DocTypeInvoice_ID()); + } + setC_BPartner_Location_ID(rmaOrder.getBill_Location_ID()); + } + + } // setShipment + + /** + * Set Target Document Type + * @param DocBaseType doc type MDocType.DOCBASETYPE_ + */ + public void setC_DocTypeTarget_ID (String DocBaseType) + { + String sql = "SELECT C_DocType_ID FROM C_DocType " + + "WHERE AD_Client_ID=? AND DocBaseType=?" + + " AND IsActive='Y' " + + "ORDER BY IsDefault DESC"; + int C_DocType_ID = DB.getSQLValue(null, sql, getAD_Client_ID(), DocBaseType); + if (C_DocType_ID <= 0) + log.log(Level.SEVERE, "Not found for AC_Client_ID=" + + getAD_Client_ID() + " - " + DocBaseType); + else + { + log.fine(DocBaseType); + setC_DocTypeTarget_ID (C_DocType_ID); + boolean isSOTrx = MDocType.DOCBASETYPE_ARInvoice.equals(DocBaseType) + || MDocType.DOCBASETYPE_ARCreditMemo.equals(DocBaseType); + setIsSOTrx (isSOTrx); + } + } // setC_DocTypeTarget_ID + + /** + * Set Target Document Type. + * Based on SO flag AP/AP Invoice + */ + public void setC_DocTypeTarget_ID () + { + if (getC_DocTypeTarget_ID() > 0) + return; + if (isSOTrx()) + setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_ARInvoice); + else + setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APInvoice); + } // setC_DocTypeTarget_ID + + + /** + * Get Grand Total + * @param creditMemoAdjusted adjusted for CM (negative) + * @return grand total + */ + public BigDecimal getGrandTotal (boolean creditMemoAdjusted) + { + if (!creditMemoAdjusted) + return super.getGrandTotal(); + // + BigDecimal amt = getGrandTotal(); + if (isCreditMemo()) + return amt.negate(); + return amt; + } // getGrandTotal + + + /** + * Get Invoice Lines of Invoice + * @param whereClause starting with AND + * @return lines + */ + private MInvoiceLine[] getLines (String whereClause) + { + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM C_InvoiceLine WHERE C_Invoice_ID=? "; + if (whereClause != null) + sql += whereClause; + sql += " ORDER BY Line"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Invoice_ID()); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + { + MInvoiceLine il = new MInvoiceLine(getCtx(), rs, get_TrxName()); + il.setInvoice(this); + list.add(il); + } + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, "getLines", e); + } + finally + { + try + { + if (pstmt != null) + pstmt.close (); + } + catch (Exception e) + {} + pstmt = null; + } + + // + MInvoiceLine[] lines = new MInvoiceLine[list.size()]; + list.toArray(lines); + return lines; + } // getLines + + /** + * Get Invoice Lines + * @param requery + * @return lines + */ + public MInvoiceLine[] getLines (boolean requery) + { + if (m_lines == null || m_lines.length == 0 || requery) + m_lines = getLines(null); + set_TrxName(m_lines, get_TrxName()); + return m_lines; + } // getLines + + /** + * Get Lines of Invoice + * @return lines + */ + public MInvoiceLine[] getLines() + { + return getLines(false); + } // getLines + + + /** + * Renumber Lines + * @param step start and step + */ + public void renumberLines (int step) + { + int number = step; + MInvoiceLine[] lines = getLines(false); + for (int i = 0; i < lines.length; i++) + { + MInvoiceLine line = lines[i]; + line.setLine(number); + line.save(); + number += step; + } + m_lines = null; + } // renumberLines + + /** + * Copy Lines From other Invoice. + * @param otherInvoice invoice + * @param counter create counter links + * @param setOrder set order links + * @return number of lines copied + */ + public int copyLinesFrom (MInvoice otherInvoice, boolean counter, boolean setOrder) + { + if (isProcessed() || isPosted() || otherInvoice == null) + return 0; + MInvoiceLine[] fromLines = otherInvoice.getLines(false); + int count = 0; + for (int i = 0; i < fromLines.length; i++) + { + MInvoiceLine line = new MInvoiceLine (getCtx(), 0, get_TrxName()); + MInvoiceLine fromLine = fromLines[i]; + if (counter) // header + PO.copyValues (fromLine, line, getAD_Client_ID(), getAD_Org_ID()); + else + PO.copyValues (fromLine, line, fromLine.getAD_Client_ID(), fromLine.getAD_Org_ID()); + line.setC_Invoice_ID(getC_Invoice_ID()); + line.setInvoice(this); + line.set_ValueNoCheck ("C_InvoiceLine_ID", I_ZERO); // new + // Reset + if (!setOrder) + line.setC_OrderLine_ID(0); + line.setRef_InvoiceLine_ID(0); + line.setM_InOutLine_ID(0); + line.setA_Asset_ID(0); + line.setM_AttributeSetInstance_ID(0); + line.setS_ResourceAssignment_ID(0); + // New Tax + if (getC_BPartner_ID() != otherInvoice.getC_BPartner_ID()) + line.setTax(); // recalculate + // + if (counter) + { + line.setRef_InvoiceLine_ID(fromLine.getC_InvoiceLine_ID()); + if (fromLine.getC_OrderLine_ID() != 0) + { + MOrderLine peer = new MOrderLine (getCtx(), fromLine.getC_OrderLine_ID(), get_TrxName()); + if (peer.getRef_OrderLine_ID() != 0) + line.setC_OrderLine_ID(peer.getRef_OrderLine_ID()); + } + line.setM_InOutLine_ID(0); + if (fromLine.getM_InOutLine_ID() != 0) + { + MInOutLine peer = new MInOutLine (getCtx(), fromLine.getM_InOutLine_ID(), get_TrxName()); + if (peer.getRef_InOutLine_ID() != 0) + line.setM_InOutLine_ID(peer.getRef_InOutLine_ID()); + } + } + // + line.setProcessed(false); + if (line.save(get_TrxName())) + count++; + // Cross Link + if (counter) + { + fromLine.setRef_InvoiceLine_ID(line.getC_InvoiceLine_ID()); + fromLine.save(get_TrxName()); + } + + // MZ Goodwill + // copy the landed cost + line.copyLandedCostFrom(fromLine); + line.allocateLandedCosts(); + // end MZ + } + if (fromLines.length != count) + log.log(Level.SEVERE, "Line difference - From=" + fromLines.length + " <> Saved=" + count); + return count; + } // copyLinesFrom + + /** Reversal Flag */ + private boolean m_reversal = false; + + /** + * Set Reversal + * @param reversal reversal + */ + private void setReversal(boolean reversal) + { + m_reversal = reversal; + } // setReversal + /** + * Is Reversal + * @return reversal + */ + private boolean isReversal() + { + return m_reversal; + } // isReversal + + /** + * Get Taxes + * @param requery requery + * @return array of taxes + */ + public MInvoiceTax[] getTaxes (boolean requery) + { + if (m_taxes != null && !requery) + return m_taxes; + String sql = "SELECT * FROM C_InvoiceTax WHERE C_Invoice_ID=?"; + ArrayList list = new ArrayList(); + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, get_TrxName()); + pstmt.setInt (1, getC_Invoice_ID()); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + list.add(new MInvoiceTax(getCtx(), rs, get_TrxName())); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, "getTaxes", e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + + m_taxes = new MInvoiceTax[list.size ()]; + list.toArray (m_taxes); + return m_taxes; + } // getTaxes + + /** + * Add to Description + * @param description text + */ + public void addDescription (String description) + { + String desc = getDescription(); + if (desc == null) + setDescription(description); + else + setDescription(desc + " | " + description); + } // addDescription + + /** + * Is it a Credit Memo? + * @return true if CM + */ + public boolean isCreditMemo() + { + MDocType dt = MDocType.get(getCtx(), + getC_DocType_ID()==0 ? getC_DocTypeTarget_ID() : getC_DocType_ID()); + return MDocType.DOCBASETYPE_APCreditMemo.equals(dt.getDocBaseType()) + || MDocType.DOCBASETYPE_ARCreditMemo.equals(dt.getDocBaseType()); + } // isCreditMemo + + /** + * Set Processed. + * Propergate to Lines/Taxes + * @param processed processed + */ + public void setProcessed (boolean processed) + { + super.setProcessed (processed); + if (get_ID() == 0) + return; + String set = "SET Processed='" + + (processed ? "Y" : "N") + + "' WHERE C_Invoice_ID=" + getC_Invoice_ID(); + int noLine = DB.executeUpdate("UPDATE C_InvoiceLine " + set, get_TrxName()); + int noTax = DB.executeUpdate("UPDATE C_InvoiceTax " + set, get_TrxName()); + m_lines = null; + m_taxes = null; + log.fine(processed + " - Lines=" + noLine + ", Tax=" + noTax); + } // setProcessed + + /** + * Validate Invoice Pay Schedule + * @return pay schedule is valid + */ + public boolean validatePaySchedule() + { + MInvoicePaySchedule[] schedule = MInvoicePaySchedule.getInvoicePaySchedule + (getCtx(), getC_Invoice_ID(), 0, get_TrxName()); + log.fine("#" + schedule.length); + if (schedule.length == 0) + { + setIsPayScheduleValid(false); + return false; + } + // Add up due amounts + BigDecimal total = Env.ZERO; + for (int i = 0; i < schedule.length; i++) + { + schedule[i].setParent(this); + BigDecimal due = schedule[i].getDueAmt(); + if (due != null) + total = total.add(due); + } + boolean valid = getGrandTotal().compareTo(total) == 0; + setIsPayScheduleValid(valid); + + // Update Schedule Lines + for (int i = 0; i < schedule.length; i++) + { + if (schedule[i].isValid() != valid) + { + schedule[i].setIsValid(valid); + schedule[i].save(get_TrxName()); + } + } + return valid; + } // validatePaySchedule + + + /************************************************************************** + * Before Save + * @param newRecord new + * @return true + */ + protected boolean beforeSave (boolean newRecord) + { + log.fine(""); + // No Partner Info - set Template + if (getC_BPartner_ID() == 0) + setBPartner(MBPartner.getTemplate(getCtx(), getAD_Client_ID())); + if (getC_BPartner_Location_ID() == 0) + setBPartner(new MBPartner(getCtx(), getC_BPartner_ID(), null)); + + // Price List + if (getM_PriceList_ID() == 0) + { + int ii = Env.getContextAsInt(getCtx(), "#M_PriceList_ID"); + if (ii != 0) + setM_PriceList_ID(ii); + else + { + String sql = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsDefault='Y'"; + ii = DB.getSQLValue (null, sql, getAD_Client_ID()); + if (ii != 0) + setM_PriceList_ID (ii); + } + } + + // Currency + if (getC_Currency_ID() == 0) + { + String sql = "SELECT C_Currency_ID FROM M_PriceList WHERE M_PriceList_ID=?"; + int ii = DB.getSQLValue (null, sql, getM_PriceList_ID()); + if (ii != 0) + setC_Currency_ID (ii); + else + setC_Currency_ID(Env.getContextAsInt(getCtx(), "#C_Currency_ID")); + } + + // Sales Rep + if (getSalesRep_ID() == 0) + { + int ii = Env.getContextAsInt(getCtx(), "#SalesRep_ID"); + if (ii != 0) + setSalesRep_ID (ii); + } + + // Document Type + if (getC_DocType_ID() == 0) + setC_DocType_ID (0); // make sure it's set to 0 + if (getC_DocTypeTarget_ID() == 0) + setC_DocTypeTarget_ID(isSOTrx() ? MDocType.DOCBASETYPE_ARInvoice : MDocType.DOCBASETYPE_APInvoice); + + // Payment Term + if (getC_PaymentTerm_ID() == 0) + { + int ii = Env.getContextAsInt(getCtx(), "#C_PaymentTerm_ID"); + if (ii != 0) + setC_PaymentTerm_ID (ii); + else + { + String sql = "SELECT C_PaymentTerm_ID FROM C_PaymentTerm WHERE AD_Client_ID=? AND IsDefault='Y'"; + ii = DB.getSQLValue(null, sql, getAD_Client_ID()); + if (ii != 0) + setC_PaymentTerm_ID (ii); + } + } + return true; + } // beforeSave + + /** + * Before Delete + * @return true if it can be deleted + */ + protected boolean beforeDelete () + { + if (getC_Order_ID() != 0) + { + log.saveError("Error", Msg.getMsg(getCtx(), "CannotDelete")); + return false; + } + return true; + } // beforeDelete + + /** + * String Representation + * @return info + */ + public String toString () + { + StringBuffer sb = new StringBuffer ("MInvoice[") + .append(get_ID()).append("-").append(getDocumentNo()) + .append(",GrandTotal=").append(getGrandTotal()); + if (m_lines != null) + sb.append(" (#").append(m_lines.length).append(")"); + sb.append ("]"); + return sb.toString (); + } // toString + + /** + * Get Document Info + * @return document info (untranslated) + */ + public String getDocumentInfo() + { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + return dt.getName() + " " + getDocumentNo(); + } // getDocumentInfo + + + /** + * After Save + * @param newRecord new + * @param success success + * @return success + */ + protected boolean afterSave (boolean newRecord, boolean success) + { + if (!success || newRecord) + return success; + + if (is_ValueChanged("AD_Org_ID")) + { + String sql = "UPDATE C_InvoiceLine ol" + + " SET AD_Org_ID =" + + "(SELECT AD_Org_ID" + + " FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) " + + "WHERE C_Invoice_ID=" + getC_Invoice_ID(); + int no = DB.executeUpdate(sql, get_TrxName()); + log.fine("Lines -> #" + no); + } + return true; + } // afterSave + + + /** + * Set Price List (and Currency) when valid + * @param M_PriceList_ID price list + */ + public void setM_PriceList_ID (int M_PriceList_ID) + { + String sql = "SELECT M_PriceList_ID, C_Currency_ID " + + "FROM M_PriceList WHERE M_PriceList_ID=?"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, null); + pstmt.setInt(1, M_PriceList_ID); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) + { + super.setM_PriceList_ID (rs.getInt(1)); + setC_Currency_ID (rs.getInt(2)); + } + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, "setM_PriceList_ID", e); + } + finally + { + try + { + if (pstmt != null) + pstmt.close (); + } + catch (Exception e) + {} + pstmt = null; + } + } // setM_PriceList_ID + + + /** + * Get Allocated Amt in Invoice Currency + * @return pos/neg amount or null + */ + public BigDecimal getAllocatedAmt () + { + BigDecimal retValue = null; + String sql = "SELECT SUM(currencyConvert(al.Amount+al.DiscountAmt+al.WriteOffAmt," + + "ah.C_Currency_ID, i.C_Currency_ID,ah.DateTrx,COALESCE(i.C_ConversionType_ID,0), al.AD_Client_ID,al.AD_Org_ID)) " + + "FROM C_AllocationLine al" + + " INNER JOIN C_AllocationHdr ah ON (al.C_AllocationHdr_ID=ah.C_AllocationHdr_ID)" + + " INNER JOIN C_Invoice i ON (al.C_Invoice_ID=i.C_Invoice_ID) " + + "WHERE al.C_Invoice_ID=?" + + " AND ah.IsActive='Y' AND al.IsActive='Y'"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Invoice_ID()); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) + retValue = rs.getBigDecimal(1); + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + // log.fine("getAllocatedAmt - " + retValue); + // ? ROUND(NVL(v_AllocatedAmt,0), 2); + return retValue; + } // getAllocatedAmt + + /** + * Test Allocation (and set paid flag) + * @return true if updated + */ + public boolean testAllocation() + { + boolean change = false; + + if ( isProcessed() ) { + BigDecimal alloc = getAllocatedAmt(); // absolute + if (alloc == null) + alloc = Env.ZERO; + BigDecimal total = getGrandTotal(); + if (!isSOTrx()) + total = total.negate(); + if (isCreditMemo()) + total = total.negate(); + boolean test = total.compareTo(alloc) == 0; + change = test != isPaid(); + if (change) + setIsPaid(test); + log.fine("Paid=" + test + + " (" + alloc + "=" + total + ")"); + } + + return change; + } // testAllocation + + /** + * Set Paid Flag for invoices + * @param ctx context + * @param C_BPartner_ID if 0 all + * @param trxName transaction + */ + public static void setIsPaid (Properties ctx, int C_BPartner_ID, String trxName) + { + int counter = 0; + String sql = "SELECT * FROM C_Invoice " + + "WHERE IsPaid='N' AND DocStatus IN ('CO','CL')"; + if (C_BPartner_ID > 1) + sql += " AND C_BPartner_ID=?"; + else + sql += " AND AD_Client_ID=" + Env.getAD_Client_ID(ctx); + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, trxName); + if (C_BPartner_ID > 1) + pstmt.setInt (1, C_BPartner_ID); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + { + MInvoice invoice = new MInvoice(ctx, rs, trxName); + if (invoice.testAllocation()) + if (invoice.save()) + counter++; + } + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + s_log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + s_log.config("#" + counter); + /**/ + } // setIsPaid + + /** + * Get Open Amount. + * Used by web interface + * @return Open Amt + */ + public BigDecimal getOpenAmt () + { + return getOpenAmt (true, null); + } // getOpenAmt + + /** + * Get Open Amount + * @param creditMemoAdjusted adjusted for CM (negative) + * @param paymentDate ignored Payment Date + * @return Open Amt + */ + public BigDecimal getOpenAmt (boolean creditMemoAdjusted, Timestamp paymentDate) + { + if (isPaid()) + return Env.ZERO; + // + if (m_openAmt == null) + { + m_openAmt = getGrandTotal(); + if (paymentDate != null) + { + // Payment Discount + // Payment Schedule + } + BigDecimal allocated = getAllocatedAmt(); + if (allocated != null) + { + allocated = allocated.abs(); // is absolute + m_openAmt = m_openAmt.subtract(allocated); + } + } + // + if (!creditMemoAdjusted) + return m_openAmt; + if (isCreditMemo()) + return m_openAmt.negate(); + return m_openAmt; + } // getOpenAmt + + + /** + * Get Document Status + * @return Document Status Clear Text + */ + public String getDocStatusName() + { + return MRefList.getListName(getCtx(), 131, getDocStatus()); + } // getDocStatusName + + + /************************************************************************** + * Create PDF + * @return File or null + */ + public File createPDF () + { + try + { + File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf"); + return createPDF (temp); + } + catch (Exception e) + { + log.severe("Could not create PDF - " + e.getMessage()); + } + return null; + } // getPDF + + /** + * Create PDF file + * @param file output file + * @return file if success + */ + public File createPDF (File file) + { + ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID()); + if (re == null) + return null; + return re.getPDF(file); + } // createPDF + + /** + * Get PDF File Name + * @param documentDir directory + * @return file name + */ + public String getPDFFileName (String documentDir) + { + return getPDFFileName (documentDir, getC_Invoice_ID()); + } // getPDFFileName + + /** + * Get ISO Code of Currency + * @return Currency ISO + */ + public String getCurrencyISO() + { + return MCurrency.getISO_Code (getCtx(), getC_Currency_ID()); + } // getCurrencyISO + + /** + * Get Currency Precision + * @return precision + */ + public int getPrecision() + { + return MCurrency.getStdPrecision(getCtx(), getC_Currency_ID()); + } // getPrecision + + + /************************************************************************** + * Process document + * @param processAction document action + * @return true if performed + */ + public boolean processIt (String processAction) + { + m_processMsg = null; + DocumentEngine engine = new DocumentEngine (this, getDocStatus()); + return engine.processIt (processAction, getDocAction()); + } // process + + /** Process Message */ + private String m_processMsg = null; + /** Just Prepared Flag */ + private boolean m_justPrepared = false; + + /** + * Unlock Document. + * @return true if success + */ + public boolean unlockIt() + { + log.info("unlockIt - " + toString()); + setProcessing(false); + return true; + } // unlockIt + + /** + * Invalidate Document + * @return true if success + */ + public boolean invalidateIt() + { + log.info("invalidateIt - " + toString()); + setDocAction(DOCACTION_Prepare); + return true; + } // invalidateIt + + /** + * Prepare Document + * @return new status (In Progress or Invalid) + */ + public String prepareIt() + { + log.info(toString()); + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + MDocType dt = MDocType.get(getCtx(), getC_DocTypeTarget_ID()); + + // Std Period open? + if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType())) + { + m_processMsg = "@PeriodClosed@"; + return DocAction.STATUS_Invalid; + } + // Lines + MInvoiceLine[] lines = getLines(true); + if (lines.length == 0) + { + m_processMsg = "@NoLines@"; + return DocAction.STATUS_Invalid; + } + // No Cash Book + if (PAYMENTRULE_Cash.equals(getPaymentRule()) + && MCashBook.get(getCtx(), getAD_Org_ID(), getC_Currency_ID()) == null) + { + m_processMsg = "@NoCashBook@"; + return DocAction.STATUS_Invalid; + } + + // Convert/Check DocType + if (getC_DocType_ID() != getC_DocTypeTarget_ID() ) + setC_DocType_ID(getC_DocTypeTarget_ID()); + if (getC_DocType_ID() == 0) + { + m_processMsg = "No Document Type"; + return DocAction.STATUS_Invalid; + } + + explodeBOM(); + if (!calculateTaxTotal()) // setTotals + { + m_processMsg = "Error calculating Tax"; + return DocAction.STATUS_Invalid; + } + + createPaySchedule(); + + // Credit Status + if (isSOTrx() && !isReversal()) + { + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null); + if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus())) + { + m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@=" + + bp.getTotalOpenBalance() + + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); + return DocAction.STATUS_Invalid; + } + } + + // Landed Costs + if (!isSOTrx()) + { + for (int i = 0; i < lines.length; i++) + { + MInvoiceLine line = lines[i]; + String error = line.allocateLandedCosts(); + if (error != null && error.length() > 0) + { + m_processMsg = error; + return DocAction.STATUS_Invalid; + } + } + } + + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + // Add up Amounts + m_justPrepared = true; + if (!DOCACTION_Complete.equals(getDocAction())) + setDocAction(DOCACTION_Complete); + return DocAction.STATUS_InProgress; + } // prepareIt + + /** + * Explode non stocked BOM. + */ + private void explodeBOM () + { + String where = "AND IsActive='Y' AND EXISTS " + + "(SELECT * FROM M_Product p WHERE C_InvoiceLine.M_Product_ID=p.M_Product_ID" + + " AND p.IsBOM='Y' AND p.IsVerified='Y' AND p.IsStocked='N')"; + // + String sql = "SELECT COUNT(*) FROM C_InvoiceLine " + + "WHERE C_Invoice_ID=? " + where; + int count = DB.getSQLValue(get_TrxName(), sql, getC_Invoice_ID()); + while (count != 0) + { + renumberLines (100); + + // Order Lines with non-stocked BOMs + MInvoiceLine[] lines = getLines (where); + for (int i = 0; i < lines.length; i++) + { + MInvoiceLine line = lines[i]; + MProduct product = MProduct.get (getCtx(), line.getM_Product_ID()); + log.fine(product.getName()); + // New Lines + int lineNo = line.getLine (); + MProductBOM[] boms = MProductBOM.getBOMLines (product); + for (int j = 0; j < boms.length; j++) + { + MProductBOM bom = boms[j]; + MInvoiceLine newLine = new MInvoiceLine (this); + newLine.setLine (++lineNo); + newLine.setM_Product_ID (bom.getProduct().getM_Product_ID(), + bom.getProduct().getC_UOM_ID()); + newLine.setQty (line.getQtyInvoiced().multiply( + bom.getBOMQty ())); // Invoiced/Entered + if (bom.getDescription () != null) + newLine.setDescription (bom.getDescription ()); + // + newLine.setPrice (); + newLine.save (get_TrxName()); + } + // Convert into Comment Line + line.setM_Product_ID (0); + line.setM_AttributeSetInstance_ID (0); + line.setPriceEntered (Env.ZERO); + line.setPriceActual (Env.ZERO); + line.setPriceLimit (Env.ZERO); + line.setPriceList (Env.ZERO); + line.setLineNetAmt (Env.ZERO); + // + String description = product.getName (); + if (product.getDescription () != null) + description += " " + product.getDescription (); + if (line.getDescription () != null) + description += " " + line.getDescription (); + line.setDescription (description); + line.save (get_TrxName()); + } // for all lines with BOM + + m_lines = null; + count = DB.getSQLValue (get_TrxName(), sql, getC_Invoice_ID ()); + renumberLines (10); + } // while count != 0 + } // explodeBOM + + /** + * Calculate Tax and Total + * @return true if calculated + */ + private boolean calculateTaxTotal() + { + log.fine(""); + // Delete Taxes + DB.executeUpdate("DELETE C_InvoiceTax WHERE C_Invoice_ID=" + getC_Invoice_ID(), get_TrxName()); + m_taxes = null; + + // Lines + BigDecimal totalLines = Env.ZERO; + ArrayList taxList = new ArrayList(); + MInvoiceLine[] lines = getLines(false); + for (int i = 0; i < lines.length; i++) + { + MInvoiceLine line = lines[i]; + /** Sync ownership for SO + if (isSOTrx() && line.getAD_Org_ID() != getAD_Org_ID()) + { + line.setAD_Org_ID(getAD_Org_ID()); + line.save(); + } **/ + Integer taxID = new Integer(line.getC_Tax_ID()); + if (!taxList.contains(taxID)) + { + MInvoiceTax iTax = MInvoiceTax.get (line, getPrecision(), + false, get_TrxName()); // current Tax + if (iTax != null) + { + iTax.setIsTaxIncluded(isTaxIncluded()); + if (!iTax.calculateTaxFromLines()) + return false; + if (!iTax.save()) + return false; + taxList.add(taxID); + } + } + totalLines = totalLines.add(line.getLineNetAmt()); + } + + // Taxes + BigDecimal grandTotal = totalLines; + MInvoiceTax[] taxes = getTaxes(true); + for (int i = 0; i < taxes.length; i++) + { + MInvoiceTax iTax = taxes[i]; + MTax tax = iTax.getTax(); + if (tax.isSummary()) + { + MTax[] cTaxes = tax.getChildTaxes(false); // Multiple taxes + for (int j = 0; j < cTaxes.length; j++) + { + MTax cTax = cTaxes[j]; + BigDecimal taxAmt = cTax.calculateTax(iTax.getTaxBaseAmt(), isTaxIncluded(), getPrecision()); + // + MInvoiceTax newITax = new MInvoiceTax(getCtx(), 0, get_TrxName()); + newITax.setClientOrg(this); + newITax.setC_Invoice_ID(getC_Invoice_ID()); + newITax.setC_Tax_ID(cTax.getC_Tax_ID()); + newITax.setPrecision(getPrecision()); + newITax.setIsTaxIncluded(isTaxIncluded()); + newITax.setTaxBaseAmt(iTax.getTaxBaseAmt()); + newITax.setTaxAmt(taxAmt); + if (!newITax.save(get_TrxName())) + return false; + // + if (!isTaxIncluded()) + grandTotal = grandTotal.add(taxAmt); + } + if (!iTax.delete(true, get_TrxName())) + return false; + } + else + { + if (!isTaxIncluded()) + grandTotal = grandTotal.add(iTax.getTaxAmt()); + } + } + // + setTotalLines(totalLines); + setGrandTotal(grandTotal); + return true; + } // calculateTaxTotal + + + /** + * (Re) Create Pay Schedule + * @return true if valid schedule + */ + private boolean createPaySchedule() + { + if (getC_PaymentTerm_ID() == 0) + return false; + MPaymentTerm pt = new MPaymentTerm(getCtx(), getC_PaymentTerm_ID(), null); + log.fine(pt.toString()); + return pt.apply(this); // calls validate pay schedule + } // createPaySchedule + + + /** + * Approve Document + * @return true if success + */ + public boolean approveIt() + { + log.info(toString()); + setIsApproved(true); + return true; + } // approveIt + + /** + * Reject Approval + * @return true if success + */ + public boolean rejectIt() + { + log.info(toString()); + setIsApproved(false); + return true; + } // rejectIt + + /** + * Complete Document + * @return new status (Complete, In Progress, Invalid, Waiting ..) + */ + public String completeIt() + { + // Re-Check + if (!m_justPrepared) + { + String status = prepareIt(); + if (!DocAction.STATUS_InProgress.equals(status)) + return status; + } + + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + // Implicit Approval + if (!isApproved()) + approveIt(); + log.info(toString()); + StringBuffer info = new StringBuffer(); + + //Modifications for cash payment + /* + // Create Cash + if (PAYMENTRULE_Cash.equals(getPaymentRule())) + { + // Modifications for POSterita + // + // MCash cash = MCash.get (getCtx(), getAD_Org_ID(), + // getDateInvoiced(), getC_Currency_ID(), get_TrxName()); + + MCash cash; + + int posId = Env.getContextAsInt(getCtx(),Env.POS_ID); + + if (posId != 0) + { + MPOSTerminal terminal = new MPOSTerminal(getCtx(), posId, get_TrxName()); // Posterita Terminal changes + int cashBookId = terminal.getC_CashBook_ID(); + cash = MCash.get(getCtx(), cashBookId, getDateInvoiced(), get_TrxName()); + } + else + { + cash = MCash.get (getCtx(), getAD_Org_ID(), + getDateInvoiced(), getC_Currency_ID(), get_TrxName()); + } + + // End Posterita Modifications + + if (cash == null || cash.get_ID() == 0) + { + m_processMsg = "@NoCashBook@"; + return DocAction.STATUS_Invalid; + } + MCashLine cl = new MCashLine (cash); + cl.setInvoice(this); + if (!cl.save(get_TrxName())) + { + m_processMsg = "Could not save Cash Journal Line"; + return DocAction.STATUS_Invalid; + } + info.append("@C_Cash_ID@: " + cash.getName() + " #" + cl.getLine()); + setC_CashLine_ID(cl.getC_CashLine_ID()); + } // CashBook + */ + + // Update Order & Match + int matchInv = 0; + int matchPO = 0; + MInvoiceLine[] lines = getLines(false); + for (int i = 0; i < lines.length; i++) + { + MInvoiceLine line = lines[i]; + + // Update Order Line + MOrderLine ol = null; + if (line.getC_OrderLine_ID() != 0) + { + if (isSOTrx() + || line.getM_Product_ID() == 0) + { + ol = new MOrderLine (getCtx(), line.getC_OrderLine_ID(), get_TrxName()); + if (line.getQtyInvoiced() != null) + ol.setQtyInvoiced(ol.getQtyInvoiced().add(line.getQtyInvoiced())); + if (!ol.save(get_TrxName())) + { + m_processMsg = "Could not update Order Line"; + return DocAction.STATUS_Invalid; + } + } + // Order Invoiced Qty updated via Matching Inv-PO + else if (!isSOTrx() + && line.getM_Product_ID() != 0 + && !isReversal()) + { + // MatchPO is created also from MInOut when Invoice exists before Shipment + BigDecimal matchQty = line.getQtyInvoiced(); + MMatchPO po = MMatchPO.create (line, null, + getDateInvoiced(), matchQty); + if (!po.save(get_TrxName())) + { + m_processMsg = "Could not create PO Matching"; + return DocAction.STATUS_Invalid; + } + else + matchPO++; + } + } + + // Matching - Inv-Shipment + if (!isSOTrx() + && line.getM_InOutLine_ID() != 0 + && line.getM_Product_ID() != 0 + && !isReversal()) + { + MInOutLine receiptLine = new MInOutLine (getCtx(),line.getM_InOutLine_ID(), get_TrxName()); + BigDecimal matchQty = line.getQtyInvoiced(); + + if (receiptLine.getMovementQty().compareTo(matchQty) < 0) + matchQty = receiptLine.getMovementQty(); + + MMatchInv inv = new MMatchInv(line, getDateInvoiced(), matchQty); + if (!inv.save(get_TrxName())) + { + m_processMsg = "Could not create Invoice Matching"; + return DocAction.STATUS_Invalid; + } + else + matchInv++; + } + } // for all lines + if (matchInv > 0) + info.append(" @M_MatchInv_ID@#").append(matchInv).append(" "); + if (matchPO > 0) + info.append(" @M_MatchPO_ID@#").append(matchPO).append(" "); + + + + // Update BP Statistics + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); + // Update total revenue and balance / credit limit (reversed on AllocationLine.processIt) + BigDecimal invAmt = MConversionRate.convertBase(getCtx(), getGrandTotal(true), // CM adjusted + getC_Currency_ID(), getDateAcct(), 0, getAD_Client_ID(), getAD_Org_ID()); + if (invAmt == null) + { + m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID() + + " to base C_Currency_ID=" + MClient.get(Env.getCtx()).getC_Currency_ID(); + return DocAction.STATUS_Invalid; + } + // Total Balance + BigDecimal newBalance = bp.getTotalOpenBalance(false); + if (newBalance == null) + newBalance = Env.ZERO; + if (isSOTrx()) + { + newBalance = newBalance.add(invAmt); + // + if (bp.getFirstSale() == null) + bp.setFirstSale(getDateInvoiced()); + BigDecimal newLifeAmt = bp.getActualLifeTimeValue(); + if (newLifeAmt == null) + newLifeAmt = invAmt; + else + newLifeAmt = newLifeAmt.add(invAmt); + BigDecimal newCreditAmt = bp.getSO_CreditUsed(); + if (newCreditAmt == null) + newCreditAmt = invAmt; + else + newCreditAmt = newCreditAmt.add(invAmt); + // + log.fine("GrandTotal=" + getGrandTotal(true) + "(" + invAmt + + ") BP Life=" + bp.getActualLifeTimeValue() + "->" + newLifeAmt + + ", Credit=" + bp.getSO_CreditUsed() + "->" + newCreditAmt + + ", Balance=" + bp.getTotalOpenBalance(false) + " -> " + newBalance); + bp.setActualLifeTimeValue(newLifeAmt); + bp.setSO_CreditUsed(newCreditAmt); + } // SO + else + { + newBalance = newBalance.subtract(invAmt); + log.fine("GrandTotal=" + getGrandTotal(true) + "(" + invAmt + + ") Balance=" + bp.getTotalOpenBalance(false) + " -> " + newBalance); + } + bp.setTotalOpenBalance(newBalance); + bp.setSOCreditStatus(); + if (!bp.save(get_TrxName())) + { + m_processMsg = "Could not update Business Partner"; + return DocAction.STATUS_Invalid; + } + + // User - Last Result/Contact + if (getAD_User_ID() != 0) + { + MUser user = new MUser (getCtx(), getAD_User_ID(), get_TrxName()); + user.setLastContact(new Timestamp(System.currentTimeMillis())); + user.setLastResult(Msg.translate(getCtx(), "C_Invoice_ID") + ": " + getDocumentNo()); + if (!user.save(get_TrxName())) + { + m_processMsg = "Could not update Business Partner User"; + return DocAction.STATUS_Invalid; + } + } // user + + // Update Project + if (isSOTrx() && getC_Project_ID() != 0) + { + MProject project = new MProject (getCtx(), getC_Project_ID(), get_TrxName()); + BigDecimal amt = getGrandTotal(true); + int C_CurrencyTo_ID = project.getC_Currency_ID(); + if (C_CurrencyTo_ID != getC_Currency_ID()) + amt = MConversionRate.convert(getCtx(), amt, getC_Currency_ID(), C_CurrencyTo_ID, + getDateAcct(), 0, getAD_Client_ID(), getAD_Org_ID()); + if (amt == null) + { + m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID() + + " to Project C_Currency_ID=" + C_CurrencyTo_ID; + return DocAction.STATUS_Invalid; + } + BigDecimal newAmt = project.getInvoicedAmt(); + if (newAmt == null) + newAmt = amt; + else + newAmt = newAmt.add(amt); + log.fine("GrandTotal=" + getGrandTotal(true) + "(" + amt + + ") Project " + project.getName() + + " - Invoiced=" + project.getInvoicedAmt() + "->" + newAmt); + project.setInvoicedAmt(newAmt); + if (!project.save(get_TrxName())) + { + m_processMsg = "Could not update Project"; + return DocAction.STATUS_Invalid; + } + } // project + + // User Validation + String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); + if (valid != null) + { + m_processMsg = valid; + return DocAction.STATUS_Invalid; + } + + // Set the definite document number after completed (if needed) + setDefiniteDocumentNo(); + + // Counter Documents + MInvoice counter = createCounterDoc(); + if (counter != null) + info.append(" - @CounterDoc@: @C_Invoice_ID@=").append(counter.getDocumentNo()); + + m_processMsg = info.toString().trim(); + setProcessed(true); + setDocAction(DOCACTION_Close); + return DocAction.STATUS_Completed; + } // completeIt + + /** + * Set the definite document number after completed + */ + private void setDefiniteDocumentNo() { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + if (dt.isOverwriteDateOnComplete()) { + setDateInvoiced(new Timestamp (System.currentTimeMillis())); + } + if (dt.isOverwriteSeqOnComplete()) { + String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); + if (value != null) + setDocumentNo(value); + } + } + + /** + * Create Counter Document + * @return counter invoice + */ + private MInvoice createCounterDoc() + { + // Is this a counter doc ? + if (getRef_Invoice_ID() != 0) + return null; + + // Org Must be linked to BPartner + MOrg org = MOrg.get(getCtx(), getAD_Org_ID()); + int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName()); + if (counterC_BPartner_ID == 0) + return null; + // Business Partner needs to be linked to Org + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null); + int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int(); + if (counterAD_Org_ID == 0) + return null; + + MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, null); + MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID); + log.info("Counter BP=" + counterBP.getName()); + + // Document Type + int C_DocTypeTarget_ID = 0; + MDocTypeCounter counterDT = MDocTypeCounter.getCounterDocType(getCtx(), getC_DocType_ID()); + if (counterDT != null) + { + log.fine(counterDT.toString()); + if (!counterDT.isCreateCounter() || !counterDT.isValid()) + return null; + C_DocTypeTarget_ID = counterDT.getCounter_C_DocType_ID(); + } + else // indirect + { + C_DocTypeTarget_ID = MDocTypeCounter.getCounterDocType_ID(getCtx(), getC_DocType_ID()); + log.fine("Indirect C_DocTypeTarget_ID=" + C_DocTypeTarget_ID); + if (C_DocTypeTarget_ID <= 0) + return null; + } + + // Deep Copy + MInvoice counter = copyFrom(this, getDateInvoiced(), + C_DocTypeTarget_ID, !isSOTrx(), true, get_TrxName(), true); + // + counter.setAD_Org_ID(counterAD_Org_ID); + // counter.setM_Warehouse_ID(counterOrgInfo.getM_Warehouse_ID()); + // + counter.setBPartner(counterBP); + // Refernces (Should not be required + counter.setSalesRep_ID(getSalesRep_ID()); + counter.save(get_TrxName()); + + // Update copied lines + MInvoiceLine[] counterLines = counter.getLines(true); + for (int i = 0; i < counterLines.length; i++) + { + MInvoiceLine counterLine = counterLines[i]; + counterLine.setClientOrg(counter); + counterLine.setInvoice(counter); // copies header values (BP, etc.) + counterLine.setPrice(); + counterLine.setTax(); + // + counterLine.save(get_TrxName()); + } + + log.fine(counter.toString()); + + // Document Action + if (counterDT != null) + { + if (counterDT.getDocAction() != null) + { + counter.setDocAction(counterDT.getDocAction()); + counter.processIt(counterDT.getDocAction()); + counter.save(get_TrxName()); + } + } + return counter; + } // createCounterDoc + + /** + * Void Document. + * @return true if success + */ + public boolean voidIt() + { + log.info(toString()); + // Before Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID); + if (m_processMsg != null) + return false; + + if (DOCSTATUS_Closed.equals(getDocStatus()) + || DOCSTATUS_Reversed.equals(getDocStatus()) + || DOCSTATUS_Voided.equals(getDocStatus())) + { + m_processMsg = "Document Closed: " + getDocStatus(); + setDocAction(DOCACTION_None); + return false; + } + + // Not Processed + if (DOCSTATUS_Drafted.equals(getDocStatus()) + || DOCSTATUS_Invalid.equals(getDocStatus()) + || DOCSTATUS_InProgress.equals(getDocStatus()) + || DOCSTATUS_Approved.equals(getDocStatus()) + || DOCSTATUS_NotApproved.equals(getDocStatus()) ) + { + // Set lines to 0 + MInvoiceLine[] lines = getLines(false); + for (int i = 0; i < lines.length; i++) + { + MInvoiceLine line = lines[i]; + BigDecimal old = line.getQtyInvoiced(); + if (old.compareTo(Env.ZERO) != 0) + { + line.setQty(Env.ZERO); + line.setTaxAmt(Env.ZERO); + line.setLineNetAmt(Env.ZERO); + line.setLineTotalAmt(Env.ZERO); + line.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + old + ")"); + // Unlink Shipment + if (line.getM_InOutLine_ID() != 0) + { + MInOutLine ioLine = new MInOutLine(getCtx(), line.getM_InOutLine_ID(), get_TrxName()); + ioLine.setIsInvoiced(false); + ioLine.save(get_TrxName()); + line.setM_InOutLine_ID(0); + } + line.save(get_TrxName()); + } + } + addDescription(Msg.getMsg(getCtx(), "Voided")); + setIsPaid(true); + setC_Payment_ID(0); + } + else + { + return reverseCorrectIt(); + } + + // After Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID); + if (m_processMsg != null) + return false; + + setProcessed(true); + setDocAction(DOCACTION_None); + return true; + } // voidIt + + /** + * Close Document. + * @return true if success + */ + public boolean closeIt() + { + log.info(toString()); + // Before Close + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE); + if (m_processMsg != null) + return false; + + // After Close + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE); + if (m_processMsg != null) + return false; + + setProcessed(true); + setDocAction(DOCACTION_None); + return true; + } // closeIt + + /** + * Reverse Correction - same date + * @return true if success + */ + public boolean reverseCorrectIt() + { + log.info(toString()); + // Before reverseCorrect + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT); + if (m_processMsg != null) + return false; + + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType())) + { + m_processMsg = "@PeriodClosed@"; + return false; + } + // + MAllocationHdr[] allocations = MAllocationHdr.getOfInvoice(getCtx(), + getC_Invoice_ID(), get_TrxName()); + for (int i = 0; i < allocations.length; i++) + { + allocations[i].setDocAction(DocAction.ACTION_Reverse_Correct); + allocations[i].reverseCorrectIt(); + allocations[i].save(get_TrxName()); + } + // Reverse/Delete Matching + if (!isSOTrx()) + { + MMatchInv[] mInv = MMatchInv.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName()); + for (int i = 0; i < mInv.length; i++) + mInv[i].delete(true); + MMatchPO[] mPO = MMatchPO.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName()); + for (int i = 0; i < mPO.length; i++) + { + if (mPO[i].getM_InOutLine_ID() == 0) + mPO[i].delete(true); + else + { + mPO[i].setC_InvoiceLine_ID(null); + mPO[i].save(get_TrxName()); + } + } + } + // + load(get_TrxName()); // reload allocation reversal info + + // Deep Copy + MInvoice reversal = copyFrom (this, getDateInvoiced(), + getC_DocType_ID(), isSOTrx(), false, get_TrxName(), true); + if (reversal == null) + { + m_processMsg = "Could not create Invoice Reversal"; + return false; + } + reversal.setReversal(true); + + // Reverse Line Qty + MInvoiceLine[] rLines = reversal.getLines(false); + for (int i = 0; i < rLines.length; i++) + { + MInvoiceLine rLine = rLines[i]; + rLine.setQtyEntered(rLine.getQtyEntered().negate()); + rLine.setQtyInvoiced(rLine.getQtyInvoiced().negate()); + rLine.setLineNetAmt(rLine.getLineNetAmt().negate()); + if (rLine.getTaxAmt() != null && rLine.getTaxAmt().compareTo(Env.ZERO) != 0) + rLine.setTaxAmt(rLine.getTaxAmt().negate()); + if (rLine.getLineTotalAmt() != null && rLine.getLineTotalAmt().compareTo(Env.ZERO) != 0) + rLine.setLineTotalAmt(rLine.getLineTotalAmt().negate()); + if (!rLine.save(get_TrxName())) + { + m_processMsg = "Could not correct Invoice Reversal Line"; + return false; + } + } + reversal.setC_Order_ID(getC_Order_ID()); + reversal.addDescription("{->" + getDocumentNo() + ")"); + // + if (!reversal.processIt(DocAction.ACTION_Complete)) + { + m_processMsg = "Reversal ERROR: " + reversal.getProcessMsg(); + return false; + } + reversal.setC_Payment_ID(0); + reversal.setIsPaid(true); + reversal.closeIt(); + reversal.setProcessing (false); + reversal.setDocStatus(DOCSTATUS_Reversed); + reversal.setDocAction(DOCACTION_None); + reversal.save(get_TrxName()); + m_processMsg = reversal.getDocumentNo(); + // + addDescription("(" + reversal.getDocumentNo() + "<-)"); + + // Clean up Reversed (this) + MInvoiceLine[] iLines = getLines(false); + for (int i = 0; i < iLines.length; i++) + { + MInvoiceLine iLine = iLines[i]; + if (iLine.getM_InOutLine_ID() != 0) + { + MInOutLine ioLine = new MInOutLine(getCtx(), iLine.getM_InOutLine_ID(), get_TrxName()); + ioLine.setIsInvoiced(false); + ioLine.save(get_TrxName()); + // Reconsiliation + iLine.setM_InOutLine_ID(0); + iLine.save(get_TrxName()); + } + } + setProcessed(true); + setDocStatus(DOCSTATUS_Reversed); // may come from void + setDocAction(DOCACTION_None); + setC_Payment_ID(0); + setIsPaid(true); + + // Create Allocation + MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, getDateAcct(), + getC_Currency_ID(), + Msg.translate(getCtx(), "C_Invoice_ID") + ": " + getDocumentNo() + "/" + reversal.getDocumentNo(), + get_TrxName()); + alloc.setAD_Org_ID(getAD_Org_ID()); + if (alloc.save()) + { + // Amount + BigDecimal gt = getGrandTotal(true); + if (!isSOTrx()) + gt = gt.negate(); + // Orig Line + MAllocationLine aLine = new MAllocationLine (alloc, gt, + Env.ZERO, Env.ZERO, Env.ZERO); + aLine.setC_Invoice_ID(getC_Invoice_ID()); + aLine.save(); + // Reversal Line + MAllocationLine rLine = new MAllocationLine (alloc, gt.negate(), + Env.ZERO, Env.ZERO, Env.ZERO); + rLine.setC_Invoice_ID(reversal.getC_Invoice_ID()); + rLine.save(); + // Process It + if (alloc.processIt(DocAction.ACTION_Complete)) + alloc.save(); + } + + //MZ Goodwill + if (!isSOTrx()) + { + // delete Matched Invoice Cost Detail + MInvoiceLine[] lines = getLines(); + for (int i = 0; i < lines.length; i++) + { + MCostDetail cd = MCostDetail.get (getCtx(), "C_InvoiceLine_ID=? AND M_AttributeSetInstance_ID=?", + lines[i].getC_InvoiceLine_ID(), lines[i].getM_AttributeSetInstance_ID(), get_TrxName()); + if (cd != null) + { + cd.setProcessed(false); + cd.delete(true); + } + } + } + //End MZ + // After reverseCorrect + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); + if (m_processMsg != null) + return false; + + return true; + } // reverseCorrectIt + + /** + * Reverse Accrual - none + * @return false + */ + public boolean reverseAccrualIt() + { + log.info(toString()); + // Before reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL); + if (m_processMsg != null) + return false; + + // After reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); + if (m_processMsg != null) + return false; + + return false; + } // reverseAccrualIt + + /** + * Re-activate + * @return false + */ + public boolean reActivateIt() + { + log.info(toString()); + // Before reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE); + if (m_processMsg != null) + return false; + + // After reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE); + if (m_processMsg != null) + return false; + + + return false; + } // reActivateIt + + + /************************************************************************* + * Get Summary + * @return Summary of Document + */ + public String getSummary() + { + StringBuffer sb = new StringBuffer(); + sb.append(getDocumentNo()); + // : Grand Total = 123.00 (#1) + sb.append(": "). + append(Msg.translate(getCtx(),"GrandTotal")).append("=").append(getGrandTotal()) + .append(" (#").append(getLines(false).length).append(")"); + // - Description + if (getDescription() != null && getDescription().length() > 0) + sb.append(" - ").append(getDescription()); + return sb.toString(); + } // getSummary + + /** + * Get Process Message + * @return clear text error message + */ + public String getProcessMsg() + { + return m_processMsg; + } // getProcessMsg + + /** + * Get Document Owner (Responsible) + * @return AD_User_ID + */ + public int getDoc_User_ID() + { + return getSalesRep_ID(); + } // getDoc_User_ID + + /** + * Get Document Approval Amount + * @return amount + */ + public BigDecimal getApprovalAmt() + { + return getGrandTotal(); + } // getApprovalAmt + + /** + * + * @param rma + */ + public void setRMA(MRMA rma) + { + setM_RMA_ID(rma.getM_RMA_ID()); + setAD_Org_ID(rma.getAD_Org_ID()); + setDescription(rma.getDescription()); + setC_BPartner_ID(rma.getC_BPartner_ID()); + setSalesRep_ID(rma.getSalesRep_ID()); + + setGrandTotal(rma.getAmt()); + setIsSOTrx(rma.isSOTrx()); + setTotalLines(rma.getAmt()); + + MInvoice originalInvoice = rma.getOriginalInvoice(); + + if (originalInvoice == null) + { + throw new IllegalStateException("Not invoiced - RMA: " + rma.getDocumentNo()); + } + + setC_BPartner_Location_ID(originalInvoice.getC_BPartner_Location_ID()); + setAD_User_ID(originalInvoice.getAD_User_ID()); + setC_Currency_ID(originalInvoice.getC_Currency_ID()); + setIsTaxIncluded(originalInvoice.isTaxIncluded()); + setM_PriceList_ID(originalInvoice.getM_PriceList_ID()); + setC_Project_ID(originalInvoice.getC_Project_ID()); + setC_Activity_ID(originalInvoice.getC_Activity_ID()); + setC_Campaign_ID(originalInvoice.getC_Campaign_ID()); + setUser1_ID(originalInvoice.getUser1_ID()); + setUser2_ID(originalInvoice.getUser2_ID()); + } + +} // MInvoice diff --git a/posterita/posterita/src/main/org/compiere/model/MOrder.java b/posterita/posterita/src/main/org/compiere/model/MOrder.java new file mode 100644 index 0000000000..a92f1f3adb --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MOrder.java @@ -0,0 +1,2330 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.io.File; +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.print.ReportEngine; +import org.compiere.process.DocAction; +import org.compiere.process.DocumentEngine; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Msg; + +/** + * Order Model. + * Please do not set DocStatus and C_DocType_ID directly. + * They are set in the process() method. + * Use DocAction and C_DocTypeTarget_ID instead. + * + * @author Jorg Janke + * @version $Id: MOrder.java,v 1.5 2006/10/06 00:42:24 jjanke Exp $ + */ +public class MOrder extends X_C_Order implements DocAction +{ + /** + * Create new Order by copying + * @param from order + * @param dateDoc date of the document date + * @param C_DocTypeTarget_ID target document type + * @param isSOTrx sales order + * @param counter create counter links + * @param copyASI copy line attributes Attribute Set Instance, Resaouce Assignment + * @param trxName trx + * @return Order + */ + public static MOrder copyFrom (MOrder from, Timestamp dateDoc, + int C_DocTypeTarget_ID, boolean isSOTrx, boolean counter, boolean copyASI, + String trxName) + { + MOrder to = new MOrder (from.getCtx(), 0, trxName); + to.set_TrxName(trxName); + PO.copyValues(from, to, from.getAD_Client_ID(), from.getAD_Org_ID()); + to.set_ValueNoCheck ("C_Order_ID", I_ZERO); + to.set_ValueNoCheck ("DocumentNo", null); + // + to.setDocStatus (DOCSTATUS_Drafted); // Draft + to.setDocAction(DOCACTION_Complete); + // + to.setC_DocType_ID(0); + to.setC_DocTypeTarget_ID (C_DocTypeTarget_ID); + to.setIsSOTrx(isSOTrx); + // + to.setIsSelected (false); + to.setDateOrdered (dateDoc); + to.setDateAcct (dateDoc); + to.setDatePromised (dateDoc); // assumption + to.setDatePrinted(null); + to.setIsPrinted (false); + // + to.setIsApproved (false); + to.setIsCreditApproved(false); + to.setC_Payment_ID(0); + to.setC_CashLine_ID(0); + // Amounts are updated when adding lines + to.setGrandTotal(Env.ZERO); + to.setTotalLines(Env.ZERO); + // + to.setIsDelivered(false); + to.setIsInvoiced(false); + to.setIsSelfService(false); + to.setIsTransferred (false); + to.setPosted (false); + to.setProcessed (false); + if (counter) + to.setRef_Order_ID(from.getC_Order_ID()); + else + to.setRef_Order_ID(0); + // + if (!to.save(trxName)) + throw new IllegalStateException("Could not create Order"); + if (counter) + from.setRef_Order_ID(to.getC_Order_ID()); + + if (to.copyLinesFrom(from, counter, copyASI) == 0) + throw new IllegalStateException("Could not create Order Lines"); + + return to; + } // copyFrom + + + /************************************************************************** + * Default Constructor + * @param ctx context + * @param C_Order_ID order to load, (0 create new order) + * @param trxName trx name + */ + public MOrder(Properties ctx, int C_Order_ID, String trxName) + { + super (ctx, C_Order_ID, trxName); + // New + if (C_Order_ID == 0) + { + setDocStatus(DOCSTATUS_Drafted); + setDocAction (DOCACTION_Prepare); + // + setDeliveryRule (DELIVERYRULE_Availability); + setFreightCostRule (FREIGHTCOSTRULE_FreightIncluded); + setInvoiceRule (INVOICERULE_Immediate); + setPaymentRule(PAYMENTRULE_OnCredit); + setPriorityRule (PRIORITYRULE_Medium); + setDeliveryViaRule (DELIVERYVIARULE_Pickup); + // + setIsDiscountPrinted (false); + setIsSelected (false); + setIsTaxIncluded (false); + setIsSOTrx (true); + setIsDropShip(false); + setSendEMail (false); + // + setIsApproved(false); + setIsPrinted(false); + setIsCreditApproved(false); + setIsDelivered(false); + setIsInvoiced(false); + setIsTransferred(false); + setIsSelfService(false); + // + super.setProcessed(false); + setProcessing(false); + setPosted(false); + + setDateAcct (new Timestamp(System.currentTimeMillis())); + setDatePromised (new Timestamp(System.currentTimeMillis())); + setDateOrdered (new Timestamp(System.currentTimeMillis())); + + setFreightAmt (Env.ZERO); + setChargeAmt (Env.ZERO); + setTotalLines (Env.ZERO); + setGrandTotal (Env.ZERO); + } + } // MOrder + + /************************************************************************** + * Project Constructor + * @param project Project to create Order from + * @param IsSOTrx sales order + * @param DocSubTypeSO if SO DocType Target (default DocSubTypeSO_OnCredit) + */ + public MOrder (MProject project, boolean IsSOTrx, String DocSubTypeSO) + { + this (project.getCtx(), 0, project.get_TrxName()); + setAD_Client_ID(project.getAD_Client_ID()); + setAD_Org_ID(project.getAD_Org_ID()); + setC_Campaign_ID(project.getC_Campaign_ID()); + setSalesRep_ID(project.getSalesRep_ID()); + // + setC_Project_ID(project.getC_Project_ID()); + setDescription(project.getName()); + Timestamp ts = project.getDateContract(); + if (ts != null) + setDateOrdered (ts); + ts = project.getDateFinish(); + if (ts != null) + setDatePromised (ts); + // + setC_BPartner_ID(project.getC_BPartner_ID()); + setC_BPartner_Location_ID(project.getC_BPartner_Location_ID()); + setAD_User_ID(project.getAD_User_ID()); + // + setM_Warehouse_ID(project.getM_Warehouse_ID()); + setM_PriceList_ID(project.getM_PriceList_ID()); + setC_PaymentTerm_ID(project.getC_PaymentTerm_ID()); + // + setIsSOTrx(IsSOTrx); + if (IsSOTrx) + { + if (DocSubTypeSO == null || DocSubTypeSO.length() == 0) + setC_DocTypeTarget_ID(DocSubTypeSO_OnCredit); + else + setC_DocTypeTarget_ID(DocSubTypeSO); + } + else + setC_DocTypeTarget_ID(); + } // MOrder + + /** + * Load Constructor + * @param ctx context + * @param rs result set record + * @param trxName transaction + */ + public MOrder (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MOrder + + /** Order Lines */ + private MOrderLine[] m_lines = null; + /** Tax Lines */ + private MOrderTax[] m_taxes = null; + /** Force Creation of order */ + private boolean m_forceCreation = false; + + /** + * Overwrite Client/Org if required + * @param AD_Client_ID client + * @param AD_Org_ID org + */ + public void setClientOrg (int AD_Client_ID, int AD_Org_ID) + { + super.setClientOrg(AD_Client_ID, AD_Org_ID); + } // setClientOrg + + + /** + * Add to Description + * @param description text + */ + public void addDescription (String description) + { + String desc = getDescription(); + if (desc == null) + setDescription(description); + else + setDescription(desc + " | " + description); + } // addDescription + + /** + * Set Business Partner (Ship+Bill) + * @param C_BPartner_ID bpartner + */ + public void setC_BPartner_ID (int C_BPartner_ID) + { + super.setC_BPartner_ID (C_BPartner_ID); + super.setBill_BPartner_ID (C_BPartner_ID); + } // setC_BPartner_ID + + /** + * Set Business Partner Location (Ship+Bill) + * @param C_BPartner_Location_ID bp location + */ + public void setC_BPartner_Location_ID (int C_BPartner_Location_ID) + { + super.setC_BPartner_Location_ID (C_BPartner_Location_ID); + super.setBill_Location_ID(C_BPartner_Location_ID); + } // setC_BPartner_Location_ID + + /** + * Set Business Partner Contact (Ship+Bill) + * @param AD_User_ID user + */ + public void setAD_User_ID (int AD_User_ID) + { + super.setAD_User_ID (AD_User_ID); + super.setBill_User_ID (AD_User_ID); + } // setAD_User_ID + + /** + * Set Ship Business Partner + * @param C_BPartner_ID bpartner + */ + public void setShip_BPartner_ID (int C_BPartner_ID) + { + super.setC_BPartner_ID (C_BPartner_ID); + } // setShip_BPartner_ID + + /** + * Set Ship Business Partner Location + * @param C_BPartner_Location_ID bp location + */ + public void setShip_Location_ID (int C_BPartner_Location_ID) + { + super.setC_BPartner_Location_ID (C_BPartner_Location_ID); + } // setShip_Location_ID + + /** + * Set Ship Business Partner Contact + * @param AD_User_ID user + */ + public void setShip_User_ID (int AD_User_ID) + { + super.setAD_User_ID (AD_User_ID); + } // setShip_User_ID + + + /** + * Set Warehouse + * @param M_Warehouse_ID warehouse + */ + public void setM_Warehouse_ID (int M_Warehouse_ID) + { + super.setM_Warehouse_ID (M_Warehouse_ID); + } // setM_Warehouse_ID + + /** + * Set Drop Ship + * @param IsDropShip drop ship + */ + public void setIsDropShip (boolean IsDropShip) + { + super.setIsDropShip (IsDropShip); + } // setIsDropShip + + /*************************************************************************/ + + /** Sales Order Sub Type - SO */ + public static final String DocSubTypeSO_Standard = "SO"; + /** Sales Order Sub Type - OB */ + public static final String DocSubTypeSO_Quotation = "OB"; + /** Sales Order Sub Type - ON */ + public static final String DocSubTypeSO_Proposal = "ON"; + /** Sales Order Sub Type - PR */ + public static final String DocSubTypeSO_Prepay = "PR"; + /** Sales Order Sub Type - WR */ + public static final String DocSubTypeSO_POS = "WR"; + /** Sales Order Sub Type - WP */ + public static final String DocSubTypeSO_Warehouse = "WP"; + /** Sales Order Sub Type - WI */ + public static final String DocSubTypeSO_OnCredit = "WI"; + /** Sales Order Sub Type - RM */ + public static final String DocSubTypeSO_RMA = "RM"; + + /** + * Set Target Sales Document Type + * @param DocSubTypeSO_x SO sub type - see DocSubTypeSO_* + */ + public void setC_DocTypeTarget_ID (String DocSubTypeSO_x) + { + String sql = "SELECT C_DocType_ID FROM C_DocType " + + "WHERE AD_Client_ID=? AND AD_Org_ID IN (0," + getAD_Org_ID() + + ") AND DocSubTypeSO=? " + + "ORDER BY AD_Org_ID DESC, IsDefault DESC"; + int C_DocType_ID = DB.getSQLValue(null, sql, getAD_Client_ID(), DocSubTypeSO_x); + if (C_DocType_ID <= 0) + log.severe ("Not found for AD_Client_ID=" + getAD_Client_ID () + ", SubType=" + DocSubTypeSO_x); + else + { + log.fine("(SO) - " + DocSubTypeSO_x); + setC_DocTypeTarget_ID (C_DocType_ID); + setIsSOTrx(true); + } + } // setC_DocTypeTarget_ID + + /** + * Set Target Document Type. + * Standard Order or PO + */ + public void setC_DocTypeTarget_ID () + { + if (isSOTrx()) // SO = Std Order + { + setC_DocTypeTarget_ID(DocSubTypeSO_Standard); + return; + } + // PO + String sql = "SELECT C_DocType_ID FROM C_DocType " + + "WHERE AD_Client_ID=? AND AD_Org_ID IN (0," + getAD_Org_ID() + + ") AND DocBaseType='POO' " + + "ORDER BY AD_Org_ID DESC, IsDefault DESC"; + int C_DocType_ID = DB.getSQLValue(null, sql, getAD_Client_ID()); + if (C_DocType_ID <= 0) + log.severe ("No POO found for AD_Client_ID=" + getAD_Client_ID ()); + else + { + log.fine("(PO) - " + C_DocType_ID); + setC_DocTypeTarget_ID (C_DocType_ID); + } + } // setC_DocTypeTarget_ID + + + /** + * Set Business Partner Defaults & Details. + * SOTrx should be set. + * @param bp business partner + */ + public void setBPartner (MBPartner bp) + { + if (bp == null) + return; + + setC_BPartner_ID(bp.getC_BPartner_ID()); + // Defaults Payment Term + int ii = 0; + if (isSOTrx()) + ii = bp.getC_PaymentTerm_ID(); + else + ii = bp.getPO_PaymentTerm_ID(); + if (ii != 0) + setC_PaymentTerm_ID(ii); + // Default Price List + if (isSOTrx()) + ii = bp.getM_PriceList_ID(); + else + ii = bp.getPO_PriceList_ID(); + if (ii != 0) + setM_PriceList_ID(ii); + // Default Delivery/Via Rule + String ss = bp.getDeliveryRule(); + if (ss != null) + setDeliveryRule(ss); + ss = bp.getDeliveryViaRule(); + if (ss != null) + setDeliveryViaRule(ss); + // Default Invoice/Payment Rule + ss = bp.getInvoiceRule(); + if (ss != null) + setInvoiceRule(ss); + ss = bp.getPaymentRule(); + if (ss != null) + setPaymentRule(ss); + // Sales Rep + ii = bp.getSalesRep_ID(); + if (ii != 0) + setSalesRep_ID(ii); + + + // Set Locations + MBPartnerLocation[] locs = bp.getLocations(false); + if (locs != null) + { + for (int i = 0; i < locs.length; i++) + { + if (locs[i].isShipTo()) + super.setC_BPartner_Location_ID(locs[i].getC_BPartner_Location_ID()); + if (locs[i].isBillTo()) + setBill_Location_ID(locs[i].getC_BPartner_Location_ID()); + } + // set to first + if (getC_BPartner_Location_ID() == 0 && locs.length > 0) + super.setC_BPartner_Location_ID(locs[0].getC_BPartner_Location_ID()); + if (getBill_Location_ID() == 0 && locs.length > 0) + setBill_Location_ID(locs[0].getC_BPartner_Location_ID()); + } + if (getC_BPartner_Location_ID() == 0) + log.log(Level.SEVERE, "MOrder.setBPartner - Has no Ship To Address: " + bp); + if (getBill_Location_ID() == 0) + log.log(Level.SEVERE, "MOrder.setBPartner - Has no Bill To Address: " + bp); + + // Set Contact + MUser[] contacts = bp.getContacts(false); + if (contacts != null && contacts.length == 1) + setAD_User_ID(contacts[0].getAD_User_ID()); + } // setBPartner + + + /** + * Copy Lines From other Order + * @param otherOrder order + * @param counter set counter info + * @param copyASI copy line attributes Attribute Set Instance, Resaouce Assignment + * @return number of lines copied + */ + public int copyLinesFrom (MOrder otherOrder, boolean counter, boolean copyASI) + { + if (isProcessed() || isPosted() || otherOrder == null) + return 0; + MOrderLine[] fromLines = otherOrder.getLines(false, null); + int count = 0; + for (int i = 0; i < fromLines.length; i++) + { + MOrderLine line = new MOrderLine (this); + PO.copyValues(fromLines[i], line, getAD_Client_ID(), getAD_Org_ID()); + line.setC_Order_ID(getC_Order_ID()); + line.setOrder(this); + line.set_ValueNoCheck ("C_OrderLine_ID", I_ZERO); // new + // References + if (!copyASI) + { + line.setM_AttributeSetInstance_ID(0); + line.setS_ResourceAssignment_ID(0); + } + if (counter) + line.setRef_OrderLine_ID(fromLines[i].getC_OrderLine_ID()); + else + line.setRef_OrderLine_ID(0); + // + line.setQtyDelivered(Env.ZERO); + line.setQtyInvoiced(Env.ZERO); + line.setQtyReserved(Env.ZERO); + line.setDateDelivered(null); + line.setDateInvoiced(null); + // Tax + if (getC_BPartner_ID() != otherOrder.getC_BPartner_ID()) + line.setTax(); // recalculate + // + // + line.setProcessed(false); + if (line.save(get_TrxName())) + count++; + // Cross Link + if (counter) + { + fromLines[i].setRef_OrderLine_ID(line.getC_OrderLine_ID()); + fromLines[i].save(get_TrxName()); + } + } + if (fromLines.length != count) + log.log(Level.SEVERE, "Line difference - From=" + fromLines.length + " <> Saved=" + count); + return count; + } // copyLinesFrom + + + /************************************************************************** + * String Representation + * @return info + */ + public String toString () + { + StringBuffer sb = new StringBuffer ("MOrder[") + .append(get_ID()).append("-").append(getDocumentNo()) + .append(",IsSOTrx=").append(isSOTrx()) + .append(",C_DocType_ID=").append(getC_DocType_ID()) + .append(", GrandTotal=").append(getGrandTotal()) + .append ("]"); + return sb.toString (); + } // toString + + /** + * Get Document Info + * @return document info (untranslated) + */ + public String getDocumentInfo() + { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + return dt.getName() + " " + getDocumentNo(); + } // getDocumentInfo + + /** + * Create PDF + * @return File or null + */ + public File createPDF () + { + try + { + File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf"); + return createPDF (temp); + } + catch (Exception e) + { + log.severe("Could not create PDF - " + e.getMessage()); + } + return null; + } // getPDF + + /** + * Create PDF file + * @param file output file + * @return file if success + */ + public File createPDF (File file) + { + ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.ORDER, getC_Order_ID()); + if (re == null) + return null; + return re.getPDF(file); + } // createPDF + + /** + * Set Price List (and Currency, TaxIncluded) when valid + * @param M_PriceList_ID price list + */ + public void setM_PriceList_ID (int M_PriceList_ID) + { + MPriceList pl = MPriceList.get(getCtx(), M_PriceList_ID, null); + if (pl.get_ID() == M_PriceList_ID) + { + super.setM_PriceList_ID(M_PriceList_ID); + setC_Currency_ID(pl.getC_Currency_ID()); + setIsTaxIncluded(pl.isTaxIncluded()); + } + } // setM_PriceList_ID + + + /************************************************************************** + * Get Lines of Order + * @param whereClause where clause or null (starting with AND) + * @param orderClause order clause + * @return lines + */ + public MOrderLine[] getLines (String whereClause, String orderClause) + { + ArrayList list = new ArrayList (); + StringBuffer sql = new StringBuffer("SELECT * FROM C_OrderLine WHERE C_Order_ID=? "); + if (whereClause != null) + sql.append(whereClause); + if (orderClause != null) + sql.append(" ").append(orderClause); + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); + pstmt.setInt(1, getC_Order_ID()); + rs = pstmt.executeQuery(); + while (rs.next()) + { + MOrderLine ol = new MOrderLine(getCtx(), rs, get_TrxName()); + ol.setHeaderInfo (this); + list.add(ol); + } + } + catch (Exception e) + { + log.log(Level.SEVERE, sql.toString(), e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + // + MOrderLine[] lines = new MOrderLine[list.size ()]; + list.toArray (lines); + return lines; + } // getLines + + /** + * Get Lines of Order + * @param requery requery + * @param orderBy optional order by column + * @return lines + */ + public MOrderLine[] getLines (boolean requery, String orderBy) + { + if (m_lines != null && !requery) { + set_TrxName(m_lines, get_TrxName()); + return m_lines; + } + // + String orderClause = "ORDER BY "; + if (orderBy != null && orderBy.length() > 0) + orderClause += orderBy; + else + orderClause += "Line"; + m_lines = getLines(null, orderClause); + return m_lines; + } // getLines + + /** + * Get Lines of Order. + * (useb by web store) + * @return lines + */ + public MOrderLine[] getLines() + { + return getLines(false, null); + } // getLines + + /** + * Renumber Lines + * @param step start and step + */ + public void renumberLines (int step) + { + int number = step; + MOrderLine[] lines = getLines(true, null); // Line is default + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + line.setLine(number); + line.save(get_TrxName()); + number += step; + } + m_lines = null; + } // renumberLines + + /** + * Does the Order Line belong to this Order + * @param C_OrderLine_ID line + * @return true if part of the order + */ + public boolean isOrderLine(int C_OrderLine_ID) + { + if (m_lines == null) + getLines(); + for (int i = 0; i < m_lines.length; i++) + if (m_lines[i].getC_OrderLine_ID() == C_OrderLine_ID) + return true; + return false; + } // isOrderLine + + /** + * Get Taxes of Order + * @param requery requery + * @return array of taxes + */ + public MOrderTax[] getTaxes(boolean requery) + { + if (m_taxes != null && !requery) + return m_taxes; + // + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM C_OrderTax WHERE C_Order_ID=?"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Order_ID()); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + list.add(new MOrderTax(getCtx(), rs, get_TrxName())); + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, "getTaxes", e); + } + finally + { + try + { + if (pstmt != null) + pstmt.close (); + } + catch (Exception e) + {} + pstmt = null; + } + // + m_taxes = new MOrderTax[list.size ()]; + list.toArray (m_taxes); + return m_taxes; + } // getTaxes + + + /** + * Get Invoices of Order + * @return invoices + */ + public MInvoice[] getInvoices() + { + ArrayList list = new ArrayList(); + String sql = " SELECT DISTINCT i.* FROM C_InvoiceLine il " + + "INNER JOIN C_OrderLine ol ON (ol.C_OrderLine_ID = il.C_OrderLine_ID) " + + "INNER JOIN C_Order o ON (o.C_Order_ID = ol.C_Order_ID) " + + "INNER JOIN C_Invoice i ON (i.C_Invoice_ID = il.C_Invoice_ID) " + + "WHERE o.C_Order_ID=? " + + "ORDER BY i.Created DESC"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Order_ID()); + rs = pstmt.executeQuery(); + while (rs.next()) + list.add(new MInvoice(getCtx(), rs, get_TrxName())); + } + catch (Exception e) + { + log.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + // + MInvoice[] retValue = new MInvoice[list.size()]; + list.toArray(retValue); + return retValue; + } // getInvoices + + /** + * Get latest Invoice of Order + * @return invoice id or 0 + */ + public int getC_Invoice_ID() + { + int C_Invoice_ID = 0; + String sql = "SELECT C_Invoice_ID FROM C_Invoice " + + "WHERE C_Order_ID=? AND DocStatus IN ('CO','CL') " + + "ORDER BY Created DESC"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Order_ID()); + rs = pstmt.executeQuery(); + if (rs.next()) + C_Invoice_ID = rs.getInt(1); + } + catch (Exception e) + { + log.log(Level.SEVERE, "getC_Invoice_ID", e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + return C_Invoice_ID; + } // getC_Invoice_ID + + + /** + * Get Shipments of Order + * @return shipments + */ + public MInOut[] getShipments() + { + ArrayList list = new ArrayList(); + String sql = "SELECT DISTINCT io.* FROM M_InOutLine iol " + + "INNER JOIN M_InOut io ON (io.M_InOut_ID = iol.M_InOut_ID) " + + "INNER JOIN C_ORDERLINE ol ON (ol.C_ORDERLINE_ID=iol.C_ORDERLINE_ID) " + + "INNER JOIN C_ORDER o ON (o.C_ORDER_ID=ol.C_ORDER_ID) " + + "WHERE o.C_ORDER_ID=? " + + "ORDER BY io.Created DESC"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Order_ID()); + rs = pstmt.executeQuery(); + while (rs.next()) + list.add(new MInOut(getCtx(), rs, get_TrxName())); + } + catch (Exception e) + { + log.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + // + MInOut[] retValue = new MInOut[list.size()]; + list.toArray(retValue); + return retValue; + } // getShipments + + /** + * Get ISO Code of Currency + * @return Currency ISO + */ + public String getCurrencyISO() + { + return MCurrency.getISO_Code (getCtx(), getC_Currency_ID()); + } // getCurrencyISO + + /** + * Get Currency Precision + * @return precision + */ + public int getPrecision() + { + return MCurrency.getStdPrecision(getCtx(), getC_Currency_ID()); + } // getPrecision + + /** + * Get Document Status + * @return Document Status Clear Text + */ + public String getDocStatusName() + { + return MRefList.getListName(getCtx(), 131, getDocStatus()); + } // getDocStatusName + + /** + * Set DocAction + * @param DocAction doc action + */ + public void setDocAction (String DocAction) + { + setDocAction (DocAction, false); + } // setDocAction + + /** + * Set DocAction + * @param DocAction doc oction + * @param forceCreation force creation + */ + public void setDocAction (String DocAction, boolean forceCreation) + { + super.setDocAction (DocAction); + m_forceCreation = forceCreation; + } // setDocAction + + /** + * Set Processed. + * Propergate to Lines/Taxes + * @param processed processed + */ + public void setProcessed (boolean processed) + { + super.setProcessed (processed); + if (get_ID() == 0) + return; + String set = "SET Processed='" + + (processed ? "Y" : "N") + + "' WHERE C_Order_ID=" + getC_Order_ID(); + int noLine = DB.executeUpdate("UPDATE C_OrderLine " + set, get_TrxName()); + int noTax = DB.executeUpdate("UPDATE C_OrderTax " + set, get_TrxName()); + m_lines = null; + m_taxes = null; + log.fine("setProcessed - " + processed + " - Lines=" + noLine + ", Tax=" + noTax); + } // setProcessed + + + + /************************************************************************** + * Before Save + * @param newRecord new + * @return save + */ + protected boolean beforeSave (boolean newRecord) + { + // Client/Org Check + if (getAD_Org_ID() == 0) + { + int context_AD_Org_ID = Env.getAD_Org_ID(getCtx()); + if (context_AD_Org_ID != 0) + { + setAD_Org_ID(context_AD_Org_ID); + log.warning("Changed Org to Context=" + context_AD_Org_ID); + } + } + if (getAD_Client_ID() == 0) + { + m_processMsg = "AD_Client_ID = 0"; + return false; + } + + // New Record Doc Type - make sure DocType set to 0 + if (newRecord && getC_DocType_ID() == 0) + setC_DocType_ID (0); + + // Default Warehouse + if (getM_Warehouse_ID() == 0) + { + int ii = Env.getContextAsInt(getCtx(), "#M_Warehouse_ID"); + if (ii != 0) + setM_Warehouse_ID(ii); + else + { + log.saveError("FillMandatory", Msg.getElement(getCtx(), "M_Warehouse_ID")); + return false; + } + } + // Warehouse Org + if (newRecord + || is_ValueChanged("AD_Org_ID") || is_ValueChanged("M_Warehouse_ID")) + { + MWarehouse wh = MWarehouse.get(getCtx(), getM_Warehouse_ID()); + if (wh.getAD_Org_ID() != getAD_Org_ID()) + log.saveWarning("WarehouseOrgConflict", ""); + } + // Reservations in Warehouse + if (!newRecord && is_ValueChanged("M_Warehouse_ID")) + { + MOrderLine[] lines = getLines(false,null); + for (int i = 0; i < lines.length; i++) + { + if (!lines[i].canChangeWarehouse()) + return false; + } + } + + // No Partner Info - set Template + if (getC_BPartner_ID() == 0) + setBPartner(MBPartner.getTemplate(getCtx(), getAD_Client_ID())); + if (getC_BPartner_Location_ID() == 0) + setBPartner(new MBPartner(getCtx(), getC_BPartner_ID(), null)); + // No Bill - get from Ship + if (getBill_BPartner_ID() == 0) + { + setBill_BPartner_ID(getC_BPartner_ID()); + setBill_Location_ID(getC_BPartner_Location_ID()); + } + if (getBill_Location_ID() == 0) + setBill_Location_ID(getC_BPartner_Location_ID()); + + // Default Price List + if (getM_PriceList_ID() == 0) + { + int ii = DB.getSQLValue(null, + "SELECT M_PriceList_ID FROM M_PriceList " + + "WHERE AD_Client_ID=? AND IsSOPriceList=? " + + "ORDER BY IsDefault DESC", getAD_Client_ID(), isSOTrx() ? "Y" : "N"); + if (ii != 0) + setM_PriceList_ID (ii); + } + // Default Currency + if (getC_Currency_ID() == 0) + { + String sql = "SELECT C_Currency_ID FROM M_PriceList WHERE M_PriceList_ID=?"; + int ii = DB.getSQLValue (null, sql, getM_PriceList_ID()); + if (ii != 0) + setC_Currency_ID (ii); + else + setC_Currency_ID(Env.getContextAsInt(getCtx(), "#C_Currency_ID")); + } + + // Default Sales Rep + if (getSalesRep_ID() == 0) + { + int ii = Env.getContextAsInt(getCtx(), "#SalesRep_ID"); + if (ii != 0) + setSalesRep_ID (ii); + } + + // Default Document Type + if (getC_DocTypeTarget_ID() == 0) + setC_DocTypeTarget_ID(DocSubTypeSO_Standard); + + // Default Payment Term + if (getC_PaymentTerm_ID() == 0) + { + int ii = Env.getContextAsInt(getCtx(), "#C_PaymentTerm_ID"); + if (ii != 0) + setC_PaymentTerm_ID(ii); + else + { + String sql = "SELECT C_PaymentTerm_ID FROM C_PaymentTerm WHERE AD_Client_ID=? AND IsDefault='Y'"; + ii = DB.getSQLValue(null, sql, getAD_Client_ID()); + if (ii != 0) + setC_PaymentTerm_ID (ii); + } + } + + return true; + } // beforeSave + + + /** + * After Save + * @param newRecord new + * @param success success + * @return true if can be saved + */ + protected boolean afterSave (boolean newRecord, boolean success) + { + if (!success || newRecord) + return success; + + // Propagate Description changes + if (is_ValueChanged("Description") || is_ValueChanged("POReference")) + { + String sql = "UPDATE C_Invoice i" + + " SET (Description,POReference)=" + + "(SELECT Description,POReference " + + "FROM C_Order o WHERE i.C_Order_ID=o.C_Order_ID) " + + "WHERE DocStatus NOT IN ('RE','CL') AND C_Order_ID=" + getC_Order_ID(); + int no = DB.executeUpdate(sql, get_TrxName()); + log.fine("Description -> #" + no); + } + + // Propagate Changes of Payment Info to existing (not reversed/closed) invoices + if (is_ValueChanged("PaymentRule") || is_ValueChanged("C_PaymentTerm_ID") + || is_ValueChanged("DateAcct") || is_ValueChanged("C_Payment_ID") + || is_ValueChanged("C_CashLine_ID")) + { + String sql = "UPDATE C_Invoice i " + + "SET (PaymentRule,C_PaymentTerm_ID,DateAcct,C_Payment_ID,C_CashLine_ID)=" + + "(SELECT PaymentRule,C_PaymentTerm_ID,DateAcct,C_Payment_ID,C_CashLine_ID " + + "FROM C_Order o WHERE i.C_Order_ID=o.C_Order_ID)" + + "WHERE DocStatus NOT IN ('RE','CL') AND C_Order_ID=" + getC_Order_ID(); + // Don't touch Closed/Reversed entries + int no = DB.executeUpdate(sql, get_TrxName()); + log.fine("Payment -> #" + no); + } + + // Sync Lines + afterSaveSync("AD_Org_ID"); + afterSaveSync("C_BPartner_ID"); + afterSaveSync("C_BPartner_Location_ID"); + afterSaveSync("DateOrdered"); + afterSaveSync("DatePromised"); + afterSaveSync("M_Warehouse_ID"); + afterSaveSync("M_Shipper_ID"); + afterSaveSync("C_Currency_ID"); + // + return true; + } // afterSave + + private void afterSaveSync (String columnName) + { + if (is_ValueChanged(columnName)) + { + String sql = "UPDATE C_OrderLine ol" + + " SET " + columnName + " =" + + "(SELECT " + columnName + + " FROM C_Order o WHERE ol.C_Order_ID=o.C_Order_ID) " + + "WHERE C_Order_ID=" + getC_Order_ID(); + int no = DB.executeUpdate(sql, get_TrxName()); + log.fine(columnName + " Lines -> #" + no); + } + } // afterSaveSync + + /** + * Before Delete + * @return true of it can be deleted + */ + protected boolean beforeDelete () + { + if (isProcessed()) + return false; + + getLines(); + for (int i = 0; i < m_lines.length; i++) + { + if (!m_lines[i].beforeDelete()) + return false; + } + return true; + } // beforeDelete + + /************************************************************************** + * Process document + * @param processAction document action + * @return true if performed + */ + public boolean processIt (String processAction) + { + m_processMsg = null; + DocumentEngine engine = new DocumentEngine (this, getDocStatus()); + return engine.processIt (processAction, getDocAction()); + } // processIt + + /** Process Message */ + private String m_processMsg = null; + /** Just Prepared Flag */ + private boolean m_justPrepared = false; + + /** + * Unlock Document. + * @return true if success + */ + public boolean unlockIt() + { + log.info("unlockIt - " + toString()); + setProcessing(false); + return true; + } // unlockIt + + /** + * Invalidate Document + * @return true if success + */ + public boolean invalidateIt() + { + log.info(toString()); + setDocAction(DOCACTION_Prepare); + return true; + } // invalidateIt + + + /************************************************************************** + * Prepare Document + * @return new status (In Progress or Invalid) + */ + public String prepareIt() + { + log.info(toString()); + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + MDocType dt = MDocType.get(getCtx(), getC_DocTypeTarget_ID()); + + // Std Period open? + if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType())) + { + m_processMsg = "@PeriodClosed@"; + return DocAction.STATUS_Invalid; + } + + // Lines + MOrderLine[] lines = getLines(true, "M_Product_ID"); + if (lines.length == 0) + { + m_processMsg = "@NoLines@"; + return DocAction.STATUS_Invalid; + } + + // Bug 1564431 + if (getDeliveryRule() != null && getDeliveryRule().equals(MOrder.DELIVERYRULE_CompleteOrder)) + { + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + MProduct product = line.getProduct(); + if (product != null && product.isExcludeAutoDelivery()) + { + m_processMsg = "@M_Product_ID@ "+product.getValue()+" @IsExcludeAutoDelivery@"; + return DocAction.STATUS_Invalid; + } + } + } + + // Convert DocType to Target + if (getC_DocType_ID() != getC_DocTypeTarget_ID() ) + { + // Cannot change Std to anything else if different warehouses + if (getC_DocType_ID() != 0) + { + MDocType dtOld = MDocType.get(getCtx(), getC_DocType_ID()); + if (MDocType.DOCSUBTYPESO_StandardOrder.equals(dtOld.getDocSubTypeSO()) // From SO + && !MDocType.DOCSUBTYPESO_StandardOrder.equals(dt.getDocSubTypeSO())) // To !SO + { + for (int i = 0; i < lines.length; i++) + { + if (lines[i].getM_Warehouse_ID() != getM_Warehouse_ID()) + { + log.warning("different Warehouse " + lines[i]); + m_processMsg = "@CannotChangeDocType@"; + return DocAction.STATUS_Invalid; + } + } + } + } + + // New or in Progress/Invalid + if (DOCSTATUS_Drafted.equals(getDocStatus()) + || DOCSTATUS_InProgress.equals(getDocStatus()) + || DOCSTATUS_Invalid.equals(getDocStatus()) + || getC_DocType_ID() == 0) + { + setC_DocType_ID(getC_DocTypeTarget_ID()); + } + else // convert only if offer + { + if (dt.isOffer()) + setC_DocType_ID(getC_DocTypeTarget_ID()); + else + { + m_processMsg = "@CannotChangeDocType@"; + return DocAction.STATUS_Invalid; + } + } + } // convert DocType + + // Mandatory Product Attribute Set Instance + String mandatoryType = "='Y'"; // IN ('Y','S') + String sql = "SELECT COUNT(*) " + + "FROM C_OrderLine ol" + + " INNER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID)" + + " INNER JOIN M_AttributeSet pas ON (p.M_AttributeSet_ID=pas.M_AttributeSet_ID) " + + "WHERE pas.MandatoryType" + mandatoryType + + " AND ol.M_AttributeSetInstance_ID IS NULL" + + " AND ol.C_Order_ID=?"; + int no = DB.getSQLValue(get_TrxName(), sql, getC_Order_ID()); + if (no != 0) + { + m_processMsg = "@LinesWithoutProductAttribute@ (" + no + ")"; + return DocAction.STATUS_Invalid; + } + + // Lines + if (explodeBOM()) + lines = getLines(true, "M_Product_ID"); + if (!reserveStock(dt, lines)) + { + m_processMsg = "Cannot reserve Stock"; + return DocAction.STATUS_Invalid; + } + if (!calculateTaxTotal()) + { + m_processMsg = "Error calculating tax"; + return DocAction.STATUS_Invalid; + } + + // Credit Check + if (isSOTrx()) + { + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); + if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus())) + { + m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@=" + + bp.getTotalOpenBalance() + + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); + return DocAction.STATUS_Invalid; + } + if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus())) + { + m_processMsg = "@BPartnerCreditHold@ - @TotalOpenBalance@=" + + bp.getTotalOpenBalance() + + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); + return DocAction.STATUS_Invalid; + } + BigDecimal grandTotal = MConversionRate.convertBase(getCtx(), + getGrandTotal(), getC_Currency_ID(), getDateOrdered(), + getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID()); + if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(grandTotal))) + { + m_processMsg = "@BPartnerOverOCreditHold@ - @TotalOpenBalance@=" + + bp.getTotalOpenBalance() + ", @GrandTotal@=" + grandTotal + + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); + return DocAction.STATUS_Invalid; + } + } + + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + m_justPrepared = true; + // if (!DOCACTION_Complete.equals(getDocAction())) don't set for just prepare + // setDocAction(DOCACTION_Complete); + return DocAction.STATUS_InProgress; + } // prepareIt + + /** + * Explode non stocked BOM. + * @return true if bom exploded + */ + private boolean explodeBOM() + { + boolean retValue = false; + String where = "AND IsActive='Y' AND EXISTS " + + "(SELECT * FROM M_Product p WHERE C_OrderLine.M_Product_ID=p.M_Product_ID" + + " AND p.IsBOM='Y' AND p.IsVerified='Y' AND p.IsStocked='N')"; + // + String sql = "SELECT COUNT(*) FROM C_OrderLine " + + "WHERE C_Order_ID=? " + where; + int count = DB.getSQLValue(get_TrxName(), sql, getC_Order_ID()); + while (count != 0) + { + retValue = true; + renumberLines (1000); // max 999 bom items + + // Order Lines with non-stocked BOMs + MOrderLine[] lines = getLines (where, "ORDER BY Line"); + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + MProduct product = MProduct.get (getCtx(), line.getM_Product_ID()); + log.fine(product.getName()); + // New Lines + int lineNo = line.getLine (); + MProductBOM[] boms = MProductBOM.getBOMLines (product); + for (int j = 0; j < boms.length; j++) + { + MProductBOM bom = boms[j]; + MOrderLine newLine = new MOrderLine (this); + newLine.setLine (++lineNo); + newLine.setM_Product_ID (bom.getProduct () + .getM_Product_ID ()); + newLine.setC_UOM_ID (bom.getProduct ().getC_UOM_ID ()); + newLine.setQty (line.getQtyOrdered ().multiply ( + bom.getBOMQty ())); + if (bom.getDescription () != null) + newLine.setDescription (bom.getDescription ()); + // + newLine.setPrice (); + newLine.save (get_TrxName()); + } + // Convert into Comment Line + line.setM_Product_ID (0); + line.setM_AttributeSetInstance_ID (0); + line.setPrice (Env.ZERO); + line.setPriceLimit (Env.ZERO); + line.setPriceList (Env.ZERO); + line.setLineNetAmt (Env.ZERO); + line.setFreightAmt (Env.ZERO); + // + String description = product.getName (); + if (product.getDescription () != null) + description += " " + product.getDescription (); + if (line.getDescription () != null) + description += " " + line.getDescription (); + line.setDescription (description); + line.save (get_TrxName()); + } // for all lines with BOM + + m_lines = null; // force requery + count = DB.getSQLValue (get_TrxName(), sql, getC_Invoice_ID ()); + renumberLines (10); + } // while count != 0 + return retValue; + } // explodeBOM + + + /** + * Reserve Inventory. + * Counterpart: MInOut.completeIt() + * @param dt document type or null + * @param lines order lines (ordered by M_Product_ID for deadlock prevention) + * @return true if (un) reserved + */ + private boolean reserveStock (MDocType dt, MOrderLine[] lines) + { + if (dt == null) + dt = MDocType.get(getCtx(), getC_DocType_ID()); + + // Binding + boolean binding = !dt.isProposal(); + // Not binding - i.e. Target=0 + if (DOCACTION_Void.equals(getDocAction()) + // Closing Binding Quotation + || (MDocType.DOCSUBTYPESO_Quotation.equals(dt.getDocSubTypeSO()) + && DOCACTION_Close.equals(getDocAction())) + || isDropShip() ) + binding = false; + boolean isSOTrx = isSOTrx(); + log.fine("Binding=" + binding + " - IsSOTrx=" + isSOTrx); + // Force same WH for all but SO/PO + int header_M_Warehouse_ID = getM_Warehouse_ID(); + if (MDocType.DOCSUBTYPESO_StandardOrder.equals(dt.getDocSubTypeSO()) + || MDocType.DOCBASETYPE_PurchaseOrder.equals(dt.getDocBaseType())) + header_M_Warehouse_ID = 0; // don't enforce + + BigDecimal Volume = Env.ZERO; + BigDecimal Weight = Env.ZERO; + + // Always check and (un) Reserve Inventory + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + // Check/set WH/Org + if (header_M_Warehouse_ID != 0) // enforce WH + { + if (header_M_Warehouse_ID != line.getM_Warehouse_ID()) + line.setM_Warehouse_ID(header_M_Warehouse_ID); + if (getAD_Org_ID() != line.getAD_Org_ID()) + line.setAD_Org_ID(getAD_Org_ID()); + } + // Binding + BigDecimal target = binding ? line.getQtyOrdered() : Env.ZERO; + BigDecimal difference = target + .subtract(line.getQtyReserved()) + .subtract(line.getQtyDelivered()); + if (difference.signum() == 0) + { + MProduct product = line.getProduct(); + if (product != null) + { + Volume = Volume.add(product.getVolume().multiply(line.getQtyOrdered())); + Weight = Weight.add(product.getWeight().multiply(line.getQtyOrdered())); + } + continue; + } + + log.fine("Line=" + line.getLine() + + " - Target=" + target + ",Difference=" + difference + + " - Ordered=" + line.getQtyOrdered() + + ",Reserved=" + line.getQtyReserved() + ",Delivered=" + line.getQtyDelivered()); + + // Check Product - Stocked and Item + MProduct product = line.getProduct(); + if (product != null) + { + if (product.isStocked()) + { + BigDecimal ordered = isSOTrx ? Env.ZERO : difference; + BigDecimal reserved = isSOTrx ? difference : Env.ZERO; + int M_Locator_ID = 0; + // Get Locator to reserve + if (line.getM_AttributeSetInstance_ID() != 0) // Get existing Location + M_Locator_ID = MStorage.getM_Locator_ID (line.getM_Warehouse_ID(), + line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), + ordered, get_TrxName()); + // Get default Location + if (M_Locator_ID == 0) + { + // try to take default locator for product first + // if it is from the selected warehouse + MWarehouse wh = MWarehouse.get(getCtx(), line.getM_Warehouse_ID()); + M_Locator_ID = product.getM_Locator_ID(); + if (M_Locator_ID!=0) { + MLocator locator = new MLocator(getCtx(), product.getM_Locator_ID(), get_TrxName()); + //product has default locator defined but is not from the order warehouse + if(locator.getM_Warehouse_ID()!=wh.get_ID()) { + M_Locator_ID = wh.getDefaultLocator().getM_Locator_ID(); + } + } else { + M_Locator_ID = wh.getDefaultLocator().getM_Locator_ID(); + } + } + // Update Storage + if (!MStorage.add(getCtx(), line.getM_Warehouse_ID(), M_Locator_ID, + line.getM_Product_ID(), + line.getM_AttributeSetInstance_ID(), line.getM_AttributeSetInstance_ID(), + Env.ZERO, reserved, ordered, get_TrxName())) + return false; + } // stockec + // update line + line.setQtyReserved(line.getQtyReserved().add(difference)); + if (!line.save(get_TrxName())) + return false; + // + Volume = Volume.add(product.getVolume().multiply(line.getQtyOrdered())); + Weight = Weight.add(product.getWeight().multiply(line.getQtyOrdered())); + } // product + } // reverse inventory + + setVolume(Volume); + setWeight(Weight); + return true; + } // reserveStock + + /** + * Calculate Tax and Total + * @return true if tax total calculated + */ + private boolean calculateTaxTotal() + { + log.fine(""); + // Delete Taxes + DB.executeUpdate("DELETE C_OrderTax WHERE C_Order_ID=" + getC_Order_ID(), get_TrxName()); + m_taxes = null; + + // Lines + BigDecimal totalLines = Env.ZERO; + ArrayList taxList = new ArrayList(); + MOrderLine[] lines = getLines(); + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + Integer taxID = new Integer(line.getC_Tax_ID()); + if (!taxList.contains(taxID)) + { + MOrderTax oTax = MOrderTax.get (line, getPrecision(), + false, get_TrxName()); // current Tax + oTax.setIsTaxIncluded(isTaxIncluded()); + if (!oTax.calculateTaxFromLines()) + return false; + if (!oTax.save(get_TrxName())) + return false; + taxList.add(taxID); + } + totalLines = totalLines.add(line.getLineNetAmt()); + } + + // Taxes + BigDecimal grandTotal = totalLines; + MOrderTax[] taxes = getTaxes(true); + for (int i = 0; i < taxes.length; i++) + { + MOrderTax oTax = taxes[i]; + MTax tax = oTax.getTax(); + if (tax.isSummary()) + { + MTax[] cTaxes = tax.getChildTaxes(false); + for (int j = 0; j < cTaxes.length; j++) + { + MTax cTax = cTaxes[j]; + BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), isTaxIncluded(), getPrecision()); + // + MOrderTax newOTax = new MOrderTax(getCtx(), 0, get_TrxName()); + newOTax.setClientOrg(this); + newOTax.setC_Order_ID(getC_Order_ID()); + newOTax.setC_Tax_ID(cTax.getC_Tax_ID()); + newOTax.setPrecision(getPrecision()); + newOTax.setIsTaxIncluded(isTaxIncluded()); + newOTax.setTaxBaseAmt(oTax.getTaxBaseAmt()); + newOTax.setTaxAmt(taxAmt); + if (!newOTax.save(get_TrxName())) + return false; + // + if (!isTaxIncluded()) + grandTotal = grandTotal.add(taxAmt); + } + if (!oTax.delete(true, get_TrxName())) + return false; + if (!oTax.save(get_TrxName())) + return false; + } + else + { + if (!isTaxIncluded()) + grandTotal = grandTotal.add(oTax.getTaxAmt()); + } + } + // + setTotalLines(totalLines); + setGrandTotal(grandTotal); + return true; + } // calculateTaxTotal + + + /** + * Approve Document + * @return true if success + */ + public boolean approveIt() + { + log.info("approveIt - " + toString()); + setIsApproved(true); + return true; + } // approveIt + + /** + * Reject Approval + * @return true if success + */ + public boolean rejectIt() + { + log.info("rejectIt - " + toString()); + setIsApproved(false); + return true; + } // rejectIt + + + /************************************************************************** + * Complete Document + * @return new status (Complete, In Progress, Invalid, Waiting ..) + */ + public String completeIt() + { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + String DocSubTypeSO = dt.getDocSubTypeSO(); + + // Just prepare + if (DOCACTION_Prepare.equals(getDocAction())) + { + setProcessed(false); + return DocAction.STATUS_InProgress; + } + // Offers + if (MDocType.DOCSUBTYPESO_Proposal.equals(DocSubTypeSO) + || MDocType.DOCSUBTYPESO_Quotation.equals(DocSubTypeSO)) + { + // Binding + if (MDocType.DOCSUBTYPESO_Quotation.equals(DocSubTypeSO)) + reserveStock(dt, getLines(true, "M_Product_ID")); + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + // Set the definite document number after completed (if needed) + setDefiniteDocumentNo(); + setProcessed(true); + return DocAction.STATUS_Completed; + } + // Waiting Payment - until we have a payment + if (!m_forceCreation + && MDocType.DOCSUBTYPESO_PrepayOrder.equals(DocSubTypeSO) + && getC_Payment_ID() == 0 && getC_CashLine_ID() == 0) + { + setProcessed(true); + return DocAction.STATUS_WaitingPayment; + } + + // Re-Check + if (!m_justPrepared) + { + String status = prepareIt(); + if (!DocAction.STATUS_InProgress.equals(status)) + return status; + } + + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + // Implicit Approval + if (!isApproved()) + approveIt(); + getLines(true,null); + log.info(toString()); + StringBuffer info = new StringBuffer(); + + boolean realTimePOS = false; + + // Create SO Shipment - Force Shipment + MInOut shipment = null; + if (MDocType.DOCSUBTYPESO_OnCreditOrder.equals(DocSubTypeSO) // (W)illCall(I)nvoice + || MDocType.DOCSUBTYPESO_WarehouseOrder.equals(DocSubTypeSO) // (W)illCall(P)ickup + || MDocType.DOCSUBTYPESO_POSOrder.equals(DocSubTypeSO) // (W)alkIn(R)eceipt + || MDocType.DOCSUBTYPESO_PrepayOrder.equals(DocSubTypeSO)) + { + if (!DELIVERYRULE_Force.equals(getDeliveryRule())) + setDeliveryRule(DELIVERYRULE_Force); + // + shipment = createShipment (dt, realTimePOS ? null : getDateOrdered()); + if (shipment == null) + return DocAction.STATUS_Invalid; + info.append("@M_InOut_ID@: ").append(shipment.getDocumentNo()); + String msg = shipment.getProcessMsg(); + if (msg != null && msg.length() > 0) + info.append(" (").append(msg).append(")"); + } // Shipment + + + // Create SO Invoice - Always invoice complete Order + if ( MDocType.DOCSUBTYPESO_POSOrder.equals(DocSubTypeSO) + || MDocType.DOCSUBTYPESO_OnCreditOrder.equals(DocSubTypeSO) + || MDocType.DOCSUBTYPESO_PrepayOrder.equals(DocSubTypeSO)) + { + MInvoice invoice = createInvoice (dt, shipment, realTimePOS ? null : getDateOrdered()); + if (invoice == null) + return DocAction.STATUS_Invalid; + info.append(" - @C_Invoice_ID@: ").append(invoice.getDocumentNo()); + String msg = invoice.getProcessMsg(); + if (msg != null && msg.length() > 0) + info.append(" (").append(msg).append(")"); + } // Invoice + + // Counter Documents + MOrder counter = createCounterDoc(); + if (counter != null) + info.append(" - @CounterDoc@: @Order@=").append(counter.getDocumentNo()); + // User Validation + String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); + if (valid != null) + { + if (info.length() > 0) + info.append(" - "); + info.append(valid); + m_processMsg = info.toString(); + return DocAction.STATUS_Invalid; + } + + // Set the definite document number after completed (if needed) + setDefiniteDocumentNo(); + + setProcessed(true); + m_processMsg = info.toString(); + // + setDocAction(DOCACTION_Close); + return DocAction.STATUS_Completed; + } // completeIt + + /** + * Set the definite document number after completed + */ + private void setDefiniteDocumentNo() { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + if (dt.isOverwriteDateOnComplete()) { + setDateOrdered(new Timestamp (System.currentTimeMillis())); + } + if (dt.isOverwriteSeqOnComplete()) { + String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); + if (value != null) + setDocumentNo(value); + } + } + + /** + * Create Shipment + * @param dt order document type + * @param movementDate optional movement date (default today) + * @return shipment or null + */ + private MInOut createShipment(MDocType dt, Timestamp movementDate) + { + log.info("For " + dt); + MInOut shipment = new MInOut (this, dt.getC_DocTypeShipment_ID(), movementDate); + // shipment.setDateAcct(getDateAcct()); + if (!shipment.save(get_TrxName())) + { + m_processMsg = "Could not create Shipment"; + return null; + } + // + MOrderLine[] oLines = getLines(true, null); + for (int i = 0; i < oLines.length; i++) + { + MOrderLine oLine = oLines[i]; + // + MInOutLine ioLine = new MInOutLine(shipment); + // Qty = Ordered - Delivered + BigDecimal MovementQty = oLine.getQtyOrdered().subtract(oLine.getQtyDelivered()); + // Location + int M_Locator_ID = MStorage.getM_Locator_ID (oLine.getM_Warehouse_ID(), + oLine.getM_Product_ID(), oLine.getM_AttributeSetInstance_ID(), + MovementQty, get_TrxName()); + if (M_Locator_ID == 0) // Get default Location + { + MWarehouse wh = MWarehouse.get(getCtx(), oLine.getM_Warehouse_ID()); + M_Locator_ID = wh.getDefaultLocator().getM_Locator_ID(); + } + // + ioLine.setOrderLine(oLine, M_Locator_ID, MovementQty); + ioLine.setQty(MovementQty); + if (oLine.getQtyEntered().compareTo(oLine.getQtyOrdered()) != 0) + ioLine.setQtyEntered(MovementQty + .multiply(oLine.getQtyEntered()) + .divide(oLine.getQtyOrdered(), 6, BigDecimal.ROUND_HALF_UP)); + if (!ioLine.save(get_TrxName())) + { + m_processMsg = "Could not create Shipment Line"; + return null; + } + } + // Manually Process Shipment + String status = shipment.completeIt(); + shipment.setDocStatus(status); + shipment.save(get_TrxName()); + if (!DOCSTATUS_Completed.equals(status)) + { + m_processMsg = "@M_InOut_ID@: " + shipment.getProcessMsg(); + return null; + } + return shipment; + } // createShipment + + /** + * Create Invoice + * @param dt order document type + * @param shipment optional shipment + * @param invoiceDate invoice date + * @return invoice or null + */ + private MInvoice createInvoice (MDocType dt, MInOut shipment, Timestamp invoiceDate) + { + log.info(dt.toString()); + MInvoice invoice = new MInvoice (this, dt.getC_DocTypeInvoice_ID(), invoiceDate); + if (!invoice.save(get_TrxName())) + { + m_processMsg = "Could not create Invoice"; + return null; + } + + // If we have a Shipment - use that as a base + if (shipment != null) + { + if (!INVOICERULE_AfterDelivery.equals(getInvoiceRule())) + setInvoiceRule(INVOICERULE_AfterDelivery); + // + MInOutLine[] sLines = shipment.getLines(false); + for (int i = 0; i < sLines.length; i++) + { + MInOutLine sLine = sLines[i]; + // + MInvoiceLine iLine = new MInvoiceLine(invoice); + iLine.setShipLine(sLine); + // Qty = Delivered + iLine.setQtyEntered(sLine.getQtyEntered()); + iLine.setQtyInvoiced(sLine.getMovementQty()); + if (!iLine.save(get_TrxName())) + { + m_processMsg = "Could not create Invoice Line from Shipment Line"; + return null; + } + // + sLine.setIsInvoiced(true); + if (!sLine.save(get_TrxName())) + { + log.warning("Could not update Shipment line: " + sLine); + } + } + } + else // Create Invoice from Order + { + if (!INVOICERULE_Immediate.equals(getInvoiceRule())) + setInvoiceRule(INVOICERULE_Immediate); + // + MOrderLine[] oLines = getLines(); + for (int i = 0; i < oLines.length; i++) + { + MOrderLine oLine = oLines[i]; + // + MInvoiceLine iLine = new MInvoiceLine(invoice); + iLine.setOrderLine(oLine); + // Qty = Ordered - Invoiced + iLine.setQtyInvoiced(oLine.getQtyOrdered().subtract(oLine.getQtyInvoiced())); + if (oLine.getQtyOrdered().compareTo(oLine.getQtyEntered()) == 0) + iLine.setQtyEntered(iLine.getQtyInvoiced()); + else + iLine.setQtyEntered(iLine.getQtyInvoiced().multiply(oLine.getQtyEntered()) + .divide(oLine.getQtyOrdered(), 12, BigDecimal.ROUND_HALF_UP)); + if (!iLine.save(get_TrxName())) + { + m_processMsg = "Could not create Invoice Line from Order Line"; + return null; + } + } + } + // Manually Process Invoice + String status = invoice.completeIt(); + invoice.setDocStatus(status); + invoice.save(get_TrxName()); + setC_CashLine_ID(invoice.getC_CashLine_ID()); + if (!DOCSTATUS_Completed.equals(status)) + { + m_processMsg = "@C_Invoice_ID@: " + invoice.getProcessMsg(); + return null; + } + return invoice; + } // createInvoice + + /** + * Create Counter Document + * @return counter order + */ + private MOrder createCounterDoc() + { + // Is this itself a counter doc ? + if (getRef_Order_ID() != 0) + return null; + + // Org Must be linked to BPartner + MOrg org = MOrg.get(getCtx(), getAD_Org_ID()); + int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName()); + if (counterC_BPartner_ID == 0) + return null; + // Business Partner needs to be linked to Org + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); + int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int(); + if (counterAD_Org_ID == 0) + return null; + + MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, null); + MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID); + log.info("Counter BP=" + counterBP.getName()); + + // Document Type + int C_DocTypeTarget_ID = 0; + MDocTypeCounter counterDT = MDocTypeCounter.getCounterDocType(getCtx(), getC_DocType_ID()); + if (counterDT != null) + { + log.fine(counterDT.toString()); + if (!counterDT.isCreateCounter() || !counterDT.isValid()) + return null; + C_DocTypeTarget_ID = counterDT.getCounter_C_DocType_ID(); + } + else // indirect + { + C_DocTypeTarget_ID = MDocTypeCounter.getCounterDocType_ID(getCtx(), getC_DocType_ID()); + log.fine("Indirect C_DocTypeTarget_ID=" + C_DocTypeTarget_ID); + if (C_DocTypeTarget_ID <= 0) + return null; + } + // Deep Copy + MOrder counter = copyFrom (this, getDateOrdered(), + C_DocTypeTarget_ID, !isSOTrx(), true, false, get_TrxName()); + // + counter.setAD_Org_ID(counterAD_Org_ID); + counter.setM_Warehouse_ID(counterOrgInfo.getM_Warehouse_ID()); + // + counter.setBPartner(counterBP); + counter.setDatePromised(getDatePromised()); // default is date ordered + // Refernces (Should not be required + counter.setSalesRep_ID(getSalesRep_ID()); + counter.save(get_TrxName()); + + // Update copied lines + MOrderLine[] counterLines = counter.getLines(true, null); + for (int i = 0; i < counterLines.length; i++) + { + MOrderLine counterLine = counterLines[i]; + counterLine.setOrder(counter); // copies header values (BP, etc.) + counterLine.setPrice(); + counterLine.setTax(); + counterLine.save(get_TrxName()); + } + log.fine(counter.toString()); + + // Document Action + if (counterDT != null) + { + if (counterDT.getDocAction() != null) + { + counter.setDocAction(counterDT.getDocAction()); + counter.processIt(counterDT.getDocAction()); + counter.save(get_TrxName()); + } + } + return counter; + } // createCounterDoc + + /** + * Void Document. + * Set Qtys to 0 - Sales: reverse all documents + * @return true if success + */ + public boolean voidIt() + { + log.info(toString()); + // Before Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID); + if (m_processMsg != null) + return false; + + MOrderLine[] lines = getLines(true, "M_Product_ID"); + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + BigDecimal old = line.getQtyOrdered(); + if (old.signum() != 0) + { + line.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + old + ")"); + line.setQty(Env.ZERO); + line.setLineNetAmt(Env.ZERO); + line.save(get_TrxName()); + } + } + addDescription(Msg.getMsg(getCtx(), "Voided")); + // Clear Reservations + if (!reserveStock(null, lines)) + { + m_processMsg = "Cannot unreserve Stock (void)"; + return false; + } + + if (!createReversals()) + return false; + + //MZ Goodwill + if (!isSOTrx()) + { + // delete Matched PO Cost Detail + MOrderLine[] linesMZ = getLines(); + for (int i = 0; i < lines.length; i++) + { + MMatchPO[] mPO = MMatchPO.getOrderLine(getCtx(), linesMZ[i].getC_OrderLine_ID(), get_TrxName()); + // delete Cost Detail if the Matched PO has been deleted + if (mPO.length == 0) + { + MCostDetail cd = MCostDetail.get(getCtx(), "C_OrderLine_ID=? AND M_AttributeSetInstance_ID=?", + linesMZ[i].getC_OrderLine_ID(), linesMZ[i].getM_AttributeSetInstance_ID(), get_TrxName()); + if (cd != null) + { + cd.setProcessed(false); + cd.delete(true); + } + } + } + } + //End MZ + + // After Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID); + if (m_processMsg != null) + return false; + + setProcessed(true); + setDocAction(DOCACTION_None); + return true; + } // voidIt + + /** + * Create Shipment/Invoice Reversals + * @return true if success + */ + private boolean createReversals() + { + // Cancel only Sales + if (!isSOTrx()) + return true; + + log.info("createReversals"); + StringBuffer info = new StringBuffer(); + + // Reverse All *Shipments* + info.append("@M_InOut_ID@:"); + MInOut[] shipments = getShipments(); + for (int i = 0; i < shipments.length; i++) + { + MInOut ship = shipments[i]; + // if closed - ignore + if (MInOut.DOCSTATUS_Closed.equals(ship.getDocStatus()) + || MInOut.DOCSTATUS_Reversed.equals(ship.getDocStatus()) + || MInOut.DOCSTATUS_Voided.equals(ship.getDocStatus()) ) + continue; + ship.set_TrxName(get_TrxName()); + + // If not completed - void - otherwise reverse it + if (!MInOut.DOCSTATUS_Completed.equals(ship.getDocStatus())) + { + if (ship.voidIt()) + ship.setDocStatus(MInOut.DOCSTATUS_Voided); + } + else if (ship.reverseCorrectIt()) // completed shipment + { + ship.setDocStatus(MInOut.DOCSTATUS_Reversed); + info.append(" ").append(ship.getDocumentNo()); + } + else + { + m_processMsg = "Could not reverse Shipment " + ship; + return false; + } + ship.setDocAction(MInOut.DOCACTION_None); + ship.save(get_TrxName()); + } // for all shipments + + // Reverse All *Invoices* + info.append(" - @C_Invoice_ID@:"); + MInvoice[] invoices = getInvoices(); + for (int i = 0; i < invoices.length; i++) + { + MInvoice invoice = invoices[i]; + // if closed - ignore + if (MInvoice.DOCSTATUS_Closed.equals(invoice.getDocStatus()) + || MInvoice.DOCSTATUS_Reversed.equals(invoice.getDocStatus()) + || MInvoice.DOCSTATUS_Voided.equals(invoice.getDocStatus()) ) + continue; + invoice.set_TrxName(get_TrxName()); + + // If not completed - void - otherwise reverse it + if (!MInvoice.DOCSTATUS_Completed.equals(invoice.getDocStatus())) + { + if (invoice.voidIt()) + invoice.setDocStatus(MInvoice.DOCSTATUS_Voided); + } + else if (invoice.reverseCorrectIt()) // completed invoice + { + invoice.setDocStatus(MInvoice.DOCSTATUS_Reversed); + info.append(" ").append(invoice.getDocumentNo()); + } + else + { + m_processMsg = "Could not reverse Invoice " + invoice; + return false; + } + invoice.setDocAction(MInvoice.DOCACTION_None); + invoice.save(get_TrxName()); + } // for all shipments + + m_processMsg = info.toString(); + return true; + } // createReversals + + + /** + * Close Document. + * Cancel not delivered Qunatities + * @return true if success + */ + public boolean closeIt() + { + log.info(toString()); + // Before Close + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE); + if (m_processMsg != null) + return false; + + // Close Not delivered Qty - SO/PO + MOrderLine[] lines = getLines(true, "M_Product_ID"); + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + BigDecimal old = line.getQtyOrdered(); + if (old.compareTo(line.getQtyDelivered()) != 0) + { + line.setQtyLostSales(line.getQtyOrdered().subtract(line.getQtyDelivered())); + line.setQtyOrdered(line.getQtyDelivered()); + // QtyEntered unchanged + line.addDescription("Close (" + old + ")"); + line.save(get_TrxName()); + } + } + // Clear Reservations + if (!reserveStock(null, lines)) + { + m_processMsg = "Cannot unreserve Stock (close)"; + return false; + } + // After Close + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE); + if (m_processMsg != null) + return false; + + setProcessed(true); + setDocAction(DOCACTION_None); + return true; + } // closeIt + + /** + * Reverse Correction - same void + * @return true if success + */ + public boolean reverseCorrectIt() + { + log.info(toString()); + // Before reverseCorrect + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT); + if (m_processMsg != null) + return false; + + // After reverseCorrect + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); + if (m_processMsg != null) + return false; + + return voidIt(); + } // reverseCorrectionIt + + /** + * Reverse Accrual - none + * @return false + */ + public boolean reverseAccrualIt() + { + log.info(toString()); + // Before reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL); + if (m_processMsg != null) + return false; + + // After reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); + if (m_processMsg != null) + return false; + + return false; + } // reverseAccrualIt + + /** + * Re-activate. + * @return true if success + */ + public boolean reActivateIt() + { + log.info(toString()); + // Before reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE); + if (m_processMsg != null) + return false; + + + + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + String DocSubTypeSO = dt.getDocSubTypeSO(); + + // Replace Prepay with POS to revert all doc + if (MDocType.DOCSUBTYPESO_PrepayOrder.equals (DocSubTypeSO)) + { + MDocType newDT = null; + MDocType[] dts = MDocType.getOfClient (getCtx()); + for (int i = 0; i < dts.length; i++) + { + MDocType type = dts[i]; + if (MDocType.DOCSUBTYPESO_PrepayOrder.equals(type.getDocSubTypeSO())) + { + if (type.isDefault() || newDT == null) + newDT = type; + } + } + if (newDT == null) + return false; + else + setC_DocType_ID (newDT.getC_DocType_ID()); + } + + // PO - just re-open + if (!isSOTrx()) + log.info("Existing documents not modified - " + dt); + // Reverse Direct Documents + else if (MDocType.DOCSUBTYPESO_OnCreditOrder.equals(DocSubTypeSO) // (W)illCall(I)nvoice + || MDocType.DOCSUBTYPESO_WarehouseOrder.equals(DocSubTypeSO) // (W)illCall(P)ickup + || MDocType.DOCSUBTYPESO_POSOrder.equals(DocSubTypeSO)) // (W)alkIn(R)eceipt + { + if (!createReversals()) + return false; + } + else + { + log.info("Existing documents not modified - SubType=" + DocSubTypeSO); + } + // After reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE); + if (m_processMsg != null) + return false; + + setDocAction(DOCACTION_Complete); + setProcessed(false); + return true; + } // reActivateIt + + + /************************************************************************* + * Get Summary + * @return Summary of Document + */ + public String getSummary() + { + StringBuffer sb = new StringBuffer(); + sb.append(getDocumentNo()); + // : Grand Total = 123.00 (#1) + sb.append(": "). + append(Msg.translate(getCtx(),"GrandTotal")).append("=").append(getGrandTotal()); + if (m_lines != null) + sb.append(" (#").append(m_lines.length).append(")"); + // - Description + if (getDescription() != null && getDescription().length() > 0) + sb.append(" - ").append(getDescription()); + return sb.toString(); + } // getSummary + + /** + * Get Process Message + * @return clear text error message + */ + public String getProcessMsg() + { + return m_processMsg; + } // getProcessMsg + + /** + * Get Document Owner (Responsible) + * @return AD_User_ID + */ + public int getDoc_User_ID() + { + return getSalesRep_ID(); + } // getDoc_User_ID + + /** + * Get Document Approval Amount + * @return amount + */ + public BigDecimal getApprovalAmt() + { + return getGrandTotal(); + } // getApprovalAmt + +} // MOrder diff --git a/posterita/posterita/src/main/org/compiere/model/MPOS.java b/posterita/posterita/src/main/org/compiere/model/MPOS.java new file mode 100644 index 0000000000..b284c90ab8 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MPOS.java @@ -0,0 +1,134 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.sql.*; +import java.util.*; +import org.compiere.util.*; + + +/** + * POS Terminal definition + * + * @author Jorg Janke + * @version $Id: MPOS.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $ + */ +public class MPOS extends X_C_POS +{ + /** + * Get POS from Cache + * @param ctx context + * @param C_POS_ID id + * @return MPOS + */ + public static MPOS get (Properties ctx, int C_POS_ID) + { + Integer key = new Integer (C_POS_ID); + MPOS retValue = (MPOS) s_cache.get (key); + if (retValue != null) + return retValue; + retValue = new MPOS (ctx, C_POS_ID, null); + if (retValue.get_ID () != 0) + s_cache.put (key, retValue); + return retValue; + } // get + + /** Cache */ + private static CCache s_cache = new CCache("C_POS", 20); + + /** + * Standard Constructor + * @param ctx context + * @param C_POS_ID id + * @param trxName transaction + */ + public MPOS (Properties ctx, int C_POS_ID, String trxName) + { + super (ctx, C_POS_ID, trxName); + if (C_POS_ID == 0) + { + // setName (null); + // setSalesRep_ID (0); + // setC_CashBook_ID (0); + // setM_PriceList_ID (0); + setIsModifyPrice (false); // N + // setM_Warehouse_ID (0); + } + } // MPOS + + /** + * Load Constructor + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MPOS (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MPOS + + /** Cash Business Partner */ + private MBPartner m_template = null; + + + + /** + * Before Save + * @param newRecord new + * @return true + */ + protected boolean beforeSave (boolean newRecord) + { + // Org Consistency + if (newRecord + || is_ValueChanged("C_CashBook_ID") || is_ValueChanged("M_Warehouse_ID")) + { + MCashBook cb = MCashBook.get(getCtx(), getC_CashBook_ID(), get_TrxName()); + if (cb.getAD_Org_ID() != getAD_Org_ID()) + { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@AD_Org_ID@: @C_CashBook_ID@")); + return false; + } + MWarehouse wh = MWarehouse.get(getCtx(), getM_Warehouse_ID(), get_TrxName()); + if (wh.getAD_Org_ID() != getAD_Org_ID()) + { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@AD_Org_ID@: @M_Warehouse_ID@")); + return false; + } + } + return true; + } // beforeSave + + + /** + * Get default Cash BPartner + * @return BPartner + */ + public MBPartner getBPartner() + { + if (m_template == null) + { + if (getC_BPartnerCashTrx_ID() == 0) + m_template = MBPartner.getBPartnerCashTrx (getCtx(), getAD_Client_ID()); + else + m_template = new MBPartner(getCtx(), getC_BPartnerCashTrx_ID(), get_TrxName()); + log.fine("getBPartner - " + m_template); + } + return m_template; + } // getBPartner + +} // MPOS diff --git a/posterita/posterita/src/main/org/compiere/model/MPOSTerminal.java b/posterita/posterita/src/main/org/compiere/model/MPOSTerminal.java new file mode 100644 index 0000000000..635585b003 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MPOSTerminal.java @@ -0,0 +1,137 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.compiere.model; + +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.Properties; + +import org.compiere.util.CCache; + +/** + * @author Ashley G Ramdass + * + */ +public class MPOSTerminal extends X_U_POSTerminal +{ + /** Cache */ + static private CCache s_cache = new CCache("U_POSTerminal", 10, 60); + + /** + * @param ctx Context + * @param rs Result Set + * @param trxName Transaction + */ + public MPOSTerminal(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + + /** + * @param ctx + * @param U_POSTerminal_ID + * @param trxName + */ + public MPOSTerminal(Properties ctx, int U_POSTerminal_ID, String trxName) + { + super(ctx, U_POSTerminal_ID, trxName); + } + + /** + * @param ctx Context + * @param U_POSTerminal_ID Terminal ID + * @return Terminal + */ + public static MPOSTerminal get(Properties ctx, int U_POSTerminal_ID) + { + Integer key = new Integer(U_POSTerminal_ID); + MPOSTerminal retValue = (MPOSTerminal)s_cache.get(key); + if (retValue == null) + { + retValue = new MPOSTerminal (ctx, U_POSTerminal_ID, null); + if (retValue.get_ID() <= 0) + { + return null; + } + s_cache.put(key, retValue); + } + + checkLock(retValue); + return retValue; + } + + protected void loadComplete(boolean success) + { + if (success) + { + checkLock(this); + } + } + + public static void checkLock(MPOSTerminal terminal) + { + if (terminal.isLocked()) + { + Timestamp currentTime = new Timestamp(System.currentTimeMillis()); + if (terminal.getUnlockingTime() != null && currentTime.after(terminal.getUnlockingTime())) + { + terminal.setLocked(false); + } + + if (terminal.getLastLockTime() != null && terminal.getLockTime() > 0) + { + long timeToUnlock = terminal.getLastLockTime().getTime() + (terminal.getLockTime() * 60 * 1000); + if (currentTime.after(new Timestamp(timeToUnlock))) + { + terminal.setLocked(false); + } + } + terminal.save(); + } + } + + /** + * @see org.compiere.model.PO#beforeSave(boolean) + */ + protected boolean beforeSave(boolean newRecord) + { + if (is_ValueChanged(COLUMNNAME_Locked) && isLocked()) + { + setLastLockTime(new Timestamp(System.currentTimeMillis())); + } + + return true; + } + + /** + * @see org.compiere.model.PO#afterSave(boolean, boolean) + */ + protected boolean afterSave(boolean newRecord, boolean success) + { + success = super.afterSave(newRecord, success); + + if (success) + { + s_cache.remove(new Integer(get_ID())); + } + + return success; + } +} diff --git a/posterita/posterita/src/main/org/compiere/model/MPayment.java b/posterita/posterita/src/main/org/compiere/model/MPayment.java new file mode 100644 index 0000000000..e657ce317d --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MPayment.java @@ -0,0 +1,2467 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.io.*; +import java.math.*; +import java.rmi.*; +import java.sql.*; +import java.util.*; +import java.util.logging.*; + +import org.compiere.db.*; +import org.compiere.interfaces.*; +import org.compiere.process.*; +import org.compiere.util.*; + +/** + * Payment Model. + * - retrieve and create payments for invoice + *
    + *  Event chain
    + *  - Payment inserted
    + *      C_Payment_Trg fires
    + *          update DocumentNo with payment summary
    + *  - Payment posted (C_Payment_Post)
    + *      create allocation line
    + *          C_Allocation_Trg fires
    + *              Update C_BPartner Open Item Amount
    + *      update invoice (IsPaid)
    + *      link invoice-payment if batch
    + *
    + *  Lifeline:
    + *  -   Created by VPayment or directly
    + *  -   When changed in VPayment
    + *      - old payment is reversed
    + *      - new payment created
    + *
    + *  When Payment is posed, the Allocation is made
    + *  
    + * @author Jorg Janke + * @version $Id: MPayment.java,v 1.4 2006/10/02 05:18:39 jjanke Exp $ + */ +public final class MPayment extends X_C_Payment + implements DocAction, ProcessCall +{ + /** + * Get Payments Of BPartner + * @param ctx context + * @param C_BPartner_ID id + * @param trxName transaction + * @return array + */ + public static MPayment[] getOfBPartner (Properties ctx, int C_BPartner_ID, String trxName) + { + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM C_Payment WHERE C_BPartner_ID=?"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, trxName); + pstmt.setInt(1, C_BPartner_ID); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + list.add(new MPayment(ctx,rs, trxName)); + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + s_log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + + // + MPayment[] retValue = new MPayment[list.size()]; + list.toArray(retValue); + return retValue; + } // getOfBPartner + + + /************************************************************************** + * Default Constructor + * @param ctx context + * @param C_Payment_ID payment to load, (0 create new payment) + * @param trxName trx name + */ + public MPayment (Properties ctx, int C_Payment_ID, String trxName) + { + super (ctx, C_Payment_ID, trxName); + // New + if (C_Payment_ID == 0) + { + setDocAction(DOCACTION_Complete); + setDocStatus(DOCSTATUS_Drafted); + setTrxType(TRXTYPE_Sales); + // + setR_AvsAddr (R_AVSZIP_Unavailable); + setR_AvsZip (R_AVSZIP_Unavailable); + // + setIsReceipt (true); + setIsApproved (false); + setIsReconciled (false); + setIsAllocated(false); + setIsOnline (false); + setIsSelfService(false); + setIsDelayedCapture (false); + setIsPrepayment(false); + setProcessed(false); + setProcessing(false); + setPosted (false); + // + setPayAmt(Env.ZERO); + setDiscountAmt(Env.ZERO); + setTaxAmt(Env.ZERO); + setWriteOffAmt(Env.ZERO); + setIsOverUnderPayment (false); + setOverUnderAmt(Env.ZERO); + // + setDateTrx (new Timestamp(System.currentTimeMillis())); + setDateAcct (getDateTrx()); + setTenderType(TENDERTYPE_Check); + } + } // MPayment + + /** + * Load Constructor + * @param ctx context + * @param rs result set record + * @param trxName transaction + */ + public MPayment (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MPayment + + /** Temporary Payment Processors */ + private MPaymentProcessor[] m_mPaymentProcessors = null; + /** Temporary Payment Processor */ + private MPaymentProcessor m_mPaymentProcessor = null; + /** Logger */ + private static CLogger s_log = CLogger.getCLogger (MPayment.class); + /** Error Message */ + private String m_errorMessage = null; + + /** Reversal Indicator */ + public static String REVERSE_INDICATOR = "^"; + + /** + * Reset Payment to new status + */ + public void resetNew() + { + setC_Payment_ID(0); // forces new Record + set_ValueNoCheck ("DocumentNo", null); + setDocAction(DOCACTION_Prepare); + setDocStatus(DOCSTATUS_Drafted); + setProcessed(false); + setPosted (false); + setIsReconciled (false); + setIsAllocated(false); + setIsOnline(false); + setIsDelayedCapture (false); + // setC_BPartner_ID(0); + setC_Invoice_ID(0); + setC_Order_ID(0); + setC_Charge_ID(0); + setC_Project_ID(0); + setIsPrepayment(false); + } // resetNew + + /** + * Is Cashbook Transfer Trx + * @return true if Cash Trx + */ + public boolean isCashTrx() + { + return "X".equals(getTenderType()); + } // isCashTrx + + /************************************************************************** + * Set Credit Card. + * Need to set PatmentProcessor after Amount/Currency Set + * + * @param TrxType Transaction Type see TRX_ + * @param creditCardType CC type + * @param creditCardNumber CC number + * @param creditCardVV CC verification + * @param creditCardExpMM CC Exp MM + * @param creditCardExpYY CC Exp YY + * @return true if valid + */ + public boolean setCreditCard (String TrxType, String creditCardType, String creditCardNumber, + String creditCardVV, int creditCardExpMM, int creditCardExpYY) + { + setTenderType(TENDERTYPE_CreditCard); + setTrxType(TrxType); + // + setCreditCardType (creditCardType); + setCreditCardNumber (creditCardNumber); + setCreditCardVV (creditCardVV); + setCreditCardExpMM (creditCardExpMM); + setCreditCardExpYY (creditCardExpYY); + // + int check = MPaymentValidate.validateCreditCardNumber(creditCardNumber, creditCardType).length() + + MPaymentValidate.validateCreditCardExp(creditCardExpMM, creditCardExpYY).length(); + if (creditCardVV.length() > 0) + check += MPaymentValidate.validateCreditCardVV(creditCardVV, creditCardType).length(); + return check == 0; + } // setCreditCard + + /** + * Set Credit Card - Exp. + * Need to set PatmentProcessor after Amount/Currency Set + * + * @param TrxType Transaction Type see TRX_ + * @param creditCardType CC type + * @param creditCardNumber CC number + * @param creditCardVV CC verification + * @param creditCardExp CC Exp + * @return true if valid + */ + public boolean setCreditCard (String TrxType, String creditCardType, String creditCardNumber, + String creditCardVV, String creditCardExp) + { + return setCreditCard(TrxType, creditCardType, creditCardNumber, + creditCardVV, MPaymentValidate.getCreditCardExpMM(creditCardExp), + MPaymentValidate.getCreditCardExpYY(creditCardExp)); + } // setCreditCard + + /** + * Set ACH BankAccount Info + * + * @param C_BankAccount_ID bank account + * @param isReceipt true if receipt + * @return true if valid + */ + public boolean setBankACH (MPaySelectionCheck preparedPayment) + { + // Our Bank + setC_BankAccount_ID(preparedPayment.getParent().getC_BankAccount_ID()); + // Target Bank + int C_BP_BankAccount_ID = preparedPayment.getC_BP_BankAccount_ID(); + MBPBankAccount ba = new MBPBankAccount (preparedPayment.getCtx(), C_BP_BankAccount_ID, null); + setRoutingNo(ba.getRoutingNo()); + setAccountNo(ba.getAccountNo()); + setIsReceipt (X_C_Order.PAYMENTRULE_DirectDebit.equals // AR only + (preparedPayment.getPaymentRule())); + // + int check = MPaymentValidate.validateRoutingNo(getRoutingNo()).length() + + MPaymentValidate.validateAccountNo(getAccountNo()).length(); + return check == 0; + } // setBankACH + + /** + * Set ACH BankAccount Info + * + * @param C_BankAccount_ID bank account + * @param isReceipt true if receipt + * @param tenderType - Direct Debit or Direct Deposit + * @param routingNo routing + * @param accountNo account + * @return true if valid + */ + public boolean setBankACH (int C_BankAccount_ID, boolean isReceipt, String tenderType, + String routingNo, String accountNo) + { + setTenderType (tenderType); + setIsReceipt (isReceipt); + // + if (C_BankAccount_ID > 0 + && (routingNo == null || routingNo.length() == 0 || accountNo == null || accountNo.length() == 0)) + setBankAccountDetails(C_BankAccount_ID); + else + { + setC_BankAccount_ID(C_BankAccount_ID); + setRoutingNo (routingNo); + setAccountNo (accountNo); + } + setCheckNo (""); + // + int check = MPaymentValidate.validateRoutingNo(routingNo).length() + + MPaymentValidate.validateAccountNo(accountNo).length(); + return check == 0; + } // setBankACH + + /** + * Set Check BankAccount Info + * + * @param C_BankAccount_ID bank account + * @param isReceipt true if receipt + * @param checkNo chack no + * @return true if valid + */ + public boolean setBankCheck (int C_BankAccount_ID, boolean isReceipt, String checkNo) + { + return setBankCheck (C_BankAccount_ID, isReceipt, null, null, checkNo); + } // setBankCheck + + /** + * Set Check BankAccount Info + * + * @param C_BankAccount_ID bank account + * @param isReceipt true if receipt + * @param routingNo routing no + * @param accountNo account no + * @param checkNo chack no + * @return true if valid + */ + public boolean setBankCheck (int C_BankAccount_ID, boolean isReceipt, + String routingNo, String accountNo, String checkNo) + { + setTenderType (TENDERTYPE_Check); + setIsReceipt (isReceipt); + // + if (C_BankAccount_ID > 0 + && (routingNo == null || routingNo.length() == 0 + || accountNo == null || accountNo.length() == 0)) + setBankAccountDetails(C_BankAccount_ID); + else + { + setC_BankAccount_ID(C_BankAccount_ID); + setRoutingNo (routingNo); + setAccountNo (accountNo); + } + setCheckNo (checkNo); + // + int check = MPaymentValidate.validateRoutingNo(routingNo).length() + + MPaymentValidate.validateAccountNo(accountNo).length() + + MPaymentValidate.validateCheckNo(checkNo).length(); + return check == 0; // no error message + } // setBankCheck + + /** + * Set Bank Account Details. + * Look up Routing No & Bank Acct No + * @param C_BankAccount_ID bank account + */ + public void setBankAccountDetails (int C_BankAccount_ID) + { + if (C_BankAccount_ID == 0) + return; + setC_BankAccount_ID(C_BankAccount_ID); + // + String sql = "SELECT b.RoutingNo, ba.AccountNo " + + "FROM C_BankAccount ba" + + " INNER JOIN C_Bank b ON (ba.C_Bank_ID=b.C_Bank_ID) " + + "WHERE C_BankAccount_ID=?"; + try + { + PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, C_BankAccount_ID); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) + { + setRoutingNo (rs.getString(1)); + setAccountNo (rs.getString(2)); + } + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql, e); + } + } // setBankAccountDetails + + /** + * Set Account Address + * + * @param name name + * @param street street + * @param city city + * @param state state + * @param zip zip + * @param country country + */ + public void setAccountAddress (String name, String street, + String city, String state, String zip, String country) + { + setA_Name (name); + setA_Street (street); + setA_City (city); + setA_State (state); + setA_Zip (zip); + setA_Country(country); + } // setAccountAddress + + + /************************************************************************** + * Process Payment + * @return true if approved + */ + public boolean processOnline() + { + log.info ("Amt=" + getPayAmt()); + // + setIsOnline(true); + setErrorMessage(null); + // prevent charging twice + if (isApproved()) + { + log.info("Already processed - " + getR_Result() + " - " + getR_RespMsg()); + setErrorMessage("Payment already Processed"); + return true; + } + + if (m_mPaymentProcessor == null) + setPaymentProcessor(); + if (m_mPaymentProcessor == null) + { + log.log(Level.WARNING, "No Payment Processor Model"); + setErrorMessage("No Payment Processor Model"); + return false; + } + + boolean approved = false; + /** Process Payment on Server */ + if (DB.isRemoteObjects()) + { + Server server = CConnection.get().getServer(); + try + { + if (server != null) + { // See ServerBean + String trxName = null; // unconditionally save + save(trxName); // server reads from disk + approved = server.paymentOnline (getCtx(), getC_Payment_ID(), + m_mPaymentProcessor.getC_PaymentProcessor_ID(), trxName); + if (CLogMgt.isLevelFinest()) + s_log.fine("server => " + approved); + load(trxName); // server saves to disk + setIsApproved(approved); + return approved; + } + log.log(Level.WARNING, "AppsServer not found"); + } + catch (RemoteException ex) + { + log.log(Level.SEVERE, "AppsServer error", ex); + } + } + /** **/ + + // Try locally + try + { + PaymentProcessor pp = PaymentProcessor.create(m_mPaymentProcessor, this); + if (pp == null) + setErrorMessage("No Payment Processor"); + else + { + approved = pp.processCC (); + if (approved) + setErrorMessage(null); + else + setErrorMessage("From " + getCreditCardName() + ": " + getR_RespMsg()); + } + } + catch (Exception e) + { + log.log(Level.SEVERE, "processOnline", e); + setErrorMessage("Payment Processor Error"); + } + setIsApproved(approved); + return approved; + } // processOnline + + /** + * Process Online Payment. + * implements ProcessCall after standard constructor + * Called when pressing the Process_Online button in C_Payment + * + * @param ctx Context + * @param pi Process Info + * @param trx transaction + * @return true if the next process should be performed + */ + public boolean startProcess (Properties ctx, ProcessInfo pi, Trx trx) + { + log.info("startProcess - " + pi.getRecord_ID()); + boolean retValue = false; + // + if (pi.getRecord_ID() != get_ID()) + { + log.log(Level.SEVERE, "startProcess - Not same Payment - " + pi.getRecord_ID()); + return false; + } + // Process it + retValue = processOnline(); + save(); + return retValue; // Payment processed + } // startProcess + + + /** + * Before Save + * @param newRecord new + * @return save + */ + protected boolean beforeSave (boolean newRecord) + { + // @Trifon - CashPayments + //if ( getTenderType().equals("X") ) { + if ( isCashTrx() ) { + // Cash Book Is mandatory + if ( getC_CashBook_ID() <= 0 ) { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@")); + return false; + } + } else { + // Bank Account Is mandatory + if ( getC_BankAccount_ID() <= 0 ) { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_BankAccount_ID@")); + return false; + } + } + // end @Trifon - CashPayments + + // We have a charge + if (getC_Charge_ID() != 0) + { + if (newRecord || is_ValueChanged("C_Charge_ID")) + { + setC_Order_ID(0); + setC_Invoice_ID(0); + setWriteOffAmt(Env.ZERO); + setDiscountAmt(Env.ZERO); + setIsOverUnderPayment(false); + setOverUnderAmt(Env.ZERO); + setIsPrepayment(false); + } + } + // We need a BPartner + else if (getC_BPartner_ID() == 0 && !isCashTrx()) + { + if (getC_Invoice_ID() != 0) + ; + else if (getC_Order_ID() != 0) + ; + else + { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@NotFound@: @C_BPartner_ID@")); + return false; + } + } + // Prepayment: No charge and order or project (not as acct dimension) + if (newRecord + || is_ValueChanged("C_Charge_ID") || is_ValueChanged("C_Invoice_ID") + || is_ValueChanged("C_Order_ID") || is_ValueChanged("C_Project_ID")) + setIsPrepayment (getC_Charge_ID() == 0 + && getC_BPartner_ID() != 0 + && (getC_Order_ID() != 0 + || (getC_Project_ID() != 0 && getC_Invoice_ID() == 0))); + if (isPrepayment()) + { + if (newRecord + || is_ValueChanged("C_Order_ID") || is_ValueChanged("C_Project_ID")) + { + setWriteOffAmt(Env.ZERO); + setDiscountAmt(Env.ZERO); + setIsOverUnderPayment(false); + setOverUnderAmt(Env.ZERO); + } + } + + // Document Type/Receipt + if (getC_DocType_ID() == 0) + setC_DocType_ID(); + else + { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + setIsReceipt(dt.isSOTrx()); + } + setDocumentNo(); + // + if (getDateAcct() == null) + setDateAcct(getDateTrx()); + // + if (!isOverUnderPayment()) + setOverUnderAmt(Env.ZERO); + + // Organization + if ((newRecord || is_ValueChanged("C_BankAccount_ID")) + && getC_Charge_ID() == 0) // allow different org for charge + { + MBankAccount ba = MBankAccount.get(getCtx(), getC_BankAccount_ID()); + if (ba.getAD_Org_ID() != 0) + setAD_Org_ID(ba.getAD_Org_ID()); + } + + // [ adempiere-Bugs-1885417 ] Validate BP on Payment Prepare or BeforeSave + // there is bp and (invoice or order) + if (getC_BPartner_ID() != 0 && (getC_Invoice_ID() != 0 || getC_Order_ID() != 0)) { + if (getC_Invoice_ID() != 0) { + MInvoice inv = new MInvoice(getCtx(), getC_Invoice_ID(), get_TrxName()); + if (inv.getC_BPartner_ID() != getC_BPartner_ID()) { + log.saveError("Error", Msg.parseTranslation(getCtx(), "BP different from BP Invoice")); + return false; + } + } + if (getC_Order_ID() != 0) { + MOrder ord = new MOrder(getCtx(), getC_Order_ID(), get_TrxName()); + if (ord.getC_BPartner_ID() != getC_BPartner_ID()) { + log.saveError("Error", Msg.parseTranslation(getCtx(), "BP different from BP Order")); + return false; + } + } + } + + return true; + } // beforeSave + + /** + * Get Allocated Amt in Payment Currency + * @return amount or null + */ + public BigDecimal getAllocatedAmt () + { + BigDecimal retValue = null; + if (getC_Charge_ID() != 0) + return getPayAmt(); + // + String sql = "SELECT SUM(currencyConvert(al.Amount," + + "ah.C_Currency_ID, p.C_Currency_ID,ah.DateTrx,p.C_ConversionType_ID, al.AD_Client_ID,al.AD_Org_ID)) " + + "FROM C_AllocationLine al" + + " INNER JOIN C_AllocationHdr ah ON (al.C_AllocationHdr_ID=ah.C_AllocationHdr_ID) " + + " INNER JOIN C_Payment p ON (al.C_Payment_ID=p.C_Payment_ID) " + + "WHERE al.C_Payment_ID=?" + + " AND ah.IsActive='Y' AND al.IsActive='Y'"; + // + " AND al.C_Invoice_ID IS NOT NULL"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Payment_ID()); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) + retValue = rs.getBigDecimal(1); + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, "getAllocatedAmt", e); + } + try + { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + // log.fine("getAllocatedAmt - " + retValue); + // ? ROUND(NVL(v_AllocatedAmt,0), 2); + return retValue; + } // getAllocatedAmt + + /** + * Test Allocation (and set allocated flag) + * @return true if updated + */ + public boolean testAllocation() + { + // Cash Trx always allocated!!! WHY??? +/* @Trifon - CashPayments + if (isCashTrx()) + { + if (!isAllocated()) + { + setIsAllocated(true); + return true; + } + return false; + } +*/ + // + BigDecimal alloc = getAllocatedAmt(); + if (alloc == null) + alloc = Env.ZERO; + BigDecimal total = getPayAmt(); + if (!isReceipt()) + total = total.negate(); + boolean test = total.compareTo(alloc) == 0; + boolean change = test != isAllocated(); + if (change) + setIsAllocated(test); + log.fine("Allocated=" + test + + " (" + alloc + "=" + total + ")"); + return change; + } // testAllocation + + /** + * Set Allocated Flag for payments + * @param ctx context + * @param C_BPartner_ID if 0 all + * @param trxName trx + */ + public static void setIsAllocated (Properties ctx, int C_BPartner_ID, String trxName) + { + int counter = 0; + String sql = "SELECT * FROM C_Payment " + + "WHERE IsAllocated='N' AND DocStatus IN ('CO','CL')"; + if (C_BPartner_ID > 1) + sql += " AND C_BPartner_ID=?"; + else + sql += " AND AD_Client_ID=" + Env.getAD_Client_ID(ctx); + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, trxName); + if (C_BPartner_ID > 1) + pstmt.setInt (1, C_BPartner_ID); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + { + MPayment pay = new MPayment (ctx, rs, trxName); + if (pay.testAllocation()) + if (pay.save()) + counter++; + } + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + s_log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + s_log.config("#" + counter); + } // setIsAllocated + + /************************************************************************** + * Set Error Message + * @param errorMessage error message + */ + public void setErrorMessage(String errorMessage) + { + m_errorMessage = errorMessage; + } // setErrorMessage + + /** + * Get Error Message + * @return error message + */ + public String getErrorMessage() + { + return m_errorMessage; + } // getErrorMessage + + + /** + * Set Bank Account for Payment. + * @param C_BankAccount_ID C_BankAccount_ID + */ + public void setC_BankAccount_ID (int C_BankAccount_ID) + { + if (C_BankAccount_ID == 0) + { + setPaymentProcessor(); + if (getC_BankAccount_ID() == 0) + throw new IllegalArgumentException("Can't find Bank Account"); + } + else + super.setC_BankAccount_ID(C_BankAccount_ID); + } // setC_BankAccount_ID + + /** + * Set BankAccount and PaymentProcessor + * @return true if found + */ + public boolean setPaymentProcessor () + { + return setPaymentProcessor (getTenderType(), getCreditCardType()); + } // setPaymentProcessor + + /** + * Set BankAccount and PaymentProcessor + * @param tender TenderType see TENDER_ + * @param CCType CC Type see CC_ + * @return true if found + */ + public boolean setPaymentProcessor (String tender, String CCType) + { + m_mPaymentProcessor = null; + // Get Processor List + if (m_mPaymentProcessors == null || m_mPaymentProcessors.length == 0) + m_mPaymentProcessors = MPaymentProcessor.find (getCtx(), tender, CCType, getAD_Client_ID(), + getC_Currency_ID(), getPayAmt(), get_TrxName()); + // Relax Amount + if (m_mPaymentProcessors == null || m_mPaymentProcessors.length == 0) + m_mPaymentProcessors = MPaymentProcessor.find (getCtx(), tender, CCType, getAD_Client_ID(), + getC_Currency_ID(), Env.ZERO, get_TrxName()); + if (m_mPaymentProcessors == null || m_mPaymentProcessors.length == 0) + return false; + + // Find the first right one + for (int i = 0; i < m_mPaymentProcessors.length; i++) + { + if (m_mPaymentProcessors[i].accepts (tender, CCType)) + { + m_mPaymentProcessor = m_mPaymentProcessors[i]; + } + } + if (m_mPaymentProcessor != null) + setC_BankAccount_ID (m_mPaymentProcessor.getC_BankAccount_ID()); + // + return m_mPaymentProcessor != null; + } // setPaymentProcessor + + + /** + * Get Accepted Credit Cards for PayAmt (default 0) + * @return credit cards + */ + public ValueNamePair[] getCreditCards () + { + return getCreditCards(getPayAmt()); + } // getCreditCards + + + /** + * Get Accepted Credit Cards for amount + * @param amt trx amount + * @return credit cards + */ + public ValueNamePair[] getCreditCards (BigDecimal amt) + { + try + { + if (m_mPaymentProcessors == null || m_mPaymentProcessors.length == 0) + m_mPaymentProcessors = MPaymentProcessor.find (getCtx (), null, null, + getAD_Client_ID (), getC_Currency_ID (), amt, get_TrxName()); + // + HashMap map = new HashMap(); // to eliminate duplicates + for (int i = 0; i < m_mPaymentProcessors.length; i++) + { + if (m_mPaymentProcessors[i].isAcceptAMEX ()) + map.put (CREDITCARDTYPE_Amex, getCreditCardPair (CREDITCARDTYPE_Amex)); + if (m_mPaymentProcessors[i].isAcceptDiners ()) + map.put (CREDITCARDTYPE_Diners, getCreditCardPair (CREDITCARDTYPE_Diners)); + if (m_mPaymentProcessors[i].isAcceptDiscover ()) + map.put (CREDITCARDTYPE_Discover, getCreditCardPair (CREDITCARDTYPE_Discover)); + if (m_mPaymentProcessors[i].isAcceptMC ()) + map.put (CREDITCARDTYPE_MasterCard, getCreditCardPair (CREDITCARDTYPE_MasterCard)); + if (m_mPaymentProcessors[i].isAcceptCorporate ()) + map.put (CREDITCARDTYPE_PurchaseCard, getCreditCardPair (CREDITCARDTYPE_PurchaseCard)); + if (m_mPaymentProcessors[i].isAcceptVisa ()) + map.put (CREDITCARDTYPE_Visa, getCreditCardPair (CREDITCARDTYPE_Visa)); + } // for all payment processors + // + ValueNamePair[] retValue = new ValueNamePair[map.size ()]; + map.values ().toArray (retValue); + log.fine("getCreditCards - #" + retValue.length + " - Processors=" + m_mPaymentProcessors.length); + return retValue; + } + catch (Exception ex) + { + ex.printStackTrace(); + return null; + } + } // getCreditCards + + /** + * Get Type and name pair + * @param CreditCardType credit card Type + * @return pair + */ + private ValueNamePair getCreditCardPair (String CreditCardType) + { + return new ValueNamePair (CreditCardType, getCreditCardName(CreditCardType)); + } // getCreditCardPair + + + /************************************************************************** + * Credit Card Number + * @param CreditCardNumber CreditCard Number + */ + public void setCreditCardNumber (String CreditCardNumber) + { + super.setCreditCardNumber (MPaymentValidate.checkNumeric(CreditCardNumber)); + } // setCreditCardNumber + + /** + * Verification Code + * @param newCreditCardVV CC verification + */ + public void setCreditCardVV(String newCreditCardVV) + { + super.setCreditCardVV (MPaymentValidate.checkNumeric(newCreditCardVV)); + } // setCreditCardVV + + /** + * Two Digit CreditCard MM + * @param CreditCardExpMM Exp month + */ + public void setCreditCardExpMM (int CreditCardExpMM) + { + if (CreditCardExpMM < 1 || CreditCardExpMM > 12) + ; + else + super.setCreditCardExpMM (CreditCardExpMM); + } // setCreditCardExpMM + + /** + * Two digit CreditCard YY (til 2020) + * @param newCreditCardExpYY 2 or 4 digit year + */ + public void setCreditCardExpYY (int newCreditCardExpYY) + { + int CreditCardExpYY = newCreditCardExpYY; + if (newCreditCardExpYY > 1999) + CreditCardExpYY = newCreditCardExpYY-2000; + super.setCreditCardExpYY(CreditCardExpYY); + } // setCreditCardExpYY + + /** + * CreditCard Exp MMYY + * @param mmyy Exp in form of mmyy + * @return true if valid + */ + public boolean setCreditCardExp (String mmyy) + { + if (MPaymentValidate.validateCreditCardExp(mmyy).length() != 0) + return false; + // + String exp = MPaymentValidate.checkNumeric(mmyy); + String mmStr = exp.substring(0,2); + String yyStr = exp.substring(2,4); + setCreditCardExpMM (Integer.parseInt(mmStr)); + setCreditCardExpYY (Integer.parseInt(yyStr)); + return true; + } // setCreditCardExp + + + /** + * CreditCard Exp MMYY + * @param delimiter / - or null + * @return Exp + */ + public String getCreditCardExp(String delimiter) + { + String mm = String.valueOf(getCreditCardExpMM()); + String yy = String.valueOf(getCreditCardExpYY()); + + StringBuffer retValue = new StringBuffer(); + if (mm.length() == 1) + retValue.append("0"); + retValue.append(mm); + // + if (delimiter != null) + retValue.append(delimiter); + // + if (yy.length() == 1) + retValue.append("0"); + retValue.append(yy); + // + return (retValue.toString()); + } // getCreditCardExp + + /** + * MICR + * @param MICR MICR + */ + public void setMicr (String MICR) + { + super.setMicr (MPaymentValidate.checkNumeric(MICR)); + } // setBankMICR + + /** + * Routing No + * @param RoutingNo Routing No + */ + public void setRoutingNo(String RoutingNo) + { + super.setRoutingNo (MPaymentValidate.checkNumeric(RoutingNo)); + } // setBankRoutingNo + + + /** + * Bank Account No + * @param AccountNo AccountNo + */ + public void setAccountNo (String AccountNo) + { + super.setAccountNo (MPaymentValidate.checkNumeric(AccountNo)); + } // setBankAccountNo + + + /** + * Check No + * @param CheckNo Check No + */ + public void setCheckNo(String CheckNo) + { + super.setCheckNo(MPaymentValidate.checkNumeric(CheckNo)); + } // setBankCheckNo + + + /** + * Set DocumentNo to Payment info. + * If there is a R_PnRef that is set automatically + */ + private void setDocumentNo() + { + // Cash Transfer + if ("X".equals(getTenderType())) + return; + // Current Document No + String documentNo = getDocumentNo(); + // Existing reversal + if (documentNo != null + && documentNo.indexOf(REVERSE_INDICATOR) >= 0) + return; + + // If external number exists - enforce it + if (getR_PnRef() != null && getR_PnRef().length() > 0) + { + if (!getR_PnRef().equals(documentNo)) + setDocumentNo(getR_PnRef()); + return; + } + + documentNo = ""; + // globalqss - read configuration to assign credit card or check number number for Payments + // Credit Card + if (TENDERTYPE_CreditCard.equals(getTenderType())) + { + if (MSysConfig.getBooleanValue("PAYMENT_OVERWRITE_DOCUMENTNO_WITH_CREDIT_CARD", true, getAD_Client_ID())) { + documentNo = getCreditCardType() + + " " + Obscure.obscure(getCreditCardNumber()) + + " " + getCreditCardExpMM() + + "/" + getCreditCardExpYY(); + } + } + // Own Check No + else if (TENDERTYPE_Check.equals(getTenderType()) + && !isReceipt() + && getCheckNo() != null && getCheckNo().length() > 0) + { + if (MSysConfig.getBooleanValue("PAYMENT_OVERWRITE_DOCUMENTNO_WITH_CHECK_ON_PAYMENT", true, getAD_Client_ID())) { + documentNo = getCheckNo(); + } + } + // Customer Check: Routing: Account #Check + else if (TENDERTYPE_Check.equals(getTenderType()) + && isReceipt()) + { + if (MSysConfig.getBooleanValue("PAYMENT_OVERWRITE_DOCUMENTNO_WITH_CHECK_ON_RECEIPT", true, getAD_Client_ID())) { + if (getRoutingNo() != null) + documentNo = getRoutingNo() + ": "; + if (getAccountNo() != null) + documentNo += getAccountNo(); + if (getCheckNo() != null) + { + if (documentNo.length() > 0) + documentNo += " "; + documentNo += "#" + getCheckNo(); + } + } + } + + // Set Document No + documentNo = documentNo.trim(); + if (documentNo.length() > 0) + setDocumentNo(documentNo); + } // setDocumentNo + + /** + * Set Refernce No (and Document No) + * @param R_PnRef reference + */ + public void setR_PnRef (String R_PnRef) + { + super.setR_PnRef (R_PnRef); + if (R_PnRef != null) + setDocumentNo (R_PnRef); + } // setR_PnRef + + // --------------- + + /** + * Set Payment Amount + * @param PayAmt Pay Amt + */ + public void setPayAmt (BigDecimal PayAmt) + { + super.setPayAmt(PayAmt == null ? Env.ZERO : PayAmt); + } // setPayAmt + + /** + * Set Payment Amount + * + * @param C_Currency_ID currency + * @param payAmt amount + */ + public void setAmount (int C_Currency_ID, BigDecimal payAmt) + { + if (C_Currency_ID == 0) + C_Currency_ID = MClient.get(getCtx()).getC_Currency_ID(); + setC_Currency_ID(C_Currency_ID); + setPayAmt(payAmt); + } // setAmount + + /** + * Discount Amt + * @param DiscountAmt Discount + */ + public void setDiscountAmt (BigDecimal DiscountAmt) + { + super.setDiscountAmt (DiscountAmt == null ? Env.ZERO : DiscountAmt); + } // setDiscountAmt + + /** + * WriteOff Amt + * @param WriteOffAmt WriteOff + */ + public void setWriteOffAmt (BigDecimal WriteOffAmt) + { + super.setWriteOffAmt (WriteOffAmt == null ? Env.ZERO : WriteOffAmt); + } // setWriteOffAmt + + /** + * OverUnder Amt + * @param OverUnderAmt OverUnder + */ + public void setOverUnderAmt (BigDecimal OverUnderAmt) + { + super.setOverUnderAmt (OverUnderAmt == null ? Env.ZERO : OverUnderAmt); + setIsOverUnderPayment(getOverUnderAmt().compareTo(Env.ZERO) != 0); + } // setOverUnderAmt + + /** + * Tax Amt + * @param TaxAmt Tax + */ + public void setTaxAmt (BigDecimal TaxAmt) + { + super.setTaxAmt (TaxAmt == null ? Env.ZERO : TaxAmt); + } // setTaxAmt + + /** + * Set Info from BP Bank Account + * @param ba BP bank account + */ + public void setBP_BankAccount (MBPBankAccount ba) + { + log.fine("" + ba); + if (ba == null) + return; + setC_BPartner_ID(ba.getC_BPartner_ID()); + setAccountAddress(ba.getA_Name(), ba.getA_Street(), ba.getA_City(), + ba.getA_State(), ba.getA_Zip(), ba.getA_Country()); + setA_EMail(ba.getA_EMail()); + setA_Ident_DL(ba.getA_Ident_DL()); + setA_Ident_SSN(ba.getA_Ident_SSN()); + // CC + if (ba.getCreditCardType() != null) + setCreditCardType(ba.getCreditCardType()); + if (ba.getCreditCardNumber() != null) + setCreditCardNumber(ba.getCreditCardNumber()); + if (ba.getCreditCardExpMM() != 0) + setCreditCardExpMM(ba.getCreditCardExpMM()); + if (ba.getCreditCardExpYY() != 0) + setCreditCardExpYY(ba.getCreditCardExpYY()); + if (ba.getCreditCardVV() != null) + setCreditCardVV(ba.getCreditCardVV()); + // Bank + if (ba.getAccountNo() != null) + setAccountNo(ba.getAccountNo()); + if (ba.getRoutingNo() != null) + setRoutingNo(ba.getRoutingNo()); + } // setBP_BankAccount + + /** + * Save Info from BP Bank Account + * @param ba BP bank account + * @return true if saved + */ + public boolean saveToBP_BankAccount (MBPBankAccount ba) + { + if (ba == null) + return false; + ba.setA_Name(getA_Name()); + ba.setA_Street(getA_Street()); + ba.setA_City(getA_City()); + ba.setA_State(getA_State()); + ba.setA_Zip(getA_Zip()); + ba.setA_Country(getA_Country()); + ba.setA_EMail(getA_EMail()); + ba.setA_Ident_DL(getA_Ident_DL()); + ba.setA_Ident_SSN(getA_Ident_SSN()); + // CC + ba.setCreditCardType(getCreditCardType()); + ba.setCreditCardNumber(getCreditCardNumber()); + ba.setCreditCardExpMM(getCreditCardExpMM()); + ba.setCreditCardExpYY(getCreditCardExpYY()); + ba.setCreditCardVV(getCreditCardVV()); + // Bank + if (getAccountNo() != null) + ba.setAccountNo(getAccountNo()); + if (getRoutingNo() != null) + ba.setRoutingNo(getRoutingNo()); + // Trx + ba.setR_AvsAddr(getR_AvsAddr()); + ba.setR_AvsZip(getR_AvsZip()); + // + boolean ok = ba.save(get_TrxName()); + log.fine("saveToBP_BankAccount - " + ba); + return ok; + } // setBP_BankAccount + + /** + * Set Doc Type bases on IsReceipt + */ + private void setC_DocType_ID () + { + setC_DocType_ID(isReceipt()); + } // setC_DocType_ID + + /** + * Set Doc Type + * @param isReceipt is receipt + */ + public void setC_DocType_ID (boolean isReceipt) + { + setIsReceipt(isReceipt); + String sql = "SELECT C_DocType_ID FROM C_DocType WHERE AD_Client_ID=? AND DocBaseType=? ORDER BY IsDefault DESC"; + try + { + PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getAD_Client_ID()); + if (isReceipt) + pstmt.setString(2, X_C_DocType.DOCBASETYPE_ARReceipt); + else + pstmt.setString(2, X_C_DocType.DOCBASETYPE_APPayment); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) + setC_DocType_ID(rs.getInt(1)); + else + log.warning ("setDocType - NOT found - isReceipt=" + isReceipt); + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql, e); + } + } // setC_DocType_ID + + + /** + * Set Document Type + * @param C_DocType_ID doc type + */ + public void setC_DocType_ID (int C_DocType_ID) + { + // if (getDocumentNo() != null && getC_DocType_ID() != C_DocType_ID) + // setDocumentNo(null); + super.setC_DocType_ID(C_DocType_ID); + } // setC_DocType_ID + + /** + * Verify Document Type with Invoice + * @return true if ok + */ + private boolean verifyDocType() + { + if (getC_DocType_ID() == 0) + return false; + // + Boolean invoiceSO = null; + // Check Invoice First + if (getC_Invoice_ID() > 0) + { + String sql = "SELECT idt.IsSOTrx " + + "FROM C_Invoice i" + + " INNER JOIN C_DocType idt ON (i.C_DocType_ID=idt.C_DocType_ID) " + + "WHERE i.C_Invoice_ID=?"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Invoice_ID()); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) + invoiceSO = new Boolean ("Y".equals(rs.getString(1))); + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + } // Invoice + + // DocumentType + Boolean paymentSO = null; + PreparedStatement pstmt = null; + String sql = "SELECT IsSOTrx " + + "FROM C_DocType " + + "WHERE C_DocType_ID=?"; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_DocType_ID()); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) + paymentSO = new Boolean ("Y".equals(rs.getString(1))); + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + // No Payment info + if (paymentSO == null) + return false; + setIsReceipt(paymentSO.booleanValue()); + + // We have an Invoice .. and it does not match + if (invoiceSO != null + && invoiceSO.booleanValue() != paymentSO.booleanValue()) + return false; + // OK + return true; + } // verifyDocType + + + /** + * Get ISO Code of Currency + * @return Currency ISO + */ + public String getCurrencyISO() + { + return MCurrency.getISO_Code (getCtx(), getC_Currency_ID()); + } // getCurrencyISO + + /** + * Get Document Status + * @return Document Status Clear Text + */ + public String getDocStatusName() + { + return MRefList.getListName(getCtx(), 131, getDocStatus()); + } // getDocStatusName + + /** + * Get Name of Credit Card + * @return Name + */ + public String getCreditCardName() + { + return getCreditCardName(getCreditCardType()); + } // getCreditCardName + + /** + * Get Name of Credit Card + * @param CreditCardType credit card type + * @return Name + */ + public String getCreditCardName(String CreditCardType) + { + if (CreditCardType == null) + return "--"; + else if (CREDITCARDTYPE_MasterCard.equals(CreditCardType)) + return "MasterCard"; + else if (CREDITCARDTYPE_Visa.equals(CreditCardType)) + return "Visa"; + else if (CREDITCARDTYPE_Amex.equals(CreditCardType)) + return "Amex"; + else if (CREDITCARDTYPE_ATM.equals(CreditCardType)) + return "ATM"; + else if (CREDITCARDTYPE_Diners.equals(CreditCardType)) + return "Diners"; + else if (CREDITCARDTYPE_Discover.equals(CreditCardType)) + return "Discover"; + else if (CREDITCARDTYPE_PurchaseCard.equals(CreditCardType)) + return "PurchaseCard"; + return "?" + CreditCardType + "?"; + } // getCreditCardName + + /** + * Add to Description + * @param description text + */ + public void addDescription (String description) + { + String desc = getDescription(); + if (desc == null) + setDescription(description); + else + setDescription(desc + " | " + description); + } // addDescription + + + /** + * Get Pay Amt + * @param absolute if true the absolute amount (i.e. negative if payment) + * @return amount + */ + public BigDecimal getPayAmt (boolean absolute) + { + if (isReceipt()) + return super.getPayAmt(); + return super.getPayAmt().negate(); + } // getPayAmt + + /** + * Get Pay Amt in cents + * @return amount in cents + */ + public int getPayAmtInCents () + { + BigDecimal bd = super.getPayAmt().multiply(Env.ONEHUNDRED); + return bd.intValue(); + } // getPayAmtInCents + + /************************************************************************** + * Process document + * @param processAction document action + * @return true if performed + */ + public boolean processIt (String processAction) + { + m_processMsg = null; + DocumentEngine engine = new DocumentEngine (this, getDocStatus()); + return engine.processIt (processAction, getDocAction()); + } // process + + /** Process Message */ + private String m_processMsg = null; + /** Just Prepared Flag */ + private boolean m_justPrepared = false; + + /** + * Unlock Document. + * @return true if success + */ + public boolean unlockIt() + { + log.info(toString()); + setProcessing(false); + return true; + } // unlockIt + + /** + * Invalidate Document + * @return true if success + */ + public boolean invalidateIt() + { + log.info(toString()); + setDocAction(DOCACTION_Prepare); + return true; + } // invalidateIt + + + /************************************************************************** + * Prepare Document + * @return new status (In Progress or Invalid) + */ + public String prepareIt() + { + log.info(toString()); + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + // Std Period open? + if (!MPeriod.isOpen(getCtx(), getDateAcct(), + isReceipt() ? X_C_DocType.DOCBASETYPE_ARReceipt : X_C_DocType.DOCBASETYPE_APPayment)) + { + m_processMsg = "@PeriodClosed@"; + return DocAction.STATUS_Invalid; + } + + // Unsuccessful Online Payment + if (isOnline() && !isApproved()) + { + if (getR_Result() != null) + m_processMsg = "@OnlinePaymentFailed@"; + else + m_processMsg = "@PaymentNotProcessed@"; + return DocAction.STATUS_Invalid; + } + + // Waiting Payment - Need to create Invoice & Shipment + if (getC_Order_ID() != 0 && getC_Invoice_ID() == 0) + { // see WebOrder.process + MOrder order = new MOrder (getCtx(), getC_Order_ID(), get_TrxName()); + if (DOCSTATUS_WaitingPayment.equals(order.getDocStatus())) + { + order.setC_Payment_ID(getC_Payment_ID()); + order.setDocAction(X_C_Order.DOCACTION_WaitComplete); + order.set_TrxName(get_TrxName()); + // boolean ok = + order.processIt (X_C_Order.DOCACTION_WaitComplete); + m_processMsg = order.getProcessMsg(); + order.save(get_TrxName()); + // Set Invoice + MInvoice[] invoices = order.getInvoices(); + int length = invoices.length; + if (length > 0) // get last invoice + setC_Invoice_ID (invoices[length-1].getC_Invoice_ID()); + // + if (getC_Invoice_ID() == 0) + { + m_processMsg = "@NotFound@ @C_Invoice_ID@"; + return DocAction.STATUS_Invalid; + } + } // WaitingPayment + } + + // Consistency of Invoice / Document Type and IsReceipt + if (!verifyDocType()) + { + m_processMsg = "@PaymentDocTypeInvoiceInconsistent@"; + return DocAction.STATUS_Invalid; + } + + // Do not pay when Credit Stop/Hold + if (!isReceipt()) + { + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); + if (X_C_BPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus())) + { + m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@=" + + bp.getTotalOpenBalance() + + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); + return DocAction.STATUS_Invalid; + } + if (X_C_BPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus())) + { + m_processMsg = "@BPartnerCreditHold@ - @TotalOpenBalance@=" + + bp.getTotalOpenBalance() + + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); + return DocAction.STATUS_Invalid; + } + } + + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + m_justPrepared = true; + if (!DOCACTION_Complete.equals(getDocAction())) + setDocAction(DOCACTION_Complete); + return DocAction.STATUS_InProgress; + } // prepareIt + + /** + * Approve Document + * @return true if success + */ + public boolean approveIt() + { + log.info(toString()); + setIsApproved(true); + return true; + } // approveIt + + /** + * Reject Approval + * @return true if success + */ + public boolean rejectIt() + { + log.info(toString()); + setIsApproved(false); + return true; + } // rejectIt + + + /************************************************************************** + * Complete Document + * @return new status (Complete, In Progress, Invalid, Waiting ..) + */ + public String completeIt() + { + // Re-Check + if (!m_justPrepared) + { + String status = prepareIt(); + if (!DocAction.STATUS_InProgress.equals(status)) + return status; + } + + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + + // Implicit Approval + if (!isApproved()) + approveIt(); + log.info(toString()); + + // Charge Handling + if (getC_Charge_ID() != 0) + { + setIsAllocated(true); + } + else + { + allocateIt(); // Create Allocation Records + testAllocation(); + } + + // Project update + if (getC_Project_ID() != 0) + { + // MProject project = new MProject(getCtx(), getC_Project_ID()); + } + // Update BP for Prepayments + if (getC_BPartner_ID() != 0 && getC_Invoice_ID() == 0) + { + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); + bp.setTotalOpenBalance(); + bp.save(); + } + + // Counter Doc + MPayment counter = createCounterDoc(); + if (counter != null) + m_processMsg += " @CounterDoc@: @C_Payment_ID@=" + counter.getDocumentNo(); + + // @Trifon - CashPayments + //if ( getTenderType().equals("X") ) { + if ( isCashTrx() ) { + // Create Cash Book entry + if ( getC_CashBook_ID() <= 0 ) { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@")); + m_processMsg = "@NoCashBook@"; + return DocAction.STATUS_Invalid; + } + MCash cash = MCash.get (getCtx(), getAD_Org_ID(), getDateAcct(), getC_Currency_ID(), get_TrxName()); + if (cash == null || cash.get_ID() == 0) + { + m_processMsg = "@NoCashBook@"; + return DocAction.STATUS_Invalid; + } + MCashLine cl = new MCashLine( cash ); + cl.setCashType( X_C_CashLine.CASHTYPE_GeneralReceipts ); + cl.setDescription("Generated From Payment #" + getDocumentNo()); + cl.setC_Currency_ID( this.getC_Currency_ID() ); + cl.setC_Payment_ID( getC_Payment_ID() ); // Set Reference to payment. + StringBuffer info=new StringBuffer(); + info.append("Cash journal ( ") + .append(cash.getDocumentNo()).append(" )"); + m_processMsg = info.toString(); + // Amount + BigDecimal amt = this.getPayAmt(); +/* + MDocType dt = MDocType.get(getCtx(), invoice.getC_DocType_ID()); + if (MDocType.DOCBASETYPE_APInvoice.equals( dt.getDocBaseType() ) + || MDocType.DOCBASETYPE_ARCreditMemo.equals( dt.getDocBaseType() ) + ) { + amt = amt.negate(); + } +*/ + cl.setAmount( amt ); + // + cl.setDiscountAmt( Env.ZERO ); + cl.setWriteOffAmt( Env.ZERO ); + cl.setIsGenerated( true ); + + if (!cl.save(get_TrxName())) + { + m_processMsg = "Could not save Cash Journal Line"; + return DocAction.STATUS_Invalid; + } + } + // End Trifon - CashPayments + + // User Validation + String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); + if (valid != null) + { + m_processMsg = valid; + return DocAction.STATUS_Invalid; + } + + // Set the definite document number after completed (if needed) + setDefiniteDocumentNo(); + + // + setProcessed(true); + setDocAction(DOCACTION_Close); + return DocAction.STATUS_Completed; + } // completeIt + + /** + * Set the definite document number after completed + */ + private void setDefiniteDocumentNo() { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + if (dt.isOverwriteDateOnComplete()) { + setDateTrx(new Timestamp (System.currentTimeMillis())); + } + if (dt.isOverwriteSeqOnComplete()) { + String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); + if (value != null) + setDocumentNo(value); + } + } + + /** + * Create Counter Document + * @return payment + */ + private MPayment createCounterDoc() + { + // Is this a counter doc ? + if (getRef_Payment_ID() != 0) + return null; + + // Org Must be linked to BPartner + MOrg org = MOrg.get(getCtx(), getAD_Org_ID()); + int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName()); + if (counterC_BPartner_ID == 0) + return null; + // Business Partner needs to be linked to Org + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); + int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int(); + if (counterAD_Org_ID == 0) + return null; + + MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, get_TrxName()); + // MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID); + log.info("Counter BP=" + counterBP.getName()); + + // Document Type + int C_DocTypeTarget_ID = 0; + MDocTypeCounter counterDT = MDocTypeCounter.getCounterDocType(getCtx(), getC_DocType_ID()); + if (counterDT != null) + { + log.fine(counterDT.toString()); + if (!counterDT.isCreateCounter() || !counterDT.isValid()) + return null; + C_DocTypeTarget_ID = counterDT.getCounter_C_DocType_ID(); + } + else // indirect + { + C_DocTypeTarget_ID = MDocTypeCounter.getCounterDocType_ID(getCtx(), getC_DocType_ID()); + log.fine("Indirect C_DocTypeTarget_ID=" + C_DocTypeTarget_ID); + if (C_DocTypeTarget_ID <= 0) + return null; + } + + // Deep Copy + MPayment counter = new MPayment (getCtx(), 0, get_TrxName()); + counter.setAD_Org_ID(counterAD_Org_ID); + counter.setC_BPartner_ID(counterBP.getC_BPartner_ID()); + counter.setIsReceipt(!isReceipt()); + counter.setC_DocType_ID(C_DocTypeTarget_ID); + counter.setTrxType(getTrxType()); + counter.setTenderType(getTenderType()); + // + counter.setPayAmt(getPayAmt()); + counter.setDiscountAmt(getDiscountAmt()); + counter.setTaxAmt(getTaxAmt()); + counter.setWriteOffAmt(getWriteOffAmt()); + counter.setIsOverUnderPayment (isOverUnderPayment()); + counter.setOverUnderAmt(getOverUnderAmt()); + counter.setC_Currency_ID(getC_Currency_ID()); + counter.setC_ConversionType_ID(getC_ConversionType_ID()); + // + counter.setDateTrx (getDateTrx()); + counter.setDateAcct (getDateAcct()); + counter.setRef_Payment_ID(getC_Payment_ID()); + // + String sql = "SELECT C_BankAccount_ID FROM C_BankAccount " + + "WHERE C_Currency_ID=? AND AD_Org_ID IN (0,?) AND IsActive='Y' " + + "ORDER BY IsDefault DESC"; + int C_BankAccount_ID = DB.getSQLValue(get_TrxName(), sql, getC_Currency_ID(), counterAD_Org_ID); + counter.setC_BankAccount_ID(C_BankAccount_ID); + + // References + counter.setC_Activity_ID(getC_Activity_ID()); + counter.setC_Campaign_ID(getC_Campaign_ID()); + counter.setC_Project_ID(getC_Project_ID()); + counter.setUser1_ID(getUser1_ID()); + counter.setUser2_ID(getUser2_ID()); + counter.save(get_TrxName()); + log.fine(counter.toString()); + setRef_Payment_ID(counter.getC_Payment_ID()); + + // Document Action + if (counterDT != null) + { + if (counterDT.getDocAction() != null) + { + counter.setDocAction(counterDT.getDocAction()); + counter.processIt(counterDT.getDocAction()); + counter.save(get_TrxName()); + } + } + return counter; + } // createCounterDoc + + /** + * Allocate It. + * Only call when there is NO allocation as it will create duplicates. + * If an invoice exists, it allocates that + * otherwise it allocates Payment Selection. + * @return true if allocated + */ + public boolean allocateIt() + { + // Create invoice Allocation - See also MCash.completeIt + if (getC_Invoice_ID() != 0) + return allocateInvoice(); + // Invoices of a AP Payment Selection + if (allocatePaySelection()) + return true; + + if (getC_Order_ID() != 0) + return false; + + // Allocate to multiple Payments based on entry + MPaymentAllocate[] pAllocs = MPaymentAllocate.get(this); + if (pAllocs.length == 0) + return false; + + MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, + getDateTrx(), getC_Currency_ID(), + Msg.translate(getCtx(), "C_Payment_ID") + ": " + getDocumentNo(), + get_TrxName()); + alloc.setAD_Org_ID(getAD_Org_ID()); + if (!alloc.save()) + { + log.severe("P.Allocations not created"); + return false; + } + // Lines + for (int i = 0; i < pAllocs.length; i++) + { + MPaymentAllocate pa = pAllocs[i]; + MAllocationLine aLine = null; + if (isReceipt()) + aLine = new MAllocationLine (alloc, pa.getAmount(), + pa.getDiscountAmt(), pa.getWriteOffAmt(), pa.getOverUnderAmt()); + else + aLine = new MAllocationLine (alloc, pa.getAmount().negate(), + pa.getDiscountAmt().negate(), pa.getWriteOffAmt().negate(), pa.getOverUnderAmt().negate()); + aLine.setDocInfo(pa.getC_BPartner_ID(), 0, pa.getC_Invoice_ID()); + aLine.setPaymentInfo(getC_Payment_ID(), 0); + if (!aLine.save(get_TrxName())) + log.warning("P.Allocations - line not saved"); + else + { + pa.setC_AllocationLine_ID(aLine.getC_AllocationLine_ID()); + pa.save(); + } + } + // Should start WF + alloc.processIt(DocAction.ACTION_Complete); + m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo(); + return alloc.save(get_TrxName()); + } // allocateIt + + /** + * Allocate single AP/AR Invoice + * @return true if allocated + */ + private boolean allocateInvoice() + { + // calculate actual allocation + BigDecimal allocationAmt = getPayAmt(); // underpayment + if (getOverUnderAmt().signum() < 0 && getPayAmt().signum() > 0) + allocationAmt = allocationAmt.add(getOverUnderAmt()); // overpayment (negative) + + MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, + getDateTrx(), getC_Currency_ID(), + Msg.translate(getCtx(), "C_Payment_ID") + ": " + getDocumentNo() + " [1]", get_TrxName()); + alloc.setAD_Org_ID(getAD_Org_ID()); + if (!alloc.save()) + { + log.log(Level.SEVERE, "Could not create Allocation Hdr"); + return false; + } + MAllocationLine aLine = null; + if (isReceipt()) + aLine = new MAllocationLine (alloc, allocationAmt, + getDiscountAmt(), getWriteOffAmt(), getOverUnderAmt()); + else + aLine = new MAllocationLine (alloc, allocationAmt.negate(), + getDiscountAmt().negate(), getWriteOffAmt().negate(), getOverUnderAmt().negate()); + aLine.setDocInfo(getC_BPartner_ID(), 0, getC_Invoice_ID()); + aLine.setC_Payment_ID(getC_Payment_ID()); + if (!aLine.save(get_TrxName())) + { + log.log(Level.SEVERE, "Could not create Allocation Line"); + return false; + } + // Should start WF + alloc.processIt(DocAction.ACTION_Complete); + alloc.save(get_TrxName()); + m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo(); + + // Get Project from Invoice + int C_Project_ID = DB.getSQLValue(get_TrxName(), + "SELECT MAX(C_Project_ID) FROM C_Invoice WHERE C_Invoice_ID=?", getC_Invoice_ID()); + if (C_Project_ID > 0 && getC_Project_ID() == 0) + setC_Project_ID(C_Project_ID); + else if (C_Project_ID > 0 && getC_Project_ID() > 0 && C_Project_ID != getC_Project_ID()) + log.warning("Invoice C_Project_ID=" + C_Project_ID + + " <> Payment C_Project_ID=" + getC_Project_ID()); + return true; + } // allocateInvoice + + /** + * Allocate Payment Selection + * @return true if allocated + */ + private boolean allocatePaySelection() + { + MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, + getDateTrx(), getC_Currency_ID(), + Msg.translate(getCtx(), "C_Payment_ID") + ": " + getDocumentNo() + " [n]", get_TrxName()); + alloc.setAD_Org_ID(getAD_Org_ID()); + + String sql = "SELECT psc.C_BPartner_ID, psl.C_Invoice_ID, psl.IsSOTrx, " // 1..3 + + " psl.PayAmt, psl.DiscountAmt, psl.DifferenceAmt, psl.OpenAmt " + + "FROM C_PaySelectionLine psl" + + " INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID) " + + "WHERE psc.C_Payment_ID=?"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, get_TrxName()); + pstmt.setInt(1, getC_Payment_ID()); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + { + int C_BPartner_ID = rs.getInt(1); + int C_Invoice_ID = rs.getInt(2); + if (C_BPartner_ID == 0 && C_Invoice_ID == 0) + continue; + boolean isSOTrx = "Y".equals(rs.getString(3)); + BigDecimal PayAmt = rs.getBigDecimal(4); + BigDecimal DiscountAmt = rs.getBigDecimal(5); + BigDecimal WriteOffAmt = rs.getBigDecimal(6); + BigDecimal OpenAmt = rs.getBigDecimal(7); + BigDecimal OverUnderAmt = OpenAmt.subtract(PayAmt) + .subtract(DiscountAmt).subtract(WriteOffAmt); + // + if (alloc.get_ID() == 0 && !alloc.save(get_TrxName())) + { + log.log(Level.SEVERE, "Could not create Allocation Hdr"); + rs.close(); + pstmt.close(); + return false; + } + MAllocationLine aLine = null; + if (isSOTrx) + aLine = new MAllocationLine (alloc, PayAmt, + DiscountAmt, WriteOffAmt, OverUnderAmt); + else + aLine = new MAllocationLine (alloc, PayAmt.negate(), + DiscountAmt.negate(), WriteOffAmt.negate(), OverUnderAmt.negate()); + aLine.setDocInfo(C_BPartner_ID, 0, C_Invoice_ID); + aLine.setC_Payment_ID(getC_Payment_ID()); + if (!aLine.save(get_TrxName())) + log.log(Level.SEVERE, "Could not create Allocation Line"); + } + rs.close(); + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, "allocatePaySelection", e); + } + try + { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + + // Should start WF + boolean ok = true; + if (alloc.get_ID() == 0) + { + log.fine("No Allocation created - C_Payment_ID=" + + getC_Payment_ID()); + ok = false; + } + else + { + alloc.processIt(DocAction.ACTION_Complete); + ok = alloc.save(get_TrxName()); + m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo(); + } + return ok; + } // allocatePaySelection + + /** + * De-allocate Payment. + * Unkink Invoices and Orders and delete Allocations + */ + private void deAllocate() + { + if (getC_Order_ID() != 0) + setC_Order_ID(0); + // if (getC_Invoice_ID() == 0) + // return; + // De-Allocate all + MAllocationHdr[] allocations = MAllocationHdr.getOfPayment(getCtx(), + getC_Payment_ID(), get_TrxName()); + log.fine("#" + allocations.length); + for (int i = 0; i < allocations.length; i++) + { + allocations[i].set_TrxName(get_TrxName()); + allocations[i].setDocAction(DocAction.ACTION_Reverse_Correct); + allocations[i].processIt(DocAction.ACTION_Reverse_Correct); + allocations[i].save(); + } + + // Unlink (in case allocation did not get it) + if (getC_Invoice_ID() != 0) + { + // Invoice + String sql = "UPDATE C_Invoice " + + "SET C_Payment_ID = NULL, IsPaid='N' " + + "WHERE C_Invoice_ID=" + getC_Invoice_ID() + + " AND C_Payment_ID=" + getC_Payment_ID(); + int no = DB.executeUpdate(sql, get_TrxName()); + if (no != 0) + log.fine("Unlink Invoice #" + no); + // Order + sql = "UPDATE C_Order o " + + "SET C_Payment_ID = NULL " + + "WHERE EXISTS (SELECT * FROM C_Invoice i " + + "WHERE o.C_Order_ID=i.C_Order_ID AND i.C_Invoice_ID=" + getC_Invoice_ID() + ")" + + " AND C_Payment_ID=" + getC_Payment_ID(); + no = DB.executeUpdate(sql, get_TrxName()); + if (no != 0) + log.fine("Unlink Order #" + no); + } + // + setC_Invoice_ID(0); + setIsAllocated(false); + } // deallocate + + /** + * Void Document. + * @return true if success + */ + public boolean voidIt() + { + log.info(toString()); + // Before Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID); + if (m_processMsg != null) + return false; + + if (DOCSTATUS_Closed.equals(getDocStatus()) + || DOCSTATUS_Reversed.equals(getDocStatus()) + || DOCSTATUS_Voided.equals(getDocStatus())) + { + m_processMsg = "Document Closed: " + getDocStatus(); + setDocAction(DOCACTION_None); + return false; + } + // If on Bank Statement, don't void it - reverse it + if (getC_BankStatementLine_ID() > 0) + return reverseCorrectIt(); + + // Not Processed + if (DOCSTATUS_Drafted.equals(getDocStatus()) + || DOCSTATUS_Invalid.equals(getDocStatus()) + || DOCSTATUS_InProgress.equals(getDocStatus()) + || DOCSTATUS_Approved.equals(getDocStatus()) + || DOCSTATUS_NotApproved.equals(getDocStatus()) ) + { + addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + getPayAmt() + ")"); + setPayAmt(Env.ZERO); + setDiscountAmt(Env.ZERO); + setWriteOffAmt(Env.ZERO); + setOverUnderAmt(Env.ZERO); + setIsAllocated(false); + // Unlink & De-Allocate + deAllocate(); + } + else + return reverseCorrectIt(); + + // + // After Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID); + if (m_processMsg != null) + return false; + + setProcessed(true); + setDocAction(DOCACTION_None); + return true; + } // voidIt + + /** + * Close Document. + * @return true if success + */ + public boolean closeIt() + { + log.info(toString()); + // Before Close + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE); + if (m_processMsg != null) + return false; + // After Close + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE); + if (m_processMsg != null) + return false; + setDocAction(DOCACTION_None); + return true; + } // closeIt + + /** + * Reverse Correction + * @return true if success + */ + public boolean reverseCorrectIt() + { + log.info(toString()); + // Before reverseCorrect + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT); + if (m_processMsg != null) + return false; + + // Std Period open? + Timestamp dateAcct = getDateAcct(); + if (!MPeriod.isOpen(getCtx(), dateAcct, + isReceipt() ? X_C_DocType.DOCBASETYPE_ARReceipt : X_C_DocType.DOCBASETYPE_APPayment)) + dateAcct = new Timestamp(System.currentTimeMillis()); + + // Auto Reconcile if not on Bank Statement + boolean reconciled = getC_BankStatementLine_ID() == 0; //AZ Goodwill + + // Create Reversal + MPayment reversal = new MPayment (getCtx(), 0, get_TrxName()); + copyValues(this, reversal); + reversal.setClientOrg(this); + reversal.setC_Order_ID(0); + reversal.setC_Invoice_ID(0); + reversal.setDateAcct(dateAcct); + // + reversal.setDocumentNo(getDocumentNo() + REVERSE_INDICATOR); // indicate reversals + reversal.setDocStatus(DOCSTATUS_Drafted); + reversal.setDocAction(DOCACTION_Complete); + // + reversal.setPayAmt(getPayAmt().negate()); + reversal.setDiscountAmt(getDiscountAmt().negate()); + reversal.setWriteOffAmt(getWriteOffAmt().negate()); + reversal.setOverUnderAmt(getOverUnderAmt().negate()); + // + reversal.setIsAllocated(true); + reversal.setIsReconciled(reconciled); // to put on bank statement + reversal.setIsOnline(false); + reversal.setIsApproved(true); + reversal.setR_PnRef(null); + reversal.setR_Result(null); + reversal.setR_RespMsg(null); + reversal.setR_AuthCode(null); + reversal.setR_Info(null); + reversal.setProcessing(false); + reversal.setOProcessing("N"); + reversal.setProcessed(false); + reversal.setPosted(false); + reversal.setDescription(getDescription()); + reversal.addDescription("{->" + getDocumentNo() + ")"); + reversal.save(get_TrxName()); + // Post Reversal + if (!reversal.processIt(DocAction.ACTION_Complete)) + { + m_processMsg = "Reversal ERROR: " + reversal.getProcessMsg(); + return false; + } + reversal.closeIt(); + reversal.setDocStatus(DOCSTATUS_Reversed); + reversal.setDocAction(DOCACTION_None); + reversal.save(get_TrxName()); + + // Unlink & De-Allocate + deAllocate(); + setIsReconciled (reconciled); + setIsAllocated (true); // the allocation below is overwritten + // Set Status + addDescription("(" + reversal.getDocumentNo() + "<-)"); + setDocStatus(DOCSTATUS_Reversed); + setDocAction(DOCACTION_None); + setProcessed(true); + + // Create automatic Allocation + MAllocationHdr alloc = new MAllocationHdr (getCtx(), false, + getDateTrx(), getC_Currency_ID(), + Msg.translate(getCtx(), "C_Payment_ID") + ": " + reversal.getDocumentNo(), get_TrxName()); + alloc.setAD_Org_ID(getAD_Org_ID()); + if (!alloc.save()) + log.warning("Automatic allocation - hdr not saved"); + else + { + // Original Allocation + MAllocationLine aLine = new MAllocationLine (alloc, getPayAmt(true), + Env.ZERO, Env.ZERO, Env.ZERO); + aLine.setDocInfo(getC_BPartner_ID(), 0, 0); + aLine.setPaymentInfo(getC_Payment_ID(), 0); + if (!aLine.save(get_TrxName())) + log.warning("Automatic allocation - line not saved"); + // Reversal Allocation + aLine = new MAllocationLine (alloc, reversal.getPayAmt(true), + Env.ZERO, Env.ZERO, Env.ZERO); + aLine.setDocInfo(reversal.getC_BPartner_ID(), 0, 0); + aLine.setPaymentInfo(reversal.getC_Payment_ID(), 0); + if (!aLine.save(get_TrxName())) + log.warning("Automatic allocation - reversal line not saved"); + } + alloc.processIt(DocAction.ACTION_Complete); + alloc.save(get_TrxName()); + // + StringBuffer info = new StringBuffer (reversal.getDocumentNo()); + info.append(" - @C_AllocationHdr_ID@: ").append(alloc.getDocumentNo()); + + // Update BPartner + if (getC_BPartner_ID() != 0) + { + MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); + bp.setTotalOpenBalance(); + bp.save(get_TrxName()); + } + // After reverseCorrect + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); + if (m_processMsg != null) + return false; + + m_processMsg = info.toString(); + return true; + } // reverseCorrectionIt + + /** + * Get Bank Statement Line of payment or 0 + * @return id or 0 + */ + private int getC_BankStatementLine_ID() + { + String sql = "SELECT C_BankStatementLine_ID FROM C_BankStatementLine WHERE C_Payment_ID=?"; + int id = DB.getSQLValue(get_TrxName(), sql, getC_Payment_ID()); + if (id < 0) + return 0; + return id; + } // getC_BankStatementLine_ID + + /** + * Reverse Accrual - none + * @return true if success + */ + public boolean reverseAccrualIt() + { + log.info(toString()); + + // Before reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL); + if (m_processMsg != null) + return false; + + // After reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); + if (m_processMsg != null) + return false; + + return false; + } // reverseAccrualIt + + /** + * Re-activate + * @return true if success + */ + public boolean reActivateIt() + { + log.info(toString()); + // Before reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE); + if (m_processMsg != null) + return false; + + if (! reverseCorrectIt()) + return false; + + // After reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE); + if (m_processMsg != null) + return false; + + return true; + } // reActivateIt + + /** + * String Representation + * @return info + */ + public String toString () + { + StringBuffer sb = new StringBuffer ("MPayment["); + sb.append(get_ID()).append("-").append(getDocumentNo()) + .append(",Receipt=").append(isReceipt()) + .append(",PayAmt=").append(getPayAmt()) + .append(",Discount=").append(getDiscountAmt()) + .append(",WriteOff=").append(getWriteOffAmt()) + .append(",OverUnder=").append(getOverUnderAmt()); + return sb.toString (); + } // toString + + /** + * Get Document Info + * @return document info (untranslated) + */ + public String getDocumentInfo() + { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + return dt.getName() + " " + getDocumentNo(); + } // getDocumentInfo + + /** + * Create PDF + * @return File or null + */ + public File createPDF () + { + try + { + File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf"); + return createPDF (temp); + } + catch (Exception e) + { + log.severe("Could not create PDF - " + e.getMessage()); + } + return null; + } // getPDF + + /** + * Create PDF file + * @param file output file + * @return file if success + */ + public File createPDF (File file) + { + // ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.PAYMENT, getC_Payment_ID()); + // if (re == null) + return null; + // return re.getPDF(file); + } // createPDF + + + /************************************************************************* + * Get Summary + * @return Summary of Document + */ + public String getSummary() + { + StringBuffer sb = new StringBuffer(); + sb.append(getDocumentNo()); + // : Total Lines = 123.00 (#1) + sb.append(": ") + .append(Msg.translate(getCtx(),"PayAmt")).append("=").append(getPayAmt()) + .append(",").append(Msg.translate(getCtx(),"WriteOffAmt")).append("=").append(getWriteOffAmt()); + // - Description + if (getDescription() != null && getDescription().length() > 0) + sb.append(" - ").append(getDescription()); + return sb.toString(); + } // getSummary + + /** + * Get Process Message + * @return clear text error message + */ + public String getProcessMsg() + { + return m_processMsg; + } // getProcessMsg + + /** + * Get Document Owner (Responsible) + * @return AD_User_ID + */ + public int getDoc_User_ID() + { + return getCreatedBy(); + } // getDoc_User_ID + + /** + * Get Document Approval Amount + * @return amount payment(AP) or write-off(AR) + */ + public BigDecimal getApprovalAmt() + { + if (isReceipt()) + return getWriteOffAmt(); + return getPayAmt(); + } // getApprovalAmt + +} // MPayment diff --git a/posterita/posterita/src/main/org/compiere/model/MSequence.java b/posterita/posterita/src/main/org/compiere/model/MSequence.java new file mode 100644 index 0000000000..6095b79c71 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MSequence.java @@ -0,0 +1,1621 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.net.Socket; +import java.net.URL; +import java.net.URLEncoder; +import java.rmi.RemoteException; +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.Properties; +import java.util.Vector; +import java.util.logging.Level; + +import org.compiere.db.CConnection; +import org.compiere.interfaces.Server; +import org.compiere.util.CLogMgt; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.DBException; +import org.compiere.util.Env; +import org.compiere.util.Ini; +import org.compiere.util.Trx; + +/** + * Sequence Model. + * @see org.compiere.process.SequenceCheck + * @author Jorg Janke + * @version $Id: MSequence.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $ + */ +public class MSequence extends X_AD_Sequence +{ + /** Use SQL procedure to get next id */ + //begin vpj-cd e-evolution 02/11/2005 PostgreSQL + //private static final boolean USE_PROCEDURE = true; + private static boolean USE_PROCEDURE = false; + //end vpj-cd e-evolution 02/11/2005 + /** Log Level for Next ID Call */ + private static final Level LOGLEVEL = Level.ALL; + + public static synchronized int getNextID (int AD_Client_ID, String TableName) + { + return getNextID(AD_Client_ID, TableName, null); + } + + /** + * + * Get next number for Key column = 0 is Error. + * @param AD_Client_ID client + * @param TableName table name + * @param trxName deprecated. + * @return next no or (-1=not found, -2=error) + */ + public static synchronized int getNextID (int AD_Client_ID, String TableName, String trxName) + { + if (TableName == null || TableName.length() == 0) + throw new IllegalArgumentException("TableName missing"); + + //get from server + if (DB.isRemoteObjects()) + { + Server server = CConnection.get().getServer(); + try + { + if (server != null) + { // See ServerBean + // hengsin: don't execute getNextID in tranaction to fix performance and locking issue + int id = server.getNextID(AD_Client_ID, TableName, null); + s_log.finest("server => " + id); + if (id < 0) + throw new DBException("No NextID"); + return id; + } + s_log.log(Level.SEVERE, "AppsServer not found - " + TableName); + } + catch (RemoteException ex) + { + s_log.log(Level.SEVERE, "AppsServer error", ex); + } + // Try locally + } + + int retValue = -1; + + // Check AdempiereSys + boolean adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS); + if (adempiereSys && AD_Client_ID > 11) + adempiereSys = false; + // + if (CLogMgt.isLevel(LOGLEVEL)) + s_log.log(LOGLEVEL, TableName + " - AdempiereSys=" + adempiereSys + " [" + trxName + "]"); + //begin vpj-cd e-evolution 09/02/2005 PostgreSQL + String selectSQL = null; + if (DB.isOracle() == false || DB.isRemoteObjects()) + { + selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, AD_Sequence_ID " + + "FROM AD_Sequence " + + "WHERE Name=?" + + " AND IsActive='Y' AND IsTableID='Y' AND IsAutoSequence='Y' " + + " FOR UPDATE OF AD_Sequence "; + USE_PROCEDURE=false; + } + else + { + selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, AD_Sequence_ID " + + "FROM AD_Sequence " + + "WHERE Name=?" + + " AND IsActive='Y' AND IsTableID='Y' AND IsAutoSequence='Y' " + + "FOR UPDATE"; // jz derby needs expicitly said it//OF CurrentNext, CurrentNextSys"; + + USE_PROCEDURE = true; + } + + //hengsin: executing getNextID in transaction create huge performance and locking issue + //Trx trx = trxName == null ? null : Trx.get(trxName, true); + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + for (int i = 0; i < 3; i++) + { + try + { + conn = DB.getConnectionID(); + // Error + if (conn == null) + return -1; + + pstmt = conn.prepareStatement(selectSQL, + ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); + pstmt.setString(1, TableName); + // + rs = pstmt.executeQuery(); + if (CLogMgt.isLevelFinest()) + s_log.finest("AC=" + conn.getAutoCommit() + ", RO=" + conn.isReadOnly() + + " - Isolation=" + conn.getTransactionIsolation() + "(" + Connection.TRANSACTION_READ_COMMITTED + + ") - RSType=" + pstmt.getResultSetType() + "(" + ResultSet.TYPE_SCROLL_SENSITIVE + + "), RSConcur=" + pstmt.getResultSetConcurrency() + "(" + ResultSet.CONCUR_UPDATABLE + + ")"); + if (rs.next()) + { + + // Get the table + MTable table = MTable.get(Env.getCtx(), TableName); + boolean hasEntityType = false; + if (table.getColumn("EntityType") != null) + hasEntityType = true; + + int AD_Sequence_ID = rs.getInt(4); + boolean gotFromHTTP = false; + + // If maintaining official dictionary try to get the ID from http official server + if (adempiereSys) { + + String isUseCentralizedID = MSysConfig.getValue("DICTIONARY_ID_USE_CENTRALIZED_ID", "Y"); // defaults to Y + if ( ( ! isUseCentralizedID.equals("N") ) && ( ! isExceptionCentralized(TableName) ) ) { + // get ID from http site + retValue = getNextOfficialID_HTTP(TableName); + if (retValue > 0) { + PreparedStatement updateSQL; + updateSQL = conn.prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = ? + 1 WHERE AD_Sequence_ID = ?"); + try { + updateSQL.setInt(1, retValue); + updateSQL.setInt(2, AD_Sequence_ID); + updateSQL.executeUpdate(); + } finally { + updateSQL.close(); + } + } + gotFromHTTP = true; + } + + } + + // If not official dictionary try to get the ID from http custom server - if configured + if (hasEntityType && ( ! adempiereSys ) && ( ! isExceptionCentralized(TableName) ) ) { + + String isUseProjectCentralizedID = MSysConfig.getValue("PROJECT_ID_USE_CENTRALIZED_ID", "N"); // defaults to N + if (isUseProjectCentralizedID.equals("Y")) { + // get ID from http site + retValue = getNextProjectID_HTTP(TableName); + if (retValue > 0) { + PreparedStatement updateSQL; + updateSQL = conn.prepareStatement("UPDATE AD_Sequence SET CurrentNext = GREATEST(CurrentNext, ? + 1) WHERE AD_Sequence_ID = ?"); + try { + updateSQL.setInt(1, retValue); + updateSQL.setInt(2, AD_Sequence_ID); + updateSQL.executeUpdate(); + } finally { + updateSQL.close(); + } + } + gotFromHTTP = true; + } + + } + + if (! gotFromHTTP) { + // + if (USE_PROCEDURE) + { + retValue = nextID(conn, AD_Sequence_ID, adempiereSys); + } + else + { + PreparedStatement updateSQL; + int incrementNo = rs.getInt(3); + if (adempiereSys) { + updateSQL = conn + .prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"); + retValue = rs.getInt(2); + } else { + updateSQL = conn + .prepareStatement("UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ?"); + retValue = rs.getInt(1); + } + try { + updateSQL.setInt(1, incrementNo); + updateSQL.setInt(2, AD_Sequence_ID); + updateSQL.executeUpdate(); + } finally { + updateSQL.close(); + } + } + } + + //if (trx == null) + conn.commit(); + } + else + s_log.severe ("No record found - " + TableName); + + // + break; // EXIT + } + catch (Exception e) + { + s_log.log(Level.SEVERE, TableName + " - " + e.getMessage(), e); + try + { + if (conn != null) + conn.rollback(); + } catch (SQLException e1) { } + } + finally + { + DB.close(rs, pstmt); + pstmt = null; + rs = null; + if (conn != null) + { + try { + conn.close(); + } catch (SQLException e) {} + conn = null; + } + } + Thread.yield(); // give it time + } + + + //s_log.finest (retValue + " - Table=" + TableName + " [" + trx + "]"); + return retValue; + } // getNextID + + /** + * Get Next ID + * @param conn connection + * @param AD_Sequence_ID sequence + * @param adempiereSys sys + * @return next id or -1 (error) or -3 (parameter) + */ + private static int nextID (Connection conn, int AD_Sequence_ID, boolean adempiereSys) + { + if (conn == null || AD_Sequence_ID == 0) + return -3; + // + int retValue = -1; + String sqlUpdate = "{call nextID(?,?,?)}"; + CallableStatement cstmt = null; + try + { + cstmt = conn.prepareCall (sqlUpdate, + ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); + cstmt.setInt(1, AD_Sequence_ID); + cstmt.setString(2, adempiereSys ? "Y" : "N"); + cstmt.registerOutParameter(3, Types.INTEGER); + cstmt.execute(); + retValue = cstmt.getInt(3); + } + catch (Exception e) + { + s_log.log(Level.SEVERE, e.toString()); + } + finally + { + DB.close(cstmt); + } + return retValue; + } // nextID + + /** + * Get next id by year + * @param conn + * @param AD_Sequence_ID + * @param incrementNo + * @param calendarYear + * @return next id + */ + private static int nextIDByYear(Connection conn, int AD_Sequence_ID, + int incrementNo, String calendarYear) { + if (conn == null || AD_Sequence_ID == 0) + return -3; + // + int retValue = -1; + String sqlUpdate = "{call nextIDByYear(?,?,?,?)}"; + CallableStatement cstmt = null; + try { + cstmt = conn.prepareCall(sqlUpdate, ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); + + cstmt.setInt(1, AD_Sequence_ID); + cstmt.setInt(2, incrementNo); + cstmt.setString(3, calendarYear); + cstmt.registerOutParameter(4, Types.INTEGER); + cstmt.execute(); + retValue = cstmt.getInt(4); + } catch (Exception e) { + s_log.log(Level.SEVERE, e.toString()); + } finally { + DB.close(cstmt); + } + return retValue; + } // nextID + + /************************************************************************** + * Get Document No from table + * @param AD_Client_ID client + * @param TableName table name + * @param trxName optional Transaction Name + * @return document no or null + */ + public static synchronized String getDocumentNo (int AD_Client_ID, String TableName, String trxName) + { + return getDocumentNo(AD_Client_ID, TableName, trxName, null); + + } + /************************************************************************** + * Get Document No from table + * @param AD_Client_ID client + * @param TableName table name + * @param trxName optional Transaction Name + * @param PO + * @return document no or null + */ + public static synchronized String getDocumentNo (int AD_Client_ID, String TableName, String trxName, PO po) + { + if (TableName == null || TableName.length() == 0) + throw new IllegalArgumentException("TableName missing"); + + //get from server + if (DB.isRemoteObjects()) + { + Server server = CConnection.get().getServer(); + try + { + if (server != null) + { // See ServerBean + String dn = server.getDocumentNo (AD_Client_ID, TableName, trxName, po); + s_log.finest("Server => " + dn); + if (dn != null) + return dn; + } + s_log.log(Level.SEVERE, "AppsServer not found - " + TableName); + } + catch (RemoteException ex) + { + s_log.log(Level.SEVERE, "AppsServer error", ex); + } + } + + //local + // Check AdempiereSys + boolean adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS); + if (adempiereSys && AD_Client_ID > 11) + adempiereSys = false; + // + if (CLogMgt.isLevel(LOGLEVEL)) + s_log.log(LOGLEVEL, TableName + " - AdempiereSys=" + adempiereSys + " [" + trxName + "]"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + boolean isStartNewYear = false; + String dateColumn = null; + + if (!adempiereSys) + { + // Get the Start New Year flag + String startNewYearSQL = "SELECT StartNewYear, DateColumn FROM AD_Sequence " + + "WHERE Name = ? AND IsActive = 'Y' AND IsTableID = 'N' AND IsAutoSequence='Y' AND AD_Client_ID = ?"; + try + { + pstmt = DB.prepareStatement(startNewYearSQL, trxName); + pstmt.setString(1, PREFIX_DOCSEQ + TableName); + pstmt.setInt(2, AD_Client_ID); + rs = pstmt.executeQuery(); + if (rs.next()) { + isStartNewYear = "Y".equals(rs.getString(1)); + dateColumn = rs.getString(2); + } + } + catch (Exception e) + { + s_log.log(Level.SEVERE, "(Table) [" + trxName + "]", e); + } + finally + { + DB.close(rs, pstmt); + } + } + + + String selectSQL = null; + if (DB.isOracle() == false || DB.isRemoteObjects()) + { + if (isStartNewYear) { + selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.DecimalPattern, s.AD_Sequence_ID " + + "FROM AD_Sequence_No y, AD_Sequence s " + + "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID " + + "AND s.Name = ? " + + "AND s.AD_Client_ID = ? " + + "AND y.CalendarYear = ? " + + "AND s.IsActive='Y' AND s.IsTableID='N' AND s.IsAutoSequence='Y' " + + "ORDER BY s.AD_Client_ID DESC " + + "FOR UPDATE OF AD_Sequence_No"; + } else { + selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, DecimalPattern, AD_Sequence_ID " + + "FROM AD_Sequence " + + "WHERE Name = ? " + + "AND AD_Client_ID = ? " + + "AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' " + + "ORDER BY AD_Client_ID DESC " + + "FOR UPDATE OF AD_Sequence"; + } + USE_PROCEDURE=false; + } + else + { + if (isStartNewYear) { + selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, Prefix, Suffix, DecimalPattern, s.AD_Sequence_ID " + + "FROM AD_Sequence_No y, AD_Sequence s " + + "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID " + + "AND s.Name = ? " + + "AND s.AD_Client_ID = ? " + + "AND y.CalendarYear = ? " + + "AND s.IsActive='Y' AND s.IsTableID='N' AND s.IsAutoSequence='Y' " + + "ORDER BY s.AD_Client_ID DESC"; + } else { + selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, DecimalPattern, AD_Sequence_ID " + + "FROM AD_Sequence " + + "WHERE Name = ? " + + "AND AD_Client_ID = ? " + + "AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' " + + "ORDER BY AD_Client_ID DESC"; + } + USE_PROCEDURE = true; + } + Connection conn = null; + Trx trx = trxName == null ? null : Trx.get(trxName, true); + // + int AD_Sequence_ID = 0; + int incrementNo = 0; + int next = -1; + String prefix = ""; + String suffix = ""; + String decimalPattern = ""; + String calendarYear = ""; + try + { + if (trx != null) + conn = trx.getConnection(); + else + conn = DB.getConnectionID(); + // Error + if (conn == null) + return null; + + if (isStartNewYear) + { + if (po != null && dateColumn != null && dateColumn.length() > 0) + { + Date docDate = (Date)po.get_Value(dateColumn); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); + calendarYear = sdf.format(docDate); + } + else + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); + calendarYear = sdf.format(new Date()); + } + } + + // + pstmt = conn.prepareStatement(selectSQL, + ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); + pstmt.setString(1, PREFIX_DOCSEQ + TableName); + pstmt.setInt(2, AD_Client_ID); + if (isStartNewYear) + pstmt.setString(3, calendarYear); + + // + rs = pstmt.executeQuery(); + // s_log.fine("AC=" + conn.getAutoCommit() + " -Iso=" + conn.getTransactionIsolation() + // + " - Type=" + pstmt.getResultSetType() + " - Concur=" + pstmt.getResultSetConcurrency()); + if (rs.next()) + { + AD_Sequence_ID = rs.getInt(7); + prefix = rs.getString(4); + suffix = rs.getString(5); + decimalPattern = rs.getString(6); + incrementNo = rs.getInt(3); + if (USE_PROCEDURE) + { + next = isStartNewYear + ? nextIDByYear(conn, AD_Sequence_ID, incrementNo, calendarYear) + : nextID(conn, AD_Sequence_ID, adempiereSys); + } + else + { + PreparedStatement updateSQL = null; + try + { + if (adempiereSys) { + updateSQL = conn + .prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"); + next = rs.getInt(2); + } else { + String sql = isStartNewYear + ? "UPDATE AD_Sequence_No SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ? AND CalendarYear = ?" + : "UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ?"; + updateSQL = conn + .prepareStatement(sql); + next = rs.getInt(1); + } + updateSQL.setInt(1, incrementNo); + updateSQL.setInt(2, AD_Sequence_ID); + if (isStartNewYear) + updateSQL.setString(3, calendarYear); + updateSQL.executeUpdate(); + } + finally + { + DB.close(updateSQL); + } + } + } + else + { + s_log.warning ("(Table) - no record found - " + TableName); + MSequence seq = new MSequence (Env.getCtx(), AD_Client_ID, TableName, null); + next = seq.getNextID(); + seq.save(); + } + // Commit + if (trx == null) + { + conn.commit(); + } + } + catch (Exception e) + { + s_log.log(Level.SEVERE, "(Table) [" + trxName + "]", e); + next = -2; + } + finally + { + //Finish + DB.close(rs, pstmt); + try + { + if (trx == null && conn != null) { + conn.close(); + conn = null; + } + } + catch (Exception e) + { + s_log.log(Level.SEVERE, "(Table) - finish", e); + } + } + + // Error + if (next < 0) + return null; + + // create DocumentNo + StringBuffer doc = new StringBuffer(); + if (prefix != null && prefix.length() > 0) + doc.append(Env.parseVariable(prefix, po, trxName, false)); + if (decimalPattern != null && decimalPattern.length() > 0) + doc.append(new DecimalFormat(decimalPattern).format(next)); + else + doc.append(next); + if (suffix != null && suffix.length() > 0) + doc.append(Env.parseVariable(suffix, po, trxName, false)); + String documentNo = doc.toString(); + s_log.finer (documentNo + " (" + incrementNo + ")" + + " - Table=" + TableName + " [" + trx + "]"); + return documentNo; + } // getDocumentNo + + /** + * Get Document No based on Document Type + * @param C_DocType_ID document type + * @param trxName optional Transaction Name + * @return document no or null + * @deprecated + */ + public static String getDocumentNo(int C_DocType_ID, String trxName) + { + return getDocumentNo (C_DocType_ID, trxName, false); + } // getDocumentNo + + /** + * Get Document No based on Document Type + * @param C_DocType_ID document type + * @param trxName optional Transaction Name + * @param definite asking for a definitive or temporary sequence + * @return document no or null + */ + public static String getDocumentNo (int C_DocType_ID, String trxName, boolean definite) + { + return getDocumentNo(C_DocType_ID, trxName, definite, null); + } + + /** + * Get Document No based on Document Type + * @param C_DocType_ID document type + * @param trxName optional Transaction Name + * @param definite asking for a definitive or temporary sequence + * @param po + * @return document no or null + */ + public static String getDocumentNo (int C_DocType_ID, String trxName, boolean definite, PO po) + { + if (C_DocType_ID == 0) + { + s_log.severe ("C_DocType_ID=0"); + return null; + } + + //get from server + + if (DB.isRemoteObjects()) + { + Server server = CConnection.get().getServer(); + try + { + if (server != null) + { // See ServerBean + String dn = server.getDocumentNo (C_DocType_ID, trxName, definite, po); + s_log.finest("Server => " + dn); + if (dn != null) + return dn; + } + s_log.log(Level.SEVERE, "AppsServer not found - " + C_DocType_ID); + } + catch (RemoteException ex) + { + s_log.log(Level.SEVERE, "AppsServer error", ex); + } + } + + //local + MDocType dt = MDocType.get (Env.getCtx(), C_DocType_ID); // wrong for SERVER, but r/o + if (dt != null && !dt.isDocNoControlled()) + { + s_log.finer("DocType_ID=" + C_DocType_ID + " Not DocNo controlled"); + return null; + } + if (definite && ! dt.isOverwriteSeqOnComplete()) { + s_log.finer("DocType_ID=" + C_DocType_ID + " Not Sequence Overwrite on Complete"); + return null; + } + if (dt == null || dt.getDocNoSequence_ID() == 0) + { + s_log.warning ("No Sequence for DocType - " + dt); + return null; + } + if (definite && dt.getDefiniteSequence_ID() == 0) + { + s_log.warning ("No Definite Sequence for DocType - " + dt); + return null; + } + + // Check AdempiereSys + boolean adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS); + if (CLogMgt.isLevel(LOGLEVEL)) + s_log.log(LOGLEVEL, "DocType_ID=" + C_DocType_ID + " [" + trxName + "]"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + boolean isStartNewYear = false; + String dateColumn = null; + + if (!adempiereSys) + { + // Get the Start New Year & Sequence Type + String startNewYearSQL = "SELECT StartNewYear, DateColumn FROM AD_Sequence " + + "WHERE AD_Sequence_ID = ? AND IsActive = 'Y' AND IsTableID = 'N' AND IsAutoSequence='Y'"; + try { + pstmt = DB.prepareStatement(startNewYearSQL, trxName); + pstmt.setInt(1, definite ? dt.getDefiniteSequence_ID() : dt + .getDocNoSequence_ID()); + rs = pstmt.executeQuery(); + if (rs.next()) { + isStartNewYear = "Y".equals(rs.getString(1)); + dateColumn = rs.getString(2); + } + } catch (Exception e) { + s_log.log(Level.SEVERE, "(Table) [" + trxName + "]", e); + } + finally + { + DB.close(rs, pstmt); + } + } + + String selectSQL = null; + if (DB.isOracle() == false) + { + if (isStartNewYear) + { + selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.DecimalPattern, s.AD_Client_ID, s.AD_Sequence_ID " + + "FROM AD_Sequence_No y, AD_Sequence s " + + "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID " + + "AND s.AD_Sequence_ID = ? " + + "AND y.CalendarYear = ? " + + "AND s.IsActive='Y' AND s.IsTableID='N' AND s.IsAutoSequence='Y' " + + "FOR UPDATE OF AD_Sequence_No"; + } + else + { + selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, DecimalPattern, AD_Client_ID, AD_Sequence_ID " + + "FROM AD_Sequence " + + "WHERE AD_Sequence_ID = ? " + + "AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' " + + "FOR UPDATE OF AD_Sequence"; + } + USE_PROCEDURE=false; + } + else + { + if (isStartNewYear) { + selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.DecimalPattern, s.AD_Client_ID, s.AD_Sequence_ID " + + "FROM AD_Sequence_No y, AD_Sequence s " + + "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID " + + "AND s.AD_Sequence_ID = ? " + + "AND y.CalendarYear = ? " + + "AND s.IsActive='Y' AND s.IsTableID='N' AND s.IsAutoSequence='Y' "; + } else { + selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, DecimalPattern, AD_Client_ID, AD_Sequence_ID " + + "FROM AD_Sequence " + + "WHERE AD_Sequence_ID = ? " + + "AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' "; + } + USE_PROCEDURE = true; + } + Connection conn = null; + Trx trx = trxName == null ? null : Trx.get(trxName, true); + // + int AD_Sequence_ID = 0; + int incrementNo = 0; + int next = -1; + String prefix = ""; + String suffix = ""; + String decimalPattern = ""; + String calendarYear = ""; + try + { + if (trx != null) + conn = trx.getConnection(); + else + conn = DB.getConnectionID(); + // Error + if (conn == null) + return null; + + if (isStartNewYear) + { + if (po != null && dateColumn != null && dateColumn.length() > 0) + { + Date docDate = (Date)po.get_Value(dateColumn); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); + calendarYear = sdf.format(docDate); + } + else + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); + calendarYear = sdf.format(new Date()); + } + } + + pstmt = conn.prepareStatement(selectSQL, + ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); + if (definite) + pstmt.setInt(1, dt.getDefiniteSequence_ID()); + else + pstmt.setInt(1, dt.getDocNoSequence_ID()); + if (isStartNewYear) + pstmt.setString(2, calendarYear); + + // + rs = pstmt.executeQuery(); + // s_log.fine("AC=" + conn.getAutoCommit() + " -Iso=" + conn.getTransactionIsolation() + // + " - Type=" + pstmt.getResultSetType() + " - Concur=" + pstmt.getResultSetConcurrency()); + if (rs.next()) + { + incrementNo = rs.getInt(3); + prefix = rs.getString(4); + suffix = rs.getString(5); + decimalPattern = rs.getString(6); + int AD_Client_ID = rs.getInt(7); + if (adempiereSys && AD_Client_ID > 11) + adempiereSys = false; + AD_Sequence_ID = rs.getInt(8); + + if (USE_PROCEDURE) + { + next = isStartNewYear + ? nextIDByYear(conn, AD_Sequence_ID, incrementNo, calendarYear) + : nextID(conn, AD_Sequence_ID, adempiereSys); + } + else + { + PreparedStatement updateSQL = null; + try + { + if (adempiereSys) { + updateSQL = conn + .prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"); + next = rs.getInt(2); + } else { + String sql = isStartNewYear + ? "UPDATE AD_Sequence_No SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ? AND CalendarYear = ?" + : "UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ?"; + updateSQL = conn.prepareStatement(sql); + next = rs.getInt(1); + } + updateSQL.setInt(1, incrementNo); + updateSQL.setInt(2, AD_Sequence_ID); + if (isStartNewYear) + updateSQL.setString(3, calendarYear); + updateSQL.executeUpdate(); + } + finally + { + DB.close(updateSQL); + } + } + } + else + { + s_log.warning ("(DocType)- no record found - " + dt); + next = -2; + } + // Commit + if (trx == null) + { + conn.commit(); + } + } + catch (Exception e) + { + s_log.log(Level.SEVERE, "(DocType) [" + trxName + "]", e); + next = -2; + } + finally + { + // Finish + try + { + DB.close(rs, pstmt); + if (trx == null && conn != null) { + conn.close(); + conn = null; + } + } + catch (Exception e) + { + s_log.log(Level.SEVERE, "(DocType) - finish", e); + } + } + // Error + if (next < 0) + return null; + + // create DocumentNo + StringBuffer doc = new StringBuffer(); + if (prefix != null && prefix.length() > 0) + doc.append(Env.parseVariable(prefix, po, trxName, false)); + if (decimalPattern != null && decimalPattern.length() > 0) + doc.append(new DecimalFormat(decimalPattern).format(next)); + else + doc.append(next); + if (suffix != null && suffix.length() > 0) + doc.append(Env.parseVariable(suffix, po, trxName, false)); + String documentNo = doc.toString(); + s_log.finer (documentNo + " (" + incrementNo + ")" + + " - C_DocType_ID=" + C_DocType_ID + " [" + trx + "]"); + return documentNo; + } // getDocumentNo + + + /************************************************************************** + * Check/Initialize Client DocumentNo/Value Sequences + * @param ctx context + * @param AD_Client_ID client + * @param trxName transaction + * @return true if no error + */ + public static boolean checkClientSequences (Properties ctx, int AD_Client_ID, String trxName) + { + String sql = "SELECT TableName " + + "FROM AD_Table t " + + "WHERE IsActive='Y' AND IsView='N'" + // Get all Tables with DocumentNo or Value + + " AND AD_Table_ID IN " + + "(SELECT AD_Table_ID FROM AD_Column " + + "WHERE ColumnName = 'DocumentNo' OR ColumnName = 'Value')" + // Ability to run multiple times + + " AND 'DocumentNo_' || TableName NOT IN " + + "(SELECT Name FROM AD_Sequence s " + + "WHERE s.AD_Client_ID=?)"; + int counter = 0; + boolean success = true; + // + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, trxName); + pstmt.setInt(1, AD_Client_ID); + rs = pstmt.executeQuery(); + while (rs.next()) + { + String tableName = rs.getString(1); + s_log.fine("Add: " + tableName); + MSequence seq = new MSequence (ctx, AD_Client_ID, tableName, trxName); + if (seq.save()) + counter++; + else + { + s_log.severe ("Not created - AD_Client_ID=" + AD_Client_ID + + " - " + tableName); + success = false; + } + } + } + catch (Exception e) + { + s_log.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + s_log.info ("AD_Client_ID=" + AD_Client_ID + + " - created #" + counter + + " - success=" + success); + return success; + } // checkClientSequences + + + /** + * Create Table ID Sequence + * @param ctx context + * @param TableName table name + * @param trxName transaction + * @return true if created + */ + public static boolean createTableSequence (Properties ctx, String TableName, String trxName) + { + MSequence seq = new MSequence (ctx, 0, trxName); + seq.setClientOrg(0, 0); + seq.setName(TableName); + seq.setDescription("Table " + TableName); + seq.setIsTableID(true); + return seq.save(); + } // createTableSequence + + + /** + * Get Sequence + * @param ctx context + * @param tableName table name + * @return Sequence + */ + public static MSequence get (Properties ctx, String tableName) + { + return get(ctx, tableName, null); + } + + /** + * Get Sequence + * @param ctx context + * @param tableName table name + * @param trxName optional transaction name + * @return Sequence + */ + public static MSequence get (Properties ctx, String tableName, String trxName) + { + String sql = "SELECT * FROM AD_Sequence " + + "WHERE UPPER(Name)=?" + + " AND IsTableID='Y'"; + MSequence retValue = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement (sql, trxName); + pstmt.setString (1, tableName.toUpperCase()); + rs = pstmt.executeQuery (); + if (rs.next ()) + retValue = new MSequence (ctx, rs, trxName); + if (rs.next()) + s_log.log(Level.SEVERE, "More then one sequence for " + tableName); + } + catch (Exception e) + { + s_log.log(Level.SEVERE, "get", e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + return retValue; + } // get + + + /** Sequence for Table Document No's */ + private static final String PREFIX_DOCSEQ = "DocumentNo_"; + /** Start Number */ + public static final int INIT_NO = 1000000; // 1 Mio + /** Start System Number */ + // public static final int INIT_SYS_NO = 100; // start number for Compiere + public static final int INIT_SYS_NO = 50000; // start number for Adempiere + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger(MSequence.class); + + + /************************************************************************** + * Standard Constructor + * @param ctx context + * @param AD_Sequence_ID id + * @param trxName transaction + */ + public MSequence (Properties ctx, int AD_Sequence_ID, String trxName) + { + super(ctx, AD_Sequence_ID, trxName); + if (AD_Sequence_ID == 0) + { + // setName (null); + // + setIsTableID(false); + setStartNo (INIT_NO); + setCurrentNext (INIT_NO); + setCurrentNextSys (INIT_SYS_NO); + setIncrementNo (1); + setIsAutoSequence (true); + setIsAudited(false); + setStartNewYear(false); + } + } // MSequence + + /** + * Load Constructor + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MSequence (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MSequence + + /** + * New Document Sequence Constructor + * @param ctx context + * @param AD_Client_ID owner + * @param tableName name + * @param trxName transaction + */ + public MSequence (Properties ctx, int AD_Client_ID, String tableName, String trxName) + { + this (ctx, 0, trxName); + setClientOrg(AD_Client_ID, 0); // Client Ownership + setName(PREFIX_DOCSEQ + tableName); + setDescription("DocumentNo/Value for Table " + tableName); + } // MSequence; + + /** + * New Document Sequence Constructor + * @param ctx context + * @param AD_Client_ID owner + * @param sequenceName name + * @param StartNo start + * @param trxName trx + */ + public MSequence (Properties ctx, int AD_Client_ID, String sequenceName, int StartNo, String trxName) + { + this (ctx, 0, trxName); + setClientOrg(AD_Client_ID, 0); // Client Ownership + setName(sequenceName); + setDescription(sequenceName); + setStartNo(StartNo); + setCurrentNext(StartNo); + setCurrentNextSys(StartNo/10); + } // MSequence; + + + /************************************************************************** + * Get Next No and increase current next + * @return next no to use + */ + public int getNextID() + { + int retValue = getCurrentNext(); + setCurrentNext(retValue + getIncrementNo()); + return retValue; + } // getNextNo + + /** + * Validate Table Sequence Values + * @return true if updated + */ + public boolean validateTableIDValue() + { + if (!isTableID()) + return false; + String tableName = getName(); + int AD_Column_ID = DB.getSQLValue(null, "SELECT MAX(c.AD_Column_ID) " + + "FROM AD_Table t" + + " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) " + + "WHERE t.TableName='" + tableName + "'" + + " AND c.ColumnName='" + tableName + "_ID'"); + if (AD_Column_ID <= 0) + return false; + // + MSystem system = MSystem.get(getCtx()); + int IDRangeEnd = 0; + if (system.getIDRangeEnd() != null) + IDRangeEnd = system.getIDRangeEnd().intValue(); + boolean change = false; + String info = null; + + // Current Next + String sql = "SELECT MAX(" + tableName + "_ID) FROM " + tableName; + if (IDRangeEnd > 0) + sql += " WHERE " + tableName + "_ID < " + IDRangeEnd; + int maxTableID = DB.getSQLValue(null, sql); + if (maxTableID < INIT_NO) + maxTableID = INIT_NO - 1; + maxTableID++; // Next + if (getCurrentNext() < maxTableID) + { + setCurrentNext(maxTableID); + info = "CurrentNext=" + maxTableID; + change = true; + } + + // Get Max System_ID used in Table + sql = "SELECT MAX(" + tableName + "_ID) FROM " + tableName + + " WHERE " + tableName + "_ID < " + INIT_NO; + int maxTableSysID = DB.getSQLValue(null, sql); + if (maxTableSysID <= 0) + maxTableSysID = INIT_SYS_NO - 1; + maxTableSysID++; // Next + if (getCurrentNextSys() < maxTableSysID) + { + setCurrentNextSys(maxTableSysID); + if (info == null) + info = "CurrentNextSys=" + maxTableSysID; + else + info += " - CurrentNextSys=" + maxTableSysID; + change = true; + } + if (info != null) + log.fine(getName() + " - " + info); + return change; + } // validate + + + /************************************************************************** + * Test + * @param args ignored + */ + static public void main (String[] args) + { + // int id = getNextID_HTTP("AD_Column"); + // if (true) return; + + org.compiere.Adempiere.startup(true); + CLogMgt.setLevel(Level.SEVERE); + CLogMgt.setLoggerLevel(Level.SEVERE, null); + s_list = new Vector(1000); + + /** Lock Test **/ + String trxName = "test"; + System.out.println(DB.getDocumentNo(115, trxName)); + System.out.println(DB.getDocumentNo(116, trxName)); + System.out.println(DB.getDocumentNo(117, trxName)); + System.out.println(DB.getDocumentNo(118, trxName)); + System.out.println(DB.getDocumentNo(118, trxName)); + System.out.println(DB.getDocumentNo(117, trxName)); + + trxName = "test1"; + System.out.println(DB.getDocumentNo(115, trxName)); // hangs here as supposed + System.out.println(DB.getDocumentNo(116, trxName)); + System.out.println(DB.getDocumentNo(117, trxName)); + System.out.println(DB.getDocumentNo(118, trxName)); + + + + + + /** **/ + + /** Time Test */ + long time = System.currentTimeMillis(); + Thread[] threads = new Thread[10]; + for (int i = 0; i < 10; i++) + { + Runnable r = new GetIDs(i); + threads[i] = new Thread(r); + threads[i].start(); + } + for (int i = 0; i < 10; i++) + { + try + { + threads[i].join(); + } + catch (InterruptedException e) + { + } + } + time = System.currentTimeMillis() - time; + + System.out.println("-------------------------------------------"); + System.out.println("Size=" + s_list.size() + " (should be 1000)"); + Integer[] ia = new Integer[s_list.size()]; + s_list.toArray(ia); + Arrays.sort(ia); + Integer last = null; + int duplicates = 0; + for (int i = 0; i < ia.length; i++) + { + if (last != null) + { + if (last.compareTo(ia[i]) == 0) + { + // System.out.println(i + ": " + ia[i]); + duplicates++; + } + } + last = ia[i]; + } + System.out.println("-------------------------------------------"); + System.out.println("Size=" + s_list.size() + " (should be 1000)"); + System.out.println("Duplicates=" + duplicates); + System.out.println("Time (ms)=" + time + " - " + ((float)time/s_list.size()) + " each" ); + System.out.println("-------------------------------------------"); + + + + /** ** + try + { + int retValue = -1; + Connection conn = DB.getConnectionRW (); + // DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()); + // Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@//dev2:1521/dev2", "adempiere", "adempiere"); + + conn.setAutoCommit(false); + String sql = "SELECT CurrentNext, CurrentNextSys, IncrementNo " + + "FROM AD_Sequence " + + "WHERE Name='AD_Sequence' "; + sql += "FOR UPDATE"; + // creates ORA-00907: missing right parenthesis + // sql += "FOR UPDATE OF CurrentNext, CurrentNextSys"; + + + PreparedStatement pstmt = conn.prepareStatement(sql, + ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = pstmt.executeQuery(); + System.out.println("AC=" + conn.getAutoCommit() + ", RO=" + conn.isReadOnly() + + " - Isolation=" + conn.getTransactionIsolation() + "(" + Connection.TRANSACTION_READ_COMMITTED + + ") - RSType=" + pstmt.getResultSetType() + "(" + ResultSet.TYPE_SCROLL_SENSITIVE + + "), RSConcur=" + pstmt.getResultSetConcurrency() + "(" + ResultSet.CONCUR_UPDATABLE + + ")"); + + if (rs.next()) + { + int IncrementNo = rs.getInt(3); + retValue = rs.getInt(1); + rs.updateInt(1, retValue + IncrementNo); + rs.updateRow(); + } + else + s_log.severe ("no record found"); + rs.close(); + pstmt.close(); + conn.commit(); + conn.close(); + // + System.out.println("Next=" + retValue); + + } + catch (Exception e) + { + e.printStackTrace (); + } + + System.exit(0); + + /** ** + + int AD_Client_ID = 0; + int C_DocType_ID = 115; // GL + String TableName = "C_Invoice"; + String trxName = "x"; + Trx trx = Trx.get(trxName, true); + + System.out.println ("none " + getNextID (0, "Test")); + System.out.println ("----------------------------------------------"); + System.out.println ("trx1 " + getNextID (0, "Test")); + System.out.println ("trx2 " + getNextID (0, "Test")); + // trx.rollback(); + System.out.println ("trx3 " + getNextID (0, "Test")); + // trx.commit(); + System.out.println ("trx4 " + getNextID (0, "Test")); + // trx.rollback(); + // trx.close(); + System.out.println ("----------------------------------------------"); + System.out.println ("none " + getNextID (0, "Test")); + System.out.println ("=============================================="); + + + trx = Trx.get(trxName, true); + System.out.println ("none " + getDocumentNo(AD_Client_ID, TableName, null)); + System.out.println ("----------------------------------------------"); + System.out.println ("trx1 " + getDocumentNo(AD_Client_ID, TableName, trxName)); + System.out.println ("trx2 " + getDocumentNo(AD_Client_ID, TableName, trxName)); + trx.rollback(); + System.out.println ("trx3 " + getDocumentNo(AD_Client_ID, TableName, trxName)); + trx.commit(); + System.out.println ("trx4 " + getDocumentNo(AD_Client_ID, TableName, trxName)); + trx.rollback(); + trx.close(); + System.out.println ("----------------------------------------------"); + System.out.println ("none " + getDocumentNo(AD_Client_ID, TableName, null)); + System.out.println ("=============================================="); + + + trx = Trx.get(trxName, true); + System.out.println ("none " + getDocumentNo(C_DocType_ID, null)); + System.out.println ("----------------------------------------------"); + System.out.println ("trx1 " + getDocumentNo(C_DocType_ID, trxName)); + System.out.println ("trx2 " + getDocumentNo(C_DocType_ID, trxName)); + trx.rollback(); + System.out.println ("trx3 " + getDocumentNo(C_DocType_ID, trxName)); + trx.commit(); + System.out.println ("trx4 " + getDocumentNo(C_DocType_ID, trxName)); + trx.rollback(); + trx.close(); + System.out.println ("----------------------------------------------"); + System.out.println ("none " + getDocumentNo(C_DocType_ID, null)); + System.out.println ("=============================================="); + /** **/ + } // main + + /** Test */ + private static Vector s_list = null; + + /** + * Test Sequence - Get IDs + * + * @author Jorg Janke + * @version $Id: MSequence.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $ + */ + public static class GetIDs implements Runnable + { + /** + * Get IDs + * @param i + */ + public GetIDs (int i) + { + m_i = i; + } + private int m_i; + + /** + * Run + */ + public void run() + { + for (int i = 0; i < 100; i++) + { + try + { + int no = DB.getNextID(0, "Test", null); + s_list.add(new Integer(no)); + // System.out.println("#" + m_i + ": " + no); + } + catch (Exception e) + { + System.err.println(e.getMessage()); + } + } + } + } // GetIDs + + /** + * Get next number for Key column + * @param AD_Client_ID client + * @param TableName table name + * @param trxName optional Transaction Name + * @return next no or (-1=error) + */ + public static synchronized int getNextOfficialID_HTTP (String TableName) + { + String website = MSysConfig.getValue("DICTIONARY_ID_WEBSITE"); // "http://developer.adempiere.com/cgi-bin/get_ID"; + String prm_USER = MSysConfig.getValue("DICTIONARY_ID_USER"); // "globalqss"; + String prm_PASSWORD = MSysConfig.getValue("DICTIONARY_ID_PASSWORD"); // "password_inseguro"; + String prm_TABLE = TableName; + String prm_ALTKEY = ""; // TODO: generate alt-key based on key of table + String prm_COMMENT = MSysConfig.getValue("DICTIONARY_ID_COMMENTS"); + String prm_PROJECT = new String("Adempiere"); + + return getNextID_HTTP(TableName, website, prm_USER, + prm_PASSWORD, prm_TABLE, prm_ALTKEY, prm_COMMENT, prm_PROJECT); + } + + /** + * Get next number for Key column + * @param AD_Client_ID client + * @param TableName table name + * @param trxName optional Transaction Name + * @return next no or (-1=error) + */ + public static synchronized int getNextProjectID_HTTP (String TableName) + { + String website = MSysConfig.getValue("PROJECT_ID_WEBSITE"); // "http://developer.adempiere.com/cgi-bin/get_ID"; + String prm_USER = MSysConfig.getValue("PROJECT_ID_USER"); // "globalqss"; + String prm_PASSWORD = MSysConfig.getValue("PROJECT_ID_PASSWORD"); // "password_inseguro"; + String prm_TABLE = TableName; + String prm_ALTKEY = ""; // TODO: generate alt-key based on key of table + String prm_COMMENT = MSysConfig.getValue("PROJECT_ID_COMMENTS"); + String prm_PROJECT = MSysConfig.getValue("PROJECT_ID_PROJECT"); + + return getNextID_HTTP(TableName, website, prm_USER, + prm_PASSWORD, prm_TABLE, prm_ALTKEY, prm_COMMENT, prm_PROJECT); + } + + private static int getNextID_HTTP(String TableName, + String website, String prm_USER, String prm_PASSWORD, + String prm_TABLE, String prm_ALTKEY, String prm_COMMENT, + String prm_PROJECT) { + StringBuffer read = new StringBuffer(""); + int retValue = -1; + try { + String completeUrl = website + "?" + "USER=" + + URLEncoder.encode(prm_USER, "UTF-8") + "&PASSWORD=" + + URLEncoder.encode(prm_PASSWORD, "UTF-8") + "&PROJECT=" + + URLEncoder.encode(prm_PROJECT, "UTF-8") + "&TABLE=" + + URLEncoder.encode(prm_TABLE, "UTF-8") + "&ALTKEY=" + + URLEncoder.encode(prm_ALTKEY, "UTF-8") + "&COMMENT=" + + URLEncoder.encode(prm_COMMENT, "UTF-8"); + + // Now use the URL class to parse the user-specified URL into + // its various parts: protocol, host, port, filename. Check the protocol + URL url = new URL(completeUrl); + String protocol = url.getProtocol(); + if (!protocol.equals("http")) + throw new IllegalArgumentException("URL must use 'http:' protocol"); + String host = url.getHost(); + int port = url.getPort(); + if (port == -1) port = 80; // if no port, use the default HTTP port + String filename = url.getFile(); + // Open a network socket connection to the specified host and port + Socket socket = new Socket(host, port); + // Get input and output streams for the socket + InputStream from_server = socket.getInputStream(); + PrintWriter to_server = + new PrintWriter(new OutputStreamWriter(socket.getOutputStream())); + + // Send the HTTP GET command to the Web server, specifying the file. + // This uses an old and very simple version of the HTTP protocol + to_server.println("GET " + filename); + to_server.flush(); // Send it right now! + + // Now read the server's response, and write it to the file + byte[] buffer = new byte[4096]; + int bytes_read; + while((bytes_read = from_server.read(buffer)) != -1) { + for (int i = 0; i < bytes_read; i++) { + if (buffer[i] != 10) + read.append((char) buffer[i]); + } + } + + // When the server closes the connection, we close our stuff + socket.close(); + retValue = Integer.parseInt(read.toString()); + if (retValue <= 0) + retValue = -1; + } + catch (Exception e) { // Report any errors that arise + System.err.println(e); + retValue = -1; + } + s_log.log(Level.INFO, "getNextID_HTTP - " + TableName + "=" + read + "(" + retValue + ")"); + + return retValue; + } + + private static boolean isExceptionCentralized(String tableName) { + String [] exceptionTables = new String[] { + "AD_ACCESSLOG", + "AD_ALERTPROCESSORLOG", + "AD_CHANGELOG", + "AD_ISSUE", + "AD_LDAPPROCESSORLOG", + "AD_PACKAGE_IMP", + "AD_PACKAGE_IMP_BACKUP", + "AD_PACKAGE_IMP_DETAIL", + "AD_PACKAGE_IMP_INST", + "AD_PACKAGE_IMP_PROC", + "AD_PINSTANCE", + "AD_PINSTANCE_LOG", + "AD_PINSTANCE_PARA", + "AD_REPLICATION_LOG", + "AD_SCHEDULERLOG", + "AD_SESSION", + "AD_WORKFLOWPROCESSORLOG", + "CM_WEBACCESSLOG", + "C_ACCTPROCESSORLOG", + "K_INDEXLOG", + "R_REQUESTPROCESSORLOG", + "T_AGING", + "T_ALTER_COLUMN", + "T_DISTRIBUTIONRUNDETAIL", + "T_INVENTORYVALUE", + "T_INVOICEGL", + "T_REPLENISH", + "T_REPORT", + "T_REPORTSTATEMENT", + "T_SELECTION", + "T_SELECTION2", + "T_SPOOL", + "T_TRANSACTION", + "T_TRIALBALANCE" + }; + for (int i = 0; i < exceptionTables.length; i++) { + if (tableName.equalsIgnoreCase(exceptionTables[i])) + return true; + } + + // don't log selects or insert/update for exception tables (i.e. AD_Issue, AD_ChangeLog) + return false; + } + + /** + * Get preliminary document no by year + * @param tab + * @param AD_Sequence_ID + * @param dateColumn + * @return Preliminary document no + */ + public static String getPreliminaryNoByYear(GridTab tab, int AD_Sequence_ID, String dateColumn, String trxName) { + Date d = (Date)tab.getValue(dateColumn); + if (d == null) + d = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); + String calendarYear = sdf.format(d); + String sql = "select CurrentNext From AD_Sequence_No Where AD_Sequence_ID = ? and CalendarYear = ?"; + + return DB.getSQLValueString(trxName, sql, AD_Sequence_ID, calendarYear); + } + +} // MSequence \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/MWarehouse.java b/posterita/posterita/src/main/org/compiere/model/MWarehouse.java new file mode 100644 index 0000000000..fbbfb4079c --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/MWarehouse.java @@ -0,0 +1,247 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.sql.*; +import java.util.*; +import java.util.logging.*; +import org.compiere.util.*; + +/** + * Warehouse Model + * + * @author Jorg Janke + * @version $Id: MWarehouse.java,v 1.3 2006/07/30 00:58:05 jjanke Exp $ + */ +public class MWarehouse extends X_M_Warehouse +{ + /** + * Get from Cache + * @param ctx context + * @param M_Warehouse_ID id + * @return warehouse + */ + public static MWarehouse get (Properties ctx, int M_Warehouse_ID) + { + return get(ctx, M_Warehouse_ID, null); + } // get + + /** + * Retrieves warehouse from cache under transaction scope + * @param ctx context + * @param M_Warehouse_ID id of warehouse to load + * @param trxName transaction name + * @return warehouse + */ + public static MWarehouse get (Properties ctx, int M_Warehouse_ID, String trxName) + { + Integer key = new Integer(M_Warehouse_ID); + MWarehouse retValue = (MWarehouse)s_cache.get(key); + if (retValue != null) + return retValue; + // + retValue = new MWarehouse (ctx, M_Warehouse_ID, trxName); + s_cache.put (key, retValue); + return retValue; + } + /** + * Get Warehouses for Org + * @param ctx context + * @param AD_Org_ID id + * @return warehouse + */ + public static MWarehouse[] getForOrg (Properties ctx, int AD_Org_ID) + { + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM M_Warehouse WHERE AD_Org_ID=? ORDER BY Created"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, null); + pstmt.setInt (1, AD_Org_ID); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + list.add (new MWarehouse (ctx, rs, null)); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + s_log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + MWarehouse[] retValue = new MWarehouse[list.size ()]; + list.toArray (retValue); + return retValue; + } // get + + + /** Cache */ + private static CCache s_cache = new CCache("M_Warehouse", 5); + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (MWarehouse.class); + + /** + * Standard Constructor + * @param ctx context + * @param M_Warehouse_ID id + * @param trxName transaction + */ + public MWarehouse (Properties ctx, int M_Warehouse_ID, String trxName) + { + super(ctx, M_Warehouse_ID, trxName); + if (M_Warehouse_ID == 0) + { + // setValue (null); + // setName (null); + // setC_Location_ID (0); + setSeparator ("*"); // * + } + } // MWarehouse + + /** + * Load Constructor + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MWarehouse (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MWarehouse + + /** + * Organization Constructor + * @param org parent + */ + public MWarehouse (MOrg org) + { + this (org.getCtx(), 0, org.get_TrxName()); + setClientOrg(org); + setValue (org.getValue()); + setName (org.getName()); + if (org.getInfo() != null) + setC_Location_ID (org.getInfo().getC_Location_ID()); + } // MWarehouse + + /** Warehouse Locators */ + private MLocator[] m_locators = null; + + /** + * Get Locators + * @param reload if true reload + * @return array of locators + */ + public MLocator[] getLocators(boolean reload) + { + if (!reload && m_locators != null) + return m_locators; + // + String sql = "SELECT * FROM M_Locator WHERE M_Warehouse_ID=? ORDER BY X,Y,Z"; + ArrayList list = new ArrayList(); + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, null); + pstmt.setInt (1, getM_Warehouse_ID()); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + list.add(new MLocator (getCtx(), rs, null)); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + // + m_locators = new MLocator[list.size()]; + list.toArray (m_locators); + return m_locators; + } // getLocators + + /** + * Get Default Locator + * @return (first) default locator + */ + public MLocator getDefaultLocator() + { + MLocator[] locators = getLocators(false); + for (int i = 0; i < locators.length; i++) + { + if (locators[i].isDefault() && locators[i].isActive()) + return locators[i]; + } + // No Default - first one + if (locators.length > 0) + { + log.warning("No default locator for " + getName()); + return locators[0]; + } + // No Locator - create one + MLocator loc = new MLocator (this, "Standard"); + loc.setIsDefault(true); + loc.save(); + log.info("Created default locator for " + getName()); + return loc; + } // getLocators + + /** + * After Save + * @param newRecord new + * @param success success + * @return success + */ + protected boolean afterSave (boolean newRecord, boolean success) + { + if (newRecord && success) + insert_Accounting("M_Warehouse_Acct", "C_AcctSchema_Default", null); + + return success; + } // afterSave + + /** + * Before Delete + * @return true + */ + protected boolean beforeDelete () + { + return delete_Accounting("M_Warehouse_Acct"); + } // beforeDelete + +} // MWarehouse diff --git a/posterita/posterita/src/main/org/compiere/model/X_AD_OrgInfo.java b/posterita/posterita/src/main/org/compiere/model/X_AD_OrgInfo.java new file mode 100644 index 0000000000..d90eaae83f --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_AD_OrgInfo.java @@ -0,0 +1,384 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.sql.ResultSet; +import java.util.Properties; +import java.util.logging.Level; + +/** Generated Model for AD_OrgInfo + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_AD_OrgInfo extends PO implements I_AD_OrgInfo, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_AD_OrgInfo (Properties ctx, int AD_OrgInfo_ID, String trxName) + { + super (ctx, AD_OrgInfo_ID, trxName); + /** if (AD_OrgInfo_ID == 0) + { + setDUNS (null); + setTaxID (null); + } */ + } + + /** Load Constructor */ + public X_AD_OrgInfo (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 7 - System - Client - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_AD_OrgInfo[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + public I_AD_OrgType getAD_OrgType() throws Exception + { + Class clazz = MTable.getClass(I_AD_OrgType.Table_Name); + I_AD_OrgType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_AD_OrgType)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_OrgType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Organization Type. + @param AD_OrgType_ID + Organization Type allows you to categorize your organizations + */ + public void setAD_OrgType_ID (int AD_OrgType_ID) + { + if (AD_OrgType_ID < 1) + set_Value (COLUMNNAME_AD_OrgType_ID, null); + else + set_Value (COLUMNNAME_AD_OrgType_ID, Integer.valueOf(AD_OrgType_ID)); + } + + /** Get Organization Type. + @return Organization Type allows you to categorize your organizations + */ + public int getAD_OrgType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_OrgType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Address. + @param C_Location_ID + Location or Address + */ + public void setC_Location_ID (int C_Location_ID) + { + if (C_Location_ID < 1) + set_Value (COLUMNNAME_C_Location_ID, null); + else + set_Value (COLUMNNAME_C_Location_ID, Integer.valueOf(C_Location_ID)); + } + + /** Get Address. + @return Location or Address + */ + public int getC_Location_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Location_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set D-U-N-S. + @param DUNS + Dun & Bradstreet Number + */ + public void setDUNS (String DUNS) + { + if (DUNS == null) + throw new IllegalArgumentException ("DUNS is mandatory."); + + if (DUNS.length() > 11) + { + log.warning("Length > 11 - truncated"); + DUNS = DUNS.substring(0, 11); + } + set_Value (COLUMNNAME_DUNS, DUNS); + } + + /** Get D-U-N-S. + @return Dun & Bradstreet Number + */ + public String getDUNS () + { + return (String)get_Value(COLUMNNAME_DUNS); + } + + public I_M_Warehouse getM_Warehouse() throws Exception + { + Class clazz = MTable.getClass(I_M_Warehouse.Table_Name); + I_M_Warehouse result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_Warehouse)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_Warehouse_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Warehouse. + @param M_Warehouse_ID + Storage Warehouse and Service Point + */ + public void setM_Warehouse_ID (int M_Warehouse_ID) + { + if (M_Warehouse_ID < 1) + set_Value (COLUMNNAME_M_Warehouse_ID, null); + else + set_Value (COLUMNNAME_M_Warehouse_ID, Integer.valueOf(M_Warehouse_ID)); + } + + /** Get Warehouse. + @return Storage Warehouse and Service Point + */ + public int getM_Warehouse_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Warehouse_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_PA_Goal getPA_Goal() throws Exception + { + Class clazz = MTable.getClass(I_PA_Goal.Table_Name); + I_PA_Goal result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_PA_Goal)constructor.newInstance(new Object[] {getCtx(), new Integer(getPA_Goal_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Goal. + @param PA_Goal_ID + Performance Goal + */ + public void setPA_Goal_ID (int PA_Goal_ID) + { + if (PA_Goal_ID < 1) + set_Value (COLUMNNAME_PA_Goal_ID, null); + else + set_Value (COLUMNNAME_PA_Goal_ID, Integer.valueOf(PA_Goal_ID)); + } + + /** Get Goal. + @return Performance Goal + */ + public int getPA_Goal_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_PA_Goal_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Parent_Org_ID AD_Reference_ID=130 */ + public static final int PARENT_ORG_ID_AD_Reference_ID=130; + /** Set Parent Organization. + @param Parent_Org_ID + Parent (superior) Organization + */ + public void setParent_Org_ID (int Parent_Org_ID) + { + if (Parent_Org_ID < 1) + set_Value (COLUMNNAME_Parent_Org_ID, null); + else + set_Value (COLUMNNAME_Parent_Org_ID, Integer.valueOf(Parent_Org_ID)); + } + + /** Get Parent Organization. + @return Parent (superior) Organization + */ + public int getParent_Org_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Parent_Org_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Receipt Footer Msg. + @param ReceiptFooterMsg + This message will be displayed at the bottom of a receipt when doing a sales or purchase + */ + public void setReceiptFooterMsg (String ReceiptFooterMsg) + { + + if (ReceiptFooterMsg != null && ReceiptFooterMsg.length() > 1023) + { + log.warning("Length > 1023 - truncated"); + ReceiptFooterMsg = ReceiptFooterMsg.substring(0, 1023); + } + set_Value (COLUMNNAME_ReceiptFooterMsg, ReceiptFooterMsg); + } + + /** Get Receipt Footer Msg. + @return This message will be displayed at the bottom of a receipt when doing a sales or purchase + */ + public String getReceiptFooterMsg () + { + return (String)get_Value(COLUMNNAME_ReceiptFooterMsg); + } + + /** Supervisor_ID AD_Reference_ID=286 */ + public static final int SUPERVISOR_ID_AD_Reference_ID=286; + /** Set Supervisor. + @param Supervisor_ID + Supervisor for this user/organization - used for escalation and approval + */ + public void setSupervisor_ID (int Supervisor_ID) + { + if (Supervisor_ID < 1) + set_Value (COLUMNNAME_Supervisor_ID, null); + else + set_Value (COLUMNNAME_Supervisor_ID, Integer.valueOf(Supervisor_ID)); + } + + /** Get Supervisor. + @return Supervisor for this user/organization - used for escalation and approval + */ + public int getSupervisor_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Supervisor_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Tax ID. + @param TaxID + Tax Identification + */ + public void setTaxID (String TaxID) + { + if (TaxID == null) + throw new IllegalArgumentException ("TaxID is mandatory."); + + if (TaxID.length() > 20) + { + log.warning("Length > 20 - truncated"); + TaxID = TaxID.substring(0, 20); + } + set_Value (COLUMNNAME_TaxID, TaxID); + } + + /** Get Tax ID. + @return Tax Identification + */ + public String getTaxID () + { + return (String)get_Value(COLUMNNAME_TaxID); + } + + /** TransferBank_ID AD_Reference_ID=52001 */ + public static final int TRANSFERBANK_ID_AD_Reference_ID=52001; + /** Set Bank for transfers. + @param TransferBank_ID + Bank account depending on currency will be used from this bank for doing transfers + */ + public void setTransferBank_ID (int TransferBank_ID) + { + if (TransferBank_ID < 1) + set_Value (COLUMNNAME_TransferBank_ID, null); + else + set_Value (COLUMNNAME_TransferBank_ID, Integer.valueOf(TransferBank_ID)); + } + + /** Get Bank for transfers. + @return Bank account depending on currency will be used from this bank for doing transfers + */ + public int getTransferBank_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_TransferBank_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** TransferCashBook_ID AD_Reference_ID=52004 */ + public static final int TRANSFERCASHBOOK_ID_AD_Reference_ID=52004; + /** Set CashBook for transfers. + @param TransferCashBook_ID CashBook for transfers */ + public void setTransferCashBook_ID (int TransferCashBook_ID) + { + if (TransferCashBook_ID < 1) + set_Value (COLUMNNAME_TransferCashBook_ID, null); + else + set_Value (COLUMNNAME_TransferCashBook_ID, Integer.valueOf(TransferCashBook_ID)); + } + + /** Get CashBook for transfers. + @return CashBook for transfers */ + public int getTransferCashBook_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_TransferCashBook_ID); + if (ii == null) + return 0; + return ii.intValue(); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_AD_Role.java b/posterita/posterita/src/main/org/compiere/model/X_AD_Role.java new file mode 100644 index 0000000000..221b025e78 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_AD_Role.java @@ -0,0 +1,1015 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.util.Properties; +import java.util.logging.Level; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for AD_Role + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_AD_Role extends PO implements I_AD_Role, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_AD_Role (Properties ctx, int AD_Role_ID, String trxName) + { + super (ctx, AD_Role_ID, trxName); + /** if (AD_Role_ID == 0) + { + setAD_Role_ID (0); + setConfirmQueryRecords (0); +// 0 + setIsAccessAllOrgs (false); +// N + setIsCanApproveOwnDoc (false); + setIsCanExport (true); +// Y + setIsCanReport (true); +// Y + setIsChangeLog (false); +// N + setIsDiscountAllowedOnTotal (false); + setIsDiscountUptoLimitPrice (false); + setIsManual (false); + setIsPersonalAccess (false); +// N + setIsPersonalLock (false); +// N + setIsShowAcct (false); +// N + setIsUseUserOrgAccess (false); +// N + setMaxQueryRecords (0); +// 0 + setName (null); + setOverwritePriceLimit (false); +// N + setPreferenceType (null); +// O + setUserLevel (null); +// O + } */ + } + + /** Load Constructor */ + public X_AD_Role (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 6 - System - Client + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_AD_Role[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** Set Role. + @param AD_Role_ID + Responsibility Role + */ + public void setAD_Role_ID (int AD_Role_ID) + { + if (AD_Role_ID < 0) + throw new IllegalArgumentException ("AD_Role_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID)); + } + + /** Get Role. + @return Responsibility Role + */ + public int getAD_Role_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** AD_Tree_Menu_ID AD_Reference_ID=184 */ + public static final int AD_TREE_MENU_ID_AD_Reference_ID=184; + /** Set Menu Tree. + @param AD_Tree_Menu_ID + Tree of the menu + */ + public void setAD_Tree_Menu_ID (int AD_Tree_Menu_ID) + { + if (AD_Tree_Menu_ID < 1) + set_Value (COLUMNNAME_AD_Tree_Menu_ID, null); + else + set_Value (COLUMNNAME_AD_Tree_Menu_ID, Integer.valueOf(AD_Tree_Menu_ID)); + } + + /** Get Menu Tree. + @return Tree of the menu + */ + public int getAD_Tree_Menu_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Tree_Menu_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** AD_Tree_Org_ID AD_Reference_ID=184 */ + public static final int AD_TREE_ORG_ID_AD_Reference_ID=184; + /** Set Organization Tree. + @param AD_Tree_Org_ID + Tree to determine organizational hierarchy + */ + public void setAD_Tree_Org_ID (int AD_Tree_Org_ID) + { + if (AD_Tree_Org_ID < 1) + set_Value (COLUMNNAME_AD_Tree_Org_ID, null); + else + set_Value (COLUMNNAME_AD_Tree_Org_ID, Integer.valueOf(AD_Tree_Org_ID)); + } + + /** Get Organization Tree. + @return Tree to determine organizational hierarchy + */ + public int getAD_Tree_Org_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Tree_Org_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Allow Info Account. + @param Allow_Info_Account Allow Info Account */ + public void setAllow_Info_Account (boolean Allow_Info_Account) + { + set_Value (COLUMNNAME_Allow_Info_Account, Boolean.valueOf(Allow_Info_Account)); + } + + /** Get Allow Info Account. + @return Allow Info Account */ + public boolean isAllow_Info_Account () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_Account); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info Asset. + @param Allow_Info_Asset Allow Info Asset */ + public void setAllow_Info_Asset (boolean Allow_Info_Asset) + { + set_Value (COLUMNNAME_Allow_Info_Asset, Boolean.valueOf(Allow_Info_Asset)); + } + + /** Get Allow Info Asset. + @return Allow Info Asset */ + public boolean isAllow_Info_Asset () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_Asset); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info BPartner. + @param Allow_Info_BPartner Allow Info BPartner */ + public void setAllow_Info_BPartner (boolean Allow_Info_BPartner) + { + set_Value (COLUMNNAME_Allow_Info_BPartner, Boolean.valueOf(Allow_Info_BPartner)); + } + + /** Get Allow Info BPartner. + @return Allow Info BPartner */ + public boolean isAllow_Info_BPartner () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_BPartner); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info CashJournal. + @param Allow_Info_CashJournal Allow Info CashJournal */ + public void setAllow_Info_CashJournal (boolean Allow_Info_CashJournal) + { + set_Value (COLUMNNAME_Allow_Info_CashJournal, Boolean.valueOf(Allow_Info_CashJournal)); + } + + /** Get Allow Info CashJournal. + @return Allow Info CashJournal */ + public boolean isAllow_Info_CashJournal () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_CashJournal); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info InOut. + @param Allow_Info_InOut Allow Info InOut */ + public void setAllow_Info_InOut (boolean Allow_Info_InOut) + { + set_Value (COLUMNNAME_Allow_Info_InOut, Boolean.valueOf(Allow_Info_InOut)); + } + + /** Get Allow Info InOut. + @return Allow Info InOut */ + public boolean isAllow_Info_InOut () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_InOut); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info Invoice. + @param Allow_Info_Invoice Allow Info Invoice */ + public void setAllow_Info_Invoice (boolean Allow_Info_Invoice) + { + set_Value (COLUMNNAME_Allow_Info_Invoice, Boolean.valueOf(Allow_Info_Invoice)); + } + + /** Get Allow Info Invoice. + @return Allow Info Invoice */ + public boolean isAllow_Info_Invoice () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_Invoice); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info Order. + @param Allow_Info_Order Allow Info Order */ + public void setAllow_Info_Order (boolean Allow_Info_Order) + { + set_Value (COLUMNNAME_Allow_Info_Order, Boolean.valueOf(Allow_Info_Order)); + } + + /** Get Allow Info Order. + @return Allow Info Order */ + public boolean isAllow_Info_Order () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_Order); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info Payment. + @param Allow_Info_Payment Allow Info Payment */ + public void setAllow_Info_Payment (boolean Allow_Info_Payment) + { + set_Value (COLUMNNAME_Allow_Info_Payment, Boolean.valueOf(Allow_Info_Payment)); + } + + /** Get Allow Info Payment. + @return Allow Info Payment */ + public boolean isAllow_Info_Payment () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_Payment); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info Product. + @param Allow_Info_Product Allow Info Product */ + public void setAllow_Info_Product (boolean Allow_Info_Product) + { + set_Value (COLUMNNAME_Allow_Info_Product, Boolean.valueOf(Allow_Info_Product)); + } + + /** Get Allow Info Product. + @return Allow Info Product */ + public boolean isAllow_Info_Product () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_Product); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info Resource. + @param Allow_Info_Resource Allow Info Resource */ + public void setAllow_Info_Resource (boolean Allow_Info_Resource) + { + set_Value (COLUMNNAME_Allow_Info_Resource, Boolean.valueOf(Allow_Info_Resource)); + } + + /** Get Allow Info Resource. + @return Allow Info Resource */ + public boolean isAllow_Info_Resource () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_Resource); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Allow Info Schedule. + @param Allow_Info_Schedule Allow Info Schedule */ + public void setAllow_Info_Schedule (boolean Allow_Info_Schedule) + { + set_Value (COLUMNNAME_Allow_Info_Schedule, Boolean.valueOf(Allow_Info_Schedule)); + } + + /** Get Allow Info Schedule. + @return Allow Info Schedule */ + public boolean isAllow_Info_Schedule () + { + Object oo = get_Value(COLUMNNAME_Allow_Info_Schedule); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Approval Amount. + @param AmtApproval + The approval amount limit for this role + */ + public void setAmtApproval (BigDecimal AmtApproval) + { + set_Value (COLUMNNAME_AmtApproval, AmtApproval); + } + + /** Get Approval Amount. + @return The approval amount limit for this role + */ + public BigDecimal getAmtApproval () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_AmtApproval); + if (bd == null) + return Env.ZERO; + return bd; + } + + public I_C_Currency getC_Currency() throws Exception + { + Class clazz = MTable.getClass(I_C_Currency.Table_Name); + I_C_Currency result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Currency)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Currency_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency. + @param C_Currency_ID + The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID) + { + if (C_Currency_ID < 1) + set_Value (COLUMNNAME_C_Currency_ID, null); + else + set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID)); + } + + /** Get Currency. + @return The Currency for this record + */ + public int getC_Currency_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Confirm Query Records. + @param ConfirmQueryRecords + Require Confirmation if more records will be returned by the query (If not defined 500) + */ + public void setConfirmQueryRecords (int ConfirmQueryRecords) + { + set_Value (COLUMNNAME_ConfirmQueryRecords, Integer.valueOf(ConfirmQueryRecords)); + } + + /** Get Confirm Query Records. + @return Require Confirmation if more records will be returned by the query (If not defined 500) + */ + public int getConfirmQueryRecords () + { + Integer ii = (Integer)get_Value(COLUMNNAME_ConfirmQueryRecords); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** ConnectionProfile AD_Reference_ID=364 */ + public static final int CONNECTIONPROFILE_AD_Reference_ID=364; + /** LAN = L */ + public static final String CONNECTIONPROFILE_LAN = "L"; + /** Terminal Server = T */ + public static final String CONNECTIONPROFILE_TerminalServer = "T"; + /** VPN = V */ + public static final String CONNECTIONPROFILE_VPN = "V"; + /** WAN = W */ + public static final String CONNECTIONPROFILE_WAN = "W"; + /** Set Connection Profile. + @param ConnectionProfile + How a Java Client connects to the server(s) + */ + public void setConnectionProfile (String ConnectionProfile) + { + + if (ConnectionProfile == null || ConnectionProfile.equals("L") || ConnectionProfile.equals("T") || ConnectionProfile.equals("V") || ConnectionProfile.equals("W")); else throw new IllegalArgumentException ("ConnectionProfile Invalid value - " + ConnectionProfile + " - Reference_ID=364 - L - T - V - W"); + if (ConnectionProfile != null && ConnectionProfile.length() > 1) + { + log.warning("Length > 1 - truncated"); + ConnectionProfile = ConnectionProfile.substring(0, 1); + } + set_Value (COLUMNNAME_ConnectionProfile, ConnectionProfile); + } + + /** Get Connection Profile. + @return How a Java Client connects to the server(s) + */ + public String getConnectionProfile () + { + return (String)get_Value(COLUMNNAME_ConnectionProfile); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set Access all Orgs. + @param IsAccessAllOrgs + Access all Organizations (no org access control) of the client + */ + public void setIsAccessAllOrgs (boolean IsAccessAllOrgs) + { + set_Value (COLUMNNAME_IsAccessAllOrgs, Boolean.valueOf(IsAccessAllOrgs)); + } + + /** Get Access all Orgs. + @return Access all Organizations (no org access control) of the client + */ + public boolean isAccessAllOrgs () + { + Object oo = get_Value(COLUMNNAME_IsAccessAllOrgs); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Approve own Documents. + @param IsCanApproveOwnDoc + Users with this role can approve their own documents + */ + public void setIsCanApproveOwnDoc (boolean IsCanApproveOwnDoc) + { + set_Value (COLUMNNAME_IsCanApproveOwnDoc, Boolean.valueOf(IsCanApproveOwnDoc)); + } + + /** Get Approve own Documents. + @return Users with this role can approve their own documents + */ + public boolean isCanApproveOwnDoc () + { + Object oo = get_Value(COLUMNNAME_IsCanApproveOwnDoc); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Can Export. + @param IsCanExport + Users with this role can export data + */ + public void setIsCanExport (boolean IsCanExport) + { + set_Value (COLUMNNAME_IsCanExport, Boolean.valueOf(IsCanExport)); + } + + /** Get Can Export. + @return Users with this role can export data + */ + public boolean isCanExport () + { + Object oo = get_Value(COLUMNNAME_IsCanExport); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Can Report. + @param IsCanReport + Users with this role can create reports + */ + public void setIsCanReport (boolean IsCanReport) + { + set_Value (COLUMNNAME_IsCanReport, Boolean.valueOf(IsCanReport)); + } + + /** Get Can Report. + @return Users with this role can create reports + */ + public boolean isCanReport () + { + Object oo = get_Value(COLUMNNAME_IsCanReport); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Maintain Change Log. + @param IsChangeLog + Maintain a log of changes + */ + public void setIsChangeLog (boolean IsChangeLog) + { + set_Value (COLUMNNAME_IsChangeLog, Boolean.valueOf(IsChangeLog)); + } + + /** Get Maintain Change Log. + @return Maintain a log of changes + */ + public boolean isChangeLog () + { + Object oo = get_Value(COLUMNNAME_IsChangeLog); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set IsDiscountAllowedOnTotal. + @param IsDiscountAllowedOnTotal IsDiscountAllowedOnTotal */ + public void setIsDiscountAllowedOnTotal (boolean IsDiscountAllowedOnTotal) + { + set_Value (COLUMNNAME_IsDiscountAllowedOnTotal, Boolean.valueOf(IsDiscountAllowedOnTotal)); + } + + /** Get IsDiscountAllowedOnTotal. + @return IsDiscountAllowedOnTotal */ + public boolean isDiscountAllowedOnTotal () + { + Object oo = get_Value(COLUMNNAME_IsDiscountAllowedOnTotal); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set IsDiscountUptoLimitPrice. + @param IsDiscountUptoLimitPrice IsDiscountUptoLimitPrice */ + public void setIsDiscountUptoLimitPrice (boolean IsDiscountUptoLimitPrice) + { + set_Value (COLUMNNAME_IsDiscountUptoLimitPrice, Boolean.valueOf(IsDiscountUptoLimitPrice)); + } + + /** Get IsDiscountUptoLimitPrice. + @return IsDiscountUptoLimitPrice */ + public boolean isDiscountUptoLimitPrice () + { + Object oo = get_Value(COLUMNNAME_IsDiscountUptoLimitPrice); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Manual. + @param IsManual + This is a manual process + */ + public void setIsManual (boolean IsManual) + { + set_Value (COLUMNNAME_IsManual, Boolean.valueOf(IsManual)); + } + + /** Get Manual. + @return This is a manual process + */ + public boolean isManual () + { + Object oo = get_Value(COLUMNNAME_IsManual); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Personal Access. + @param IsPersonalAccess + Allow access to all personal records + */ + public void setIsPersonalAccess (boolean IsPersonalAccess) + { + set_Value (COLUMNNAME_IsPersonalAccess, Boolean.valueOf(IsPersonalAccess)); + } + + /** Get Personal Access. + @return Allow access to all personal records + */ + public boolean isPersonalAccess () + { + Object oo = get_Value(COLUMNNAME_IsPersonalAccess); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Personal Lock. + @param IsPersonalLock + Allow users with role to lock access to personal records + */ + public void setIsPersonalLock (boolean IsPersonalLock) + { + set_Value (COLUMNNAME_IsPersonalLock, Boolean.valueOf(IsPersonalLock)); + } + + /** Get Personal Lock. + @return Allow users with role to lock access to personal records + */ + public boolean isPersonalLock () + { + Object oo = get_Value(COLUMNNAME_IsPersonalLock); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Show Accounting. + @param IsShowAcct + Users with this role can see accounting information + */ + public void setIsShowAcct (boolean IsShowAcct) + { + set_Value (COLUMNNAME_IsShowAcct, Boolean.valueOf(IsShowAcct)); + } + + /** Get Show Accounting. + @return Users with this role can see accounting information + */ + public boolean isShowAcct () + { + Object oo = get_Value(COLUMNNAME_IsShowAcct); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Use User Org Access. + @param IsUseUserOrgAccess + Use Org Access defined by user instead of Role Org Access + */ + public void setIsUseUserOrgAccess (boolean IsUseUserOrgAccess) + { + set_Value (COLUMNNAME_IsUseUserOrgAccess, Boolean.valueOf(IsUseUserOrgAccess)); + } + + /** Get Use User Org Access. + @return Use Org Access defined by user instead of Role Org Access + */ + public boolean isUseUserOrgAccess () + { + Object oo = get_Value(COLUMNNAME_IsUseUserOrgAccess); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Max Query Records. + @param MaxQueryRecords + If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public void setMaxQueryRecords (int MaxQueryRecords) + { + set_Value (COLUMNNAME_MaxQueryRecords, Integer.valueOf(MaxQueryRecords)); + } + + /** Get Max Query Records. + @return If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords () + { + Integer ii = (Integer)get_Value(COLUMNNAME_MaxQueryRecords); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Name. + @param Name + Alphanumeric identifier of the entity + */ + public void setName (String Name) + { + if (Name == null) + throw new IllegalArgumentException ("Name is mandatory."); + + if (Name.length() > 60) + { + log.warning("Length > 60 - truncated"); + Name = Name.substring(0, 60); + } + set_Value (COLUMNNAME_Name, Name); + } + + /** Get Name. + @return Alphanumeric identifier of the entity + */ + public String getName () + { + return (String)get_Value(COLUMNNAME_Name); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), getName()); + } + + /** Set Overwrite Price Limit. + @param OverwritePriceLimit + Overwrite Price Limit if the Price List enforces the Price Limit + */ + public void setOverwritePriceLimit (boolean OverwritePriceLimit) + { + set_Value (COLUMNNAME_OverwritePriceLimit, Boolean.valueOf(OverwritePriceLimit)); + } + + /** Get Overwrite Price Limit. + @return Overwrite Price Limit if the Price List enforces the Price Limit + */ + public boolean isOverwritePriceLimit () + { + Object oo = get_Value(COLUMNNAME_OverwritePriceLimit); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** PreferenceType AD_Reference_ID=330 */ + public static final int PREFERENCETYPE_AD_Reference_ID=330; + /** Client = C */ + public static final String PREFERENCETYPE_Client = "C"; + /** Organization = O */ + public static final String PREFERENCETYPE_Organization = "O"; + /** User = U */ + public static final String PREFERENCETYPE_User = "U"; + /** None = N */ + public static final String PREFERENCETYPE_None = "N"; + /** Set Preference Level. + @param PreferenceType + Determines what preferences the user can set + */ + public void setPreferenceType (String PreferenceType) + { + if (PreferenceType == null) throw new IllegalArgumentException ("PreferenceType is mandatory"); + if (PreferenceType.equals("C") || PreferenceType.equals("O") || PreferenceType.equals("U") || PreferenceType.equals("N")); else throw new IllegalArgumentException ("PreferenceType Invalid value - " + PreferenceType + " - Reference_ID=330 - C - O - U - N"); + if (PreferenceType.length() > 1) + { + log.warning("Length > 1 - truncated"); + PreferenceType = PreferenceType.substring(0, 1); + } + set_Value (COLUMNNAME_PreferenceType, PreferenceType); + } + + /** Get Preference Level. + @return Determines what preferences the user can set + */ + public String getPreferenceType () + { + return (String)get_Value(COLUMNNAME_PreferenceType); + } + + /** Supervisor_ID AD_Reference_ID=286 */ + public static final int SUPERVISOR_ID_AD_Reference_ID=286; + /** Set Supervisor. + @param Supervisor_ID + Supervisor for this user/organization - used for escalation and approval + */ + public void setSupervisor_ID (int Supervisor_ID) + { + if (Supervisor_ID < 1) + set_Value (COLUMNNAME_Supervisor_ID, null); + else + set_Value (COLUMNNAME_Supervisor_ID, Integer.valueOf(Supervisor_ID)); + } + + /** Get Supervisor. + @return Supervisor for this user/organization - used for escalation and approval + */ + public int getSupervisor_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Supervisor_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set UserDiscount. + @param UserDiscount UserDiscount */ + public void setUserDiscount (BigDecimal UserDiscount) + { + set_Value (COLUMNNAME_UserDiscount, UserDiscount); + } + + /** Get UserDiscount. + @return UserDiscount */ + public BigDecimal getUserDiscount () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_UserDiscount); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** UserLevel AD_Reference_ID=226 */ + public static final int USERLEVEL_AD_Reference_ID=226; + /** System = S */ + public static final String USERLEVEL_System = "S "; + /** Client = C */ + public static final String USERLEVEL_Client = " C "; + /** Organization = O */ + public static final String USERLEVEL_Organization = " O"; + /** Client+Organization = CO */ + public static final String USERLEVEL_ClientPlusOrganization = " CO"; + /** Set User Level. + @param UserLevel + System Client Organization + */ + public void setUserLevel (String UserLevel) + { + if (UserLevel == null) throw new IllegalArgumentException ("UserLevel is mandatory"); + if (UserLevel.equals("S ") || UserLevel.equals(" C ") || UserLevel.equals(" O") || UserLevel.equals(" CO")); else throw new IllegalArgumentException ("UserLevel Invalid value - " + UserLevel + " - Reference_ID=226 - S - C - O - CO"); + if (UserLevel.length() > 3) + { + log.warning("Length > 3 - truncated"); + UserLevel = UserLevel.substring(0, 3); + } + set_Value (COLUMNNAME_UserLevel, UserLevel); + } + + /** Get User Level. + @return System Client Organization + */ + public String getUserLevel () + { + return (String)get_Value(COLUMNNAME_UserLevel); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_C_CashLine.java b/posterita/posterita/src/main/org/compiere/model/X_C_CashLine.java new file mode 100644 index 0000000000..b808c8ac18 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_C_CashLine.java @@ -0,0 +1,537 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.util.Properties; +import java.util.logging.Level; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for C_CashLine + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_C_CashLine extends PO implements I_C_CashLine, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_C_CashLine (Properties ctx, int C_CashLine_ID, String trxName) + { + super (ctx, C_CashLine_ID, trxName); + /** if (C_CashLine_ID == 0) + { + setAmount (Env.ZERO); + setCashType (null); +// E + setC_Cash_ID (0); + setC_CashLine_ID (0); + setLine (0); +// @SQL=SELECT COALESCE(MAX(Line),0)+10 AS DefaultValue FROM C_CashLine WHERE C_Cash_ID=@C_Cash_ID@ + setProcessed (false); + } */ + } + + /** Load Constructor */ + public X_C_CashLine (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 3 - Client - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_C_CashLine[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** Set Amount. + @param Amount + Amount in a defined currency + */ + public void setAmount (BigDecimal Amount) + { + if (Amount == null) + throw new IllegalArgumentException ("Amount is mandatory."); + set_Value (COLUMNNAME_Amount, Amount); + } + + /** Get Amount. + @return Amount in a defined currency + */ + public BigDecimal getAmount () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amount); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** CashType AD_Reference_ID=217 */ + public static final int CASHTYPE_AD_Reference_ID=217; + /** Bank Account Transfer = T */ + public static final String CASHTYPE_BankAccountTransfer = "T"; + /** Invoice = I */ + public static final String CASHTYPE_Invoice = "I"; + /** General Expense = E */ + public static final String CASHTYPE_GeneralExpense = "E"; + /** General Receipts = R */ + public static final String CASHTYPE_GeneralReceipts = "R"; + /** Charge = C */ + public static final String CASHTYPE_Charge = "C"; + /** Difference = D */ + public static final String CASHTYPE_Difference = "D"; + /** Set Cash Type. + @param CashType + Source of Cash + */ + public void setCashType (String CashType) + { + if (CashType == null) throw new IllegalArgumentException ("CashType is mandatory"); + if (CashType.equals("T") || CashType.equals("I") || CashType.equals("E") || CashType.equals("R") || CashType.equals("C") || CashType.equals("D")); else throw new IllegalArgumentException ("CashType Invalid value - " + CashType + " - Reference_ID=217 - T - I - E - R - C - D"); + if (CashType.length() > 1) + { + log.warning("Length > 1 - truncated"); + CashType = CashType.substring(0, 1); + } + set_ValueNoCheck (COLUMNNAME_CashType, CashType); + } + + /** Get Cash Type. + @return Source of Cash + */ + public String getCashType () + { + return (String)get_Value(COLUMNNAME_CashType); + } + + public I_C_BankAccount getC_BankAccount() throws Exception + { + Class clazz = MTable.getClass(I_C_BankAccount.Table_Name); + I_C_BankAccount result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_BankAccount)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_BankAccount_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Bank Account. + @param C_BankAccount_ID + Account at the Bank + */ + public void setC_BankAccount_ID (int C_BankAccount_ID) + { + if (C_BankAccount_ID < 1) + set_Value (COLUMNNAME_C_BankAccount_ID, null); + else + set_Value (COLUMNNAME_C_BankAccount_ID, Integer.valueOf(C_BankAccount_ID)); + } + + /** Get Bank Account. + @return Account at the Bank + */ + public int getC_BankAccount_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_BankAccount_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Cash getC_Cash() throws Exception + { + Class clazz = MTable.getClass(I_C_Cash.Table_Name); + I_C_Cash result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Cash)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Cash_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Cash Journal. + @param C_Cash_ID + Cash Journal + */ + public void setC_Cash_ID (int C_Cash_ID) + { + if (C_Cash_ID < 1) + throw new IllegalArgumentException ("C_Cash_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_Cash_ID, Integer.valueOf(C_Cash_ID)); + } + + /** Get Cash Journal. + @return Cash Journal + */ + public int getC_Cash_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Cash_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), String.valueOf(getC_Cash_ID())); + } + + /** Set Cash Journal Line. + @param C_CashLine_ID + Cash Journal Line + */ + public void setC_CashLine_ID (int C_CashLine_ID) + { + if (C_CashLine_ID < 1) + throw new IllegalArgumentException ("C_CashLine_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_CashLine_ID, Integer.valueOf(C_CashLine_ID)); + } + + /** Get Cash Journal Line. + @return Cash Journal Line + */ + public int getC_CashLine_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_CashLine_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Charge getC_Charge() throws Exception + { + Class clazz = MTable.getClass(I_C_Charge.Table_Name); + I_C_Charge result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Charge)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Charge_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Charge. + @param C_Charge_ID + Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID) + { + if (C_Charge_ID < 1) + set_Value (COLUMNNAME_C_Charge_ID, null); + else + set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID)); + } + + /** Get Charge. + @return Additional document charges + */ + public int getC_Charge_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Currency getC_Currency() throws Exception + { + Class clazz = MTable.getClass(I_C_Currency.Table_Name); + I_C_Currency result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Currency)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Currency_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency. + @param C_Currency_ID + The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID) + { + if (C_Currency_ID < 1) + set_ValueNoCheck (COLUMNNAME_C_Currency_ID, null); + else + set_ValueNoCheck (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID)); + } + + /** Get Currency. + @return The Currency for this record + */ + public int getC_Currency_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Invoice getC_Invoice() throws Exception + { + Class clazz = MTable.getClass(I_C_Invoice.Table_Name); + I_C_Invoice result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Invoice)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Invoice_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Invoice. + @param C_Invoice_ID + Invoice Identifier + */ + public void setC_Invoice_ID (int C_Invoice_ID) + { + if (C_Invoice_ID < 1) + set_ValueNoCheck (COLUMNNAME_C_Invoice_ID, null); + else + set_ValueNoCheck (COLUMNNAME_C_Invoice_ID, Integer.valueOf(C_Invoice_ID)); + } + + /** Get Invoice. + @return Invoice Identifier + */ + public int getC_Invoice_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Payment getC_Payment() throws Exception + { + Class clazz = MTable.getClass(I_C_Payment.Table_Name); + I_C_Payment result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Payment)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Payment_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Payment. + @param C_Payment_ID + Payment identifier + */ + public void setC_Payment_ID (int C_Payment_ID) + { + if (C_Payment_ID < 1) + set_ValueNoCheck (COLUMNNAME_C_Payment_ID, null); + else + set_ValueNoCheck (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID)); + } + + /** Get Payment. + @return Payment identifier + */ + public int getC_Payment_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set Discount Amount. + @param DiscountAmt + Calculated amount of discount + */ + public void setDiscountAmt (BigDecimal DiscountAmt) + { + set_Value (COLUMNNAME_DiscountAmt, DiscountAmt); + } + + /** Get Discount Amount. + @return Calculated amount of discount + */ + public BigDecimal getDiscountAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_DiscountAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Generated. + @param IsGenerated + This Line is generated + */ + public void setIsGenerated (boolean IsGenerated) + { + set_ValueNoCheck (COLUMNNAME_IsGenerated, Boolean.valueOf(IsGenerated)); + } + + /** Get Generated. + @return This Line is generated + */ + public boolean isGenerated () + { + Object oo = get_Value(COLUMNNAME_IsGenerated); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Line No. + @param Line + Unique line for this document + */ + public void setLine (int Line) + { + set_Value (COLUMNNAME_Line, Integer.valueOf(Line)); + } + + /** Get Line No. + @return Unique line for this document + */ + public int getLine () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Line); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Processed. + @param Processed + The document has been processed + */ + public void setProcessed (boolean Processed) + { + set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); + } + + /** Get Processed. + @return The document has been processed + */ + public boolean isProcessed () + { + Object oo = get_Value(COLUMNNAME_Processed); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Write-off Amount. + @param WriteOffAmt + Amount to write-off + */ + public void setWriteOffAmt (BigDecimal WriteOffAmt) + { + set_Value (COLUMNNAME_WriteOffAmt, WriteOffAmt); + } + + /** Get Write-off Amount. + @return Amount to write-off + */ + public BigDecimal getWriteOffAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_WriteOffAmt); + if (bd == null) + return Env.ZERO; + return bd; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_C_Currency.java b/posterita/posterita/src/main/org/compiere/model/X_C_Currency.java new file mode 100644 index 0000000000..e01758e0b1 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_C_Currency.java @@ -0,0 +1,337 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.Properties; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for C_Currency + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_C_Currency extends PO implements I_C_Currency, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_C_Currency (Properties ctx, int C_Currency_ID, String trxName) + { + super (ctx, C_Currency_ID, trxName); + /** if (C_Currency_ID == 0) + { + setC_Currency_ID (0); + setCostingPrecision (0); +// 4 + setDescription (null); + setIsEMUMember (false); +// N + setIsEuro (false); +// N + setISO_Code (null); + setRoundOffFactor (Env.ZERO); +// 1 + setStdPrecision (0); +// 2 + } */ + } + + /** Load Constructor */ + public X_C_Currency (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 6 - System - Client + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_C_Currency[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** Set Currency. + @param C_Currency_ID + The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID) + { + if (C_Currency_ID < 1) + throw new IllegalArgumentException ("C_Currency_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID)); + } + + /** Get Currency. + @return The Currency for this record + */ + public int getC_Currency_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Costing Precision. + @param CostingPrecision + Rounding used costing calculations + */ + public void setCostingPrecision (int CostingPrecision) + { + set_Value (COLUMNNAME_CostingPrecision, Integer.valueOf(CostingPrecision)); + } + + /** Get Costing Precision. + @return Rounding used costing calculations + */ + public int getCostingPrecision () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CostingPrecision); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Symbol. + @param CurSymbol + Symbol of the currency (opt used for printing only) + */ + public void setCurSymbol (String CurSymbol) + { + + if (CurSymbol != null && CurSymbol.length() > 10) + { + log.warning("Length > 10 - truncated"); + CurSymbol = CurSymbol.substring(0, 10); + } + set_Value (COLUMNNAME_CurSymbol, CurSymbol); + } + + /** Get Symbol. + @return Symbol of the currency (opt used for printing only) + */ + public String getCurSymbol () + { + return (String)get_Value(COLUMNNAME_CurSymbol); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + if (Description == null) + throw new IllegalArgumentException ("Description is mandatory."); + + if (Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set EMU Entry Date. + @param EMUEntryDate + Date when the currency joined / will join the EMU + */ + public void setEMUEntryDate (Timestamp EMUEntryDate) + { + set_Value (COLUMNNAME_EMUEntryDate, EMUEntryDate); + } + + /** Get EMU Entry Date. + @return Date when the currency joined / will join the EMU + */ + public Timestamp getEMUEntryDate () + { + return (Timestamp)get_Value(COLUMNNAME_EMUEntryDate); + } + + /** Set EMU Rate. + @param EMURate + Official rate to the Euro + */ + public void setEMURate (BigDecimal EMURate) + { + set_Value (COLUMNNAME_EMURate, EMURate); + } + + /** Get EMU Rate. + @return Official rate to the Euro + */ + public BigDecimal getEMURate () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_EMURate); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set EMU Member. + @param IsEMUMember + This currency is member if the European Monetary Union + */ + public void setIsEMUMember (boolean IsEMUMember) + { + set_Value (COLUMNNAME_IsEMUMember, Boolean.valueOf(IsEMUMember)); + } + + /** Get EMU Member. + @return This currency is member if the European Monetary Union + */ + public boolean isEMUMember () + { + Object oo = get_Value(COLUMNNAME_IsEMUMember); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set The Euro Currency. + @param IsEuro + This currency is the Euro + */ + public void setIsEuro (boolean IsEuro) + { + set_Value (COLUMNNAME_IsEuro, Boolean.valueOf(IsEuro)); + } + + /** Get The Euro Currency. + @return This currency is the Euro + */ + public boolean isEuro () + { + Object oo = get_Value(COLUMNNAME_IsEuro); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set ISO Currency Code. + @param ISO_Code + Three letter ISO 4217 Code of the Currency + */ + public void setISO_Code (String ISO_Code) + { + if (ISO_Code == null) + throw new IllegalArgumentException ("ISO_Code is mandatory."); + + if (ISO_Code.length() > 3) + { + log.warning("Length > 3 - truncated"); + ISO_Code = ISO_Code.substring(0, 3); + } + set_Value (COLUMNNAME_ISO_Code, ISO_Code); + } + + /** Get ISO Currency Code. + @return Three letter ISO 4217 Code of the Currency + */ + public String getISO_Code () + { + return (String)get_Value(COLUMNNAME_ISO_Code); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), getISO_Code()); + } + + /** Set RoundOffFactor. + @param RoundOffFactor + Used to Round Off Payment Amount + */ + public void setRoundOffFactor (BigDecimal RoundOffFactor) + { + if (RoundOffFactor == null) + throw new IllegalArgumentException ("RoundOffFactor is mandatory."); + set_Value (COLUMNNAME_RoundOffFactor, RoundOffFactor); + } + + /** Get RoundOffFactor. + @return Used to Round Off Payment Amount + */ + public BigDecimal getRoundOffFactor () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RoundOffFactor); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Standard Precision. + @param StdPrecision + Rule for rounding calculated amounts + */ + public void setStdPrecision (int StdPrecision) + { + set_Value (COLUMNNAME_StdPrecision, Integer.valueOf(StdPrecision)); + } + + /** Get Standard Precision. + @return Rule for rounding calculated amounts + */ + public int getStdPrecision () + { + Integer ii = (Integer)get_Value(COLUMNNAME_StdPrecision); + if (ii == null) + return 0; + return ii.intValue(); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_C_Invoice.java b/posterita/posterita/src/main/org/compiere/model/X_C_Invoice.java new file mode 100644 index 0000000000..959b7eb534 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_C_Invoice.java @@ -0,0 +1,1731 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.Properties; +import java.util.logging.Level; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for C_Invoice + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_C_Invoice extends PO implements I_C_Invoice, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_C_Invoice (Properties ctx, int C_Invoice_ID, String trxName) + { + super (ctx, C_Invoice_ID, trxName); + /** if (C_Invoice_ID == 0) + { + setC_BPartner_ID (0); + setC_BPartner_Location_ID (0); + setC_Currency_ID (0); +// @C_Currency_ID@ + setC_DocType_ID (0); +// 0 + setC_DocTypeTarget_ID (0); + setC_Invoice_ID (0); + setC_PaymentTerm_ID (0); + setDateAcct (new Timestamp(System.currentTimeMillis())); +// @#Date@ + setDateInvoiced (new Timestamp(System.currentTimeMillis())); +// @#Date@ + setDocAction (null); +// CO + setDocStatus (null); +// DR + setDocumentNo (null); + setGrandTotal (Env.ZERO); + setIsApproved (false); +// @IsApproved@ + setIsDiscountPrinted (false); + setIsInDispute (false); +// N + setIsPaid (false); + setIsPayScheduleValid (false); + setIsPrinted (false); + setIsSelfService (false); + setIsSOTrx (false); +// @IsSOTrx@ + setIsTaxIncluded (false); + setIsTransferred (false); + setM_PriceList_ID (0); + setPaymentRule (null); +// P + setPosted (false); +// N + setProcessed (false); + setSendEMail (false); + setTotalLines (Env.ZERO); + } */ + } + + /** Load Constructor */ + public X_C_Invoice (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 1 - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_C_Invoice[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** AD_OrgTrx_ID AD_Reference_ID=130 */ + public static final int AD_ORGTRX_ID_AD_Reference_ID=130; + /** Set Trx Organization. + @param AD_OrgTrx_ID + Performing or initiating organization + */ + public void setAD_OrgTrx_ID (int AD_OrgTrx_ID) + { + if (AD_OrgTrx_ID < 1) + set_Value (COLUMNNAME_AD_OrgTrx_ID, null); + else + set_Value (COLUMNNAME_AD_OrgTrx_ID, Integer.valueOf(AD_OrgTrx_ID)); + } + + /** Get Trx Organization. + @return Performing or initiating organization + */ + public int getAD_OrgTrx_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_OrgTrx_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_AD_User getAD_User() throws Exception + { + Class clazz = MTable.getClass(I_AD_User.Table_Name); + I_AD_User result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_AD_User)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_User_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set User/Contact. + @param AD_User_ID + User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID) + { + if (AD_User_ID < 0) + set_Value (COLUMNNAME_AD_User_ID, null); + else + set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID)); + } + + /** Get User/Contact. + @return User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Activity getC_Activity() throws Exception + { + Class clazz = MTable.getClass(I_C_Activity.Table_Name); + I_C_Activity result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Activity)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Activity_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Activity. + @param C_Activity_ID + Business Activity + */ + public void setC_Activity_ID (int C_Activity_ID) + { + if (C_Activity_ID < 1) + set_Value (COLUMNNAME_C_Activity_ID, null); + else + set_Value (COLUMNNAME_C_Activity_ID, Integer.valueOf(C_Activity_ID)); + } + + /** Get Activity. + @return Business Activity + */ + public int getC_Activity_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Activity_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_BPartner getC_BPartner() throws Exception + { + Class clazz = MTable.getClass(I_C_BPartner.Table_Name); + I_C_BPartner result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_BPartner)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_BPartner_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Business Partner . + @param C_BPartner_ID + Identifies a Business Partner + */ + public void setC_BPartner_ID (int C_BPartner_ID) + { + if (C_BPartner_ID < 1) + throw new IllegalArgumentException ("C_BPartner_ID is mandatory."); + set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID)); + } + + /** Get Business Partner . + @return Identifies a Business Partner + */ + public int getC_BPartner_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_BPartner_Location getC_BPartner_Location() throws Exception + { + Class clazz = MTable.getClass(I_C_BPartner_Location.Table_Name); + I_C_BPartner_Location result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_BPartner_Location)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_BPartner_Location_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Partner Location. + @param C_BPartner_Location_ID + Identifies the (ship to) address for this Business Partner + */ + public void setC_BPartner_Location_ID (int C_BPartner_Location_ID) + { + if (C_BPartner_Location_ID < 1) + throw new IllegalArgumentException ("C_BPartner_Location_ID is mandatory."); + set_Value (COLUMNNAME_C_BPartner_Location_ID, Integer.valueOf(C_BPartner_Location_ID)); + } + + /** Get Partner Location. + @return Identifies the (ship to) address for this Business Partner + */ + public int getC_BPartner_Location_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_Location_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Campaign getC_Campaign() throws Exception + { + Class clazz = MTable.getClass(I_C_Campaign.Table_Name); + I_C_Campaign result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Campaign)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Campaign_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Campaign. + @param C_Campaign_ID + Marketing Campaign + */ + public void setC_Campaign_ID (int C_Campaign_ID) + { + if (C_Campaign_ID < 1) + set_Value (COLUMNNAME_C_Campaign_ID, null); + else + set_Value (COLUMNNAME_C_Campaign_ID, Integer.valueOf(C_Campaign_ID)); + } + + /** Get Campaign. + @return Marketing Campaign + */ + public int getC_Campaign_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Campaign_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_CashLine getC_CashLine() throws Exception + { + Class clazz = MTable.getClass(I_C_CashLine.Table_Name); + I_C_CashLine result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_CashLine)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_CashLine_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Cash Journal Line. + @param C_CashLine_ID + Cash Journal Line + */ + public void setC_CashLine_ID (int C_CashLine_ID) + { + if (C_CashLine_ID < 1) + set_Value (COLUMNNAME_C_CashLine_ID, null); + else + set_Value (COLUMNNAME_C_CashLine_ID, Integer.valueOf(C_CashLine_ID)); + } + + /** Get Cash Journal Line. + @return Cash Journal Line + */ + public int getC_CashLine_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_CashLine_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** C_Charge_ID AD_Reference_ID=200 */ + public static final int C_CHARGE_ID_AD_Reference_ID=200; + /** Set Charge. + @param C_Charge_ID + Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID) + { + if (C_Charge_ID < 1) + set_Value (COLUMNNAME_C_Charge_ID, null); + else + set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID)); + } + + /** Get Charge. + @return Additional document charges + */ + public int getC_Charge_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_ConversionType getC_ConversionType() throws Exception + { + Class clazz = MTable.getClass(I_C_ConversionType.Table_Name); + I_C_ConversionType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_ConversionType)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_ConversionType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency Type. + @param C_ConversionType_ID + Currency Conversion Rate Type + */ + public void setC_ConversionType_ID (int C_ConversionType_ID) + { + if (C_ConversionType_ID < 1) + set_Value (COLUMNNAME_C_ConversionType_ID, null); + else + set_Value (COLUMNNAME_C_ConversionType_ID, Integer.valueOf(C_ConversionType_ID)); + } + + /** Get Currency Type. + @return Currency Conversion Rate Type + */ + public int getC_ConversionType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_ConversionType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Currency getC_Currency() throws Exception + { + Class clazz = MTable.getClass(I_C_Currency.Table_Name); + I_C_Currency result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Currency)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Currency_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency. + @param C_Currency_ID + The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID) + { + if (C_Currency_ID < 1) + throw new IllegalArgumentException ("C_Currency_ID is mandatory."); + set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID)); + } + + /** Get Currency. + @return The Currency for this record + */ + public int getC_Currency_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_DocType getC_DocType() throws Exception + { + Class clazz = MTable.getClass(I_C_DocType.Table_Name); + I_C_DocType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_DocType)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DocType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Document Type. + @param C_DocType_ID + Document type or rules + */ + public void setC_DocType_ID (int C_DocType_ID) + { + if (C_DocType_ID < 0) + throw new IllegalArgumentException ("C_DocType_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID)); + } + + /** Get Document Type. + @return Document type or rules + */ + public int getC_DocType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** C_DocTypeTarget_ID AD_Reference_ID=170 */ + public static final int C_DOCTYPETARGET_ID_AD_Reference_ID=170; + /** Set Target Document Type. + @param C_DocTypeTarget_ID + Target document type for conversing documents + */ + public void setC_DocTypeTarget_ID (int C_DocTypeTarget_ID) + { + if (C_DocTypeTarget_ID < 1) + throw new IllegalArgumentException ("C_DocTypeTarget_ID is mandatory."); + set_Value (COLUMNNAME_C_DocTypeTarget_ID, Integer.valueOf(C_DocTypeTarget_ID)); + } + + /** Get Target Document Type. + @return Target document type for conversing documents + */ + public int getC_DocTypeTarget_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_DocTypeTarget_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_DunningLevel getC_DunningLevel() throws Exception + { + Class clazz = MTable.getClass(I_C_DunningLevel.Table_Name); + I_C_DunningLevel result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_DunningLevel)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DunningLevel_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Dunning Level. + @param C_DunningLevel_ID Dunning Level */ + public void setC_DunningLevel_ID (int C_DunningLevel_ID) + { + if (C_DunningLevel_ID < 1) + set_Value (COLUMNNAME_C_DunningLevel_ID, null); + else + set_Value (COLUMNNAME_C_DunningLevel_ID, Integer.valueOf(C_DunningLevel_ID)); + } + + /** Get Dunning Level. + @return Dunning Level */ + public int getC_DunningLevel_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningLevel_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Charge amount. + @param ChargeAmt + Charge Amount + */ + public void setChargeAmt (BigDecimal ChargeAmt) + { + set_Value (COLUMNNAME_ChargeAmt, ChargeAmt); + } + + /** Get Charge amount. + @return Charge Amount + */ + public BigDecimal getChargeAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ChargeAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Invoice. + @param C_Invoice_ID + Invoice Identifier + */ + public void setC_Invoice_ID (int C_Invoice_ID) + { + if (C_Invoice_ID < 1) + throw new IllegalArgumentException ("C_Invoice_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_Invoice_ID, Integer.valueOf(C_Invoice_ID)); + } + + /** Get Invoice. + @return Invoice Identifier + */ + public int getC_Invoice_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Copy From. + @param CopyFrom + Copy From Record + */ + public void setCopyFrom (String CopyFrom) + { + + if (CopyFrom != null && CopyFrom.length() > 1) + { + log.warning("Length > 1 - truncated"); + CopyFrom = CopyFrom.substring(0, 1); + } + set_Value (COLUMNNAME_CopyFrom, CopyFrom); + } + + /** Get Copy From. + @return Copy From Record + */ + public String getCopyFrom () + { + return (String)get_Value(COLUMNNAME_CopyFrom); + } + + public I_C_Order getC_Order() throws Exception + { + Class clazz = MTable.getClass(I_C_Order.Table_Name); + I_C_Order result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Order)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Order_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Order. + @param C_Order_ID + Order + */ + public void setC_Order_ID (int C_Order_ID) + { + if (C_Order_ID < 1) + set_ValueNoCheck (COLUMNNAME_C_Order_ID, null); + else + set_ValueNoCheck (COLUMNNAME_C_Order_ID, Integer.valueOf(C_Order_ID)); + } + + /** Get Order. + @return Order + */ + public int getC_Order_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Order_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Payment getC_Payment() throws Exception + { + Class clazz = MTable.getClass(I_C_Payment.Table_Name); + I_C_Payment result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Payment)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Payment_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Payment. + @param C_Payment_ID + Payment identifier + */ + public void setC_Payment_ID (int C_Payment_ID) + { + if (C_Payment_ID < 1) + set_Value (COLUMNNAME_C_Payment_ID, null); + else + set_Value (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID)); + } + + /** Get Payment. + @return Payment identifier + */ + public int getC_Payment_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_PaymentTerm getC_PaymentTerm() throws Exception + { + Class clazz = MTable.getClass(I_C_PaymentTerm.Table_Name); + I_C_PaymentTerm result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_PaymentTerm)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_PaymentTerm_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Payment Term. + @param C_PaymentTerm_ID + The terms of Payment (timing, discount) + */ + public void setC_PaymentTerm_ID (int C_PaymentTerm_ID) + { + if (C_PaymentTerm_ID < 1) + throw new IllegalArgumentException ("C_PaymentTerm_ID is mandatory."); + set_Value (COLUMNNAME_C_PaymentTerm_ID, Integer.valueOf(C_PaymentTerm_ID)); + } + + /** Get Payment Term. + @return The terms of Payment (timing, discount) + */ + public int getC_PaymentTerm_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_PaymentTerm_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Project getC_Project() throws Exception + { + Class clazz = MTable.getClass(I_C_Project.Table_Name); + I_C_Project result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Project)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Project_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Project. + @param C_Project_ID + Financial Project + */ + public void setC_Project_ID (int C_Project_ID) + { + if (C_Project_ID < 1) + set_Value (COLUMNNAME_C_Project_ID, null); + else + set_Value (COLUMNNAME_C_Project_ID, Integer.valueOf(C_Project_ID)); + } + + /** Get Project. + @return Financial Project + */ + public int getC_Project_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Project_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Create lines from. + @param CreateFrom + Process which will generate a new document lines based on an existing document + */ + public void setCreateFrom (String CreateFrom) + { + + if (CreateFrom != null && CreateFrom.length() > 1) + { + log.warning("Length > 1 - truncated"); + CreateFrom = CreateFrom.substring(0, 1); + } + set_Value (COLUMNNAME_CreateFrom, CreateFrom); + } + + /** Get Create lines from. + @return Process which will generate a new document lines based on an existing document + */ + public String getCreateFrom () + { + return (String)get_Value(COLUMNNAME_CreateFrom); + } + + /** Set Account Date. + @param DateAcct + Accounting Date + */ + public void setDateAcct (Timestamp DateAcct) + { + if (DateAcct == null) + throw new IllegalArgumentException ("DateAcct is mandatory."); + set_Value (COLUMNNAME_DateAcct, DateAcct); + } + + /** Get Account Date. + @return Accounting Date + */ + public Timestamp getDateAcct () + { + return (Timestamp)get_Value(COLUMNNAME_DateAcct); + } + + /** Set Date Invoiced. + @param DateInvoiced + Date printed on Invoice + */ + public void setDateInvoiced (Timestamp DateInvoiced) + { + if (DateInvoiced == null) + throw new IllegalArgumentException ("DateInvoiced is mandatory."); + set_Value (COLUMNNAME_DateInvoiced, DateInvoiced); + } + + /** Get Date Invoiced. + @return Date printed on Invoice + */ + public Timestamp getDateInvoiced () + { + return (Timestamp)get_Value(COLUMNNAME_DateInvoiced); + } + + /** Set Date Ordered. + @param DateOrdered + Date of Order + */ + public void setDateOrdered (Timestamp DateOrdered) + { + set_ValueNoCheck (COLUMNNAME_DateOrdered, DateOrdered); + } + + /** Get Date Ordered. + @return Date of Order + */ + public Timestamp getDateOrdered () + { + return (Timestamp)get_Value(COLUMNNAME_DateOrdered); + } + + /** Set Date printed. + @param DatePrinted + Date the document was printed. + */ + public void setDatePrinted (Timestamp DatePrinted) + { + set_Value (COLUMNNAME_DatePrinted, DatePrinted); + } + + /** Get Date printed. + @return Date the document was printed. + */ + public Timestamp getDatePrinted () + { + return (Timestamp)get_Value(COLUMNNAME_DatePrinted); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** DocAction AD_Reference_ID=135 */ + public static final int DOCACTION_AD_Reference_ID=135; + /** Complete = CO */ + public static final String DOCACTION_Complete = "CO"; + /** Approve = AP */ + public static final String DOCACTION_Approve = "AP"; + /** Reject = RJ */ + public static final String DOCACTION_Reject = "RJ"; + /** Post = PO */ + public static final String DOCACTION_Post = "PO"; + /** Void = VO */ + public static final String DOCACTION_Void = "VO"; + /** Close = CL */ + public static final String DOCACTION_Close = "CL"; + /** Reverse - Correct = RC */ + public static final String DOCACTION_Reverse_Correct = "RC"; + /** Reverse - Accrual = RA */ + public static final String DOCACTION_Reverse_Accrual = "RA"; + /** Invalidate = IN */ + public static final String DOCACTION_Invalidate = "IN"; + /** Re-activate = RE */ + public static final String DOCACTION_Re_Activate = "RE"; + /** = -- */ + public static final String DOCACTION_None = "--"; + /** Prepare = PR */ + public static final String DOCACTION_Prepare = "PR"; + /** Unlock = XL */ + public static final String DOCACTION_Unlock = "XL"; + /** Wait Complete = WC */ + public static final String DOCACTION_WaitComplete = "WC"; + /** Set Document Action. + @param DocAction + The targeted status of the document + */ + public void setDocAction (String DocAction) + { + if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory"); + if (DocAction.equals("CO") || DocAction.equals("AP") || DocAction.equals("RJ") || DocAction.equals("PO") || DocAction.equals("VO") || DocAction.equals("CL") || DocAction.equals("RC") || DocAction.equals("RA") || DocAction.equals("IN") || DocAction.equals("RE") || DocAction.equals("--") || DocAction.equals("PR") || DocAction.equals("XL") || DocAction.equals("WC")); else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - CO - AP - RJ - PO - VO - CL - RC - RA - IN - RE - -- - PR - XL - WC"); + if (DocAction.length() > 2) + { + log.warning("Length > 2 - truncated"); + DocAction = DocAction.substring(0, 2); + } + set_Value (COLUMNNAME_DocAction, DocAction); + } + + /** Get Document Action. + @return The targeted status of the document + */ + public String getDocAction () + { + return (String)get_Value(COLUMNNAME_DocAction); + } + + /** DocStatus AD_Reference_ID=131 */ + public static final int DOCSTATUS_AD_Reference_ID=131; + /** Drafted = DR */ + public static final String DOCSTATUS_Drafted = "DR"; + /** Completed = CO */ + public static final String DOCSTATUS_Completed = "CO"; + /** Approved = AP */ + public static final String DOCSTATUS_Approved = "AP"; + /** Not Approved = NA */ + public static final String DOCSTATUS_NotApproved = "NA"; + /** Voided = VO */ + public static final String DOCSTATUS_Voided = "VO"; + /** Invalid = IN */ + public static final String DOCSTATUS_Invalid = "IN"; + /** Reversed = RE */ + public static final String DOCSTATUS_Reversed = "RE"; + /** Closed = CL */ + public static final String DOCSTATUS_Closed = "CL"; + /** Unknown = ?? */ + public static final String DOCSTATUS_Unknown = "??"; + /** In Progress = IP */ + public static final String DOCSTATUS_InProgress = "IP"; + /** Waiting Payment = WP */ + public static final String DOCSTATUS_WaitingPayment = "WP"; + /** Waiting Confirmation = WC */ + public static final String DOCSTATUS_WaitingConfirmation = "WC"; + /** Set Document Status. + @param DocStatus + The current status of the document + */ + public void setDocStatus (String DocStatus) + { + if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory"); + if (DocStatus.equals("DR") || DocStatus.equals("CO") || DocStatus.equals("AP") || DocStatus.equals("NA") || DocStatus.equals("VO") || DocStatus.equals("IN") || DocStatus.equals("RE") || DocStatus.equals("CL") || DocStatus.equals("??") || DocStatus.equals("IP") || DocStatus.equals("WP") || DocStatus.equals("WC")); else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - DR - CO - AP - NA - VO - IN - RE - CL - ?? - IP - WP - WC"); + if (DocStatus.length() > 2) + { + log.warning("Length > 2 - truncated"); + DocStatus = DocStatus.substring(0, 2); + } + set_Value (COLUMNNAME_DocStatus, DocStatus); + } + + /** Get Document Status. + @return The current status of the document + */ + public String getDocStatus () + { + return (String)get_Value(COLUMNNAME_DocStatus); + } + + /** Set Document No. + @param DocumentNo + Document sequence number of the document + */ + public void setDocumentNo (String DocumentNo) + { + if (DocumentNo == null) + throw new IllegalArgumentException ("DocumentNo is mandatory."); + + if (DocumentNo.length() > 30) + { + log.warning("Length > 30 - truncated"); + DocumentNo = DocumentNo.substring(0, 30); + } + set_ValueNoCheck (COLUMNNAME_DocumentNo, DocumentNo); + } + + /** Get Document No. + @return Document sequence number of the document + */ + public String getDocumentNo () + { + return (String)get_Value(COLUMNNAME_DocumentNo); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), getDocumentNo()); + } + + /** Set Dunning Grace. + @param DunningGrace Dunning Grace */ + public void setDunningGrace (Timestamp DunningGrace) + { + set_Value (COLUMNNAME_DunningGrace, DunningGrace); + } + + /** Get Dunning Grace. + @return Dunning Grace */ + public Timestamp getDunningGrace () + { + return (Timestamp)get_Value(COLUMNNAME_DunningGrace); + } + + /** Set Generate To. + @param GenerateTo + Generate To + */ + public void setGenerateTo (String GenerateTo) + { + + if (GenerateTo != null && GenerateTo.length() > 1) + { + log.warning("Length > 1 - truncated"); + GenerateTo = GenerateTo.substring(0, 1); + } + set_Value (COLUMNNAME_GenerateTo, GenerateTo); + } + + /** Get Generate To. + @return Generate To + */ + public String getGenerateTo () + { + return (String)get_Value(COLUMNNAME_GenerateTo); + } + + /** Set Grand Total. + @param GrandTotal + Total amount of document + */ + public void setGrandTotal (BigDecimal GrandTotal) + { + if (GrandTotal == null) + throw new IllegalArgumentException ("GrandTotal is mandatory."); + set_ValueNoCheck (COLUMNNAME_GrandTotal, GrandTotal); + } + + /** Get Grand Total. + @return Total amount of document + */ + public BigDecimal getGrandTotal () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_GrandTotal); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** InvoiceCollectionType AD_Reference_ID=394 */ + public static final int INVOICECOLLECTIONTYPE_AD_Reference_ID=394; + /** Dunning = D */ + public static final String INVOICECOLLECTIONTYPE_Dunning = "D"; + /** Collection Agency = C */ + public static final String INVOICECOLLECTIONTYPE_CollectionAgency = "C"; + /** Legal Procedure = L */ + public static final String INVOICECOLLECTIONTYPE_LegalProcedure = "L"; + /** Uncollectable = U */ + public static final String INVOICECOLLECTIONTYPE_Uncollectable = "U"; + /** Set Collection Status. + @param InvoiceCollectionType + Invoice Collection Status + */ + public void setInvoiceCollectionType (String InvoiceCollectionType) + { + + if (InvoiceCollectionType == null || InvoiceCollectionType.equals("D") || InvoiceCollectionType.equals("C") || InvoiceCollectionType.equals("L") || InvoiceCollectionType.equals("U")); else throw new IllegalArgumentException ("InvoiceCollectionType Invalid value - " + InvoiceCollectionType + " - Reference_ID=394 - D - C - L - U"); + if (InvoiceCollectionType != null && InvoiceCollectionType.length() > 1) + { + log.warning("Length > 1 - truncated"); + InvoiceCollectionType = InvoiceCollectionType.substring(0, 1); + } + set_Value (COLUMNNAME_InvoiceCollectionType, InvoiceCollectionType); + } + + /** Get Collection Status. + @return Invoice Collection Status + */ + public String getInvoiceCollectionType () + { + return (String)get_Value(COLUMNNAME_InvoiceCollectionType); + } + + /** Set Approved. + @param IsApproved + Indicates if this document requires approval + */ + public void setIsApproved (boolean IsApproved) + { + set_ValueNoCheck (COLUMNNAME_IsApproved, Boolean.valueOf(IsApproved)); + } + + /** Get Approved. + @return Indicates if this document requires approval + */ + public boolean isApproved () + { + Object oo = get_Value(COLUMNNAME_IsApproved); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Discount Printed. + @param IsDiscountPrinted + Print Discount on Invoice and Order + */ + public void setIsDiscountPrinted (boolean IsDiscountPrinted) + { + set_Value (COLUMNNAME_IsDiscountPrinted, Boolean.valueOf(IsDiscountPrinted)); + } + + /** Get Discount Printed. + @return Print Discount on Invoice and Order + */ + public boolean isDiscountPrinted () + { + Object oo = get_Value(COLUMNNAME_IsDiscountPrinted); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set In Dispute. + @param IsInDispute + Document is in dispute + */ + public void setIsInDispute (boolean IsInDispute) + { + set_Value (COLUMNNAME_IsInDispute, Boolean.valueOf(IsInDispute)); + } + + /** Get In Dispute. + @return Document is in dispute + */ + public boolean isInDispute () + { + Object oo = get_Value(COLUMNNAME_IsInDispute); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Paid. + @param IsPaid + The document is paid + */ + public void setIsPaid (boolean IsPaid) + { + set_Value (COLUMNNAME_IsPaid, Boolean.valueOf(IsPaid)); + } + + /** Get Paid. + @return The document is paid + */ + public boolean isPaid () + { + Object oo = get_Value(COLUMNNAME_IsPaid); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Pay Schedule valid. + @param IsPayScheduleValid + Is the Payment Schedule is valid + */ + public void setIsPayScheduleValid (boolean IsPayScheduleValid) + { + set_ValueNoCheck (COLUMNNAME_IsPayScheduleValid, Boolean.valueOf(IsPayScheduleValid)); + } + + /** Get Pay Schedule valid. + @return Is the Payment Schedule is valid + */ + public boolean isPayScheduleValid () + { + Object oo = get_Value(COLUMNNAME_IsPayScheduleValid); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Printed. + @param IsPrinted + Indicates if this document / line is printed + */ + public void setIsPrinted (boolean IsPrinted) + { + set_ValueNoCheck (COLUMNNAME_IsPrinted, Boolean.valueOf(IsPrinted)); + } + + /** Get Printed. + @return Indicates if this document / line is printed + */ + public boolean isPrinted () + { + Object oo = get_Value(COLUMNNAME_IsPrinted); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Self-Service. + @param IsSelfService + This is a Self-Service entry or this entry can be changed via Self-Service + */ + public void setIsSelfService (boolean IsSelfService) + { + set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService)); + } + + /** Get Self-Service. + @return This is a Self-Service entry or this entry can be changed via Self-Service + */ + public boolean isSelfService () + { + Object oo = get_Value(COLUMNNAME_IsSelfService); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Sales Transaction. + @param IsSOTrx + This is a Sales Transaction + */ + public void setIsSOTrx (boolean IsSOTrx) + { + set_ValueNoCheck (COLUMNNAME_IsSOTrx, Boolean.valueOf(IsSOTrx)); + } + + /** Get Sales Transaction. + @return This is a Sales Transaction + */ + public boolean isSOTrx () + { + Object oo = get_Value(COLUMNNAME_IsSOTrx); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Price includes Tax. + @param IsTaxIncluded + Tax is included in the price + */ + public void setIsTaxIncluded (boolean IsTaxIncluded) + { + set_Value (COLUMNNAME_IsTaxIncluded, Boolean.valueOf(IsTaxIncluded)); + } + + /** Get Price includes Tax. + @return Tax is included in the price + */ + public boolean isTaxIncluded () + { + Object oo = get_Value(COLUMNNAME_IsTaxIncluded); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Transferred. + @param IsTransferred + Transferred to General Ledger (i.e. accounted) + */ + public void setIsTransferred (boolean IsTransferred) + { + set_ValueNoCheck (COLUMNNAME_IsTransferred, Boolean.valueOf(IsTransferred)); + } + + /** Get Transferred. + @return Transferred to General Ledger (i.e. accounted) + */ + public boolean isTransferred () + { + Object oo = get_Value(COLUMNNAME_IsTransferred); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + public I_M_PriceList getM_PriceList() throws Exception + { + Class clazz = MTable.getClass(I_M_PriceList.Table_Name); + I_M_PriceList result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_PriceList)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_PriceList_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Price List. + @param M_PriceList_ID + Unique identifier of a Price List + */ + public void setM_PriceList_ID (int M_PriceList_ID) + { + if (M_PriceList_ID < 1) + throw new IllegalArgumentException ("M_PriceList_ID is mandatory."); + set_Value (COLUMNNAME_M_PriceList_ID, Integer.valueOf(M_PriceList_ID)); + } + + /** Get Price List. + @return Unique identifier of a Price List + */ + public int getM_PriceList_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_PriceList_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_M_RMA getM_RMA() throws Exception + { + Class clazz = MTable.getClass(I_M_RMA.Table_Name); + I_M_RMA result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_RMA)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_RMA_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set RMA. + @param M_RMA_ID + Return Material Authorization + */ + public void setM_RMA_ID (int M_RMA_ID) + { + if (M_RMA_ID < 1) + set_Value (COLUMNNAME_M_RMA_ID, null); + else + set_Value (COLUMNNAME_M_RMA_ID, Integer.valueOf(M_RMA_ID)); + } + + /** Get RMA. + @return Return Material Authorization + */ + public int getM_RMA_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_RMA_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** PaymentRule AD_Reference_ID=195 */ + public static final int PAYMENTRULE_AD_Reference_ID=195; + /** Cash = B */ + public static final String PAYMENTRULE_Cash = "B"; + /** Credit Card = K */ + public static final String PAYMENTRULE_CreditCard = "K"; + /** Direct Deposit = T */ + public static final String PAYMENTRULE_DirectDeposit = "T"; + /** Check = S */ + public static final String PAYMENTRULE_Check = "S"; + /** On Credit = P */ + public static final String PAYMENTRULE_OnCredit = "P"; + /** Direct Debit = D */ + public static final String PAYMENTRULE_DirectDebit = "D"; + /** Mixed = M */ + public static final String PAYMENTRULE_Mixed = "M"; + /** Set Payment Rule. + @param PaymentRule + How you pay the invoice + */ + public void setPaymentRule (String PaymentRule) + { + if (PaymentRule == null) throw new IllegalArgumentException ("PaymentRule is mandatory"); + if (PaymentRule.equals("B") || PaymentRule.equals("K") || PaymentRule.equals("T") || PaymentRule.equals("S") || PaymentRule.equals("P") || PaymentRule.equals("D") || PaymentRule.equals("M")); else throw new IllegalArgumentException ("PaymentRule Invalid value - " + PaymentRule + " - Reference_ID=195 - B - K - T - S - P - D - M"); + if (PaymentRule.length() > 1) + { + log.warning("Length > 1 - truncated"); + PaymentRule = PaymentRule.substring(0, 1); + } + set_Value (COLUMNNAME_PaymentRule, PaymentRule); + } + + /** Get Payment Rule. + @return How you pay the invoice + */ + public String getPaymentRule () + { + return (String)get_Value(COLUMNNAME_PaymentRule); + } + + /** Set Order Reference. + @param POReference + Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner + */ + public void setPOReference (String POReference) + { + + if (POReference != null && POReference.length() > 20) + { + log.warning("Length > 20 - truncated"); + POReference = POReference.substring(0, 20); + } + set_Value (COLUMNNAME_POReference, POReference); + } + + /** Get Order Reference. + @return Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner + */ + public String getPOReference () + { + return (String)get_Value(COLUMNNAME_POReference); + } + + /** Set Posted. + @param Posted + Posting status + */ + public void setPosted (boolean Posted) + { + set_Value (COLUMNNAME_Posted, Boolean.valueOf(Posted)); + } + + /** Get Posted. + @return Posting status + */ + public boolean isPosted () + { + Object oo = get_Value(COLUMNNAME_Posted); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Processed. + @param Processed + The document has been processed + */ + public void setProcessed (boolean Processed) + { + set_ValueNoCheck (COLUMNNAME_Processed, Boolean.valueOf(Processed)); + } + + /** Get Processed. + @return The document has been processed + */ + public boolean isProcessed () + { + Object oo = get_Value(COLUMNNAME_Processed); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Process Now. + @param Processing Process Now */ + public void setProcessing (boolean Processing) + { + set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); + } + + /** Get Process Now. + @return Process Now */ + public boolean isProcessing () + { + Object oo = get_Value(COLUMNNAME_Processing); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Referenced Invoice. + @param Ref_Invoice_ID Referenced Invoice */ + public void setRef_Invoice_ID (int Ref_Invoice_ID) + { + if (Ref_Invoice_ID < 1) + set_Value (COLUMNNAME_Ref_Invoice_ID, null); + else + set_Value (COLUMNNAME_Ref_Invoice_ID, Integer.valueOf(Ref_Invoice_ID)); + } + + /** Get Referenced Invoice. + @return Referenced Invoice */ + public int getRef_Invoice_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Ref_Invoice_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** SalesRep_ID AD_Reference_ID=190 */ + public static final int SALESREP_ID_AD_Reference_ID=190; + /** Set Sales Representative. + @param SalesRep_ID + Sales Representative or Company Agent + */ + public void setSalesRep_ID (int SalesRep_ID) + { + if (SalesRep_ID < 1) + set_Value (COLUMNNAME_SalesRep_ID, null); + else + set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID)); + } + + /** Get Sales Representative. + @return Sales Representative or Company Agent + */ + public int getSalesRep_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Send EMail. + @param SendEMail + Enable sending Document EMail + */ + public void setSendEMail (boolean SendEMail) + { + set_Value (COLUMNNAME_SendEMail, Boolean.valueOf(SendEMail)); + } + + /** Get Send EMail. + @return Enable sending Document EMail + */ + public boolean isSendEMail () + { + Object oo = get_Value(COLUMNNAME_SendEMail); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Total Lines. + @param TotalLines + Total of all document lines + */ + public void setTotalLines (BigDecimal TotalLines) + { + if (TotalLines == null) + throw new IllegalArgumentException ("TotalLines is mandatory."); + set_ValueNoCheck (COLUMNNAME_TotalLines, TotalLines); + } + + /** Get Total Lines. + @return Total of all document lines + */ + public BigDecimal getTotalLines () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalLines); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** User1_ID AD_Reference_ID=134 */ + public static final int USER1_ID_AD_Reference_ID=134; + /** Set User List 1. + @param User1_ID + User defined list element #1 + */ + public void setUser1_ID (int User1_ID) + { + if (User1_ID < 1) + set_Value (COLUMNNAME_User1_ID, null); + else + set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID)); + } + + /** Get User List 1. + @return User defined list element #1 + */ + public int getUser1_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** User2_ID AD_Reference_ID=137 */ + public static final int USER2_ID_AD_Reference_ID=137; + /** Set User List 2. + @param User2_ID + User defined list element #2 + */ + public void setUser2_ID (int User2_ID) + { + if (User2_ID < 1) + set_Value (COLUMNNAME_User2_ID, null); + else + set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID)); + } + + /** Get User List 2. + @return User defined list element #2 + */ + public int getUser2_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_User2_ID); + if (ii == null) + return 0; + return ii.intValue(); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_C_Order.java b/posterita/posterita/src/main/org/compiere/model/X_C_Order.java new file mode 100644 index 0000000000..c49bd4c9ac --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_C_Order.java @@ -0,0 +1,2117 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.Properties; +import java.util.logging.Level; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for C_Order + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_C_Order extends PO implements I_C_Order, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_C_Order (Properties ctx, int C_Order_ID, String trxName) + { + super (ctx, C_Order_ID, trxName); + /** if (C_Order_ID == 0) + { + setC_BPartner_ID (0); + setC_BPartner_Location_ID (0); + setC_Currency_ID (0); +// @C_Currency_ID@ + setC_DocType_ID (0); +// 0 + setC_DocTypeTarget_ID (0); + setC_Order_ID (0); + setC_PaymentTerm_ID (0); + setDateAcct (new Timestamp(System.currentTimeMillis())); +// @#Date@ + setDateOrdered (new Timestamp(System.currentTimeMillis())); +// @#Date@ + setDatePromised (new Timestamp(System.currentTimeMillis())); +// @#Date@ + setDeliveryRule (null); +// F + setDeliveryViaRule (null); +// P + setDocAction (null); +// CO + setDocStatus (null); +// DR + setDocumentNo (null); + setFreightAmt (Env.ZERO); + setFreightCostRule (null); +// I + setGrandTotal (Env.ZERO); + setInvoiceRule (null); +// I + setIsApproved (false); +// @IsApproved@ + setIsCreditApproved (false); + setIsDelivered (false); + setIsDiscountPrinted (false); + setIsDropShip (false); +// N + setIsInvoiced (false); + setIsPrinted (false); + setIsSelected (false); + setIsSelfService (false); + setIsSOTrx (false); +// @IsSOTrx@ + setIsTaxIncluded (false); + setIsTransferred (false); + setM_PriceList_ID (0); + setM_Warehouse_ID (0); + setPaymentRule (null); +// B + setPosted (false); +// N + setPriorityRule (null); +// 5 + setProcessed (false); + setSalesRep_ID (0); + setSendEMail (false); + setTotalLines (Env.ZERO); + } */ + } + + /** Load Constructor */ + public X_C_Order (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 1 - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_C_Order[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** AD_OrgTrx_ID AD_Reference_ID=130 */ + public static final int AD_ORGTRX_ID_AD_Reference_ID=130; + /** Set Trx Organization. + @param AD_OrgTrx_ID + Performing or initiating organization + */ + public void setAD_OrgTrx_ID (int AD_OrgTrx_ID) + { + if (AD_OrgTrx_ID < 1) + set_Value (COLUMNNAME_AD_OrgTrx_ID, null); + else + set_Value (COLUMNNAME_AD_OrgTrx_ID, Integer.valueOf(AD_OrgTrx_ID)); + } + + /** Get Trx Organization. + @return Performing or initiating organization + */ + public int getAD_OrgTrx_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_OrgTrx_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_AD_User getAD_User() throws Exception + { + Class clazz = MTable.getClass(I_AD_User.Table_Name); + I_AD_User result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_AD_User)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_User_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set User/Contact. + @param AD_User_ID + User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID) + { + if (AD_User_ID < 0) + set_Value (COLUMNNAME_AD_User_ID, null); + else + set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID)); + } + + /** Get User/Contact. + @return User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set AmountRefunded. + @param AmountRefunded AmountRefunded */ + public void setAmountRefunded (BigDecimal AmountRefunded) + { + set_Value (COLUMNNAME_AmountRefunded, AmountRefunded); + } + + /** Get AmountRefunded. + @return AmountRefunded */ + public BigDecimal getAmountRefunded () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_AmountRefunded); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set AmountTendered. + @param AmountTendered AmountTendered */ + public void setAmountTendered (BigDecimal AmountTendered) + { + set_Value (COLUMNNAME_AmountTendered, AmountTendered); + } + + /** Get AmountTendered. + @return AmountTendered */ + public BigDecimal getAmountTendered () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_AmountTendered); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Bill_BPartner_ID AD_Reference_ID=138 */ + public static final int BILL_BPARTNER_ID_AD_Reference_ID=138; + /** Set Invoice Partner. + @param Bill_BPartner_ID + Business Partner to be invoiced + */ + public void setBill_BPartner_ID (int Bill_BPartner_ID) + { + if (Bill_BPartner_ID < 1) + set_Value (COLUMNNAME_Bill_BPartner_ID, null); + else + set_Value (COLUMNNAME_Bill_BPartner_ID, Integer.valueOf(Bill_BPartner_ID)); + } + + /** Get Invoice Partner. + @return Business Partner to be invoiced + */ + public int getBill_BPartner_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Bill_BPartner_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Bill_Location_ID AD_Reference_ID=159 */ + public static final int BILL_LOCATION_ID_AD_Reference_ID=159; + /** Set Invoice Location. + @param Bill_Location_ID + Business Partner Location for invoicing + */ + public void setBill_Location_ID (int Bill_Location_ID) + { + if (Bill_Location_ID < 1) + set_Value (COLUMNNAME_Bill_Location_ID, null); + else + set_Value (COLUMNNAME_Bill_Location_ID, Integer.valueOf(Bill_Location_ID)); + } + + /** Get Invoice Location. + @return Business Partner Location for invoicing + */ + public int getBill_Location_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Bill_Location_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Bill_User_ID AD_Reference_ID=110 */ + public static final int BILL_USER_ID_AD_Reference_ID=110; + /** Set Invoice Contact. + @param Bill_User_ID + Business Partner Contact for invoicing + */ + public void setBill_User_ID (int Bill_User_ID) + { + if (Bill_User_ID < 1) + set_Value (COLUMNNAME_Bill_User_ID, null); + else + set_Value (COLUMNNAME_Bill_User_ID, Integer.valueOf(Bill_User_ID)); + } + + /** Get Invoice Contact. + @return Business Partner Contact for invoicing + */ + public int getBill_User_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Bill_User_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Activity getC_Activity() throws Exception + { + Class clazz = MTable.getClass(I_C_Activity.Table_Name); + I_C_Activity result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Activity)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Activity_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Activity. + @param C_Activity_ID + Business Activity + */ + public void setC_Activity_ID (int C_Activity_ID) + { + if (C_Activity_ID < 1) + set_Value (COLUMNNAME_C_Activity_ID, null); + else + set_Value (COLUMNNAME_C_Activity_ID, Integer.valueOf(C_Activity_ID)); + } + + /** Get Activity. + @return Business Activity + */ + public int getC_Activity_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Activity_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_BPartner getC_BPartner() throws Exception + { + Class clazz = MTable.getClass(I_C_BPartner.Table_Name); + I_C_BPartner result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_BPartner)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_BPartner_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Business Partner . + @param C_BPartner_ID + Identifies a Business Partner + */ + public void setC_BPartner_ID (int C_BPartner_ID) + { + if (C_BPartner_ID < 1) + throw new IllegalArgumentException ("C_BPartner_ID is mandatory."); + set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID)); + } + + /** Get Business Partner . + @return Identifies a Business Partner + */ + public int getC_BPartner_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_BPartner_Location getC_BPartner_Location() throws Exception + { + Class clazz = MTable.getClass(I_C_BPartner_Location.Table_Name); + I_C_BPartner_Location result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_BPartner_Location)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_BPartner_Location_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Partner Location. + @param C_BPartner_Location_ID + Identifies the (ship to) address for this Business Partner + */ + public void setC_BPartner_Location_ID (int C_BPartner_Location_ID) + { + if (C_BPartner_Location_ID < 1) + throw new IllegalArgumentException ("C_BPartner_Location_ID is mandatory."); + set_Value (COLUMNNAME_C_BPartner_Location_ID, Integer.valueOf(C_BPartner_Location_ID)); + } + + /** Get Partner Location. + @return Identifies the (ship to) address for this Business Partner + */ + public int getC_BPartner_Location_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_Location_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Campaign getC_Campaign() throws Exception + { + Class clazz = MTable.getClass(I_C_Campaign.Table_Name); + I_C_Campaign result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Campaign)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Campaign_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Campaign. + @param C_Campaign_ID + Marketing Campaign + */ + public void setC_Campaign_ID (int C_Campaign_ID) + { + if (C_Campaign_ID < 1) + set_Value (COLUMNNAME_C_Campaign_ID, null); + else + set_Value (COLUMNNAME_C_Campaign_ID, Integer.valueOf(C_Campaign_ID)); + } + + /** Get Campaign. + @return Marketing Campaign + */ + public int getC_Campaign_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Campaign_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_CashLine getC_CashLine() throws Exception + { + Class clazz = MTable.getClass(I_C_CashLine.Table_Name); + I_C_CashLine result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_CashLine)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_CashLine_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Cash Journal Line. + @param C_CashLine_ID + Cash Journal Line + */ + public void setC_CashLine_ID (int C_CashLine_ID) + { + if (C_CashLine_ID < 1) + set_Value (COLUMNNAME_C_CashLine_ID, null); + else + set_Value (COLUMNNAME_C_CashLine_ID, Integer.valueOf(C_CashLine_ID)); + } + + /** Get Cash Journal Line. + @return Cash Journal Line + */ + public int getC_CashLine_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_CashLine_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** C_Charge_ID AD_Reference_ID=200 */ + public static final int C_CHARGE_ID_AD_Reference_ID=200; + /** Set Charge. + @param C_Charge_ID + Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID) + { + if (C_Charge_ID < 1) + set_Value (COLUMNNAME_C_Charge_ID, null); + else + set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID)); + } + + /** Get Charge. + @return Additional document charges + */ + public int getC_Charge_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_ConversionType getC_ConversionType() throws Exception + { + Class clazz = MTable.getClass(I_C_ConversionType.Table_Name); + I_C_ConversionType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_ConversionType)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_ConversionType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency Type. + @param C_ConversionType_ID + Currency Conversion Rate Type + */ + public void setC_ConversionType_ID (int C_ConversionType_ID) + { + if (C_ConversionType_ID < 1) + set_Value (COLUMNNAME_C_ConversionType_ID, null); + else + set_Value (COLUMNNAME_C_ConversionType_ID, Integer.valueOf(C_ConversionType_ID)); + } + + /** Get Currency Type. + @return Currency Conversion Rate Type + */ + public int getC_ConversionType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_ConversionType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Currency getC_Currency() throws Exception + { + Class clazz = MTable.getClass(I_C_Currency.Table_Name); + I_C_Currency result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Currency)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Currency_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency. + @param C_Currency_ID + The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID) + { + if (C_Currency_ID < 1) + throw new IllegalArgumentException ("C_Currency_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID)); + } + + /** Get Currency. + @return The Currency for this record + */ + public int getC_Currency_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** C_DocType_ID AD_Reference_ID=170 */ + public static final int C_DOCTYPE_ID_AD_Reference_ID=170; + public I_C_DocType getC_DocType() throws Exception + { + Class clazz = MTable.getClass(I_C_DocType.Table_Name); + I_C_DocType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_DocType)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DocType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Document Type. + @param C_DocType_ID + Document type or rules + */ + public void setC_DocType_ID (int C_DocType_ID) + { + if (C_DocType_ID < 0) + throw new IllegalArgumentException ("C_DocType_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID)); + } + + /** Get Document Type. + @return Document type or rules + */ + public int getC_DocType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** C_DocTypeTarget_ID AD_Reference_ID=170 */ + public static final int C_DOCTYPETARGET_ID_AD_Reference_ID=170; + /** Set Target Document Type. + @param C_DocTypeTarget_ID + Target document type for conversing documents + */ + public void setC_DocTypeTarget_ID (int C_DocTypeTarget_ID) + { + if (C_DocTypeTarget_ID < 1) + throw new IllegalArgumentException ("C_DocTypeTarget_ID is mandatory."); + set_Value (COLUMNNAME_C_DocTypeTarget_ID, Integer.valueOf(C_DocTypeTarget_ID)); + } + + /** Get Target Document Type. + @return Target document type for conversing documents + */ + public int getC_DocTypeTarget_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_DocTypeTarget_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Charge amount. + @param ChargeAmt + Charge Amount + */ + public void setChargeAmt (BigDecimal ChargeAmt) + { + set_Value (COLUMNNAME_ChargeAmt, ChargeAmt); + } + + /** Get Charge amount. + @return Charge Amount + */ + public BigDecimal getChargeAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ChargeAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Copy From. + @param CopyFrom + Copy From Record + */ + public void setCopyFrom (String CopyFrom) + { + + if (CopyFrom != null && CopyFrom.length() > 1) + { + log.warning("Length > 1 - truncated"); + CopyFrom = CopyFrom.substring(0, 1); + } + set_Value (COLUMNNAME_CopyFrom, CopyFrom); + } + + /** Get Copy From. + @return Copy From Record + */ + public String getCopyFrom () + { + return (String)get_Value(COLUMNNAME_CopyFrom); + } + + /** Set Order. + @param C_Order_ID + Order + */ + public void setC_Order_ID (int C_Order_ID) + { + if (C_Order_ID < 1) + throw new IllegalArgumentException ("C_Order_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_Order_ID, Integer.valueOf(C_Order_ID)); + } + + /** Get Order. + @return Order + */ + public int getC_Order_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Order_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Payment getC_Payment() throws Exception + { + Class clazz = MTable.getClass(I_C_Payment.Table_Name); + I_C_Payment result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Payment)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Payment_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Payment. + @param C_Payment_ID + Payment identifier + */ + public void setC_Payment_ID (int C_Payment_ID) + { + if (C_Payment_ID < 1) + set_Value (COLUMNNAME_C_Payment_ID, null); + else + set_Value (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID)); + } + + /** Get Payment. + @return Payment identifier + */ + public int getC_Payment_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_PaymentTerm getC_PaymentTerm() throws Exception + { + Class clazz = MTable.getClass(I_C_PaymentTerm.Table_Name); + I_C_PaymentTerm result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_PaymentTerm)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_PaymentTerm_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Payment Term. + @param C_PaymentTerm_ID + The terms of Payment (timing, discount) + */ + public void setC_PaymentTerm_ID (int C_PaymentTerm_ID) + { + if (C_PaymentTerm_ID < 1) + throw new IllegalArgumentException ("C_PaymentTerm_ID is mandatory."); + set_Value (COLUMNNAME_C_PaymentTerm_ID, Integer.valueOf(C_PaymentTerm_ID)); + } + + /** Get Payment Term. + @return The terms of Payment (timing, discount) + */ + public int getC_PaymentTerm_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_PaymentTerm_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_POS getC_POS() throws Exception + { + Class clazz = MTable.getClass(I_C_POS.Table_Name); + I_C_POS result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_POS)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_POS_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set POS Terminal. + @param C_POS_ID + Point of Sales Terminal + */ + public void setC_POS_ID (int C_POS_ID) + { + if (C_POS_ID < 1) + set_Value (COLUMNNAME_C_POS_ID, null); + else + set_Value (COLUMNNAME_C_POS_ID, Integer.valueOf(C_POS_ID)); + } + + /** Get POS Terminal. + @return Point of Sales Terminal + */ + public int getC_POS_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_POS_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Project getC_Project() throws Exception + { + Class clazz = MTable.getClass(I_C_Project.Table_Name); + I_C_Project result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Project)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Project_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Project. + @param C_Project_ID + Financial Project + */ + public void setC_Project_ID (int C_Project_ID) + { + if (C_Project_ID < 1) + set_Value (COLUMNNAME_C_Project_ID, null); + else + set_Value (COLUMNNAME_C_Project_ID, Integer.valueOf(C_Project_ID)); + } + + /** Get Project. + @return Financial Project + */ + public int getC_Project_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Project_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Account Date. + @param DateAcct + Accounting Date + */ + public void setDateAcct (Timestamp DateAcct) + { + if (DateAcct == null) + throw new IllegalArgumentException ("DateAcct is mandatory."); + set_Value (COLUMNNAME_DateAcct, DateAcct); + } + + /** Get Account Date. + @return Accounting Date + */ + public Timestamp getDateAcct () + { + return (Timestamp)get_Value(COLUMNNAME_DateAcct); + } + + /** Set Date Ordered. + @param DateOrdered + Date of Order + */ + public void setDateOrdered (Timestamp DateOrdered) + { + if (DateOrdered == null) + throw new IllegalArgumentException ("DateOrdered is mandatory."); + set_Value (COLUMNNAME_DateOrdered, DateOrdered); + } + + /** Get Date Ordered. + @return Date of Order + */ + public Timestamp getDateOrdered () + { + return (Timestamp)get_Value(COLUMNNAME_DateOrdered); + } + + /** Set Date printed. + @param DatePrinted + Date the document was printed. + */ + public void setDatePrinted (Timestamp DatePrinted) + { + set_Value (COLUMNNAME_DatePrinted, DatePrinted); + } + + /** Get Date printed. + @return Date the document was printed. + */ + public Timestamp getDatePrinted () + { + return (Timestamp)get_Value(COLUMNNAME_DatePrinted); + } + + /** Set Date Promised. + @param DatePromised + Date Order was promised + */ + public void setDatePromised (Timestamp DatePromised) + { + if (DatePromised == null) + throw new IllegalArgumentException ("DatePromised is mandatory."); + set_Value (COLUMNNAME_DatePromised, DatePromised); + } + + /** Get Date Promised. + @return Date Order was promised + */ + public Timestamp getDatePromised () + { + return (Timestamp)get_Value(COLUMNNAME_DatePromised); + } + + /** DeliveryRule AD_Reference_ID=151 */ + public static final int DELIVERYRULE_AD_Reference_ID=151; + /** After Receipt = R */ + public static final String DELIVERYRULE_AfterReceipt = "R"; + /** Availability = A */ + public static final String DELIVERYRULE_Availability = "A"; + /** Complete Line = L */ + public static final String DELIVERYRULE_CompleteLine = "L"; + /** Complete Order = O */ + public static final String DELIVERYRULE_CompleteOrder = "O"; + /** Force = F */ + public static final String DELIVERYRULE_Force = "F"; + /** Manual = M */ + public static final String DELIVERYRULE_Manual = "M"; + /** Set Delivery Rule. + @param DeliveryRule + Defines the timing of Delivery + */ + public void setDeliveryRule (String DeliveryRule) + { + if (DeliveryRule == null) throw new IllegalArgumentException ("DeliveryRule is mandatory"); + if (DeliveryRule.equals("R") || DeliveryRule.equals("A") || DeliveryRule.equals("L") || DeliveryRule.equals("O") || DeliveryRule.equals("F") || DeliveryRule.equals("M")); else throw new IllegalArgumentException ("DeliveryRule Invalid value - " + DeliveryRule + " - Reference_ID=151 - R - A - L - O - F - M"); + if (DeliveryRule.length() > 1) + { + log.warning("Length > 1 - truncated"); + DeliveryRule = DeliveryRule.substring(0, 1); + } + set_Value (COLUMNNAME_DeliveryRule, DeliveryRule); + } + + /** Get Delivery Rule. + @return Defines the timing of Delivery + */ + public String getDeliveryRule () + { + return (String)get_Value(COLUMNNAME_DeliveryRule); + } + + /** DeliveryViaRule AD_Reference_ID=152 */ + public static final int DELIVERYVIARULE_AD_Reference_ID=152; + /** Pickup = P */ + public static final String DELIVERYVIARULE_Pickup = "P"; + /** Delivery = D */ + public static final String DELIVERYVIARULE_Delivery = "D"; + /** Shipper = S */ + public static final String DELIVERYVIARULE_Shipper = "S"; + /** Set Delivery Via. + @param DeliveryViaRule + How the order will be delivered + */ + public void setDeliveryViaRule (String DeliveryViaRule) + { + if (DeliveryViaRule == null) throw new IllegalArgumentException ("DeliveryViaRule is mandatory"); + if (DeliveryViaRule.equals("P") || DeliveryViaRule.equals("D") || DeliveryViaRule.equals("S")); else throw new IllegalArgumentException ("DeliveryViaRule Invalid value - " + DeliveryViaRule + " - Reference_ID=152 - P - D - S"); + if (DeliveryViaRule.length() > 1) + { + log.warning("Length > 1 - truncated"); + DeliveryViaRule = DeliveryViaRule.substring(0, 1); + } + set_Value (COLUMNNAME_DeliveryViaRule, DeliveryViaRule); + } + + /** Get Delivery Via. + @return How the order will be delivered + */ + public String getDeliveryViaRule () + { + return (String)get_Value(COLUMNNAME_DeliveryViaRule); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** DocAction AD_Reference_ID=135 */ + public static final int DOCACTION_AD_Reference_ID=135; + /** Complete = CO */ + public static final String DOCACTION_Complete = "CO"; + /** Approve = AP */ + public static final String DOCACTION_Approve = "AP"; + /** Reject = RJ */ + public static final String DOCACTION_Reject = "RJ"; + /** Post = PO */ + public static final String DOCACTION_Post = "PO"; + /** Void = VO */ + public static final String DOCACTION_Void = "VO"; + /** Close = CL */ + public static final String DOCACTION_Close = "CL"; + /** Reverse - Correct = RC */ + public static final String DOCACTION_Reverse_Correct = "RC"; + /** Reverse - Accrual = RA */ + public static final String DOCACTION_Reverse_Accrual = "RA"; + /** Invalidate = IN */ + public static final String DOCACTION_Invalidate = "IN"; + /** Re-activate = RE */ + public static final String DOCACTION_Re_Activate = "RE"; + /** = -- */ + public static final String DOCACTION_None = "--"; + /** Prepare = PR */ + public static final String DOCACTION_Prepare = "PR"; + /** Unlock = XL */ + public static final String DOCACTION_Unlock = "XL"; + /** Wait Complete = WC */ + public static final String DOCACTION_WaitComplete = "WC"; + /** Set Document Action. + @param DocAction + The targeted status of the document + */ + public void setDocAction (String DocAction) + { + if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory"); + if (DocAction.equals("CO") || DocAction.equals("AP") || DocAction.equals("RJ") || DocAction.equals("PO") || DocAction.equals("VO") || DocAction.equals("CL") || DocAction.equals("RC") || DocAction.equals("RA") || DocAction.equals("IN") || DocAction.equals("RE") || DocAction.equals("--") || DocAction.equals("PR") || DocAction.equals("XL") || DocAction.equals("WC")); else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - CO - AP - RJ - PO - VO - CL - RC - RA - IN - RE - -- - PR - XL - WC"); + if (DocAction.length() > 2) + { + log.warning("Length > 2 - truncated"); + DocAction = DocAction.substring(0, 2); + } + set_Value (COLUMNNAME_DocAction, DocAction); + } + + /** Get Document Action. + @return The targeted status of the document + */ + public String getDocAction () + { + return (String)get_Value(COLUMNNAME_DocAction); + } + + /** DocStatus AD_Reference_ID=131 */ + public static final int DOCSTATUS_AD_Reference_ID=131; + /** Drafted = DR */ + public static final String DOCSTATUS_Drafted = "DR"; + /** Completed = CO */ + public static final String DOCSTATUS_Completed = "CO"; + /** Approved = AP */ + public static final String DOCSTATUS_Approved = "AP"; + /** Not Approved = NA */ + public static final String DOCSTATUS_NotApproved = "NA"; + /** Voided = VO */ + public static final String DOCSTATUS_Voided = "VO"; + /** Invalid = IN */ + public static final String DOCSTATUS_Invalid = "IN"; + /** Reversed = RE */ + public static final String DOCSTATUS_Reversed = "RE"; + /** Closed = CL */ + public static final String DOCSTATUS_Closed = "CL"; + /** Unknown = ?? */ + public static final String DOCSTATUS_Unknown = "??"; + /** In Progress = IP */ + public static final String DOCSTATUS_InProgress = "IP"; + /** Waiting Payment = WP */ + public static final String DOCSTATUS_WaitingPayment = "WP"; + /** Waiting Confirmation = WC */ + public static final String DOCSTATUS_WaitingConfirmation = "WC"; + /** Set Document Status. + @param DocStatus + The current status of the document + */ + public void setDocStatus (String DocStatus) + { + if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory"); + if (DocStatus.equals("DR") || DocStatus.equals("CO") || DocStatus.equals("AP") || DocStatus.equals("NA") || DocStatus.equals("VO") || DocStatus.equals("IN") || DocStatus.equals("RE") || DocStatus.equals("CL") || DocStatus.equals("??") || DocStatus.equals("IP") || DocStatus.equals("WP") || DocStatus.equals("WC")); else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - DR - CO - AP - NA - VO - IN - RE - CL - ?? - IP - WP - WC"); + if (DocStatus.length() > 2) + { + log.warning("Length > 2 - truncated"); + DocStatus = DocStatus.substring(0, 2); + } + set_Value (COLUMNNAME_DocStatus, DocStatus); + } + + /** Get Document Status. + @return The current status of the document + */ + public String getDocStatus () + { + return (String)get_Value(COLUMNNAME_DocStatus); + } + + /** Set Document No. + @param DocumentNo + Document sequence number of the document + */ + public void setDocumentNo (String DocumentNo) + { + if (DocumentNo == null) + throw new IllegalArgumentException ("DocumentNo is mandatory."); + + if (DocumentNo.length() > 30) + { + log.warning("Length > 30 - truncated"); + DocumentNo = DocumentNo.substring(0, 30); + } + set_ValueNoCheck (COLUMNNAME_DocumentNo, DocumentNo); + } + + /** Get Document No. + @return Document sequence number of the document + */ + public String getDocumentNo () + { + return (String)get_Value(COLUMNNAME_DocumentNo); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), getDocumentNo()); + } + + /** Set Freight Amount. + @param FreightAmt + Freight Amount + */ + public void setFreightAmt (BigDecimal FreightAmt) + { + if (FreightAmt == null) + throw new IllegalArgumentException ("FreightAmt is mandatory."); + set_Value (COLUMNNAME_FreightAmt, FreightAmt); + } + + /** Get Freight Amount. + @return Freight Amount + */ + public BigDecimal getFreightAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FreightAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** FreightCostRule AD_Reference_ID=153 */ + public static final int FREIGHTCOSTRULE_AD_Reference_ID=153; + /** Freight included = I */ + public static final String FREIGHTCOSTRULE_FreightIncluded = "I"; + /** Fix price = F */ + public static final String FREIGHTCOSTRULE_FixPrice = "F"; + /** Calculated = C */ + public static final String FREIGHTCOSTRULE_Calculated = "C"; + /** Line = L */ + public static final String FREIGHTCOSTRULE_Line = "L"; + /** Set Freight Cost Rule. + @param FreightCostRule + Method for charging Freight + */ + public void setFreightCostRule (String FreightCostRule) + { + if (FreightCostRule == null) throw new IllegalArgumentException ("FreightCostRule is mandatory"); + if (FreightCostRule.equals("I") || FreightCostRule.equals("F") || FreightCostRule.equals("C") || FreightCostRule.equals("L")); else throw new IllegalArgumentException ("FreightCostRule Invalid value - " + FreightCostRule + " - Reference_ID=153 - I - F - C - L"); + if (FreightCostRule.length() > 1) + { + log.warning("Length > 1 - truncated"); + FreightCostRule = FreightCostRule.substring(0, 1); + } + set_Value (COLUMNNAME_FreightCostRule, FreightCostRule); + } + + /** Get Freight Cost Rule. + @return Method for charging Freight + */ + public String getFreightCostRule () + { + return (String)get_Value(COLUMNNAME_FreightCostRule); + } + + /** Set Grand Total. + @param GrandTotal + Total amount of document + */ + public void setGrandTotal (BigDecimal GrandTotal) + { + if (GrandTotal == null) + throw new IllegalArgumentException ("GrandTotal is mandatory."); + set_ValueNoCheck (COLUMNNAME_GrandTotal, GrandTotal); + } + + /** Get Grand Total. + @return Total amount of document + */ + public BigDecimal getGrandTotal () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_GrandTotal); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** InvoiceRule AD_Reference_ID=150 */ + public static final int INVOICERULE_AD_Reference_ID=150; + /** After Order delivered = O */ + public static final String INVOICERULE_AfterOrderDelivered = "O"; + /** After Delivery = D */ + public static final String INVOICERULE_AfterDelivery = "D"; + /** Customer Schedule after Delivery = S */ + public static final String INVOICERULE_CustomerScheduleAfterDelivery = "S"; + /** Immediate = I */ + public static final String INVOICERULE_Immediate = "I"; + /** Set Invoice Rule. + @param InvoiceRule + Frequency and method of invoicing + */ + public void setInvoiceRule (String InvoiceRule) + { + if (InvoiceRule == null) throw new IllegalArgumentException ("InvoiceRule is mandatory"); + if (InvoiceRule.equals("O") || InvoiceRule.equals("D") || InvoiceRule.equals("S") || InvoiceRule.equals("I")); else throw new IllegalArgumentException ("InvoiceRule Invalid value - " + InvoiceRule + " - Reference_ID=150 - O - D - S - I"); + if (InvoiceRule.length() > 1) + { + log.warning("Length > 1 - truncated"); + InvoiceRule = InvoiceRule.substring(0, 1); + } + set_Value (COLUMNNAME_InvoiceRule, InvoiceRule); + } + + /** Get Invoice Rule. + @return Frequency and method of invoicing + */ + public String getInvoiceRule () + { + return (String)get_Value(COLUMNNAME_InvoiceRule); + } + + /** Set Approved. + @param IsApproved + Indicates if this document requires approval + */ + public void setIsApproved (boolean IsApproved) + { + set_ValueNoCheck (COLUMNNAME_IsApproved, Boolean.valueOf(IsApproved)); + } + + /** Get Approved. + @return Indicates if this document requires approval + */ + public boolean isApproved () + { + Object oo = get_Value(COLUMNNAME_IsApproved); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Credit Approved. + @param IsCreditApproved + Credit has been approved + */ + public void setIsCreditApproved (boolean IsCreditApproved) + { + set_ValueNoCheck (COLUMNNAME_IsCreditApproved, Boolean.valueOf(IsCreditApproved)); + } + + /** Get Credit Approved. + @return Credit has been approved + */ + public boolean isCreditApproved () + { + Object oo = get_Value(COLUMNNAME_IsCreditApproved); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Delivered. + @param IsDelivered Delivered */ + public void setIsDelivered (boolean IsDelivered) + { + set_ValueNoCheck (COLUMNNAME_IsDelivered, Boolean.valueOf(IsDelivered)); + } + + /** Get Delivered. + @return Delivered */ + public boolean isDelivered () + { + Object oo = get_Value(COLUMNNAME_IsDelivered); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Discount Printed. + @param IsDiscountPrinted + Print Discount on Invoice and Order + */ + public void setIsDiscountPrinted (boolean IsDiscountPrinted) + { + set_Value (COLUMNNAME_IsDiscountPrinted, Boolean.valueOf(IsDiscountPrinted)); + } + + /** Get Discount Printed. + @return Print Discount on Invoice and Order + */ + public boolean isDiscountPrinted () + { + Object oo = get_Value(COLUMNNAME_IsDiscountPrinted); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Drop Shipment. + @param IsDropShip + Drop Shipments are sent from the Vendor directly to the Customer + */ + public void setIsDropShip (boolean IsDropShip) + { + set_ValueNoCheck (COLUMNNAME_IsDropShip, Boolean.valueOf(IsDropShip)); + } + + /** Get Drop Shipment. + @return Drop Shipments are sent from the Vendor directly to the Customer + */ + public boolean isDropShip () + { + Object oo = get_Value(COLUMNNAME_IsDropShip); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Invoiced. + @param IsInvoiced + Is this invoiced? + */ + public void setIsInvoiced (boolean IsInvoiced) + { + set_ValueNoCheck (COLUMNNAME_IsInvoiced, Boolean.valueOf(IsInvoiced)); + } + + /** Get Invoiced. + @return Is this invoiced? + */ + public boolean isInvoiced () + { + Object oo = get_Value(COLUMNNAME_IsInvoiced); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Printed. + @param IsPrinted + Indicates if this document / line is printed + */ + public void setIsPrinted (boolean IsPrinted) + { + set_ValueNoCheck (COLUMNNAME_IsPrinted, Boolean.valueOf(IsPrinted)); + } + + /** Get Printed. + @return Indicates if this document / line is printed + */ + public boolean isPrinted () + { + Object oo = get_Value(COLUMNNAME_IsPrinted); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Selected. + @param IsSelected Selected */ + public void setIsSelected (boolean IsSelected) + { + set_Value (COLUMNNAME_IsSelected, Boolean.valueOf(IsSelected)); + } + + /** Get Selected. + @return Selected */ + public boolean isSelected () + { + Object oo = get_Value(COLUMNNAME_IsSelected); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Self-Service. + @param IsSelfService + This is a Self-Service entry or this entry can be changed via Self-Service + */ + public void setIsSelfService (boolean IsSelfService) + { + set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService)); + } + + /** Get Self-Service. + @return This is a Self-Service entry or this entry can be changed via Self-Service + */ + public boolean isSelfService () + { + Object oo = get_Value(COLUMNNAME_IsSelfService); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Sales Transaction. + @param IsSOTrx + This is a Sales Transaction + */ + public void setIsSOTrx (boolean IsSOTrx) + { + set_Value (COLUMNNAME_IsSOTrx, Boolean.valueOf(IsSOTrx)); + } + + /** Get Sales Transaction. + @return This is a Sales Transaction + */ + public boolean isSOTrx () + { + Object oo = get_Value(COLUMNNAME_IsSOTrx); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Price includes Tax. + @param IsTaxIncluded + Tax is included in the price + */ + public void setIsTaxIncluded (boolean IsTaxIncluded) + { + set_Value (COLUMNNAME_IsTaxIncluded, Boolean.valueOf(IsTaxIncluded)); + } + + /** Get Price includes Tax. + @return Tax is included in the price + */ + public boolean isTaxIncluded () + { + Object oo = get_Value(COLUMNNAME_IsTaxIncluded); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Transferred. + @param IsTransferred + Transferred to General Ledger (i.e. accounted) + */ + public void setIsTransferred (boolean IsTransferred) + { + set_ValueNoCheck (COLUMNNAME_IsTransferred, Boolean.valueOf(IsTransferred)); + } + + /** Get Transferred. + @return Transferred to General Ledger (i.e. accounted) + */ + public boolean isTransferred () + { + Object oo = get_Value(COLUMNNAME_IsTransferred); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + public I_M_PriceList getM_PriceList() throws Exception + { + Class clazz = MTable.getClass(I_M_PriceList.Table_Name); + I_M_PriceList result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_PriceList)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_PriceList_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Price List. + @param M_PriceList_ID + Unique identifier of a Price List + */ + public void setM_PriceList_ID (int M_PriceList_ID) + { + if (M_PriceList_ID < 1) + throw new IllegalArgumentException ("M_PriceList_ID is mandatory."); + set_Value (COLUMNNAME_M_PriceList_ID, Integer.valueOf(M_PriceList_ID)); + } + + /** Get Price List. + @return Unique identifier of a Price List + */ + public int getM_PriceList_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_PriceList_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_M_Shipper getM_Shipper() throws Exception + { + Class clazz = MTable.getClass(I_M_Shipper.Table_Name); + I_M_Shipper result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_Shipper)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_Shipper_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Shipper. + @param M_Shipper_ID + Method or manner of product delivery + */ + public void setM_Shipper_ID (int M_Shipper_ID) + { + if (M_Shipper_ID < 1) + set_Value (COLUMNNAME_M_Shipper_ID, null); + else + set_Value (COLUMNNAME_M_Shipper_ID, Integer.valueOf(M_Shipper_ID)); + } + + /** Get Shipper. + @return Method or manner of product delivery + */ + public int getM_Shipper_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Shipper_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_M_Warehouse getM_Warehouse() throws Exception + { + Class clazz = MTable.getClass(I_M_Warehouse.Table_Name); + I_M_Warehouse result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_Warehouse)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_Warehouse_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Warehouse. + @param M_Warehouse_ID + Storage Warehouse and Service Point + */ + public void setM_Warehouse_ID (int M_Warehouse_ID) + { + if (M_Warehouse_ID < 1) + throw new IllegalArgumentException ("M_Warehouse_ID is mandatory."); + set_Value (COLUMNNAME_M_Warehouse_ID, Integer.valueOf(M_Warehouse_ID)); + } + + /** Get Warehouse. + @return Storage Warehouse and Service Point + */ + public int getM_Warehouse_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Warehouse_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set OrderType. + @param OrderType OrderType */ + public void setOrderType (String OrderType) + { + + if (OrderType != null && OrderType.length() > 510) + { + log.warning("Length > 510 - truncated"); + OrderType = OrderType.substring(0, 510); + } + set_Value (COLUMNNAME_OrderType, OrderType); + } + + /** Get OrderType. + @return OrderType */ + public String getOrderType () + { + return (String)get_Value(COLUMNNAME_OrderType); + } + + /** Set Payment BPartner. + @param Pay_BPartner_ID + Business Partner responsible for the payment + */ + public void setPay_BPartner_ID (int Pay_BPartner_ID) + { + if (Pay_BPartner_ID < 1) + set_Value (COLUMNNAME_Pay_BPartner_ID, null); + else + set_Value (COLUMNNAME_Pay_BPartner_ID, Integer.valueOf(Pay_BPartner_ID)); + } + + /** Get Payment BPartner. + @return Business Partner responsible for the payment + */ + public int getPay_BPartner_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Pay_BPartner_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Payment Location. + @param Pay_Location_ID + Location of the Business Partner responsible for the payment + */ + public void setPay_Location_ID (int Pay_Location_ID) + { + if (Pay_Location_ID < 1) + set_Value (COLUMNNAME_Pay_Location_ID, null); + else + set_Value (COLUMNNAME_Pay_Location_ID, Integer.valueOf(Pay_Location_ID)); + } + + /** Get Payment Location. + @return Location of the Business Partner responsible for the payment + */ + public int getPay_Location_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Pay_Location_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** PaymentRule AD_Reference_ID=195 */ + public static final int PAYMENTRULE_AD_Reference_ID=195; + /** Cash = B */ + public static final String PAYMENTRULE_Cash = "B"; + /** Credit Card = K */ + public static final String PAYMENTRULE_CreditCard = "K"; + /** Direct Deposit = T */ + public static final String PAYMENTRULE_DirectDeposit = "T"; + /** Check = S */ + public static final String PAYMENTRULE_Check = "S"; + /** On Credit = P */ + public static final String PAYMENTRULE_OnCredit = "P"; + /** Direct Debit = D */ + public static final String PAYMENTRULE_DirectDebit = "D"; + /** Mixed = M */ + public static final String PAYMENTRULE_Mixed = "M"; + /** Set Payment Rule. + @param PaymentRule + How you pay the invoice + */ + public void setPaymentRule (String PaymentRule) + { + if (PaymentRule == null) throw new IllegalArgumentException ("PaymentRule is mandatory"); + if (PaymentRule.equals("B") || PaymentRule.equals("K") || PaymentRule.equals("T") || PaymentRule.equals("S") || PaymentRule.equals("P") || PaymentRule.equals("D") || PaymentRule.equals("M")); else throw new IllegalArgumentException ("PaymentRule Invalid value - " + PaymentRule + " - Reference_ID=195 - B - K - T - S - P - D - M"); + if (PaymentRule.length() > 1) + { + log.warning("Length > 1 - truncated"); + PaymentRule = PaymentRule.substring(0, 1); + } + set_Value (COLUMNNAME_PaymentRule, PaymentRule); + } + + /** Get Payment Rule. + @return How you pay the invoice + */ + public String getPaymentRule () + { + return (String)get_Value(COLUMNNAME_PaymentRule); + } + + /** Set Order Reference. + @param POReference + Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner + */ + public void setPOReference (String POReference) + { + + if (POReference != null && POReference.length() > 20) + { + log.warning("Length > 20 - truncated"); + POReference = POReference.substring(0, 20); + } + set_Value (COLUMNNAME_POReference, POReference); + } + + /** Get Order Reference. + @return Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner + */ + public String getPOReference () + { + return (String)get_Value(COLUMNNAME_POReference); + } + + /** Set Posted. + @param Posted + Posting status + */ + public void setPosted (boolean Posted) + { + set_Value (COLUMNNAME_Posted, Boolean.valueOf(Posted)); + } + + /** Get Posted. + @return Posting status + */ + public boolean isPosted () + { + Object oo = get_Value(COLUMNNAME_Posted); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** PriorityRule AD_Reference_ID=154 */ + public static final int PRIORITYRULE_AD_Reference_ID=154; + /** High = 3 */ + public static final String PRIORITYRULE_High = "3"; + /** Medium = 5 */ + public static final String PRIORITYRULE_Medium = "5"; + /** Low = 7 */ + public static final String PRIORITYRULE_Low = "7"; + /** Urgent = 1 */ + public static final String PRIORITYRULE_Urgent = "1"; + /** Minor = 9 */ + public static final String PRIORITYRULE_Minor = "9"; + /** Set Priority. + @param PriorityRule + Priority of a document + */ + public void setPriorityRule (String PriorityRule) + { + if (PriorityRule == null) throw new IllegalArgumentException ("PriorityRule is mandatory"); + if (PriorityRule.equals("3") || PriorityRule.equals("5") || PriorityRule.equals("7") || PriorityRule.equals("1") || PriorityRule.equals("9")); else throw new IllegalArgumentException ("PriorityRule Invalid value - " + PriorityRule + " - Reference_ID=154 - 3 - 5 - 7 - 1 - 9"); + if (PriorityRule.length() > 1) + { + log.warning("Length > 1 - truncated"); + PriorityRule = PriorityRule.substring(0, 1); + } + set_Value (COLUMNNAME_PriorityRule, PriorityRule); + } + + /** Get Priority. + @return Priority of a document + */ + public String getPriorityRule () + { + return (String)get_Value(COLUMNNAME_PriorityRule); + } + + /** Set Processed. + @param Processed + The document has been processed + */ + public void setProcessed (boolean Processed) + { + set_ValueNoCheck (COLUMNNAME_Processed, Boolean.valueOf(Processed)); + } + + /** Get Processed. + @return The document has been processed + */ + public boolean isProcessed () + { + Object oo = get_Value(COLUMNNAME_Processed); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Process Now. + @param Processing Process Now */ + public void setProcessing (boolean Processing) + { + set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); + } + + /** Get Process Now. + @return Process Now */ + public boolean isProcessing () + { + Object oo = get_Value(COLUMNNAME_Processing); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Ref_Order_ID AD_Reference_ID=290 */ + public static final int REF_ORDER_ID_AD_Reference_ID=290; + /** Set Referenced Order. + @param Ref_Order_ID + Reference to corresponding Sales/Purchase Order + */ + public void setRef_Order_ID (int Ref_Order_ID) + { + if (Ref_Order_ID < 1) + set_Value (COLUMNNAME_Ref_Order_ID, null); + else + set_Value (COLUMNNAME_Ref_Order_ID, Integer.valueOf(Ref_Order_ID)); + } + + /** Get Referenced Order. + @return Reference to corresponding Sales/Purchase Order + */ + public int getRef_Order_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Ref_Order_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** SalesRep_ID AD_Reference_ID=190 */ + public static final int SALESREP_ID_AD_Reference_ID=190; + /** Set Sales Representative. + @param SalesRep_ID + Sales Representative or Company Agent + */ + public void setSalesRep_ID (int SalesRep_ID) + { + if (SalesRep_ID < 1) + throw new IllegalArgumentException ("SalesRep_ID is mandatory."); + set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID)); + } + + /** Get Sales Representative. + @return Sales Representative or Company Agent + */ + public int getSalesRep_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Send EMail. + @param SendEMail + Enable sending Document EMail + */ + public void setSendEMail (boolean SendEMail) + { + set_Value (COLUMNNAME_SendEMail, Boolean.valueOf(SendEMail)); + } + + /** Get Send EMail. + @return Enable sending Document EMail + */ + public boolean isSendEMail () + { + Object oo = get_Value(COLUMNNAME_SendEMail); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Total Lines. + @param TotalLines + Total of all document lines + */ + public void setTotalLines (BigDecimal TotalLines) + { + if (TotalLines == null) + throw new IllegalArgumentException ("TotalLines is mandatory."); + set_ValueNoCheck (COLUMNNAME_TotalLines, TotalLines); + } + + /** Get Total Lines. + @return Total of all document lines + */ + public BigDecimal getTotalLines () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalLines); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** User1_ID AD_Reference_ID=134 */ + public static final int USER1_ID_AD_Reference_ID=134; + /** Set User List 1. + @param User1_ID + User defined list element #1 + */ + public void setUser1_ID (int User1_ID) + { + if (User1_ID < 1) + set_Value (COLUMNNAME_User1_ID, null); + else + set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID)); + } + + /** Get User List 1. + @return User defined list element #1 + */ + public int getUser1_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** User2_ID AD_Reference_ID=137 */ + public static final int USER2_ID_AD_Reference_ID=137; + /** Set User List 2. + @param User2_ID + User defined list element #2 + */ + public void setUser2_ID (int User2_ID) + { + if (User2_ID < 1) + set_Value (COLUMNNAME_User2_ID, null); + else + set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID)); + } + + /** Get User List 2. + @return User defined list element #2 + */ + public int getUser2_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_User2_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Volume. + @param Volume + Volume of a product + */ + public void setVolume (BigDecimal Volume) + { + set_Value (COLUMNNAME_Volume, Volume); + } + + /** Get Volume. + @return Volume of a product + */ + public BigDecimal getVolume () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Volume); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Weight. + @param Weight + Weight of a product + */ + public void setWeight (BigDecimal Weight) + { + set_Value (COLUMNNAME_Weight, Weight); + } + + /** Get Weight. + @return Weight of a product + */ + public BigDecimal getWeight () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Weight); + if (bd == null) + return Env.ZERO; + return bd; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_C_Payment.java b/posterita/posterita/src/main/org/compiere/model/X_C_Payment.java new file mode 100644 index 0000000000..7e73a76dcc --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_C_Payment.java @@ -0,0 +1,2242 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.Properties; +import java.util.logging.Level; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for C_Payment + * @author Adempiere (generated) + * @version Release 3.5.0 - $Id$ */ +public class X_C_Payment extends PO implements I_C_Payment, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_C_Payment (Properties ctx, int C_Payment_ID, String trxName) + { + super (ctx, C_Payment_ID, trxName); + /** if (C_Payment_ID == 0) + { + setC_BPartner_ID (0); + setC_BankAccount_ID (0); + setC_Currency_ID (0); + setC_DocType_ID (0); + setC_Payment_ID (0); + setDateAcct (new Timestamp(System.currentTimeMillis())); +// @#Date@ + setDateTrx (new Timestamp(System.currentTimeMillis())); +// @#Date@ + setDocAction (null); +// CO + setDocStatus (null); +// DR + setDocumentNo (null); + setIsAllocated (false); + setIsApproved (false); +// N + setIsDelayedCapture (false); + setIsOnline (false); + setIsOverUnderPayment (false); +// N + setIsPrepayment (false); + setIsReceipt (false); + setIsReconciled (false); + setIsSelfService (false); + setPayAmt (Env.ZERO); +// 0 + setPosted (false); +// N + setProcessed (false); + setTenderType (null); +// K + setTrxType (null); +// S + } */ + } + + /** Load Constructor */ + public X_C_Payment (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 1 - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_C_Payment[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** AD_OrgTrx_ID AD_Reference_ID=130 */ + public static final int AD_ORGTRX_ID_AD_Reference_ID=130; + /** Set Trx Organization. + @param AD_OrgTrx_ID + Performing or initiating organization + */ + public void setAD_OrgTrx_ID (int AD_OrgTrx_ID) + { + if (AD_OrgTrx_ID < 1) + set_Value (COLUMNNAME_AD_OrgTrx_ID, null); + else + set_Value (COLUMNNAME_AD_OrgTrx_ID, Integer.valueOf(AD_OrgTrx_ID)); + } + + /** Get Trx Organization. + @return Performing or initiating organization + */ + public int getAD_OrgTrx_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_OrgTrx_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Account City. + @param A_City + City or the Credit Card or Account Holder + */ + public void setA_City (String A_City) + { + + if (A_City != null && A_City.length() > 60) + { + log.warning("Length > 60 - truncated"); + A_City = A_City.substring(0, 60); + } + set_Value (COLUMNNAME_A_City, A_City); + } + + /** Get Account City. + @return City or the Credit Card or Account Holder + */ + public String getA_City () + { + return (String)get_Value(COLUMNNAME_A_City); + } + + /** Set Account Country. + @param A_Country + Country + */ + public void setA_Country (String A_Country) + { + + if (A_Country != null && A_Country.length() > 40) + { + log.warning("Length > 40 - truncated"); + A_Country = A_Country.substring(0, 40); + } + set_Value (COLUMNNAME_A_Country, A_Country); + } + + /** Get Account Country. + @return Country + */ + public String getA_Country () + { + return (String)get_Value(COLUMNNAME_A_Country); + } + + /** Set Account EMail. + @param A_EMail + Email Address + */ + public void setA_EMail (String A_EMail) + { + + if (A_EMail != null && A_EMail.length() > 60) + { + log.warning("Length > 60 - truncated"); + A_EMail = A_EMail.substring(0, 60); + } + set_Value (COLUMNNAME_A_EMail, A_EMail); + } + + /** Get Account EMail. + @return Email Address + */ + public String getA_EMail () + { + return (String)get_Value(COLUMNNAME_A_EMail); + } + + /** Set Driver License. + @param A_Ident_DL + Payment Identification - Driver License + */ + public void setA_Ident_DL (String A_Ident_DL) + { + + if (A_Ident_DL != null && A_Ident_DL.length() > 20) + { + log.warning("Length > 20 - truncated"); + A_Ident_DL = A_Ident_DL.substring(0, 20); + } + set_Value (COLUMNNAME_A_Ident_DL, A_Ident_DL); + } + + /** Get Driver License. + @return Payment Identification - Driver License + */ + public String getA_Ident_DL () + { + return (String)get_Value(COLUMNNAME_A_Ident_DL); + } + + /** Set Social Security No. + @param A_Ident_SSN + Payment Identification - Social Security No + */ + public void setA_Ident_SSN (String A_Ident_SSN) + { + + if (A_Ident_SSN != null && A_Ident_SSN.length() > 20) + { + log.warning("Length > 20 - truncated"); + A_Ident_SSN = A_Ident_SSN.substring(0, 20); + } + set_Value (COLUMNNAME_A_Ident_SSN, A_Ident_SSN); + } + + /** Get Social Security No. + @return Payment Identification - Social Security No + */ + public String getA_Ident_SSN () + { + return (String)get_Value(COLUMNNAME_A_Ident_SSN); + } + + /** Set Account Name. + @param A_Name + Name on Credit Card or Account holder + */ + public void setA_Name (String A_Name) + { + + if (A_Name != null && A_Name.length() > 60) + { + log.warning("Length > 60 - truncated"); + A_Name = A_Name.substring(0, 60); + } + set_Value (COLUMNNAME_A_Name, A_Name); + } + + /** Get Account Name. + @return Name on Credit Card or Account holder + */ + public String getA_Name () + { + return (String)get_Value(COLUMNNAME_A_Name); + } + + /** Set Account State. + @param A_State + State of the Credit Card or Account holder + */ + public void setA_State (String A_State) + { + + if (A_State != null && A_State.length() > 40) + { + log.warning("Length > 40 - truncated"); + A_State = A_State.substring(0, 40); + } + set_Value (COLUMNNAME_A_State, A_State); + } + + /** Get Account State. + @return State of the Credit Card or Account holder + */ + public String getA_State () + { + return (String)get_Value(COLUMNNAME_A_State); + } + + /** Set Account Street. + @param A_Street + Street address of the Credit Card or Account holder + */ + public void setA_Street (String A_Street) + { + + if (A_Street != null && A_Street.length() > 60) + { + log.warning("Length > 60 - truncated"); + A_Street = A_Street.substring(0, 60); + } + set_Value (COLUMNNAME_A_Street, A_Street); + } + + /** Get Account Street. + @return Street address of the Credit Card or Account holder + */ + public String getA_Street () + { + return (String)get_Value(COLUMNNAME_A_Street); + } + + /** Set Account Zip/Postal. + @param A_Zip + Zip Code of the Credit Card or Account Holder + */ + public void setA_Zip (String A_Zip) + { + + if (A_Zip != null && A_Zip.length() > 20) + { + log.warning("Length > 20 - truncated"); + A_Zip = A_Zip.substring(0, 20); + } + set_Value (COLUMNNAME_A_Zip, A_Zip); + } + + /** Get Account Zip/Postal. + @return Zip Code of the Credit Card or Account Holder + */ + public String getA_Zip () + { + return (String)get_Value(COLUMNNAME_A_Zip); + } + + /** Set Account No. + @param AccountNo + Account Number + */ + public void setAccountNo (String AccountNo) + { + + if (AccountNo != null && AccountNo.length() > 20) + { + log.warning("Length > 20 - truncated"); + AccountNo = AccountNo.substring(0, 20); + } + set_Value (COLUMNNAME_AccountNo, AccountNo); + } + + /** Get Account No. + @return Account Number + */ + public String getAccountNo () + { + return (String)get_Value(COLUMNNAME_AccountNo); + } + + public I_C_Activity getC_Activity() throws Exception + { + Class clazz = MTable.getClass(I_C_Activity.Table_Name); + I_C_Activity result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Activity)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Activity_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Activity. + @param C_Activity_ID + Business Activity + */ + public void setC_Activity_ID (int C_Activity_ID) + { + if (C_Activity_ID < 1) + set_Value (COLUMNNAME_C_Activity_ID, null); + else + set_Value (COLUMNNAME_C_Activity_ID, Integer.valueOf(C_Activity_ID)); + } + + /** Get Activity. + @return Business Activity + */ + public int getC_Activity_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Activity_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_BP_BankAccount getC_BP_BankAccount() throws Exception + { + Class clazz = MTable.getClass(I_C_BP_BankAccount.Table_Name); + I_C_BP_BankAccount result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_BP_BankAccount)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_BP_BankAccount_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Partner Bank Account. + @param C_BP_BankAccount_ID + Bank Account of the Business Partner + */ + public void setC_BP_BankAccount_ID (int C_BP_BankAccount_ID) + { + if (C_BP_BankAccount_ID < 1) + set_Value (COLUMNNAME_C_BP_BankAccount_ID, null); + else + set_Value (COLUMNNAME_C_BP_BankAccount_ID, Integer.valueOf(C_BP_BankAccount_ID)); + } + + /** Get Partner Bank Account. + @return Bank Account of the Business Partner + */ + public int getC_BP_BankAccount_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_BP_BankAccount_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_BPartner getC_BPartner() throws Exception + { + Class clazz = MTable.getClass(I_C_BPartner.Table_Name); + I_C_BPartner result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_BPartner)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_BPartner_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Business Partner . + @param C_BPartner_ID + Identifies a Business Partner + */ + public void setC_BPartner_ID (int C_BPartner_ID) + { + if (C_BPartner_ID < 1) + throw new IllegalArgumentException ("C_BPartner_ID is mandatory."); + set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID)); + } + + /** Get Business Partner . + @return Identifies a Business Partner + */ + public int getC_BPartner_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_BankAccount getC_BankAccount() throws Exception + { + Class clazz = MTable.getClass(I_C_BankAccount.Table_Name); + I_C_BankAccount result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_BankAccount)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_BankAccount_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Bank Account. + @param C_BankAccount_ID + Account at the Bank + */ + public void setC_BankAccount_ID (int C_BankAccount_ID) + { + if (C_BankAccount_ID < 1) + set_Value (COLUMNNAME_C_BankAccount_ID, null); + else + set_Value (COLUMNNAME_C_BankAccount_ID, Integer.valueOf(C_BankAccount_ID)); + } + + /** Get Bank Account. + @return Account at the Bank + */ + public int getC_BankAccount_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_BankAccount_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Campaign getC_Campaign() throws Exception + { + Class clazz = MTable.getClass(I_C_Campaign.Table_Name); + I_C_Campaign result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Campaign)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Campaign_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Campaign. + @param C_Campaign_ID + Marketing Campaign + */ + public void setC_Campaign_ID (int C_Campaign_ID) + { + if (C_Campaign_ID < 1) + set_Value (COLUMNNAME_C_Campaign_ID, null); + else + set_Value (COLUMNNAME_C_Campaign_ID, Integer.valueOf(C_Campaign_ID)); + } + + /** Get Campaign. + @return Marketing Campaign + */ + public int getC_Campaign_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Campaign_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_CashBook getC_CashBook() throws Exception + { + Class clazz = MTable.getClass(I_C_CashBook.Table_Name); + I_C_CashBook result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_CashBook)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_CashBook_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Cash Book. + @param C_CashBook_ID + Cash Book for recording petty cash transactions + */ + public void setC_CashBook_ID (int C_CashBook_ID) + { + if (C_CashBook_ID < 1) + set_Value (COLUMNNAME_C_CashBook_ID, null); + else + set_Value (COLUMNNAME_C_CashBook_ID, Integer.valueOf(C_CashBook_ID)); + } + + /** Get Cash Book. + @return Cash Book for recording petty cash transactions + */ + public int getC_CashBook_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_CashBook_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Charge getC_Charge() throws Exception + { + Class clazz = MTable.getClass(I_C_Charge.Table_Name); + I_C_Charge result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Charge)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Charge_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Charge. + @param C_Charge_ID + Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID) + { + if (C_Charge_ID < 1) + set_Value (COLUMNNAME_C_Charge_ID, null); + else + set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID)); + } + + /** Get Charge. + @return Additional document charges + */ + public int getC_Charge_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_ConversionType getC_ConversionType() throws Exception + { + Class clazz = MTable.getClass(I_C_ConversionType.Table_Name); + I_C_ConversionType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_ConversionType)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_ConversionType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency Type. + @param C_ConversionType_ID + Currency Conversion Rate Type + */ + public void setC_ConversionType_ID (int C_ConversionType_ID) + { + if (C_ConversionType_ID < 1) + set_Value (COLUMNNAME_C_ConversionType_ID, null); + else + set_Value (COLUMNNAME_C_ConversionType_ID, Integer.valueOf(C_ConversionType_ID)); + } + + /** Get Currency Type. + @return Currency Conversion Rate Type + */ + public int getC_ConversionType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_ConversionType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Currency getC_Currency() throws Exception + { + Class clazz = MTable.getClass(I_C_Currency.Table_Name); + I_C_Currency result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Currency)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Currency_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency. + @param C_Currency_ID + The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID) + { + if (C_Currency_ID < 1) + throw new IllegalArgumentException ("C_Currency_ID is mandatory."); + set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID)); + } + + /** Get Currency. + @return The Currency for this record + */ + public int getC_Currency_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_DocType getC_DocType() throws Exception + { + Class clazz = MTable.getClass(I_C_DocType.Table_Name); + I_C_DocType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_DocType)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DocType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Document Type. + @param C_DocType_ID + Document type or rules + */ + public void setC_DocType_ID (int C_DocType_ID) + { + if (C_DocType_ID < 0) + throw new IllegalArgumentException ("C_DocType_ID is mandatory."); + set_Value (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID)); + } + + /** Get Document Type. + @return Document type or rules + */ + public int getC_DocType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Invoice getC_Invoice() throws Exception + { + Class clazz = MTable.getClass(I_C_Invoice.Table_Name); + I_C_Invoice result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Invoice)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Invoice_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Invoice. + @param C_Invoice_ID + Invoice Identifier + */ + public void setC_Invoice_ID (int C_Invoice_ID) + { + if (C_Invoice_ID < 1) + set_Value (COLUMNNAME_C_Invoice_ID, null); + else + set_Value (COLUMNNAME_C_Invoice_ID, Integer.valueOf(C_Invoice_ID)); + } + + /** Get Invoice. + @return Invoice Identifier + */ + public int getC_Invoice_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Order getC_Order() throws Exception + { + Class clazz = MTable.getClass(I_C_Order.Table_Name); + I_C_Order result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Order)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Order_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Order. + @param C_Order_ID + Order + */ + public void setC_Order_ID (int C_Order_ID) + { + if (C_Order_ID < 1) + set_Value (COLUMNNAME_C_Order_ID, null); + else + set_Value (COLUMNNAME_C_Order_ID, Integer.valueOf(C_Order_ID)); + } + + /** Get Order. + @return Order + */ + public int getC_Order_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Order_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_PaymentBatch getC_PaymentBatch() throws Exception + { + Class clazz = MTable.getClass(I_C_PaymentBatch.Table_Name); + I_C_PaymentBatch result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_PaymentBatch)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_PaymentBatch_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Payment Batch. + @param C_PaymentBatch_ID + Payment batch for EFT + */ + public void setC_PaymentBatch_ID (int C_PaymentBatch_ID) + { + if (C_PaymentBatch_ID < 1) + set_Value (COLUMNNAME_C_PaymentBatch_ID, null); + else + set_Value (COLUMNNAME_C_PaymentBatch_ID, Integer.valueOf(C_PaymentBatch_ID)); + } + + /** Get Payment Batch. + @return Payment batch for EFT + */ + public int getC_PaymentBatch_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_PaymentBatch_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Payment. + @param C_Payment_ID + Payment identifier + */ + public void setC_Payment_ID (int C_Payment_ID) + { + if (C_Payment_ID < 1) + throw new IllegalArgumentException ("C_Payment_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID)); + } + + /** Get Payment. + @return Payment identifier + */ + public int getC_Payment_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Project getC_Project() throws Exception + { + Class clazz = MTable.getClass(I_C_Project.Table_Name); + I_C_Project result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Project)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Project_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Project. + @param C_Project_ID + Financial Project + */ + public void setC_Project_ID (int C_Project_ID) + { + if (C_Project_ID < 1) + set_Value (COLUMNNAME_C_Project_ID, null); + else + set_Value (COLUMNNAME_C_Project_ID, Integer.valueOf(C_Project_ID)); + } + + /** Get Project. + @return Financial Project + */ + public int getC_Project_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Project_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Charge amount. + @param ChargeAmt + Charge Amount + */ + public void setChargeAmt (BigDecimal ChargeAmt) + { + set_Value (COLUMNNAME_ChargeAmt, ChargeAmt); + } + + /** Get Charge amount. + @return Charge Amount + */ + public BigDecimal getChargeAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ChargeAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Check No. + @param CheckNo + Check Number + */ + public void setCheckNo (String CheckNo) + { + + if (CheckNo != null && CheckNo.length() > 20) + { + log.warning("Length > 20 - truncated"); + CheckNo = CheckNo.substring(0, 20); + } + set_Value (COLUMNNAME_CheckNo, CheckNo); + } + + /** Get Check No. + @return Check Number + */ + public String getCheckNo () + { + return (String)get_Value(COLUMNNAME_CheckNo); + } + + /** Set Exp. Month. + @param CreditCardExpMM + Expiry Month + */ + public void setCreditCardExpMM (int CreditCardExpMM) + { + set_Value (COLUMNNAME_CreditCardExpMM, Integer.valueOf(CreditCardExpMM)); + } + + /** Get Exp. Month. + @return Expiry Month + */ + public int getCreditCardExpMM () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CreditCardExpMM); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Exp. Year. + @param CreditCardExpYY + Expiry Year + */ + public void setCreditCardExpYY (int CreditCardExpYY) + { + set_Value (COLUMNNAME_CreditCardExpYY, Integer.valueOf(CreditCardExpYY)); + } + + /** Get Exp. Year. + @return Expiry Year + */ + public int getCreditCardExpYY () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CreditCardExpYY); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Number. + @param CreditCardNumber + Credit Card Number + */ + public void setCreditCardNumber (String CreditCardNumber) + { + + if (CreditCardNumber != null && CreditCardNumber.length() > 20) + { + log.warning("Length > 20 - truncated"); + CreditCardNumber = CreditCardNumber.substring(0, 20); + } + set_Value (COLUMNNAME_CreditCardNumber, CreditCardNumber); + } + + /** Get Number. + @return Credit Card Number + */ + public String getCreditCardNumber () + { + return (String)get_Value(COLUMNNAME_CreditCardNumber); + } + + /** CreditCardType AD_Reference_ID=149 */ + public static final int CREDITCARDTYPE_AD_Reference_ID=149; + /** Amex = A */ + public static final String CREDITCARDTYPE_Amex = "A"; + /** MasterCard = M */ + public static final String CREDITCARDTYPE_MasterCard = "M"; + /** Visa = V */ + public static final String CREDITCARDTYPE_Visa = "V"; + /** ATM = C */ + public static final String CREDITCARDTYPE_ATM = "C"; + /** Diners = D */ + public static final String CREDITCARDTYPE_Diners = "D"; + /** Discover = N */ + public static final String CREDITCARDTYPE_Discover = "N"; + /** Purchase Card = P */ + public static final String CREDITCARDTYPE_PurchaseCard = "P"; + /** Set Credit Card. + @param CreditCardType + Credit Card (Visa, MC, AmEx) + */ + public void setCreditCardType (String CreditCardType) + { + + if (CreditCardType == null || CreditCardType.equals("A") || CreditCardType.equals("M") || CreditCardType.equals("V") || CreditCardType.equals("C") || CreditCardType.equals("D") || CreditCardType.equals("N") || CreditCardType.equals("P")); else throw new IllegalArgumentException ("CreditCardType Invalid value - " + CreditCardType + " - Reference_ID=149 - A - M - V - C - D - N - P"); + if (CreditCardType != null && CreditCardType.length() > 1) + { + log.warning("Length > 1 - truncated"); + CreditCardType = CreditCardType.substring(0, 1); + } + set_Value (COLUMNNAME_CreditCardType, CreditCardType); + } + + /** Get Credit Card. + @return Credit Card (Visa, MC, AmEx) + */ + public String getCreditCardType () + { + return (String)get_Value(COLUMNNAME_CreditCardType); + } + + /** Set Verification Code. + @param CreditCardVV + Credit Card Verification code on credit card + */ + public void setCreditCardVV (String CreditCardVV) + { + + if (CreditCardVV != null && CreditCardVV.length() > 4) + { + log.warning("Length > 4 - truncated"); + CreditCardVV = CreditCardVV.substring(0, 4); + } + set_Value (COLUMNNAME_CreditCardVV, CreditCardVV); + } + + /** Get Verification Code. + @return Credit Card Verification code on credit card + */ + public String getCreditCardVV () + { + return (String)get_Value(COLUMNNAME_CreditCardVV); + } + + /** Set Account Date. + @param DateAcct + Accounting Date + */ + public void setDateAcct (Timestamp DateAcct) + { + if (DateAcct == null) + throw new IllegalArgumentException ("DateAcct is mandatory."); + set_Value (COLUMNNAME_DateAcct, DateAcct); + } + + /** Get Account Date. + @return Accounting Date + */ + public Timestamp getDateAcct () + { + return (Timestamp)get_Value(COLUMNNAME_DateAcct); + } + + /** Set Transaction Date. + @param DateTrx + Transaction Date + */ + public void setDateTrx (Timestamp DateTrx) + { + if (DateTrx == null) + throw new IllegalArgumentException ("DateTrx is mandatory."); + set_Value (COLUMNNAME_DateTrx, DateTrx); + } + + /** Get Transaction Date. + @return Transaction Date + */ + public Timestamp getDateTrx () + { + return (Timestamp)get_Value(COLUMNNAME_DateTrx); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set Discount Amount. + @param DiscountAmt + Calculated amount of discount + */ + public void setDiscountAmt (BigDecimal DiscountAmt) + { + set_Value (COLUMNNAME_DiscountAmt, DiscountAmt); + } + + /** Get Discount Amount. + @return Calculated amount of discount + */ + public BigDecimal getDiscountAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_DiscountAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** DocAction AD_Reference_ID=135 */ + public static final int DOCACTION_AD_Reference_ID=135; + /** Complete = CO */ + public static final String DOCACTION_Complete = "CO"; + /** Approve = AP */ + public static final String DOCACTION_Approve = "AP"; + /** Reject = RJ */ + public static final String DOCACTION_Reject = "RJ"; + /** Post = PO */ + public static final String DOCACTION_Post = "PO"; + /** Void = VO */ + public static final String DOCACTION_Void = "VO"; + /** Close = CL */ + public static final String DOCACTION_Close = "CL"; + /** Reverse - Correct = RC */ + public static final String DOCACTION_Reverse_Correct = "RC"; + /** Reverse - Accrual = RA */ + public static final String DOCACTION_Reverse_Accrual = "RA"; + /** Invalidate = IN */ + public static final String DOCACTION_Invalidate = "IN"; + /** Re-activate = RE */ + public static final String DOCACTION_Re_Activate = "RE"; + /** = -- */ + public static final String DOCACTION_None = "--"; + /** Prepare = PR */ + public static final String DOCACTION_Prepare = "PR"; + /** Unlock = XL */ + public static final String DOCACTION_Unlock = "XL"; + /** Wait Complete = WC */ + public static final String DOCACTION_WaitComplete = "WC"; + /** Set Document Action. + @param DocAction + The targeted status of the document + */ + public void setDocAction (String DocAction) + { + if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory"); + if (DocAction.equals("CO") || DocAction.equals("AP") || DocAction.equals("RJ") || DocAction.equals("PO") || DocAction.equals("VO") || DocAction.equals("CL") || DocAction.equals("RC") || DocAction.equals("RA") || DocAction.equals("IN") || DocAction.equals("RE") || DocAction.equals("--") || DocAction.equals("PR") || DocAction.equals("XL") || DocAction.equals("WC")); else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - CO - AP - RJ - PO - VO - CL - RC - RA - IN - RE - -- - PR - XL - WC"); + if (DocAction.length() > 2) + { + log.warning("Length > 2 - truncated"); + DocAction = DocAction.substring(0, 2); + } + set_Value (COLUMNNAME_DocAction, DocAction); + } + + /** Get Document Action. + @return The targeted status of the document + */ + public String getDocAction () + { + return (String)get_Value(COLUMNNAME_DocAction); + } + + /** DocStatus AD_Reference_ID=131 */ + public static final int DOCSTATUS_AD_Reference_ID=131; + /** Drafted = DR */ + public static final String DOCSTATUS_Drafted = "DR"; + /** Completed = CO */ + public static final String DOCSTATUS_Completed = "CO"; + /** Approved = AP */ + public static final String DOCSTATUS_Approved = "AP"; + /** Not Approved = NA */ + public static final String DOCSTATUS_NotApproved = "NA"; + /** Voided = VO */ + public static final String DOCSTATUS_Voided = "VO"; + /** Invalid = IN */ + public static final String DOCSTATUS_Invalid = "IN"; + /** Reversed = RE */ + public static final String DOCSTATUS_Reversed = "RE"; + /** Closed = CL */ + public static final String DOCSTATUS_Closed = "CL"; + /** Unknown = ?? */ + public static final String DOCSTATUS_Unknown = "??"; + /** In Progress = IP */ + public static final String DOCSTATUS_InProgress = "IP"; + /** Waiting Payment = WP */ + public static final String DOCSTATUS_WaitingPayment = "WP"; + /** Waiting Confirmation = WC */ + public static final String DOCSTATUS_WaitingConfirmation = "WC"; + /** Set Document Status. + @param DocStatus + The current status of the document + */ + public void setDocStatus (String DocStatus) + { + if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory"); + if (DocStatus.equals("DR") || DocStatus.equals("CO") || DocStatus.equals("AP") || DocStatus.equals("NA") || DocStatus.equals("VO") || DocStatus.equals("IN") || DocStatus.equals("RE") || DocStatus.equals("CL") || DocStatus.equals("??") || DocStatus.equals("IP") || DocStatus.equals("WP") || DocStatus.equals("WC")); else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - DR - CO - AP - NA - VO - IN - RE - CL - ?? - IP - WP - WC"); + if (DocStatus.length() > 2) + { + log.warning("Length > 2 - truncated"); + DocStatus = DocStatus.substring(0, 2); + } + set_Value (COLUMNNAME_DocStatus, DocStatus); + } + + /** Get Document Status. + @return The current status of the document + */ + public String getDocStatus () + { + return (String)get_Value(COLUMNNAME_DocStatus); + } + + /** Set Document No. + @param DocumentNo + Document sequence number of the document + */ + public void setDocumentNo (String DocumentNo) + { + if (DocumentNo == null) + throw new IllegalArgumentException ("DocumentNo is mandatory."); + + if (DocumentNo.length() > 30) + { + log.warning("Length > 30 - truncated"); + DocumentNo = DocumentNo.substring(0, 30); + } + set_Value (COLUMNNAME_DocumentNo, DocumentNo); + } + + /** Get Document No. + @return Document sequence number of the document + */ + public String getDocumentNo () + { + return (String)get_Value(COLUMNNAME_DocumentNo); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), getDocumentNo()); + } + + /** Set Allocated. + @param IsAllocated + Indicates if the payment has been allocated + */ + public void setIsAllocated (boolean IsAllocated) + { + set_Value (COLUMNNAME_IsAllocated, Boolean.valueOf(IsAllocated)); + } + + /** Get Allocated. + @return Indicates if the payment has been allocated + */ + public boolean isAllocated () + { + Object oo = get_Value(COLUMNNAME_IsAllocated); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Approved. + @param IsApproved + Indicates if this document requires approval + */ + public void setIsApproved (boolean IsApproved) + { + set_ValueNoCheck (COLUMNNAME_IsApproved, Boolean.valueOf(IsApproved)); + } + + /** Get Approved. + @return Indicates if this document requires approval + */ + public boolean isApproved () + { + Object oo = get_Value(COLUMNNAME_IsApproved); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Delayed Capture. + @param IsDelayedCapture + Charge after Shipment + */ + public void setIsDelayedCapture (boolean IsDelayedCapture) + { + set_Value (COLUMNNAME_IsDelayedCapture, Boolean.valueOf(IsDelayedCapture)); + } + + /** Get Delayed Capture. + @return Charge after Shipment + */ + public boolean isDelayedCapture () + { + Object oo = get_Value(COLUMNNAME_IsDelayedCapture); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Online Access. + @param IsOnline + Can be accessed online + */ + public void setIsOnline (boolean IsOnline) + { + set_Value (COLUMNNAME_IsOnline, Boolean.valueOf(IsOnline)); + } + + /** Get Online Access. + @return Can be accessed online + */ + public boolean isOnline () + { + Object oo = get_Value(COLUMNNAME_IsOnline); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Over/Under Payment. + @param IsOverUnderPayment + Over-Payment (unallocated) or Under-Payment (partial payment) + */ + public void setIsOverUnderPayment (boolean IsOverUnderPayment) + { + set_Value (COLUMNNAME_IsOverUnderPayment, Boolean.valueOf(IsOverUnderPayment)); + } + + /** Get Over/Under Payment. + @return Over-Payment (unallocated) or Under-Payment (partial payment) + */ + public boolean isOverUnderPayment () + { + Object oo = get_Value(COLUMNNAME_IsOverUnderPayment); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Prepayment. + @param IsPrepayment + The Payment/Receipt is a Prepayment + */ + public void setIsPrepayment (boolean IsPrepayment) + { + set_Value (COLUMNNAME_IsPrepayment, Boolean.valueOf(IsPrepayment)); + } + + /** Get Prepayment. + @return The Payment/Receipt is a Prepayment + */ + public boolean isPrepayment () + { + Object oo = get_Value(COLUMNNAME_IsPrepayment); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Receipt. + @param IsReceipt + This is a sales transaction (receipt) + */ + public void setIsReceipt (boolean IsReceipt) + { + set_Value (COLUMNNAME_IsReceipt, Boolean.valueOf(IsReceipt)); + } + + /** Get Receipt. + @return This is a sales transaction (receipt) + */ + public boolean isReceipt () + { + Object oo = get_Value(COLUMNNAME_IsReceipt); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Reconciled. + @param IsReconciled + Payment is reconciled with bank statement + */ + public void setIsReconciled (boolean IsReconciled) + { + set_Value (COLUMNNAME_IsReconciled, Boolean.valueOf(IsReconciled)); + } + + /** Get Reconciled. + @return Payment is reconciled with bank statement + */ + public boolean isReconciled () + { + Object oo = get_Value(COLUMNNAME_IsReconciled); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Self-Service. + @param IsSelfService + This is a Self-Service entry or this entry can be changed via Self-Service + */ + public void setIsSelfService (boolean IsSelfService) + { + set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService)); + } + + /** Get Self-Service. + @return This is a Self-Service entry or this entry can be changed via Self-Service + */ + public boolean isSelfService () + { + Object oo = get_Value(COLUMNNAME_IsSelfService); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Micr. + @param Micr + Combination of routing no, account and check no + */ + public void setMicr (String Micr) + { + + if (Micr != null && Micr.length() > 20) + { + log.warning("Length > 20 - truncated"); + Micr = Micr.substring(0, 20); + } + set_Value (COLUMNNAME_Micr, Micr); + } + + /** Get Micr. + @return Combination of routing no, account and check no + */ + public String getMicr () + { + return (String)get_Value(COLUMNNAME_Micr); + } + + /** Set Online Processing. + @param OProcessing + This payment can be processed online + */ + public void setOProcessing (String OProcessing) + { + + if (OProcessing != null && OProcessing.length() > 1) + { + log.warning("Length > 1 - truncated"); + OProcessing = OProcessing.substring(0, 1); + } + set_Value (COLUMNNAME_OProcessing, OProcessing); + } + + /** Get Online Processing. + @return This payment can be processed online + */ + public String getOProcessing () + { + return (String)get_Value(COLUMNNAME_OProcessing); + } + + /** Set Original Transaction ID. + @param Orig_TrxID + Original Transaction ID + */ + public void setOrig_TrxID (String Orig_TrxID) + { + + if (Orig_TrxID != null && Orig_TrxID.length() > 20) + { + log.warning("Length > 20 - truncated"); + Orig_TrxID = Orig_TrxID.substring(0, 20); + } + set_Value (COLUMNNAME_Orig_TrxID, Orig_TrxID); + } + + /** Get Original Transaction ID. + @return Original Transaction ID + */ + public String getOrig_TrxID () + { + return (String)get_Value(COLUMNNAME_Orig_TrxID); + } + + /** Set Over/Under Payment. + @param OverUnderAmt + Over-Payment (unallocated) or Under-Payment (partial payment) Amount + */ + public void setOverUnderAmt (BigDecimal OverUnderAmt) + { + set_Value (COLUMNNAME_OverUnderAmt, OverUnderAmt); + } + + /** Get Over/Under Payment. + @return Over-Payment (unallocated) or Under-Payment (partial payment) Amount + */ + public BigDecimal getOverUnderAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OverUnderAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set PO Number. + @param PONum + Purchase Order Number + */ + public void setPONum (String PONum) + { + + if (PONum != null && PONum.length() > 60) + { + log.warning("Length > 60 - truncated"); + PONum = PONum.substring(0, 60); + } + set_Value (COLUMNNAME_PONum, PONum); + } + + /** Get PO Number. + @return Purchase Order Number + */ + public String getPONum () + { + return (String)get_Value(COLUMNNAME_PONum); + } + + /** Set Payment amount. + @param PayAmt + Amount being paid + */ + public void setPayAmt (BigDecimal PayAmt) + { + if (PayAmt == null) + throw new IllegalArgumentException ("PayAmt is mandatory."); + set_Value (COLUMNNAME_PayAmt, PayAmt); + } + + /** Get Payment amount. + @return Amount being paid + */ + public BigDecimal getPayAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PayAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Posted. + @param Posted + Posting status + */ + public void setPosted (boolean Posted) + { + set_Value (COLUMNNAME_Posted, Boolean.valueOf(Posted)); + } + + /** Get Posted. + @return Posting status + */ + public boolean isPosted () + { + Object oo = get_Value(COLUMNNAME_Posted); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Processed. + @param Processed + The document has been processed + */ + public void setProcessed (boolean Processed) + { + set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); + } + + /** Get Processed. + @return The document has been processed + */ + public boolean isProcessed () + { + Object oo = get_Value(COLUMNNAME_Processed); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Process Now. + @param Processing Process Now */ + public void setProcessing (boolean Processing) + { + set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); + } + + /** Get Process Now. + @return Process Now */ + public boolean isProcessing () + { + Object oo = get_Value(COLUMNNAME_Processing); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Authorization Code. + @param R_AuthCode + Authorization Code returned + */ + public void setR_AuthCode (String R_AuthCode) + { + + if (R_AuthCode != null && R_AuthCode.length() > 20) + { + log.warning("Length > 20 - truncated"); + R_AuthCode = R_AuthCode.substring(0, 20); + } + set_ValueNoCheck (COLUMNNAME_R_AuthCode, R_AuthCode); + } + + /** Get Authorization Code. + @return Authorization Code returned + */ + public String getR_AuthCode () + { + return (String)get_Value(COLUMNNAME_R_AuthCode); + } + + /** Set Authorization Code (DC). + @param R_AuthCode_DC + Authorization Code Delayed Capture returned + */ + public void setR_AuthCode_DC (String R_AuthCode_DC) + { + + if (R_AuthCode_DC != null && R_AuthCode_DC.length() > 20) + { + log.warning("Length > 20 - truncated"); + R_AuthCode_DC = R_AuthCode_DC.substring(0, 20); + } + set_ValueNoCheck (COLUMNNAME_R_AuthCode_DC, R_AuthCode_DC); + } + + /** Get Authorization Code (DC). + @return Authorization Code Delayed Capture returned + */ + public String getR_AuthCode_DC () + { + return (String)get_Value(COLUMNNAME_R_AuthCode_DC); + } + + /** R_AvsAddr AD_Reference_ID=213 */ + public static final int R_AVSADDR_AD_Reference_ID=213; + /** Match = Y */ + public static final String R_AVSADDR_Match = "Y"; + /** No Match = N */ + public static final String R_AVSADDR_NoMatch = "N"; + /** Unavailable = X */ + public static final String R_AVSADDR_Unavailable = "X"; + /** Set Address verified. + @param R_AvsAddr + This address has been verified + */ + public void setR_AvsAddr (String R_AvsAddr) + { + + if (R_AvsAddr == null || R_AvsAddr.equals("Y") || R_AvsAddr.equals("N") || R_AvsAddr.equals("X")); else throw new IllegalArgumentException ("R_AvsAddr Invalid value - " + R_AvsAddr + " - Reference_ID=213 - Y - N - X"); + if (R_AvsAddr != null && R_AvsAddr.length() > 1) + { + log.warning("Length > 1 - truncated"); + R_AvsAddr = R_AvsAddr.substring(0, 1); + } + set_ValueNoCheck (COLUMNNAME_R_AvsAddr, R_AvsAddr); + } + + /** Get Address verified. + @return This address has been verified + */ + public String getR_AvsAddr () + { + return (String)get_Value(COLUMNNAME_R_AvsAddr); + } + + /** R_AvsZip AD_Reference_ID=213 */ + public static final int R_AVSZIP_AD_Reference_ID=213; + /** Match = Y */ + public static final String R_AVSZIP_Match = "Y"; + /** No Match = N */ + public static final String R_AVSZIP_NoMatch = "N"; + /** Unavailable = X */ + public static final String R_AVSZIP_Unavailable = "X"; + /** Set Zip verified. + @param R_AvsZip + The Zip Code has been verified + */ + public void setR_AvsZip (String R_AvsZip) + { + + if (R_AvsZip == null || R_AvsZip.equals("Y") || R_AvsZip.equals("N") || R_AvsZip.equals("X")); else throw new IllegalArgumentException ("R_AvsZip Invalid value - " + R_AvsZip + " - Reference_ID=213 - Y - N - X"); + if (R_AvsZip != null && R_AvsZip.length() > 1) + { + log.warning("Length > 1 - truncated"); + R_AvsZip = R_AvsZip.substring(0, 1); + } + set_ValueNoCheck (COLUMNNAME_R_AvsZip, R_AvsZip); + } + + /** Get Zip verified. + @return The Zip Code has been verified + */ + public String getR_AvsZip () + { + return (String)get_Value(COLUMNNAME_R_AvsZip); + } + + /** Set CVV Match. + @param R_CVV2Match + Credit Card Verification Code Match + */ + public void setR_CVV2Match (boolean R_CVV2Match) + { + set_ValueNoCheck (COLUMNNAME_R_CVV2Match, Boolean.valueOf(R_CVV2Match)); + } + + /** Get CVV Match. + @return Credit Card Verification Code Match + */ + public boolean isR_CVV2Match () + { + Object oo = get_Value(COLUMNNAME_R_CVV2Match); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Info. + @param R_Info + Response info + */ + public void setR_Info (String R_Info) + { + + if (R_Info != null && R_Info.length() > 2000) + { + log.warning("Length > 2000 - truncated"); + R_Info = R_Info.substring(0, 2000); + } + set_ValueNoCheck (COLUMNNAME_R_Info, R_Info); + } + + /** Get Info. + @return Response info + */ + public String getR_Info () + { + return (String)get_Value(COLUMNNAME_R_Info); + } + + /** Set Reference. + @param R_PnRef + Payment reference + */ + public void setR_PnRef (String R_PnRef) + { + + if (R_PnRef != null && R_PnRef.length() > 20) + { + log.warning("Length > 20 - truncated"); + R_PnRef = R_PnRef.substring(0, 20); + } + set_ValueNoCheck (COLUMNNAME_R_PnRef, R_PnRef); + } + + /** Get Reference. + @return Payment reference + */ + public String getR_PnRef () + { + return (String)get_Value(COLUMNNAME_R_PnRef); + } + + /** Set Reference (DC). + @param R_PnRef_DC + Payment Reference Delayed Capture + */ + public void setR_PnRef_DC (String R_PnRef_DC) + { + + if (R_PnRef_DC != null && R_PnRef_DC.length() > 20) + { + log.warning("Length > 20 - truncated"); + R_PnRef_DC = R_PnRef_DC.substring(0, 20); + } + set_ValueNoCheck (COLUMNNAME_R_PnRef_DC, R_PnRef_DC); + } + + /** Get Reference (DC). + @return Payment Reference Delayed Capture + */ + public String getR_PnRef_DC () + { + return (String)get_Value(COLUMNNAME_R_PnRef_DC); + } + + /** Set Response Message. + @param R_RespMsg + Response message + */ + public void setR_RespMsg (String R_RespMsg) + { + + if (R_RespMsg != null && R_RespMsg.length() > 60) + { + log.warning("Length > 60 - truncated"); + R_RespMsg = R_RespMsg.substring(0, 60); + } + set_ValueNoCheck (COLUMNNAME_R_RespMsg, R_RespMsg); + } + + /** Get Response Message. + @return Response message + */ + public String getR_RespMsg () + { + return (String)get_Value(COLUMNNAME_R_RespMsg); + } + + /** Set Result. + @param R_Result + Result of transmission + */ + public void setR_Result (String R_Result) + { + + if (R_Result != null && R_Result.length() > 20) + { + log.warning("Length > 20 - truncated"); + R_Result = R_Result.substring(0, 20); + } + set_ValueNoCheck (COLUMNNAME_R_Result, R_Result); + } + + /** Get Result. + @return Result of transmission + */ + public String getR_Result () + { + return (String)get_Value(COLUMNNAME_R_Result); + } + + /** Ref_Payment_ID AD_Reference_ID=343 */ + public static final int REF_PAYMENT_ID_AD_Reference_ID=343; + /** Set Referenced Payment. + @param Ref_Payment_ID Referenced Payment */ + public void setRef_Payment_ID (int Ref_Payment_ID) + { + if (Ref_Payment_ID < 1) + set_ValueNoCheck (COLUMNNAME_Ref_Payment_ID, null); + else + set_ValueNoCheck (COLUMNNAME_Ref_Payment_ID, Integer.valueOf(Ref_Payment_ID)); + } + + /** Get Referenced Payment. + @return Referenced Payment */ + public int getRef_Payment_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Ref_Payment_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Routing No. + @param RoutingNo + Bank Routing Number + */ + public void setRoutingNo (String RoutingNo) + { + + if (RoutingNo != null && RoutingNo.length() > 20) + { + log.warning("Length > 20 - truncated"); + RoutingNo = RoutingNo.substring(0, 20); + } + set_Value (COLUMNNAME_RoutingNo, RoutingNo); + } + + /** Get Routing No. + @return Bank Routing Number + */ + public String getRoutingNo () + { + return (String)get_Value(COLUMNNAME_RoutingNo); + } + + /** Set Swipe. + @param Swipe + Track 1 and 2 of the Credit Card + */ + public void setSwipe (String Swipe) + { + + if (Swipe != null && Swipe.length() > 80) + { + log.warning("Length > 80 - truncated"); + Swipe = Swipe.substring(0, 80); + } + set_ValueNoCheck (COLUMNNAME_Swipe, Swipe); + } + + /** Get Swipe. + @return Track 1 and 2 of the Credit Card + */ + public String getSwipe () + { + return (String)get_Value(COLUMNNAME_Swipe); + } + + /** Set Tax Amount. + @param TaxAmt + Tax Amount for a document + */ + public void setTaxAmt (BigDecimal TaxAmt) + { + set_Value (COLUMNNAME_TaxAmt, TaxAmt); + } + + /** Get Tax Amount. + @return Tax Amount for a document + */ + public BigDecimal getTaxAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TaxAmt); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** TenderType AD_Reference_ID=214 */ + public static final int TENDERTYPE_AD_Reference_ID=214; + /** Credit Card = C */ + public static final String TENDERTYPE_CreditCard = "C"; + /** Check = K */ + public static final String TENDERTYPE_Check = "K"; + /** Direct Deposit = A */ + public static final String TENDERTYPE_DirectDeposit = "A"; + /** Direct Debit = D */ + public static final String TENDERTYPE_DirectDebit = "D"; + /** Account = T */ + public static final String TENDERTYPE_Account = "T"; + /** Cash = X */ + public static final String TENDERTYPE_Cash = "X"; + /** Set Tender type. + @param TenderType + Method of Payment + */ + public void setTenderType (String TenderType) + { + if (TenderType == null) throw new IllegalArgumentException ("TenderType is mandatory"); + if (TenderType.equals("C") || TenderType.equals("K") || TenderType.equals("A") || TenderType.equals("D") || TenderType.equals("T") || TenderType.equals("X")); else throw new IllegalArgumentException ("TenderType Invalid value - " + TenderType + " - Reference_ID=214 - C - K - A - D - T - X"); + if (TenderType.length() > 1) + { + log.warning("Length > 1 - truncated"); + TenderType = TenderType.substring(0, 1); + } + set_Value (COLUMNNAME_TenderType, TenderType); + } + + /** Get Tender type. + @return Method of Payment + */ + public String getTenderType () + { + return (String)get_Value(COLUMNNAME_TenderType); + } + + /** TrxType AD_Reference_ID=215 */ + public static final int TRXTYPE_AD_Reference_ID=215; + /** Sales = S */ + public static final String TRXTYPE_Sales = "S"; + /** Delayed Capture = D */ + public static final String TRXTYPE_DelayedCapture = "D"; + /** Credit (Payment) = C */ + public static final String TRXTYPE_CreditPayment = "C"; + /** Voice Authorization = F */ + public static final String TRXTYPE_VoiceAuthorization = "F"; + /** Authorization = A */ + public static final String TRXTYPE_Authorization = "A"; + /** Void = V */ + public static final String TRXTYPE_Void = "V"; + /** Set Transaction Type. + @param TrxType + Type of credit card transaction + */ + public void setTrxType (String TrxType) + { + if (TrxType == null) throw new IllegalArgumentException ("TrxType is mandatory"); + if (TrxType.equals("S") || TrxType.equals("D") || TrxType.equals("C") || TrxType.equals("F") || TrxType.equals("A") || TrxType.equals("V")); else throw new IllegalArgumentException ("TrxType Invalid value - " + TrxType + " - Reference_ID=215 - S - D - C - F - A - V"); + if (TrxType.length() > 1) + { + log.warning("Length > 1 - truncated"); + TrxType = TrxType.substring(0, 1); + } + set_Value (COLUMNNAME_TrxType, TrxType); + } + + /** Get Transaction Type. + @return Type of credit card transaction + */ + public String getTrxType () + { + return (String)get_Value(COLUMNNAME_TrxType); + } + + /** User1_ID AD_Reference_ID=134 */ + public static final int USER1_ID_AD_Reference_ID=134; + /** Set User List 1. + @param User1_ID + User defined list element #1 + */ + public void setUser1_ID (int User1_ID) + { + if (User1_ID < 1) + set_Value (COLUMNNAME_User1_ID, null); + else + set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID)); + } + + /** Get User List 1. + @return User defined list element #1 + */ + public int getUser1_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** User2_ID AD_Reference_ID=137 */ + public static final int USER2_ID_AD_Reference_ID=137; + /** Set User List 2. + @param User2_ID + User defined list element #2 + */ + public void setUser2_ID (int User2_ID) + { + if (User2_ID < 1) + set_Value (COLUMNNAME_User2_ID, null); + else + set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID)); + } + + /** Get User List 2. + @return User defined list element #2 + */ + public int getUser2_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_User2_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Voice authorization code. + @param VoiceAuthCode + Voice Authorization Code from credit card company + */ + public void setVoiceAuthCode (String VoiceAuthCode) + { + + if (VoiceAuthCode != null && VoiceAuthCode.length() > 20) + { + log.warning("Length > 20 - truncated"); + VoiceAuthCode = VoiceAuthCode.substring(0, 20); + } + set_Value (COLUMNNAME_VoiceAuthCode, VoiceAuthCode); + } + + /** Get Voice authorization code. + @return Voice Authorization Code from credit card company + */ + public String getVoiceAuthCode () + { + return (String)get_Value(COLUMNNAME_VoiceAuthCode); + } + + /** Set Write-off Amount. + @param WriteOffAmt + Amount to write-off + */ + public void setWriteOffAmt (BigDecimal WriteOffAmt) + { + set_Value (COLUMNNAME_WriteOffAmt, WriteOffAmt); + } + + /** Get Write-off Amount. + @return Amount to write-off + */ + public BigDecimal getWriteOffAmt () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_WriteOffAmt); + if (bd == null) + return Env.ZERO; + return bd; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_M_InventoryLine.java b/posterita/posterita/src/main/org/compiere/model/X_M_InventoryLine.java new file mode 100644 index 0000000000..88a85e30e9 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_M_InventoryLine.java @@ -0,0 +1,477 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.util.Properties; +import java.util.logging.Level; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for M_InventoryLine + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_M_InventoryLine extends PO implements I_M_InventoryLine, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_M_InventoryLine (Properties ctx, int M_InventoryLine_ID, String trxName) + { + super (ctx, M_InventoryLine_ID, trxName); + /** if (M_InventoryLine_ID == 0) + { + setInventoryType (null); +// D + setM_AttributeSetInstance_ID (0); + setM_Inventory_ID (0); + setM_InventoryLine_ID (0); + setM_Locator_ID (0); +// @M_Locator_ID@ + setM_Product_ID (0); + setProcessed (false); + setQtyBook (Env.ZERO); + setQtyCount (Env.ZERO); + setqtycsv (Env.ZERO); + } */ + } + + /** Load Constructor */ + public X_M_InventoryLine (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 1 - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_M_InventoryLine[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + public I_C_Charge getC_Charge() throws Exception + { + Class clazz = MTable.getClass(I_C_Charge.Table_Name); + I_C_Charge result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Charge)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Charge_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Charge. + @param C_Charge_ID + Additional document charges + */ + public void setC_Charge_ID (int C_Charge_ID) + { + if (C_Charge_ID < 1) + set_Value (COLUMNNAME_C_Charge_ID, null); + else + set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID)); + } + + /** Get Charge. + @return Additional document charges + */ + public int getC_Charge_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** InventoryType AD_Reference_ID=292 */ + public static final int INVENTORYTYPE_AD_Reference_ID=292; + /** Inventory Difference = D */ + public static final String INVENTORYTYPE_InventoryDifference = "D"; + /** Charge Account = C */ + public static final String INVENTORYTYPE_ChargeAccount = "C"; + /** Set Inventory Type. + @param InventoryType + Type of inventory difference + */ + public void setInventoryType (String InventoryType) + { + if (InventoryType == null) throw new IllegalArgumentException ("InventoryType is mandatory"); + if (InventoryType.equals("D") || InventoryType.equals("C")); else throw new IllegalArgumentException ("InventoryType Invalid value - " + InventoryType + " - Reference_ID=292 - D - C"); + if (InventoryType.length() > 1) + { + log.warning("Length > 1 - truncated"); + InventoryType = InventoryType.substring(0, 1); + } + set_Value (COLUMNNAME_InventoryType, InventoryType); + } + + /** Get Inventory Type. + @return Type of inventory difference + */ + public String getInventoryType () + { + return (String)get_Value(COLUMNNAME_InventoryType); + } + + /** Set Line No. + @param Line + Unique line for this document + */ + public void setLine (int Line) + { + set_Value (COLUMNNAME_Line, Integer.valueOf(Line)); + } + + /** Get Line No. + @return Unique line for this document + */ + public int getLine () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Line); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), String.valueOf(getLine())); + } + + /** Set Attribute Set Instance. + @param M_AttributeSetInstance_ID + Product Attribute Set Instance + */ + public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID) + { + if (M_AttributeSetInstance_ID < 0) + throw new IllegalArgumentException ("M_AttributeSetInstance_ID is mandatory."); + set_Value (COLUMNNAME_M_AttributeSetInstance_ID, Integer.valueOf(M_AttributeSetInstance_ID)); + } + + /** Get Attribute Set Instance. + @return Product Attribute Set Instance + */ + public int getM_AttributeSetInstance_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstance_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_M_Inventory getM_Inventory() throws Exception + { + Class clazz = MTable.getClass(I_M_Inventory.Table_Name); + I_M_Inventory result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_Inventory)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_Inventory_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Phys.Inventory. + @param M_Inventory_ID + Parameters for a Physical Inventory + */ + public void setM_Inventory_ID (int M_Inventory_ID) + { + if (M_Inventory_ID < 1) + throw new IllegalArgumentException ("M_Inventory_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_M_Inventory_ID, Integer.valueOf(M_Inventory_ID)); + } + + /** Get Phys.Inventory. + @return Parameters for a Physical Inventory + */ + public int getM_Inventory_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Inventory_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Phys.Inventory Line. + @param M_InventoryLine_ID + Unique line in an Inventory document + */ + public void setM_InventoryLine_ID (int M_InventoryLine_ID) + { + if (M_InventoryLine_ID < 1) + throw new IllegalArgumentException ("M_InventoryLine_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_M_InventoryLine_ID, Integer.valueOf(M_InventoryLine_ID)); + } + + /** Get Phys.Inventory Line. + @return Unique line in an Inventory document + */ + public int getM_InventoryLine_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_InventoryLine_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Locator. + @param M_Locator_ID + Warehouse Locator + */ + public void setM_Locator_ID (int M_Locator_ID) + { + if (M_Locator_ID < 1) + throw new IllegalArgumentException ("M_Locator_ID is mandatory."); + set_Value (COLUMNNAME_M_Locator_ID, Integer.valueOf(M_Locator_ID)); + } + + /** Get Locator. + @return Warehouse Locator + */ + public int getM_Locator_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Locator_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** M_Product_ID AD_Reference_ID=171 */ + public static final int M_PRODUCT_ID_AD_Reference_ID=171; + /** Set Product. + @param M_Product_ID + Product, Service, Item + */ + public void setM_Product_ID (int M_Product_ID) + { + if (M_Product_ID < 1) + throw new IllegalArgumentException ("M_Product_ID is mandatory."); + set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); + } + + /** Get Product. + @return Product, Service, Item + */ + public int getM_Product_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Processed. + @param Processed + The document has been processed + */ + public void setProcessed (boolean Processed) + { + set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); + } + + /** Get Processed. + @return The document has been processed + */ + public boolean isProcessed () + { + Object oo = get_Value(COLUMNNAME_Processed); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Quantity book. + @param QtyBook + Book Quantity + */ + public void setQtyBook (BigDecimal QtyBook) + { + if (QtyBook == null) + throw new IllegalArgumentException ("QtyBook is mandatory."); + set_ValueNoCheck (COLUMNNAME_QtyBook, QtyBook); + } + + /** Get Quantity book. + @return Book Quantity + */ + public BigDecimal getQtyBook () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyBook); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Quantity count. + @param QtyCount + Counted Quantity + */ + public void setQtyCount (BigDecimal QtyCount) + { + if (QtyCount == null) + throw new IllegalArgumentException ("QtyCount is mandatory."); + set_Value (COLUMNNAME_QtyCount, QtyCount); + } + + /** Get Quantity count. + @return Counted Quantity + */ + public BigDecimal getQtyCount () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyCount); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Quantity CSV. + @param Quantity CSV + Quantity CSV + */ + public void setQtyCsv (BigDecimal QtyCsv) + { + if (QtyCsv == null) + throw new IllegalArgumentException ("qtycsv is mandatory."); + set_Value (COLUMNNAME_QtyCsv, QtyCsv); + } + + /** Get Quantity CSV. + @return Quantity CSV + */ + public BigDecimal getQtyCsv () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyCsv); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Internal Use Qty. + @param QtyInternalUse + Internal Use Quantity removed from Inventory + */ + public void setQtyInternalUse (BigDecimal QtyInternalUse) + { + set_Value (COLUMNNAME_QtyInternalUse, QtyInternalUse); + } + + /** Get Internal Use Qty. + @return Internal Use Quantity removed from Inventory + */ + public BigDecimal getQtyInternalUse () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyInternalUse); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set UPC/EAN. + @param UPC + Bar Code (Universal Product Code or its superset European Article Number) + */ + public void setUPC (String UPC) + { + throw new IllegalArgumentException ("UPC is virtual column"); } + + /** Get UPC/EAN. + @return Bar Code (Universal Product Code or its superset European Article Number) + */ + public String getUPC () + { + return (String)get_Value(COLUMNNAME_UPC); + } + + /** Set Search Key. + @param Value + Search key for the record in the format required - must be unique + */ + public void setValue (String Value) + { + throw new IllegalArgumentException ("Value is virtual column"); } + + /** Get Search Key. + @return Search key for the record in the format required - must be unique + */ + public String getValue () + { + return (String)get_Value(COLUMNNAME_Value); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_M_PriceList.java b/posterita/posterita/src/main/org/compiere/model/X_M_PriceList.java new file mode 100644 index 0000000000..56e1fd22bf --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_M_PriceList.java @@ -0,0 +1,388 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.util.Properties; +import java.util.logging.Level; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for M_PriceList + * @author Adempiere (generated) + * @version Release 3.3.1b - $Id$ */ +public class X_M_PriceList extends PO implements I_M_PriceList, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_M_PriceList (Properties ctx, int M_PriceList_ID, String trxName) + { + super (ctx, M_PriceList_ID, trxName); + /** if (M_PriceList_ID == 0) + { + setC_Currency_ID (0); + setEnforcePriceLimit (false); + setIsDefault (false); + setIsSOPriceList (false); + setIsTaxIncluded (false); + setM_PriceList_ID (0); + setName (null); + setPricePrecision (Env.ZERO); +// 2 + } */ + } + + /** Load Constructor */ + public X_M_PriceList (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 3 - Client - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_M_PriceList[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** BasePriceList_ID AD_Reference_ID=166 */ + public static final int BASEPRICELIST_ID_AD_Reference_ID=166; + /** Set Base Pricelist. + @param BasePriceList_ID + Pricelist to be used, if product not found on this pricelist + */ + public void setBasePriceList_ID (int BasePriceList_ID) + { + if (BasePriceList_ID <= 0) + set_Value (COLUMNNAME_BasePriceList_ID, null); + else + set_Value (COLUMNNAME_BasePriceList_ID, Integer.valueOf(BasePriceList_ID)); + } + + /** Get Base Pricelist. + @return Pricelist to be used, if product not found on this pricelist + */ + public int getBasePriceList_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_BasePriceList_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_Currency getC_Currency() throws Exception + { + Class clazz = MTable.getClass(I_C_Currency.Table_Name); + I_C_Currency result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_Currency)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Currency_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Currency. + @param C_Currency_ID + The Currency for this record + */ + public void setC_Currency_ID (int C_Currency_ID) + { + if (C_Currency_ID < 1) + throw new IllegalArgumentException ("C_Currency_ID is mandatory."); + set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID)); + } + + /** Get Currency. + @return The Currency for this record + */ + public int getC_Currency_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set Enforce price limit. + @param EnforcePriceLimit + Do not allow prices below the limit price + */ + public void setEnforcePriceLimit (boolean EnforcePriceLimit) + { + set_Value (COLUMNNAME_EnforcePriceLimit, Boolean.valueOf(EnforcePriceLimit)); + } + + /** Get Enforce price limit. + @return Do not allow prices below the limit price + */ + public boolean isEnforcePriceLimit () + { + Object oo = get_Value(COLUMNNAME_EnforcePriceLimit); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Default. + @param IsDefault + Default value + */ + public void setIsDefault (boolean IsDefault) + { + set_Value (COLUMNNAME_IsDefault, Boolean.valueOf(IsDefault)); + } + + /** Get Default. + @return Default value + */ + public boolean isDefault () + { + Object oo = get_Value(COLUMNNAME_IsDefault); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Mandatory. + @param IsMandatory + Data entry is required in this column + */ + public void setIsMandatory (boolean IsMandatory) + { + set_Value (COLUMNNAME_IsMandatory, Boolean.valueOf(IsMandatory)); + } + + /** Get Mandatory. + @return Data entry is required in this column + */ + public boolean isMandatory () + { + Object oo = get_Value(COLUMNNAME_IsMandatory); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set isPresentForProduct. + @param isPresentForProduct isPresentForProduct */ + public void setisPresentForProduct (boolean isPresentForProduct) + { + set_Value (COLUMNNAME_isPresentForProduct, Boolean.valueOf(isPresentForProduct)); + } + + /** Get isPresentForProduct. + @return isPresentForProduct */ + public boolean isPresentForProduct () + { + Object oo = get_Value(COLUMNNAME_isPresentForProduct); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Sales Price list. + @param IsSOPriceList + This is a Sales Price List + */ + public void setIsSOPriceList (boolean IsSOPriceList) + { + set_Value (COLUMNNAME_IsSOPriceList, Boolean.valueOf(IsSOPriceList)); + } + + /** Get Sales Price list. + @return This is a Sales Price List + */ + public boolean isSOPriceList () + { + Object oo = get_Value(COLUMNNAME_IsSOPriceList); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Price includes Tax. + @param IsTaxIncluded + Tax is included in the price + */ + public void setIsTaxIncluded (boolean IsTaxIncluded) + { + set_Value (COLUMNNAME_IsTaxIncluded, Boolean.valueOf(IsTaxIncluded)); + } + + /** Get Price includes Tax. + @return Tax is included in the price + */ + public boolean isTaxIncluded () + { + Object oo = get_Value(COLUMNNAME_IsTaxIncluded); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Price List. + @param M_PriceList_ID + Unique identifier of a Price List + */ + public void setM_PriceList_ID (int M_PriceList_ID) + { + if (M_PriceList_ID < 1) + throw new IllegalArgumentException ("M_PriceList_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_M_PriceList_ID, Integer.valueOf(M_PriceList_ID)); + } + + /** Get Price List. + @return Unique identifier of a Price List + */ + public int getM_PriceList_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_PriceList_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Name. + @param Name + Alphanumeric identifier of the entity + */ + public void setName (String Name) + { + if (Name == null) + throw new IllegalArgumentException ("Name is mandatory."); + + if (Name.length() > 60) + { + log.warning("Length > 60 - truncated"); + Name = Name.substring(0, 60); + } + set_Value (COLUMNNAME_Name, Name); + } + + /** Get Name. + @return Alphanumeric identifier of the entity + */ + public String getName () + { + return (String)get_Value(COLUMNNAME_Name); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), getName()); + } + + /** Set Price Precision. + @param PricePrecision + Precision (number of decimals) for the Price + */ + public void setPricePrecision (BigDecimal PricePrecision) + { + if (PricePrecision == null) + throw new IllegalArgumentException ("PricePrecision is mandatory."); + set_Value (COLUMNNAME_PricePrecision, PricePrecision); + } + + /** Get Price Precision. + @return Precision (number of decimals) for the Price + */ + public BigDecimal getPricePrecision () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PricePrecision); + if (bd == null) + return Env.ZERO; + return bd; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_M_Product.java b/posterita/posterita/src/main/org/compiere/model/X_M_Product.java new file mode 100644 index 0000000000..df11c39fed --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_M_Product.java @@ -0,0 +1,1440 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.Properties; +import java.util.logging.Level; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +/** Generated Model for M_Product + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_M_Product extends PO implements I_M_Product, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_M_Product (Properties ctx, int M_Product_ID, String trxName) + { + super (ctx, M_Product_ID, trxName); + /** if (M_Product_ID == 0) + { + setC_TaxCategory_ID (0); + setC_UOM_ID (0); + setIsBOM (false); +// N + setIsDropShip (false); + setIsExcludeAutoDelivery (false); +// N + setIsInvoicePrintDetails (false); + setIsPickListPrintDetails (false); + setIsPurchased (true); +// Y + setIsSelfService (true); +// Y + setIsSold (true); +// Y + setIsStocked (true); +// Y + setIsSummary (false); + setIsVerified (false); +// N + setIsWebStoreFeatured (false); + setM_AttributeSetInstance_ID (0); + setM_Product_Category_ID (0); + setM_Product_ID (0); + setName (null); + setProductType (null); +// I + setValue (null); + } */ + } + + /** Load Constructor */ + public X_M_Product (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 3 - Client - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_M_Product[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** Set Classification. + @param Classification + Classification for grouping + */ + public void setClassification (String Classification) + { + + if (Classification != null && Classification.length() > 1) + { + log.warning("Length > 1 - truncated"); + Classification = Classification.substring(0, 1); + } + set_Value (COLUMNNAME_Classification, Classification); + } + + /** Get Classification. + @return Classification for grouping + */ + public String getClassification () + { + return (String)get_Value(COLUMNNAME_Classification); + } + + public I_C_RevenueRecognition getC_RevenueRecognition() throws Exception + { + Class clazz = MTable.getClass(I_C_RevenueRecognition.Table_Name); + I_C_RevenueRecognition result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_RevenueRecognition)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_RevenueRecognition_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Revenue Recognition. + @param C_RevenueRecognition_ID + Method for recording revenue + */ + public void setC_RevenueRecognition_ID (int C_RevenueRecognition_ID) + { + if (C_RevenueRecognition_ID < 1) + set_Value (COLUMNNAME_C_RevenueRecognition_ID, null); + else + set_Value (COLUMNNAME_C_RevenueRecognition_ID, Integer.valueOf(C_RevenueRecognition_ID)); + } + + /** Get Revenue Recognition. + @return Method for recording revenue + */ + public int getC_RevenueRecognition_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_RevenueRecognition_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Subscription Type. + @param C_SubscriptionType_ID + Type of subscription + */ + public void setC_SubscriptionType_ID (int C_SubscriptionType_ID) + { + if (C_SubscriptionType_ID < 1) + set_Value (COLUMNNAME_C_SubscriptionType_ID, null); + else + set_Value (COLUMNNAME_C_SubscriptionType_ID, Integer.valueOf(C_SubscriptionType_ID)); + } + + /** Get Subscription Type. + @return Type of subscription + */ + public int getC_SubscriptionType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_SubscriptionType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_TaxCategory getC_TaxCategory() throws Exception + { + Class clazz = MTable.getClass(I_C_TaxCategory.Table_Name); + I_C_TaxCategory result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_TaxCategory)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_TaxCategory_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Tax Category. + @param C_TaxCategory_ID + Tax Category + */ + public void setC_TaxCategory_ID (int C_TaxCategory_ID) + { + if (C_TaxCategory_ID < 1) + throw new IllegalArgumentException ("C_TaxCategory_ID is mandatory."); + set_Value (COLUMNNAME_C_TaxCategory_ID, Integer.valueOf(C_TaxCategory_ID)); + } + + /** Get Tax Category. + @return Tax Category + */ + public int getC_TaxCategory_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxCategory_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_UOM getC_UOM() throws Exception + { + Class clazz = MTable.getClass(I_C_UOM.Table_Name); + I_C_UOM result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_UOM)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_UOM_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set UOM. + @param C_UOM_ID + Unit of Measure + */ + public void setC_UOM_ID (int C_UOM_ID) + { + if (C_UOM_ID < 1) + throw new IllegalArgumentException ("C_UOM_ID is mandatory."); + set_Value (COLUMNNAME_C_UOM_ID, Integer.valueOf(C_UOM_ID)); + } + + /** Get UOM. + @return Unit of Measure + */ + public int getC_UOM_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_UOM_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set Description URL. + @param DescriptionURL + URL for the description + */ + public void setDescriptionURL (String DescriptionURL) + { + + if (DescriptionURL != null && DescriptionURL.length() > 120) + { + log.warning("Length > 120 - truncated"); + DescriptionURL = DescriptionURL.substring(0, 120); + } + set_Value (COLUMNNAME_DescriptionURL, DescriptionURL); + } + + /** Get Description URL. + @return URL for the description + */ + public String getDescriptionURL () + { + return (String)get_Value(COLUMNNAME_DescriptionURL); + } + + /** Set Discontinued. + @param Discontinued + This product is no longer available + */ + public void setDiscontinued (boolean Discontinued) + { + set_Value (COLUMNNAME_Discontinued, Boolean.valueOf(Discontinued)); + } + + /** Get Discontinued. + @return This product is no longer available + */ + public boolean isDiscontinued () + { + Object oo = get_Value(COLUMNNAME_Discontinued); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Discontinued by. + @param DiscontinuedBy + Discontinued By + */ + public void setDiscontinuedBy (Timestamp DiscontinuedBy) + { + set_Value (COLUMNNAME_DiscontinuedBy, DiscontinuedBy); + } + + /** Get Discontinued by. + @return Discontinued By + */ + public Timestamp getDiscontinuedBy () + { + return (Timestamp)get_Value(COLUMNNAME_DiscontinuedBy); + } + + /** Set Document Note. + @param DocumentNote + Additional information for a Document + */ + public void setDocumentNote (String DocumentNote) + { + + if (DocumentNote != null && DocumentNote.length() > 2000) + { + log.warning("Length > 2000 - truncated"); + DocumentNote = DocumentNote.substring(0, 2000); + } + set_Value (COLUMNNAME_DocumentNote, DocumentNote); + } + + /** Get Document Note. + @return Additional information for a Document + */ + public String getDocumentNote () + { + return (String)get_Value(COLUMNNAME_DocumentNote); + } + + /** Set Group1. + @param Group1 Group1 */ + public void setGroup1 (String Group1) + { + + if (Group1 != null && Group1.length() > 255) + { + log.warning("Length > 255 - truncated"); + Group1 = Group1.substring(0, 255); + } + set_Value (COLUMNNAME_Group1, Group1); + } + + /** Get Group1. + @return Group1 */ + public String getGroup1 () + { + return (String)get_Value(COLUMNNAME_Group1); + } + + /** Set Group2. + @param Group2 Group2 */ + public void setGroup2 (String Group2) + { + + if (Group2 != null && Group2.length() > 255) + { + log.warning("Length > 255 - truncated"); + Group2 = Group2.substring(0, 255); + } + set_Value (COLUMNNAME_Group2, Group2); + } + + /** Get Group2. + @return Group2 */ + public String getGroup2 () + { + return (String)get_Value(COLUMNNAME_Group2); + } + + /** Set Guarantee Days. + @param GuaranteeDays + Number of days the product is guaranteed or available + */ + public void setGuaranteeDays (int GuaranteeDays) + { + set_Value (COLUMNNAME_GuaranteeDays, Integer.valueOf(GuaranteeDays)); + } + + /** Get Guarantee Days. + @return Number of days the product is guaranteed or available + */ + public int getGuaranteeDays () + { + Integer ii = (Integer)get_Value(COLUMNNAME_GuaranteeDays); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Min Guarantee Days. + @param GuaranteeDaysMin + Minumum number of guarantee days + */ + public void setGuaranteeDaysMin (int GuaranteeDaysMin) + { + set_Value (COLUMNNAME_GuaranteeDaysMin, Integer.valueOf(GuaranteeDaysMin)); + } + + /** Get Min Guarantee Days. + @return Minumum number of guarantee days + */ + public int getGuaranteeDaysMin () + { + Integer ii = (Integer)get_Value(COLUMNNAME_GuaranteeDaysMin); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Comment/Help. + @param Help + Comment or Hint + */ + public void setHelp (String Help) + { + + if (Help != null && Help.length() > 2000) + { + log.warning("Length > 2000 - truncated"); + Help = Help.substring(0, 2000); + } + set_Value (COLUMNNAME_Help, Help); + } + + /** Get Comment/Help. + @return Comment or Hint + */ + public String getHelp () + { + return (String)get_Value(COLUMNNAME_Help); + } + + /** Set Image URL. + @param ImageURL + URL of image + */ + public void setImageURL (String ImageURL) + { + + if (ImageURL != null && ImageURL.length() > 120) + { + log.warning("Length > 120 - truncated"); + ImageURL = ImageURL.substring(0, 120); + } + set_Value (COLUMNNAME_ImageURL, ImageURL); + } + + /** Get Image URL. + @return URL of image + */ + public String getImageURL () + { + return (String)get_Value(COLUMNNAME_ImageURL); + } + + /** Set Bill of Materials. + @param IsBOM + Bill of Materials + */ + public void setIsBOM (boolean IsBOM) + { + set_Value (COLUMNNAME_IsBOM, Boolean.valueOf(IsBOM)); + } + + /** Get Bill of Materials. + @return Bill of Materials + */ + public boolean isBOM () + { + Object oo = get_Value(COLUMNNAME_IsBOM); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Drop Shipment. + @param IsDropShip + Drop Shipments are sent from the Vendor directly to the Customer + */ + public void setIsDropShip (boolean IsDropShip) + { + set_Value (COLUMNNAME_IsDropShip, Boolean.valueOf(IsDropShip)); + } + + /** Get Drop Shipment. + @return Drop Shipments are sent from the Vendor directly to the Customer + */ + public boolean isDropShip () + { + Object oo = get_Value(COLUMNNAME_IsDropShip); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Exclude Auto Delivery. + @param IsExcludeAutoDelivery + Exclude from automatic Delivery + */ + public void setIsExcludeAutoDelivery (boolean IsExcludeAutoDelivery) + { + set_Value (COLUMNNAME_IsExcludeAutoDelivery, Boolean.valueOf(IsExcludeAutoDelivery)); + } + + /** Get Exclude Auto Delivery. + @return Exclude from automatic Delivery + */ + public boolean isExcludeAutoDelivery () + { + Object oo = get_Value(COLUMNNAME_IsExcludeAutoDelivery); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Print detail records on invoice . + @param IsInvoicePrintDetails + Print detail BOM elements on the invoice + */ + public void setIsInvoicePrintDetails (boolean IsInvoicePrintDetails) + { + set_Value (COLUMNNAME_IsInvoicePrintDetails, Boolean.valueOf(IsInvoicePrintDetails)); + } + + /** Get Print detail records on invoice . + @return Print detail BOM elements on the invoice + */ + public boolean isInvoicePrintDetails () + { + Object oo = get_Value(COLUMNNAME_IsInvoicePrintDetails); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Print detail records on pick list. + @param IsPickListPrintDetails + Print detail BOM elements on the pick list + */ + public void setIsPickListPrintDetails (boolean IsPickListPrintDetails) + { + set_Value (COLUMNNAME_IsPickListPrintDetails, Boolean.valueOf(IsPickListPrintDetails)); + } + + /** Get Print detail records on pick list. + @return Print detail BOM elements on the pick list + */ + public boolean isPickListPrintDetails () + { + Object oo = get_Value(COLUMNNAME_IsPickListPrintDetails); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Purchased. + @param IsPurchased + Organization purchases this product + */ + public void setIsPurchased (boolean IsPurchased) + { + set_Value (COLUMNNAME_IsPurchased, Boolean.valueOf(IsPurchased)); + } + + /** Get Purchased. + @return Organization purchases this product + */ + public boolean isPurchased () + { + Object oo = get_Value(COLUMNNAME_IsPurchased); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Self-Service. + @param IsSelfService + This is a Self-Service entry or this entry can be changed via Self-Service + */ + public void setIsSelfService (boolean IsSelfService) + { + set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService)); + } + + /** Get Self-Service. + @return This is a Self-Service entry or this entry can be changed via Self-Service + */ + public boolean isSelfService () + { + Object oo = get_Value(COLUMNNAME_IsSelfService); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Sold. + @param IsSold + Organization sells this product + */ + public void setIsSold (boolean IsSold) + { + set_Value (COLUMNNAME_IsSold, Boolean.valueOf(IsSold)); + } + + /** Get Sold. + @return Organization sells this product + */ + public boolean isSold () + { + Object oo = get_Value(COLUMNNAME_IsSold); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Stocked. + @param IsStocked + Organization stocks this product + */ + public void setIsStocked (boolean IsStocked) + { + set_Value (COLUMNNAME_IsStocked, Boolean.valueOf(IsStocked)); + } + + /** Get Stocked. + @return Organization stocks this product + */ + public boolean isStocked () + { + Object oo = get_Value(COLUMNNAME_IsStocked); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Summary Level. + @param IsSummary + This is a summary entity + */ + public void setIsSummary (boolean IsSummary) + { + set_Value (COLUMNNAME_IsSummary, Boolean.valueOf(IsSummary)); + } + + /** Get Summary Level. + @return This is a summary entity + */ + public boolean isSummary () + { + Object oo = get_Value(COLUMNNAME_IsSummary); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Verified. + @param IsVerified + The BOM configuration has been verified + */ + public void setIsVerified (boolean IsVerified) + { + set_ValueNoCheck (COLUMNNAME_IsVerified, Boolean.valueOf(IsVerified)); + } + + /** Get Verified. + @return The BOM configuration has been verified + */ + public boolean isVerified () + { + Object oo = get_Value(COLUMNNAME_IsVerified); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Featured in Web Store. + @param IsWebStoreFeatured + If selected, the product is displayed in the inital or any empy search + */ + public void setIsWebStoreFeatured (boolean IsWebStoreFeatured) + { + set_Value (COLUMNNAME_IsWebStoreFeatured, Boolean.valueOf(IsWebStoreFeatured)); + } + + /** Get Featured in Web Store. + @return If selected, the product is displayed in the inital or any empy search + */ + public boolean isWebStoreFeatured () + { + Object oo = get_Value(COLUMNNAME_IsWebStoreFeatured); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + public I_M_AttributeSet getM_AttributeSet() throws Exception + { + Class clazz = MTable.getClass(I_M_AttributeSet.Table_Name); + I_M_AttributeSet result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_AttributeSet)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_AttributeSet_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Attribute Set. + @param M_AttributeSet_ID + Product Attribute Set + */ + public void setM_AttributeSet_ID (int M_AttributeSet_ID) + { + if (M_AttributeSet_ID < 0) + set_Value (COLUMNNAME_M_AttributeSet_ID, null); + else + set_Value (COLUMNNAME_M_AttributeSet_ID, Integer.valueOf(M_AttributeSet_ID)); + } + + /** Get Attribute Set. + @return Product Attribute Set + */ + public int getM_AttributeSet_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSet_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Attribute Set Instance. + @param M_AttributeSetInstance_ID + Product Attribute Set Instance + */ + public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID) + { + if (M_AttributeSetInstance_ID < 0) + throw new IllegalArgumentException ("M_AttributeSetInstance_ID is mandatory."); + set_Value (COLUMNNAME_M_AttributeSetInstance_ID, Integer.valueOf(M_AttributeSetInstance_ID)); + } + + /** Get Attribute Set Instance. + @return Product Attribute Set Instance + */ + public int getM_AttributeSetInstance_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstance_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_M_FreightCategory getM_FreightCategory() throws Exception + { + Class clazz = MTable.getClass(I_M_FreightCategory.Table_Name); + I_M_FreightCategory result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_FreightCategory)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_FreightCategory_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Freight Category. + @param M_FreightCategory_ID + Category of the Freight + */ + public void setM_FreightCategory_ID (int M_FreightCategory_ID) + { + if (M_FreightCategory_ID < 1) + set_Value (COLUMNNAME_M_FreightCategory_ID, null); + else + set_Value (COLUMNNAME_M_FreightCategory_ID, Integer.valueOf(M_FreightCategory_ID)); + } + + /** Get Freight Category. + @return Category of the Freight + */ + public int getM_FreightCategory_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_FreightCategory_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Locator. + @param M_Locator_ID + Warehouse Locator + */ + public void setM_Locator_ID (int M_Locator_ID) + { + if (M_Locator_ID < 1) + set_Value (COLUMNNAME_M_Locator_ID, null); + else + set_Value (COLUMNNAME_M_Locator_ID, Integer.valueOf(M_Locator_ID)); + } + + /** Get Locator. + @return Warehouse Locator + */ + public int getM_Locator_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Locator_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** M_Product_Category_ID AD_Reference_ID=163 */ + public static final int M_PRODUCT_CATEGORY_ID_AD_Reference_ID=163; + public I_M_Product_Category getM_Product_Category() throws Exception + { + Class clazz = MTable.getClass(I_M_Product_Category.Table_Name); + I_M_Product_Category result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_Product_Category)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_Product_Category_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Product Category. + @param M_Product_Category_ID + Category of a Product + */ + public void setM_Product_Category_ID (int M_Product_Category_ID) + { + if (M_Product_Category_ID < 1) + throw new IllegalArgumentException ("M_Product_Category_ID is mandatory."); + set_Value (COLUMNNAME_M_Product_Category_ID, Integer.valueOf(M_Product_Category_ID)); + } + + /** Get Product Category. + @return Category of a Product + */ + public int getM_Product_Category_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_Category_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Product. + @param M_Product_ID + Product, Service, Item + */ + public void setM_Product_ID (int M_Product_ID) + { + if (M_Product_ID < 1) + throw new IllegalArgumentException ("M_Product_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); + } + + /** Get Product. + @return Product, Service, Item + */ + public int getM_Product_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Name. + @param Name + Alphanumeric identifier of the entity + */ + public void setName (String Name) + { + if (Name == null) + throw new IllegalArgumentException ("Name is mandatory."); + + if (Name.length() > 60) + { + log.warning("Length > 60 - truncated"); + Name = Name.substring(0, 60); + } + set_Value (COLUMNNAME_Name, Name); + } + + /** Get Name. + @return Alphanumeric identifier of the entity + */ + public String getName () + { + return (String)get_Value(COLUMNNAME_Name); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), getName()); + } + + /** Set Process Now. + @param Processing Process Now */ + public void setProcessing (boolean Processing) + { + set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); + } + + /** Get Process Now. + @return Process Now */ + public boolean isProcessing () + { + Object oo = get_Value(COLUMNNAME_Processing); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** ProductType AD_Reference_ID=270 */ + public static final int PRODUCTTYPE_AD_Reference_ID=270; + /** Item = I */ + public static final String PRODUCTTYPE_Item = "I"; + /** Service = S */ + public static final String PRODUCTTYPE_Service = "S"; + /** Resource = R */ + public static final String PRODUCTTYPE_Resource = "R"; + /** Expense type = E */ + public static final String PRODUCTTYPE_ExpenseType = "E"; + /** Online = O */ + public static final String PRODUCTTYPE_Online = "O"; + /** Set Product Type. + @param ProductType + Type of product + */ + public void setProductType (String ProductType) + { + if (ProductType == null) throw new IllegalArgumentException ("ProductType is mandatory"); + if (ProductType.equals("I") || ProductType.equals("S") || ProductType.equals("R") || ProductType.equals("E") || ProductType.equals("O")); else throw new IllegalArgumentException ("ProductType Invalid value - " + ProductType + " - Reference_ID=270 - I - S - R - E - O"); + if (ProductType.length() > 1) + { + log.warning("Length > 1 - truncated"); + ProductType = ProductType.substring(0, 1); + } + set_Value (COLUMNNAME_ProductType, ProductType); + } + + /** Get Product Type. + @return Type of product + */ + public String getProductType () + { + return (String)get_Value(COLUMNNAME_ProductType); + } + + public I_R_MailText getR_MailText() throws Exception + { + Class clazz = MTable.getClass(I_R_MailText.Table_Name); + I_R_MailText result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_R_MailText)constructor.newInstance(new Object[] {getCtx(), new Integer(getR_MailText_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Mail Template. + @param R_MailText_ID + Text templates for mailings + */ + public void setR_MailText_ID (int R_MailText_ID) + { + if (R_MailText_ID < 1) + set_Value (COLUMNNAME_R_MailText_ID, null); + else + set_Value (COLUMNNAME_R_MailText_ID, Integer.valueOf(R_MailText_ID)); + } + + /** Get Mail Template. + @return Text templates for mailings + */ + public int getR_MailText_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_R_MailText_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** SalesRep_ID AD_Reference_ID=190 */ + public static final int SALESREP_ID_AD_Reference_ID=190; + /** Set Sales Representative. + @param SalesRep_ID + Sales Representative or Company Agent + */ + public void setSalesRep_ID (int SalesRep_ID) + { + if (SalesRep_ID < 1) + set_Value (COLUMNNAME_SalesRep_ID, null); + else + set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID)); + } + + /** Get Sales Representative. + @return Sales Representative or Company Agent + */ + public int getSalesRep_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_S_ExpenseType getS_ExpenseType() throws Exception + { + Class clazz = MTable.getClass(I_S_ExpenseType.Table_Name); + I_S_ExpenseType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_S_ExpenseType)constructor.newInstance(new Object[] {getCtx(), new Integer(getS_ExpenseType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Expense Type. + @param S_ExpenseType_ID + Expense report type + */ + public void setS_ExpenseType_ID (int S_ExpenseType_ID) + { + if (S_ExpenseType_ID < 1) + set_ValueNoCheck (COLUMNNAME_S_ExpenseType_ID, null); + else + set_ValueNoCheck (COLUMNNAME_S_ExpenseType_ID, Integer.valueOf(S_ExpenseType_ID)); + } + + /** Get Expense Type. + @return Expense report type + */ + public int getS_ExpenseType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_S_ExpenseType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Shelf Depth. + @param ShelfDepth + Shelf depth required + */ + public void setShelfDepth (int ShelfDepth) + { + set_Value (COLUMNNAME_ShelfDepth, Integer.valueOf(ShelfDepth)); + } + + /** Get Shelf Depth. + @return Shelf depth required + */ + public int getShelfDepth () + { + Integer ii = (Integer)get_Value(COLUMNNAME_ShelfDepth); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Shelf Height. + @param ShelfHeight + Shelf height required + */ + public void setShelfHeight (int ShelfHeight) + { + set_Value (COLUMNNAME_ShelfHeight, Integer.valueOf(ShelfHeight)); + } + + /** Get Shelf Height. + @return Shelf height required + */ + public int getShelfHeight () + { + Integer ii = (Integer)get_Value(COLUMNNAME_ShelfHeight); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Shelf Width. + @param ShelfWidth + Shelf width required + */ + public void setShelfWidth (int ShelfWidth) + { + set_Value (COLUMNNAME_ShelfWidth, Integer.valueOf(ShelfWidth)); + } + + /** Get Shelf Width. + @return Shelf width required + */ + public int getShelfWidth () + { + Integer ii = (Integer)get_Value(COLUMNNAME_ShelfWidth); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set SKU. + @param SKU + Stock Keeping Unit + */ + public void setSKU (String SKU) + { + + if (SKU != null && SKU.length() > 30) + { + log.warning("Length > 30 - truncated"); + SKU = SKU.substring(0, 30); + } + set_Value (COLUMNNAME_SKU, SKU); + } + + /** Get SKU. + @return Stock Keeping Unit + */ + public String getSKU () + { + return (String)get_Value(COLUMNNAME_SKU); + } + + public I_S_Resource getS_Resource() throws Exception + { + Class clazz = MTable.getClass(I_S_Resource.Table_Name); + I_S_Resource result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_S_Resource)constructor.newInstance(new Object[] {getCtx(), new Integer(getS_Resource_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Resource. + @param S_Resource_ID + Resource + */ + public void setS_Resource_ID (int S_Resource_ID) + { + if (S_Resource_ID < 1) + set_ValueNoCheck (COLUMNNAME_S_Resource_ID, null); + else + set_ValueNoCheck (COLUMNNAME_S_Resource_ID, Integer.valueOf(S_Resource_ID)); + } + + /** Get Resource. + @return Resource + */ + public int getS_Resource_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_S_Resource_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set UnitsPerPack. + @param UnitsPerPack + The Units Per Pack indicates the no of units of a product packed together. + */ + public void setUnitsPerPack (int UnitsPerPack) + { + set_Value (COLUMNNAME_UnitsPerPack, Integer.valueOf(UnitsPerPack)); + } + + /** Get UnitsPerPack. + @return The Units Per Pack indicates the no of units of a product packed together. + */ + public int getUnitsPerPack () + { + Integer ii = (Integer)get_Value(COLUMNNAME_UnitsPerPack); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Units Per Pallet. + @param UnitsPerPallet + Units Per Pallet + */ + public void setUnitsPerPallet (int UnitsPerPallet) + { + set_Value (COLUMNNAME_UnitsPerPallet, Integer.valueOf(UnitsPerPallet)); + } + + /** Get Units Per Pallet. + @return Units Per Pallet + */ + public int getUnitsPerPallet () + { + Integer ii = (Integer)get_Value(COLUMNNAME_UnitsPerPallet); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set UPC/EAN. + @param UPC + Bar Code (Universal Product Code or its superset European Article Number) + */ + public void setUPC (String UPC) + { + + if (UPC != null && UPC.length() > 30) + { + log.warning("Length > 30 - truncated"); + UPC = UPC.substring(0, 30); + } + set_Value (COLUMNNAME_UPC, UPC); + } + + /** Get UPC/EAN. + @return Bar Code (Universal Product Code or its superset European Article Number) + */ + public String getUPC () + { + return (String)get_Value(COLUMNNAME_UPC); + } + + /** Set Search Key. + @param Value + Search key for the record in the format required - must be unique + */ + public void setValue (String Value) + { + if (Value == null) + throw new IllegalArgumentException ("Value is mandatory."); + + if (Value.length() > 40) + { + log.warning("Length > 40 - truncated"); + Value = Value.substring(0, 40); + } + set_Value (COLUMNNAME_Value, Value); + } + + /** Get Search Key. + @return Search key for the record in the format required - must be unique + */ + public String getValue () + { + return (String)get_Value(COLUMNNAME_Value); + } + + /** Set Version No. + @param VersionNo + Version Number + */ + public void setVersionNo (String VersionNo) + { + + if (VersionNo != null && VersionNo.length() > 20) + { + log.warning("Length > 20 - truncated"); + VersionNo = VersionNo.substring(0, 20); + } + set_Value (COLUMNNAME_VersionNo, VersionNo); + } + + /** Get Version No. + @return Version Number + */ + public String getVersionNo () + { + return (String)get_Value(COLUMNNAME_VersionNo); + } + + /** Set Volume. + @param Volume + Volume of a product + */ + public void setVolume (BigDecimal Volume) + { + set_Value (COLUMNNAME_Volume, Volume); + } + + /** Get Volume. + @return Volume of a product + */ + public BigDecimal getVolume () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Volume); + if (bd == null) + return Env.ZERO; + return bd; + } + + /** Set Weight. + @param Weight + Weight of a product + */ + public void setWeight (BigDecimal Weight) + { + set_Value (COLUMNNAME_Weight, Weight); + } + + /** Get Weight. + @return Weight of a product + */ + public BigDecimal getWeight () + { + BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Weight); + if (bd == null) + return Env.ZERO; + return bd; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/model/X_U_POSTerminal.java b/posterita/posterita/src/main/org/compiere/model/X_U_POSTerminal.java new file mode 100644 index 0000000000..b7b411bd85 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/model/X_U_POSTerminal.java @@ -0,0 +1,774 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.lang.reflect.Constructor; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.Properties; +import java.util.logging.Level; + +/** Generated Model for U_POSTerminal + * @author Adempiere (generated) + * @version Release 3.4.0s - $Id$ */ +public class X_U_POSTerminal extends PO implements I_U_POSTerminal, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_U_POSTerminal (Properties ctx, int U_POSTerminal_ID, String trxName) + { + super (ctx, U_POSTerminal_ID, trxName); + /** if (U_POSTerminal_ID == 0) + { + setAutoLock (false); +// N + setCashBookTransferType (null); + setC_CashBook_ID (0); + setC_CashBPartner_ID (0); + setU_POSTerminal_ID (0); + } */ + } + + /** Load Constructor */ + public X_U_POSTerminal (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 1 - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_U_POSTerminal[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** Set Auto Lock. + @param AutoLock + Whether to automatically lock the terminal when till is closed + */ + public void setAutoLock (boolean AutoLock) + { + set_Value (COLUMNNAME_AutoLock, Boolean.valueOf(AutoLock)); + } + + /** Get Auto Lock. + @return Whether to automatically lock the terminal when till is closed + */ + public boolean isAutoLock () + { + Object oo = get_Value(COLUMNNAME_AutoLock); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Card_BankAccount_ID AD_Reference_ID=52003 */ + public static final int CARD_BANKACCOUNT_ID_AD_Reference_ID=52003; + /** Set Card Bank Account. + @param Card_BankAccount_ID + Bank Account on which card transactions will be processed + */ + public void setCard_BankAccount_ID (int Card_BankAccount_ID) + { + if (Card_BankAccount_ID < 1) + set_Value (COLUMNNAME_Card_BankAccount_ID, null); + else + set_Value (COLUMNNAME_Card_BankAccount_ID, Integer.valueOf(Card_BankAccount_ID)); + } + + /** Get Card Bank Account. + @return Bank Account on which card transactions will be processed + */ + public int getCard_BankAccount_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Card_BankAccount_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** CardTransferBankAccount_ID AD_Reference_ID=52003 */ + public static final int CARDTRANSFERBANKACCOUNT_ID_AD_Reference_ID=52003; + /** Set Transfer Card trx to. + @param CardTransferBankAccount_ID + Bank account on which to transfer Card transactions + */ + public void setCardTransferBankAccount_ID (int CardTransferBankAccount_ID) + { + if (CardTransferBankAccount_ID < 1) + set_Value (COLUMNNAME_CardTransferBankAccount_ID, null); + else + set_Value (COLUMNNAME_CardTransferBankAccount_ID, Integer.valueOf(CardTransferBankAccount_ID)); + } + + /** Get Transfer Card trx to. + @return Bank account on which to transfer Card transactions + */ + public int getCardTransferBankAccount_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CardTransferBankAccount_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** CardTransferCashBook_ID AD_Reference_ID=52004 */ + public static final int CARDTRANSFERCASHBOOK_ID_AD_Reference_ID=52004; + /** Set Transfer Card trx to. + @param CardTransferCashBook_ID + Cash Book on which to transfer all Card transactions + */ + public void setCardTransferCashBook_ID (int CardTransferCashBook_ID) + { + if (CardTransferCashBook_ID < 1) + set_Value (COLUMNNAME_CardTransferCashBook_ID, null); + else + set_Value (COLUMNNAME_CardTransferCashBook_ID, Integer.valueOf(CardTransferCashBook_ID)); + } + + /** Get Transfer Card trx to. + @return Cash Book on which to transfer all Card transactions + */ + public int getCardTransferCashBook_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CardTransferCashBook_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** CardTransferType AD_Reference_ID=52002 */ + public static final int CARDTRANSFERTYPE_AD_Reference_ID=52002; + /** Bank Account = B */ + public static final String CARDTRANSFERTYPE_BankAccount = "B"; + /** CashBook = C */ + public static final String CARDTRANSFERTYPE_CashBook = "C"; + /** Set Card Transfer Type. + @param CardTransferType Card Transfer Type */ + public void setCardTransferType (String CardTransferType) + { + + if (CardTransferType == null || CardTransferType.equals("B") || CardTransferType.equals("C")); else throw new IllegalArgumentException ("CardTransferType Invalid value - " + CardTransferType + " - Reference_ID=52002 - B - C"); + if (CardTransferType != null && CardTransferType.length() > 1) + { + log.warning("Length > 1 - truncated"); + CardTransferType = CardTransferType.substring(0, 1); + } + set_Value (COLUMNNAME_CardTransferType, CardTransferType); + } + + /** Get Card Transfer Type. + @return Card Transfer Type */ + public String getCardTransferType () + { + return (String)get_Value(COLUMNNAME_CardTransferType); + } + + /** CashBookTransferType AD_Reference_ID=52002 */ + public static final int CASHBOOKTRANSFERTYPE_AD_Reference_ID=52002; + /** Bank Account = B */ + public static final String CASHBOOKTRANSFERTYPE_BankAccount = "B"; + /** CashBook = C */ + public static final String CASHBOOKTRANSFERTYPE_CashBook = "C"; + /** Set Cash Book Transfer Type. + @param CashBookTransferType + Where the money in the cash book should be transfered to. Either a Bank Account or another Cash Book + */ + public void setCashBookTransferType (String CashBookTransferType) + { + if (CashBookTransferType == null) throw new IllegalArgumentException ("CashBookTransferType is mandatory"); + if (CashBookTransferType.equals("B") || CashBookTransferType.equals("C")); else throw new IllegalArgumentException ("CashBookTransferType Invalid value - " + CashBookTransferType + " - Reference_ID=52002 - B - C"); + if (CashBookTransferType.length() > 1) + { + log.warning("Length > 1 - truncated"); + CashBookTransferType = CashBookTransferType.substring(0, 1); + } + set_Value (COLUMNNAME_CashBookTransferType, CashBookTransferType); + } + + /** Get Cash Book Transfer Type. + @return Where the money in the cash book should be transfered to. Either a Bank Account or another Cash Book + */ + public String getCashBookTransferType () + { + return (String)get_Value(COLUMNNAME_CashBookTransferType); + } + + /** CashTransferBankAccount_ID AD_Reference_ID=52003 */ + public static final int CASHTRANSFERBANKACCOUNT_ID_AD_Reference_ID=52003; + /** Set Transfer Cash trx to. + @param CashTransferBankAccount_ID + Bank Account on which to transfer all Cash transactions + */ + public void setCashTransferBankAccount_ID (int CashTransferBankAccount_ID) + { + if (CashTransferBankAccount_ID < 1) + set_Value (COLUMNNAME_CashTransferBankAccount_ID, null); + else + set_Value (COLUMNNAME_CashTransferBankAccount_ID, Integer.valueOf(CashTransferBankAccount_ID)); + } + + /** Get Transfer Cash trx to. + @return Bank Account on which to transfer all Cash transactions + */ + public int getCashTransferBankAccount_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CashTransferBankAccount_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** CashTransferCashBook_ID AD_Reference_ID=52004 */ + public static final int CASHTRANSFERCASHBOOK_ID_AD_Reference_ID=52004; + /** Set Transfer Cash trx to. + @param CashTransferCashBook_ID + Cash Book on which to transfer all Cash transactions + */ + public void setCashTransferCashBook_ID (int CashTransferCashBook_ID) + { + if (CashTransferCashBook_ID < 1) + set_Value (COLUMNNAME_CashTransferCashBook_ID, null); + else + set_Value (COLUMNNAME_CashTransferCashBook_ID, Integer.valueOf(CashTransferCashBook_ID)); + } + + /** Get Transfer Cash trx to. + @return Cash Book on which to transfer all Cash transactions + */ + public int getCashTransferCashBook_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CashTransferCashBook_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_C_CashBook getC_CashBook() throws Exception + { + Class clazz = MTable.getClass(I_C_CashBook.Table_Name); + I_C_CashBook result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_CashBook)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_CashBook_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Cash Book. + @param C_CashBook_ID + Cash Book for recording petty cash transactions + */ + public void setC_CashBook_ID (int C_CashBook_ID) + { + if (C_CashBook_ID < 1) + throw new IllegalArgumentException ("C_CashBook_ID is mandatory."); + set_Value (COLUMNNAME_C_CashBook_ID, Integer.valueOf(C_CashBook_ID)); + } + + /** Get Cash Book. + @return Cash Book for recording petty cash transactions + */ + public int getC_CashBook_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_CashBook_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** C_CashBPartner_ID AD_Reference_ID=173 */ + public static final int C_CASHBPARTNER_ID_AD_Reference_ID=173; + /** Set Cash BPartner. + @param C_CashBPartner_ID + BPartner to be used for Cash transactions + */ + public void setC_CashBPartner_ID (int C_CashBPartner_ID) + { + if (C_CashBPartner_ID < 1) + throw new IllegalArgumentException ("C_CashBPartner_ID is mandatory."); + set_Value (COLUMNNAME_C_CashBPartner_ID, Integer.valueOf(C_CashBPartner_ID)); + } + + /** Get Cash BPartner. + @return BPartner to be used for Cash transactions + */ + public int getC_CashBPartner_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_CashBPartner_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Check_BankAccount_ID AD_Reference_ID=52003 */ + public static final int CHECK_BANKACCOUNT_ID_AD_Reference_ID=52003; + /** Set Check Bank Account. + @param Check_BankAccount_ID + Bank Account to be used for processing Check transactions + */ + public void setCheck_BankAccount_ID (int Check_BankAccount_ID) + { + if (Check_BankAccount_ID < 1) + set_Value (COLUMNNAME_Check_BankAccount_ID, null); + else + set_Value (COLUMNNAME_Check_BankAccount_ID, Integer.valueOf(Check_BankAccount_ID)); + } + + /** Get Check Bank Account. + @return Bank Account to be used for processing Check transactions + */ + public int getCheck_BankAccount_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Check_BankAccount_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** CheckTransferBankAccount_ID AD_Reference_ID=52003 */ + public static final int CHECKTRANSFERBANKACCOUNT_ID_AD_Reference_ID=52003; + /** Set Tranfer Check trx to. + @param CheckTransferBankAccount_ID + Bank account on which to transfer Check transactions + */ + public void setCheckTransferBankAccount_ID (int CheckTransferBankAccount_ID) + { + if (CheckTransferBankAccount_ID < 1) + set_Value (COLUMNNAME_CheckTransferBankAccount_ID, null); + else + set_Value (COLUMNNAME_CheckTransferBankAccount_ID, Integer.valueOf(CheckTransferBankAccount_ID)); + } + + /** Get Tranfer Check trx to. + @return Bank account on which to transfer Check transactions + */ + public int getCheckTransferBankAccount_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CheckTransferBankAccount_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** CheckTransferCashBook_ID AD_Reference_ID=52004 */ + public static final int CHECKTRANSFERCASHBOOK_ID_AD_Reference_ID=52004; + /** Set Transfer Check trx to. + @param CheckTransferCashBook_ID + Cash Book on which to transfer all Check transactions + */ + public void setCheckTransferCashBook_ID (int CheckTransferCashBook_ID) + { + if (CheckTransferCashBook_ID < 1) + set_Value (COLUMNNAME_CheckTransferCashBook_ID, null); + else + set_Value (COLUMNNAME_CheckTransferCashBook_ID, Integer.valueOf(CheckTransferCashBook_ID)); + } + + /** Get Transfer Check trx to. + @return Cash Book on which to transfer all Check transactions + */ + public int getCheckTransferCashBook_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_CheckTransferCashBook_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** CheckTransferType AD_Reference_ID=52002 */ + public static final int CHECKTRANSFERTYPE_AD_Reference_ID=52002; + /** Bank Account = B */ + public static final String CHECKTRANSFERTYPE_BankAccount = "B"; + /** CashBook = C */ + public static final String CHECKTRANSFERTYPE_CashBook = "C"; + /** Set Check Transfer Type. + @param CheckTransferType Check Transfer Type */ + public void setCheckTransferType (String CheckTransferType) + { + + if (CheckTransferType == null || CheckTransferType.equals("B") || CheckTransferType.equals("C")); else throw new IllegalArgumentException ("CheckTransferType Invalid value - " + CheckTransferType + " - Reference_ID=52002 - B - C"); + if (CheckTransferType != null && CheckTransferType.length() > 1) + { + log.warning("Length > 1 - truncated"); + CheckTransferType = CheckTransferType.substring(0, 1); + } + set_Value (COLUMNNAME_CheckTransferType, CheckTransferType); + } + + /** Get Check Transfer Type. + @return Check Transfer Type */ + public String getCheckTransferType () + { + return (String)get_Value(COLUMNNAME_CheckTransferType); + } + + /** C_TemplateBPartner_ID AD_Reference_ID=173 */ + public static final int C_TEMPLATEBPARTNER_ID_AD_Reference_ID=173; + /** Set Template BPartner. + @param C_TemplateBPartner_ID + BPartner that is to be used as template when new customers are created + */ + public void setC_TemplateBPartner_ID (int C_TemplateBPartner_ID) + { + if (C_TemplateBPartner_ID < 1) + set_Value (COLUMNNAME_C_TemplateBPartner_ID, null); + else + set_Value (COLUMNNAME_C_TemplateBPartner_ID, Integer.valueOf(C_TemplateBPartner_ID)); + } + + /** Get Template BPartner. + @return BPartner that is to be used as template when new customers are created + */ + public int getC_TemplateBPartner_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_TemplateBPartner_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + + if (Description != null && Description.length() > 255) + { + log.warning("Length > 255 - truncated"); + Description = Description.substring(0, 255); + } + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set Comment/Help. + @param Help + Comment or Hint + */ + public void setHelp (String Help) + { + + if (Help != null && Help.length() > 2000) + { + log.warning("Length > 2000 - truncated"); + Help = Help.substring(0, 2000); + } + set_Value (COLUMNNAME_Help, Help); + } + + /** Get Comment/Help. + @return Comment or Hint + */ + public String getHelp () + { + return (String)get_Value(COLUMNNAME_Help); + } + + /** Set Last Lock Time. + @param LastLockTime + Last time at which the terminal was locked + */ + public void setLastLockTime (Timestamp LastLockTime) + { + set_Value (COLUMNNAME_LastLockTime, LastLockTime); + } + + /** Get Last Lock Time. + @return Last time at which the terminal was locked + */ + public Timestamp getLastLockTime () + { + return (Timestamp)get_Value(COLUMNNAME_LastLockTime); + } + + /** Set Locked. + @param Locked + Whether the terminal is locked + */ + public void setLocked (boolean Locked) + { + set_Value (COLUMNNAME_Locked, Boolean.valueOf(Locked)); + } + + /** Get Locked. + @return Whether the terminal is locked + */ + public boolean isLocked () + { + Object oo = get_Value(COLUMNNAME_Locked); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Lock Time. + @param LockTime + Time in minutes the terminal should be kept in a locked state. + */ + public void setLockTime (int LockTime) + { + set_Value (COLUMNNAME_LockTime, Integer.valueOf(LockTime)); + } + + /** Get Lock Time. + @return Time in minutes the terminal should be kept in a locked state. + */ + public int getLockTime () + { + Integer ii = (Integer)get_Value(COLUMNNAME_LockTime); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_M_Warehouse getM_Warehouse() throws Exception + { + Class clazz = MTable.getClass(I_M_Warehouse.Table_Name); + I_M_Warehouse result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_M_Warehouse)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_Warehouse_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Warehouse. + @param M_Warehouse_ID + Storage Warehouse and Service Point + */ + public void setM_Warehouse_ID (int M_Warehouse_ID) + { + if (M_Warehouse_ID < 1) + set_Value (COLUMNNAME_M_Warehouse_ID, null); + else + set_Value (COLUMNNAME_M_Warehouse_ID, Integer.valueOf(M_Warehouse_ID)); + } + + /** Get Warehouse. + @return Storage Warehouse and Service Point + */ + public int getM_Warehouse_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_Warehouse_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Name. + @param Name + Alphanumeric identifier of the entity + */ + public void setName (String Name) + { + + if (Name != null && Name.length() > 60) + { + log.warning("Length > 60 - truncated"); + Name = Name.substring(0, 60); + } + set_Value (COLUMNNAME_Name, Name); + } + + /** Get Name. + @return Alphanumeric identifier of the entity + */ + public String getName () + { + return (String)get_Value(COLUMNNAME_Name); + } + + /** PO_PriceList_ID AD_Reference_ID=166 */ + public static final int PO_PRICELIST_ID_AD_Reference_ID=166; + /** Set Purchase Pricelist. + @param PO_PriceList_ID + Price List used by this Business Partner + */ + public void setPO_PriceList_ID (int PO_PriceList_ID) + { + if (PO_PriceList_ID < 1) + set_Value (COLUMNNAME_PO_PriceList_ID, null); + else + set_Value (COLUMNNAME_PO_PriceList_ID, Integer.valueOf(PO_PriceList_ID)); + } + + /** Get Purchase Pricelist. + @return Price List used by this Business Partner + */ + public int getPO_PriceList_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_PO_PriceList_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Printer Name. + @param PrinterName + Name of the Printer + */ + public void setPrinterName (String PrinterName) + { + + if (PrinterName != null && PrinterName.length() > 60) + { + log.warning("Length > 60 - truncated"); + PrinterName = PrinterName.substring(0, 60); + } + set_Value (COLUMNNAME_PrinterName, PrinterName); + } + + /** Get Printer Name. + @return Name of the Printer + */ + public String getPrinterName () + { + return (String)get_Value(COLUMNNAME_PrinterName); + } + + /** SalesRep_ID AD_Reference_ID=316 */ + public static final int SALESREP_ID_AD_Reference_ID=316; + /** Set Sales Representative. + @param SalesRep_ID + Sales Representative or Company Agent + */ + public void setSalesRep_ID (int SalesRep_ID) + { + if (SalesRep_ID < 1) + set_Value (COLUMNNAME_SalesRep_ID, null); + else + set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID)); + } + + /** Get Sales Representative. + @return Sales Representative or Company Agent + */ + public int getSalesRep_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** SO_PriceList_ID AD_Reference_ID=166 */ + public static final int SO_PRICELIST_ID_AD_Reference_ID=166; + /** Set Sales Pricelist. + @param SO_PriceList_ID Sales Pricelist */ + public void setSO_PriceList_ID (int SO_PriceList_ID) + { + if (SO_PriceList_ID < 1) + set_Value (COLUMNNAME_SO_PriceList_ID, null); + else + set_Value (COLUMNNAME_SO_PriceList_ID, Integer.valueOf(SO_PriceList_ID)); + } + + /** Get Sales Pricelist. + @return Sales Pricelist */ + public int getSO_PriceList_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SO_PriceList_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set UnlockingTime. + @param UnlockingTime + Time at which the terminal should be unlocked + */ + public void setUnlockingTime (Timestamp UnlockingTime) + { + set_Value (COLUMNNAME_UnlockingTime, UnlockingTime); + } + + /** Get UnlockingTime. + @return Time at which the terminal should be unlocked + */ + public Timestamp getUnlockingTime () + { + return (Timestamp)get_Value(COLUMNNAME_UnlockingTime); + } + + /** Set POS Terminal. + @param U_POSTerminal_ID POS Terminal */ + public void setU_POSTerminal_ID (int U_POSTerminal_ID) + { + if (U_POSTerminal_ID < 1) + throw new IllegalArgumentException ("U_POSTerminal_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_U_POSTerminal_ID, Integer.valueOf(U_POSTerminal_ID)); + } + + /** Get POS Terminal. + @return POS Terminal */ + public int getU_POSTerminal_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_U_POSTerminal_ID); + if (ii == null) + return 0; + return ii.intValue(); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/compiere/report/ReportStarter.java b/posterita/posterita/src/main/org/compiere/report/ReportStarter.java new file mode 100644 index 0000000000..d6896b52e0 --- /dev/null +++ b/posterita/posterita/src/main/org/compiere/report/ReportStarter.java @@ -0,0 +1,1123 @@ +/* + */ +package org.compiere.report; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.UnknownHostException; +import java.rmi.RemoteException; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; +import java.util.Properties; +import java.util.PropertyResourceBundle; + +import javax.ejb.CreateException; +import javax.ejb.RemoveException; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JasperCompileManager; +import net.sf.jasperreports.engine.JasperFillManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.JasperReport; +import net.sf.jasperreports.engine.util.JRLoader; + +import org.compiere.db.CConnection; +import org.compiere.db.ServerConnection; +import org.compiere.interfaces.MD5; +import org.compiere.interfaces.MD5Home; +import org.compiere.model.MAttachment; +import org.compiere.model.MAttachmentEntry; +import org.compiere.model.MProcess; +import org.compiere.process.ClientProcess; +import org.compiere.process.ProcessCall; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Ini; +import org.compiere.util.Language; +import org.compiere.util.Trx; +import org.compiere.utils.DBUtils; +import org.compiere.utils.DigestOfFile; + +/** + * @author rlemeill + * originaly coming from an application note from compiere.co.uk + * --- + * Modifications: Allow Jasper Reports to be able to be run on VPN profile (i.e: no direct connection to DB). + * Implemented ClientProcess for it to run on client. + * @author Ashley Ramdass + */ +public class ReportStarter implements ProcessCall, ClientProcess { +//logger + private static CLogger log = CLogger.getCLogger(ReportStarter.class); + private static File REPORT_HOME = null; + + private static JRViewerProvider viewerProvider = new SwingJRViewerProvider(); + private static JasperPrint jasperPrint; + + static { + System.setProperty( "javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); + System.setProperty( "org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser"); + + String reportPath = System.getProperty("org.compiere.report.path"); + if (reportPath == null) { + REPORT_HOME = new File(Ini.getAdempiereHome() + File.separator + "reports"); + } else { + REPORT_HOME = new File(reportPath); + } + } + + private ProcessInfo processInfo; + private MAttachment attachment; + + + /** + * @param requestURL + * @return true if the report is on the same ip address than Application Server + */ + private boolean isRequestedonAS(URL requestURL) + { + boolean tBool = false; + try{ + InetAddress[] request_iaddrs = InetAddress.getAllByName(requestURL.getHost()); + InetAddress as_iaddr = InetAddress.getByName(CConnection.get().getAppsHost()); + for(int i=0;i 0) + fout.write(buf, 0, s); + + in.close(); + fout.flush(); + fout.close(); + return downloadedFile; + } catch (FileNotFoundException e) { + if(reportLocation.indexOf("Subreport") == -1) // Only show the warning if it is not a subreport + log.warning("404 not found: Report cannot be found on server "+ e.getMessage()); + return null; + } catch (IOException e) { + log.severe("I/O error when trying to download (sub)report from server "+ e.getMessage()); + return null; + } + } + + /** + * Search for additional subreports deployed to a webcontext if + * the parent report is located there + * @author deathmeat + * @param reportName The original reportname + * @param reportPath The full path to the parent report + * @param fileExtension The file extension of the parent report + * @return An Array of File objects referencing to the downloaded subreports + */ + private File[] getHttpSubreports(String reportName, String reportPath, String fileExtension) + { + ArrayList subreports = new ArrayList(); + String remoteDir = reportPath.substring(0, reportPath.lastIndexOf("/")); + + // Currently check hardcoded for max. 10 subreports + for(int i=1; i<10; i++) + { + // Check if subreport number i exists + File subreport = httpDownloadedReport(remoteDir + "/" + reportName + i + fileExtension); + if(subreport == null) // Subreport doesn't exist, abort further approaches + break; + + subreports.add(subreport); + } + + File[] subreportsTemp = new File[0]; + subreportsTemp = subreports.toArray(subreportsTemp); + return subreportsTemp; + } + + /** + * @author rlemeill + * @param reportLocation http string url ex: http://adempiereserver.domain.com/webApp/standalone.jrxml + * @return downloaded File (or already existing one) + */ + private File httpDownloadedReport(String reportLocation) + { + File reportFile = null; + File downloadedFile = null; + log.info(" report deployed to " + reportLocation); + try { + + + String[] tmps = reportLocation.split("/"); + String cleanFile = tmps[tmps.length-1]; + String localFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + cleanFile; + String downloadedLocalFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator")+"TMP" + cleanFile; + + reportFile = new File(localFile); + + + if (reportFile.exists()) + { + String localMD5hash = DigestOfFile.GetLocalMD5Hash(reportFile); + String remoteMD5Hash = ejbGetRemoteMD5(reportLocation); + log.info("MD5 for local file is "+localMD5hash ); + if ( remoteMD5Hash != null) + { + if (localMD5hash.equals(remoteMD5Hash)) + { + log.info(" no need to download: local report is up-to-date"); + } + else + { + log.info(" report on server is different that local one, download and replace"); + downloadedFile = getRemoteFile(reportLocation, downloadedLocalFile); + reportFile.delete(); + downloadedFile.renameTo(reportFile); + } + } + else + { + log.warning("Remote hashing is not available did you deployed webApp.ear?"); + downloadedFile = getRemoteFile(reportLocation, downloadedLocalFile); + // compare hash of existing and downloaded + if ( DigestOfFile.md5localHashCompare(reportFile,downloadedFile) ) + { + //nothing file are identic + log.info(" no need to replace your existing report"); + } + else + { + log.info(" report on server is different that local one, replacing"); + reportFile.delete(); + downloadedFile.renameTo(reportFile); + } + } + } + else + { + reportFile = getRemoteFile(reportLocation,localFile); + } + + } + catch (Exception e) { + log.severe("Unknown exception: "+ e.getMessage()); + return null; + } + return reportFile; + } + + /** + * Returns the Server Connection if direct connection is not available + * (VPN, WAN, Terminal) and thus query has to be run on server only else return + * a direct connection to DB. + * + * Notes: Need to refactor and integrate in DB if confirmed to be working as + * expected. + * + * @author Ashley Ramdass + * @return Connection DB Connection + */ + protected Connection getConnection() + { + if (DB.isRemoteObjects()) + { + return new ServerConnection(); + } + else + { + return DB.getConnectionRW(); + } + } + + /** + * Start the process. + * Called then pressing the Process button in R_Request. + * It should only return false, if the function could not be performed + * as this causes the process to abort. + * @author rlemeill + * @param ctx context + * @param pi Compiere standard process info + * @param trx + * @return true if success + */ + public boolean startProcess(Properties ctx, ProcessInfo pi, Trx trx) { + + processInfo = pi; + String Name=pi.getTitle(); + int AD_PInstance_ID=pi.getAD_PInstance_ID(); + int Record_ID=pi.getRecord_ID(); + log.info( "Name="+Name+" AD_PInstance_ID="+AD_PInstance_ID+" Record_ID="+Record_ID); + String trxName = null; + if (trx != null) { + trxName = trx.getTrxName(); + } + ReportData reportData = getReportData( pi, trxName); + if (reportData==null) { + reportResult( AD_PInstance_ID, "Can not find report data", trxName); + return false; + } + + String reportPath = reportData.getReportFilePath(); + if ((reportPath==null)||(reportPath.length()==0)) { + reportResult( AD_PInstance_ID, "Can not find report", trxName); + return false; + } + + JasperData data = null; + File reportFile = null; + String fileExtension = ""; + HashMap params = new HashMap( ctx); + + addProcessParameters( AD_PInstance_ID, params, trxName); + + addProcessInfoParameters(params, pi.getParameter()); + + reportFile = getReportFile(reportPath, (String)params.get("ReportType")); + + if (reportFile == null || reportFile.exists() == false) + { + log.severe("No report file found for given type, falling back to " + reportPath); + reportFile = getReportFile(reportPath); + } + + if (reportFile == null || reportFile.exists() == false) { + String tmp = "Can not find report file at path - " + reportPath; + log.severe(tmp); + reportResult(AD_PInstance_ID, tmp, trxName); + } + + if (reportFile != null) + { + data = processReport(reportFile); + fileExtension = reportFile.getName().substring(reportFile.getName().lastIndexOf("."), + reportFile.getName().length()); + } + else + { + return false; + } + + JasperReport jasperReport = data.getJasperReport(); + String jasperName = data.getJasperName(); + File reportDir = data.getReportDir(); + + if (jasperReport != null) { + File[] subreports; + + // Subreports + if(reportPath.startsWith("http://") || reportPath.startsWith("https://")) + { + // Locate and download subreports from remote webcontext + subreports = getHttpSubreports(jasperName + "Subreport", reportPath, fileExtension); + } + else if (reportPath.startsWith("attachment:")) + { + subreports = getAttachmentSubreports(reportPath); + } + else if (reportPath.startsWith("resource:")) + { + subreports = getResourceSubreports(jasperName + "Subreport", reportPath, fileExtension); + } + // TODO: Implement file:/ lookup for subreports + else + { + // Locate subreports from local/remote filesystem + subreports = reportDir.listFiles( new FileFilter( jasperName+"Subreport", reportDir, fileExtension)); + } + + for( int i=0; i 0) + params.put("RECORD_ID", new Integer( Record_ID)); + + // contribution from Ricardo (ralexsander) + // in iReports you can 'SELECT' AD_Client_ID, AD_Org_ID and AD_User_ID using only AD_PINSTANCE_ID + params.put("AD_PINSTANCE_ID", new Integer( AD_PInstance_ID)); + + Language currLang = Env.getLanguage(Env.getCtx()); + params.put("CURRENT_LANG", currLang.getAD_Language()); + // Resources + File resFile = null; + if (reportPath.startsWith("attachment:") && attachment != null) { + resFile = getAttachmentResourceFile(jasperName, currLang); + } else if (reportPath.startsWith("resource:")) { + resFile = getResourcesForResourceFile(jasperName, currLang); + // TODO: Implement file:/ for resources + } else { + File[] resources = reportDir.listFiles( new FileFilter( jasperName, reportDir, ".properties")); + // try baseName + "_" + language + for( int i=0; i subreports = new ArrayList(); + MAttachmentEntry[] entries = attachment.getEntries(); + for(int i = 0; i < entries.length; i++) { + if (!entries[i].getName().equals(name) && + (entries[i].getName().endsWith(".jrxml") || entries[i].getName().endsWith(".jasper"))) { + File reportFile = getAttachmentEntryFile(entries[i]); + if (reportFile != null) + subreports.add(reportFile); + } + } + File[] files = new File[subreports.size()]; + File[] subreportsTemp = new File[0]; + subreportsTemp = subreports.toArray(subreportsTemp); + return subreportsTemp; + } + + /** + * Search for additional subreports deployed as resources + * @param reportName The original reportname + * @param reportPath The full path to the parent report + * @param fileExtension The file extension of the parent report + * @return An Array of File objects referencing to the downloaded subreports + */ + private File[] getResourceSubreports(String reportName, String reportPath, String fileExtension) + { + ArrayList subreports = new ArrayList(); + String remoteDir = reportPath.substring(0, reportPath.lastIndexOf("/")); + + // Currently check hardcoded for max. 10 subreports + for(int i=1; i<10; i++) + { + // Check if subreport number i exists + File subreport = null; + try { + subreport = getFileAsResource(remoteDir + "/" + reportName + i + fileExtension); + } catch (Exception e) { + // just ignore it + } + if(subreport == null) // Subreport doesn't exist, abort further approaches + break; + + subreports.add(subreport); + } + + File[] subreportsTemp = new File[0]; + subreportsTemp = subreports.toArray(subreportsTemp); + return subreportsTemp; + } + + /** + * @author alinv + * @param reportPath + * @param reportType + * @return the abstract file corresponding to typed report + */ + protected File getReportFile(String reportPath, String reportType) { + + if (reportType != null) + { + int cpos = reportPath.lastIndexOf('.'); + reportPath = reportPath.substring(0, cpos) + "_" + reportType + reportPath.substring(cpos, reportPath.length()); + } + + return getReportFile(reportPath); + } + + /** + * @author alinv + * @param reportPath + * @return the abstract file corresponding to report + */ + protected File getReportFile(String reportPath) { + File reportFile = null; + + // Reports deployement on web server Thanks to Alin Vaida + if (reportPath.startsWith("http://") || reportPath.startsWith("https://")) { + reportFile = httpDownloadedReport(reportPath); + } else if (reportPath.startsWith("attachment:")) { + //report file from process attachment + reportFile = downloadAttachment(reportPath); + } else if(reportPath.startsWith("/")) { + reportFile = new File(reportPath); + } else if (reportPath.startsWith("file:/")) { + try { + reportFile = new File(new URI(reportPath)); + } catch (URISyntaxException e) { + log.warning(e.getLocalizedMessage()); + reportFile = null; + } + } else if (reportPath.startsWith("resource:")) { + try { + reportFile = getFileAsResource(reportPath); + } catch (Exception e) { + log.warning(e.getLocalizedMessage()); + reportFile = null; + } + } else { + reportFile = new File(REPORT_HOME, reportPath); + } + + // Set org.compiere.report.path because it is used in reports which refer to subreports + System.setProperty("org.compiere.report.path", reportFile.getParentFile().getAbsolutePath()); + return reportFile; + } + + /** + * @param reportPath + * @return + * @throws Exception + */ + private File getFileAsResource(String reportPath) throws Exception { + File reportFile; + String name = reportPath.substring("resource:".length()).trim(); + String localName = name.replace('/', '_'); + log.info("reportPath = " + reportPath); + log.info("getting resource from = " + getClass().getClassLoader().getResource(name)); + InputStream inputStream = getClass().getClassLoader().getResourceAsStream(name); + String localFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + localName; + log.info("localFile = " + localFile); + reportFile = new File(localFile); + + OutputStream out = null; + out = new FileOutputStream(reportFile); + if (out != null){ + byte buf[]=new byte[1024]; + int len; + while((len=inputStream.read(buf))>0) + out.write(buf,0,len); + out.close(); + inputStream.close(); + } + + return reportFile; + } + + /** + * Download db attachment + * @param reportPath must of syntax attachment:filename + * @return File + */ + private File downloadAttachment(String reportPath) { + File reportFile = null; + String name = reportPath.substring("attachment:".length()).trim(); + MProcess process = new MProcess(Env.getCtx(), processInfo.getAD_Process_ID(), processInfo.getTransactionName()); + attachment = process.getAttachment(); + if (attachment != null) { + MAttachmentEntry[] entries = attachment.getEntries(); + MAttachmentEntry entry = null; + for (int i = 0; i < entries.length; i++) { + if (entries[i].getName().equals(name)) { + entry = entries[i]; + break; + } + } + if (entry != null) { + reportFile = getAttachmentEntryFile(entry); + } + } + return reportFile; + } + + /** + * Download db attachment to local file + * @param entry + * @return File + */ + private File getAttachmentEntryFile(MAttachmentEntry entry) { + String localFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + entry.getName(); + String downloadedLocalFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator")+"TMP" + entry.getName(); + File reportFile = new File(localFile); + if (reportFile.exists()) { + String localMD5hash = DigestOfFile.GetLocalMD5Hash(reportFile); + String entryMD5hash = DigestOfFile.getMD5Hash(entry.getData()); + if (localMD5hash.equals(entryMD5hash)) + { + log.info(" no need to download: local report is up-to-date"); + } + else + { + log.info(" report on server is different that local one, download and replace"); + File downloadedFile = new File(downloadedLocalFile); + entry.getFile(downloadedFile); + reportFile.delete(); + downloadedFile.renameTo(reportFile); + } + } else { + entry.getFile(reportFile); + } + return reportFile; + } + + /** + * @author rlemeill + * @param AD_PInstance_ID + * @param errMsg + */ + protected void reportResult( int AD_PInstance_ID, String errMsg, String trxName) { + int result = (errMsg==null)?1:0; + errMsg = (errMsg==null)?"":errMsg; + String sql = "UPDATE AD_PInstance SET result="+result+", errormsg='"+errMsg+"' "+ + "WHERE AD_PInstance_ID="+AD_PInstance_ID; + Statement pstmt = null; + try { + pstmt = DB.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE, trxName); + pstmt.executeUpdate(sql); + pstmt.close(); + } catch (SQLException e) { + log.severe(sql+e.getMessage()); + } finally { + DBUtils.close( pstmt); + } + } + + /** + * @author rlemeill + * @param reportFile + * @return + */ + protected JasperData processReport( File reportFile) { + log.info( "reportFile.getAbsolutePath() = "+reportFile.getAbsolutePath()); + JasperReport jasperReport = null; + + String jasperName = reportFile.getName(); + int pos = jasperName.indexOf('.'); + if (pos!=-1) jasperName = jasperName.substring(0, pos); + File reportDir = reportFile.getParentFile(); + + //test if the compiled report exists + File jasperFile = new File( reportDir.getAbsolutePath(), jasperName+".jasper"); + if (jasperFile.exists()) { // test time + if (reportFile.lastModified() == jasperFile.lastModified()) { + log.info(" no need to compile use "+jasperFile.getAbsolutePath()); + try { + jasperReport = (JasperReport)JRLoader.loadObject(jasperFile.getAbsolutePath()); + } catch (JRException e) { + jasperReport = null; + log.severe("Can not load report - "+ e.getMessage()); + } + } else { + jasperReport = compileReport( reportFile, jasperFile); + } + } else { // create new jasper file + jasperReport = compileReport( reportFile, jasperFile); + } + + return new JasperData( jasperReport, reportDir, jasperName, jasperFile); + } + + + protected void addProcessParameters( int AD_PInstance_ID, Map params, String trxName) { + log.info(""); + String sql = "SELECT ParameterName, "+ + "P_String, "+ + "P_String_To, "+ + "P_Number, "+ + "P_Number_To, "+ + "P_Date, "+ + "P_Date_To "+ + "FROM AD_PInstance_Para "+ + "WHERE AD_PInstance_ID=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try { + pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, trxName); + pstmt.setInt(1, AD_PInstance_ID); + rs = pstmt.executeQuery(); + while (rs.next()) { + String name = rs.getString(1); + String pStr = rs.getString(2); + String pStrTo = rs.getString(3); + //Double pNum = new Double( rs.getDouble(4)); + //Double pNumTo = new Double( rs.getDouble(5)); + BigDecimal pNum = rs.getBigDecimal(4); + BigDecimal pNumTo = rs.getBigDecimal(5); + + Timestamp pDate = rs.getTimestamp(6); + Timestamp pDateTo = rs.getTimestamp(7); + if (pStr != null) { + if (pStrTo!=null) { + params.put( name+"1", pStr); + params.put( name+"2", pStrTo); + } else { + params.put( name, pStr); + } + } else if (pDate != null) { + if (pDateTo!=null) { + params.put( name+"1", pDate); + params.put( name+"2", pDateTo); + } else { + params.put( name, pDate); + } + } else if (pNum != null) { + if (rs.getBigDecimal(5)!=null) { + params.put( name+"1", pNum); + params.put( name+"2", pNumTo); + } else { + params.put( name, pNum); + } + } + } + } catch (SQLException e) { + log.severe("Execption; sql = "+sql+"; e.getMessage() = " +e.getMessage()); + } finally { + DBUtils.close( rs); + DBUtils.close( pstmt); + } + } + + private void addProcessInfoParameters(Map params, ProcessInfoParameter[] para) { + if (para != null) { + for (int i = 0; i < para.length; i++) { + if (para[i].getParameter_To() == null) { + params.put(para[i].getParameterName(), para[i].getParameter()); + } else { + params.put( para[i].getParameterName()+"1", para[i].getParameter()); + params.put( para[i].getParameterName()+"2", para[i].getParameter_To()); + } + } + } + } + + /** + * @author rlemeill + * Correct the class path if loaded from java web start + */ + private void JWScorrectClassPath() + { + URL jasperreportsAbsoluteURL = Thread.currentThread().getContextClassLoader().getResource("net/sf/jasperreports/engine"); + String jasperreportsAbsolutePath = ""; + + if(jasperreportsAbsoluteURL.toString().startsWith("jar:http:") || jasperreportsAbsoluteURL.toString().startsWith("jar:https:")) + { + // Jasper classes are deployed to a webserver (Java Webstart) + jasperreportsAbsolutePath = jasperreportsAbsoluteURL.toString().split("!")[0].split("jar:")[1]; + + // Download the required jasper libraries if they are not already existing + File reqLib = new File(System.getProperty("java.io.tmpdir"), "CompiereJasperReqs.jar"); + if(!reqLib.exists() && !(reqLib.length() > 0)) + { + try{ + URL reqLibURL = new URL(jasperreportsAbsolutePath); + InputStream in = reqLibURL.openStream(); + + FileOutputStream fout = new FileOutputStream(reqLib); + + byte buf[] = new byte[1024]; + int s = 0; + long tl = 0; + + while((s = in.read(buf, 0, 1024)) > 0) + fout.write(buf, 0, s); + + in.close(); + fout.flush(); + fout.close(); + } catch (FileNotFoundException e) { + log.warning("Required library not found "+ e.getMessage()); + reqLib.delete(); + reqLib = null; + } catch (IOException e) { + log.severe("I/O error downloading required library from server "+ e.getMessage()); + reqLib.delete(); + reqLib = null; + } + } + + jasperreportsAbsolutePath = reqLib.getAbsolutePath(); + } + else + { + // Jasper classes are locally available (Local client) + jasperreportsAbsolutePath = jasperreportsAbsoluteURL.toString().split("!")[0].split("file:")[1]; + } + + if(jasperreportsAbsolutePath != null && !jasperreportsAbsolutePath.trim().equals("")) + { + // Check whether the current CLASSPATH already contains our + // jasper libraries and dependencies or not. + if(System.getProperty("java.class.path").indexOf(jasperreportsAbsolutePath) < 0) + { + System.setProperty("java.class.path", + System.getProperty("java.class.path") + + System.getProperty("path.separator") + + jasperreportsAbsolutePath); + log.info("Classpath has been corrected to " + System.getProperty("java.class.path")); + } + } + } + + /** + * @author rlemeill + * @param reportFile + * @param jasperFile + * @return compiled JasperReport + */ + private JasperReport compileReport( File reportFile, File jasperFile) { + JWScorrectClassPath(); + JasperReport compiledJasperReport = null; + try { + JasperCompileManager.compileReportToFile ( reportFile.getAbsolutePath(), jasperFile.getAbsolutePath() ); + jasperFile.setLastModified( reportFile.lastModified()); //Synchronize Dates + compiledJasperReport = (JasperReport)JRLoader.loadObject(jasperFile); + } catch (JRException e) { + log.severe("JRException; e.getMessage()= "+ e.getMessage()); + } + return compiledJasperReport; + } + + /** + * @author rlemeill + * @param ProcessInfo + * @return ReportData + */ + public ReportData getReportData( ProcessInfo pi, String trxName) { + log.info(""); + String sql = "SELECT pr.JasperReport, pr.IsDirectPrint " + + "FROM AD_Process pr, AD_PInstance pi " + + "WHERE pr.AD_Process_ID = pi.AD_Process_ID " + + " AND pi.AD_PInstance_ID=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try { + pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, trxName); + pstmt.setInt(1, pi.getAD_PInstance_ID()); + rs = pstmt.executeQuery(); + String path = null; + boolean directPrint = false; + boolean isPrintPreview = pi.isPrintPreview(); + if (rs.next()) { + path = rs.getString(1); + + if ("Y".equalsIgnoreCase(rs.getString(2)) && !Ini.isPropertyBool(Ini.P_PRINTPREVIEW) + && !isPrintPreview ) + directPrint = true; + } else { + log.severe("data not found; sql = "+sql); + return null; + } + + return new ReportData( path, directPrint); + } catch (SQLException e) { + log.severe("sql = "+sql+"; e.getMessage() = "+ e.getMessage()); + return null; + } finally { + DBUtils.close( rs); + DBUtils.close( pstmt); + } + } + + /** + * Set jasper report viewer provider. + * @param provider + */ + public static void setReportViewerProvider(JRViewerProvider provider) { + if (provider == null) + throw new IllegalArgumentException("Cannot set report viewer provider to null"); + viewerProvider = provider; + } + + /** + * Get the current jasper report viewer provider + * @return JRViewerProvider + */ + public static JRViewerProvider getReportViewerProvider() { + return viewerProvider; + } + + class ReportData { + private String reportFilePath; + private boolean directPrint; + + public ReportData(String reportFilePath, boolean directPrint) { + this.reportFilePath = reportFilePath; + this.directPrint = directPrint; + } + + public String getReportFilePath() { + return reportFilePath; + } + + public boolean isDirectPrint() { + return directPrint; + } + } + + class JasperData { + private JasperReport jasperReport; + private File reportDir; + private String jasperName; + private File jasperFile; + + public JasperData(JasperReport jasperReport, File reportDir, String jasperName, File jasperFile) { + this.jasperReport = jasperReport; + this.reportDir = reportDir; + this.jasperName = jasperName; + this.jasperFile = jasperFile; + } + + public JasperReport getJasperReport() { + return jasperReport; + } + + public File getReportDir() { + return reportDir; + } + + public String getJasperName() { + return jasperName; + } + + public File getJasperFile() { + return jasperFile; + } + } + + class FileFilter implements FilenameFilter { + private String reportStart; + private File directory; + private String extension; + + public FileFilter(String reportStart, File directory, String extension) { + this.reportStart = reportStart; + this.directory = directory; + this.extension = extension; + } + + public boolean accept(File file, String name) { + if (file.equals( directory)) { + if (name.startsWith( reportStart)) { + int pos = name.lastIndexOf( extension); + if ( (pos!=-1) && (pos==(name.length()-extension.length()))) return true; + } + } + return false; + } + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/Constants.java b/posterita/posterita/src/main/org/posterita/Constants.java new file mode 100644 index 0000000000..9a58bbab99 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/Constants.java @@ -0,0 +1,825 @@ +/* + * + * Copyright (c) 2005 UDI Ltd. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * UDI Ltd. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with UDI. + * + * UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Created on Jul 6, 2005 by vishee + */ + +package org.posterita; + +import org.compiere.model.MPayment; + +public class Constants +{ + public static final String ACCESSIBLE_ORGS = "accessibleOrgs"; + public static final String ACTION = "action"; + public static final String ADD_ORDERLINE_ID = "addOrderLineId"; + public static final String ADMIN = "admin"; + public static final String ADMIN_USER_ID = "adminUserId"; + public static final String ALL_BANKS = "allBanks"; + public static final String ALL_CUSTOMERS = "allCustomers"; + public static final String ALL_ORDERS = "allOrders"; + public static final String ALL_ORGS = "allOrgs"; + public static final String ALL_ROLES = "allRoles"; + public static final String ALL_STOCK_REPORT = "allStockReport"; + public static final String ALL_USERS = "allUsers"; + public static final String ALL_WAREHOUSES="allwarehouses"; + public static final String ALL_WEEKS = "allWeeks"; + public static final String ALLBUSINESSPARTNERS = "allBp"; + public static final String ALLOCATION = "allocation"; + public static final String ALLOCATION_DATE = "allocationDate"; + public static final String ALLOCATION_ID = "allocationId"; + public static final String ALLOCATION_LINES="allocationsLines"; + public static final String ALLOCATION_LIST = "allocationList"; + public static final String ALLOCATION_ORDERS = "allocationOrders"; + + + public static final String ALLOCATION_REPORT = "allocationReport"; + public static final String ALLOCATION_STOCK = "Allocation Stock"; + public static final String ALLWAREHOUSES="allwarehouses"; + + public static final String APP_CRM = "crm"; + public static final String APP_DCS = "dcs"; + public static final String APP_IMMOBILIER_WEBSTORE = "ImmobilierWebstore"; + public static final String APP_NAME = "appName"; + //APPLICATION NAME + public static final String APP_POS = "pos"; + public static final String APP_WEBSTORE = "webstore"; + public static final String APP_WEBSTORE_ADMIN = "webstoreadmin"; + public static final String APPROVE = "APPROVE"; + public static final String ASSIGNED_ROLES = "assignedRoles"; + public static final String ATTRIBUTE_LIST = "attributeList"; + public static final String ATTRIBUTE_NAME = "atttributeName"; + public static final String ATTRIBUTE_SET = "attributeSet"; + public static final String ATTRIBUTE_SET_ID = "attributeSetId"; + public static final String ATTRIBUTE_VALUES = "attributeValues"; + public static final String ATTRIBUTE_VALUES_LIST = "attributeValuesList"; + + + public static final int ATTRIBUTE_YEAR_MIN_VALUE = 2000; + public static final String ATTRIBUTESET = "AttributeSet"; + public static final String ATTRIBUTESETINSTANCE_ID = "attributeSetInstanceId"; + public static final String AUCTION_MODULE="Auction Module"; + public static final String AVAILABLE_COLOURS = "availableColours"; + public static final String AVAILABLE_COLOURS_SIZES = "availableColoursSizes"; + public static final String AVAILABLE_SIZES = "availableSizes"; + + + public static final String AVAILABLE_VIN = "availableVin"; + public static final String B_PARTNER_ID = "bPartnerId"; + public static final String BACK_ORDER = "backOrder"; + public static final String BANK = "bank"; + public static final String BANKS = "banks"; + public static final String BANK_ACCOUNTS = "bankAccounts"; + public static final String BASIC_DETAILS = "basicDetails"; + public static final String BARCODE_CART = "barcodeCart"; + public static final String BARCODE_CART_ITEMS = "barcodeCartItems"; + public static final String MMOVEMENT_CART = "mmovementCart"; + public static final String MMOVEMENT_CART_ITEMS = "mmovementCartItems"; + public static final String BP_LIST = "bpList"; + public static final String BPARTNER = "bPartner"; + public static final String BRAND_ATTRIBUTE_VALUES="brandAttributeValues"; + public static final String BREADCRUMB = "breadcrumb"; + public static final String BUSINESSPARTNER = "businessPartner"; + public static final String BUSINESSPARTNER_ORDER_DETAILS ="bPartnerOrderDetails"; + public static final String BUSINESSPARTNER_TRX_DETAILS = "businessPartnerTrxdetails"; + public static final String BUSINESSPARTNERSDETAILS = "bPartnerDetails"; + public static final String CAN_TRADE_IN = "canTradeIn"; + public static final String CANCEL_DO = "cancelDO"; + public static final String CANCEL_DT = "cancelDT"; + public static final String CANCEL_INVOICE = "cancelInvoice"; + public static final String CANCEL_SCO = "cancelSCO"; + public static final String CARD = "card"; + public static final String CASH = "cash"; + public static final String CASH_BOOK = "cashBook"; + public static final String CASH_DETAILS = "cashDetails"; + + public static final String CASH_LINE_DETAILS = "cashLineDetails"; + public static final String CASH_SUMMARY = "cashSummary"; + public static final String CERTIFICATE = "certificate"; + public static final String CHANGE = "change"; + public static final String CHECKED_PRODUCTS = "checkedProducts"; + public static final String CHECKING_ACCOUNT_TYPE = "C"; + public static final String CHECKOUT_ACTION = "/CheckoutAction"; + public static final String CHOOSE = "Choose"; + public static final String CHOOSE_SHIPPING_ADDRESS = "chooseShippingAddress"; + + public static final String CHOOSE_USER = "chooseUser"; + public static final String CHOOSE_VIN = "chooseVin"; + public static final String CLIENT_ID="client"; + public static final String CLIENT_NAME="clientName"; + public static final Integer COGS = Integer.valueOf(51100); + public static final String COLOUR_ATTRIBUTE_VALUE_ID = "colourAttributeValueId"; + public static final String COLOUR_ATTRIBUTE_VALUES = "colourAttributeValues"; + public static final String COLOURCODE_MATCHING = "colourCodeMatching"; + public static final String COMPLETED_INVOICE = "completedInvoice"; + public static final String COMPLETED_POS_ORDER = "completedPOSOrder"; + public static final String COMPLEX_COMMAND = "complexCommand"; + public static final String CONTENT = "content"; + public static final String SUBCLASSIFICATION = "subClassification"; + public static final String COUNTRY_CLASSIFICATION = "countryClassification"; + public static final String BRAND_CLASSIFICATION = "brandClassification"; + public static final String COUNTRIES = "countries"; + public static final String CREATE = "create"; + public static final String CREATE_BANKACCOUNT = "createBankAccount"; + public static final String CREATE_DRAFTED_ORDER = "createDraftedOrder"; + public static final String CREATE_NEW_CAR = "createNewCar"; + public static final String CREATE_PRODUCT_ATTRIBUTE_VALUE_ACTION = "/CreateProductAttributeValueAction"; + public static final String CREATE_PRODUCT_ATTRIBUTE_VALUE_FORM = "CreateProductAttributeValueForm"; + public static final String CREATE_USED_CAR = "createUsedCar"; + public static final String CREATE_WEBSTORE_CUSTOMER_ACTION = "/CreateWebstoreCustomerAction"; + public static final String CREATEPRODUCTS = "createProducts"; + public static final String CREATING_FROM_ORDER = "creatingFromOrder"; + public static final String CREDITCARDTYPE_AMEX = "Amex"; + public static final String CREDITCARDTYPE_DISCOVER = "Discover"; + public static final String CREDITCARDTYPE_MASTERCARD = "MasterCard"; + public static final String CREDITCARDTYPE_VISA = "Visa"; + public static final String CRM_REQUEST_USERS = "crmUsers"; + public static final String CSV = "csv"; + public static final String CSV_FILE = "csvFile"; + public static final String CSV_FILE2 = "csvFile2"; + public static final String PDF_FILE = "pdfFile"; + + public static final String CURRENCIES = "currencies"; + public static final String CURRENCY_SYMBOLE = "currencySymbole"; + public static final String CURRENT_PARTIAL_POS_ORDER_ID = "currentPartialPOSOrderId"; + public static final String CURRENT_POS_ORDER="currentPOSOrder"; + public static final String CURRENT_POS_ORDER_ID = "currentPOSOrderId"; + public static final String CURRENT_PRODUCT = "currentProduct"; + public static final String CURRENT_REQUEST = "currentRequest"; + public static final String CURRENT_TILL_AMOUNT = "currentTillAmount"; + public static final String CURRENT_TILL_AMOUNT_POS = "currentTillAmountPOS"; + public static final String CURRENT_YEAR = "currentYear"; + public static final String CUSTOM_DATE_RANGE = "customDateRange"; + public static final String CUSTOMER = "customer"; + public static final String CUSTOMER_CREATED="CustomerCreated"; + public static final String CUSTOMER_DETAILS = "customerDetails"; + + public static final String CUSTOMER_ID = "customerId"; + public static final String CUSTOMER_RETURN_ORDER = "customerReturnOrder"; + public static final String CUSTOMER_RETURN_ORDER_ID = "customerReturnOrderId"; + + public static final String CUSTOMER_RETURN_ORDER_LINES = "customerReturnOrderLine"; + public static final String CUSTOMER_RETURN_ORDER_SHOPPING_CART = "customerReturnOrderShoppingCart"; + public static final String CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS = "customerReturnOrderShoppingCartItems"; + public static final String DEALER_COUNTER_REF = "dealerCounterRef"; + public static final String DEALER_DETAILS = "dealerDetails"; + public static final String DEALER_REF = "dealerRef"; + + public static final String DEALERCODE_LIST = "dealerCodeList"; + public static final String DEALERS = "dealers"; + public static final String DEALERS_DETAIL = "dealersDetail"; + + + public static final String DELETE_ORDER_TYPE = "deleteOrderType"; + public static final String DELIVERY = "Delivery"; + public static final String DESCRIPTION ="description"; + public static final String DESIGN_ATTRIBUTE_VALUES="designAttributeValues"; + public static final String DISPLAY_REPORT = "displayReport"; + public static final String DMS = "DMS"; + public static final String DOC_STATUS = "docStatus"; + public static final String DOC_NO = "docNo"; + + public static final String DOCUMENT_HISTORY = "documentHistory"; + public static final String DOCUMENT_PDF = "documentPDF"; + public static final String DRAFT_INVOICE = "draftInvoice"; + + public static final String EDITWAREHOUSE="editWarehouse"; + public static final String EMAIL = "email"; + + //Email specific + public static final String EMAIL_FOOTER= "email.footer"; + public static final String EMAIL_REGARDS = "emailRegards"; + public static final String EMAIL_SIGNIN_INFO = "signin.info"; + public static final String END_OF_THE_DAY_DETAILS = "endOfTheDayDetails"; + public static final String ERROR_TITLE = "errorTitle"; + public static final String ERRORS = "errors"; + public static final String ETA_LIST = "ETAList"; + //public static final String EURO_SIGN = "€"; + public static final String EXISTING_BAR_CODE = "existingBarCode"; + public static final String FILE_FOR_UPDATE = "fileForUpdate"; + public static final String FINISHED_AL ="finishedAL"; + public static final String FINISHED_DO = "finishedDO"; + public static final String FINISHED_DT ="finishedDT"; + + public static final String FINISHED_MRO = "finishedMRO"; + + public static final String FINISHED_NR = "finishedNR"; + public static final String FINISHED_SCO = "finishedSCO"; + public static final String FIXED_DATE_RANGE = "fixedDateRange"; + public static final String FREE_STOCK = "Free Stock"; + public static final String FROM_DATE = "fromDate"; + public static final String FULL_DETAILS = "fullDetails"; + public static final String FULL_IMAGE = "fullImage"; + public static final String FULLIMAGE = "fullImage"; + public static final String GENERATE_INVOICE = "generateInvoice"; + public static final String GENERATE_INVOICE_ACTION = "Invoice"; + public static final String GENERATE_INVOICE_PAYMENT_ACTION = "InvoicePayment"; + public static final String GENERATE_WEBSTORE_INVOICE = "generateWebstoreInvoice"; + public static final String GET_CREDIT_CARD_DETAILS = "getCreditCardDetails"; + public static final String GET_LOGO="getLogo"; + + public static final String GET_PRODUCT_CATEGORY_ACTION = "/GetProductCategory"; + public static final String GOING_RATE_REPORT = "goingRateReport"; + public static final String GOODS_RECEIVE_NOTE = "goodsReceiveNote"; + public static final String GOODS_RECEIVE_NOTE_ID = "goodsReceiveNoteId"; + public static final String GOODS_RECEIVE_NOTE_LINES = "goodsReceiveNoteLines"; + public static final String GOODS_RECEIVE_NOTE_SHOPPING_CART = "goodsReceiveNoteShoppingCart"; + public static final String GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS = "goodsReceiveNoteShoppingCartItems"; + public static final String GOODS_RETURN_NOTE = "goodsReturnNote"; + public static final String GOODS_RETURN_NOTE_ID = "goodsReturnNoteId"; + + public static final String GOODS_RETURN_NOTE_LINES = "goodsReturnNoteLines"; + public static final String GOODS_RETURN_NOTE_SHOPPING_CART = "goodsReturnNoteShoppingCart"; + public static final String GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS = "goodsReturnNoteShoppingCartItems"; + public static final String GRAND_TOTAL = "grandTotal"; + public static final String HIDDEN_STOCK = "Hidden Stock"; + public static final String HOMEPAGE_PRODUCTS = "homePageProducts"; + public static final String HTML = "html"; + public static final String IMAGE_NAME = "ImageName"; + public static final String IMAGES_DIRECTORY = "images/"; + public static final String IMPORTED_VEHICLES = "importedVehicles"; + public static final String InitPriceListAction = "/InitPriceListAction"; + public static final String INSERT_VIN = "insertVin"; + public static final String INVOICE_ACTION_CANCEL = "Cancel"; + public static final String INVOICE_ACTION_COMPLETE = "Complete"; + public static final String INVOICE_ACTION_DELETE = "Delete"; + public static final String INVOICE_ACTION_PAID = "Paid"; + public static final String INVOICE_ACTION_PAID_AND_SHIP = "Paid and Ship"; + public static final String INVOICE_HISTORY = "invoiceHistory"; + public static final String INVOICE_ID = "invoiceId"; + public static final String INVENTORY_CART = "inventoryCart"; + public static final String INVENTORY_CART_ITEMS = "inventoryCartItems"; + + public static final String INVOICE_PAID = "Invoice & Pay"; + public static final String INVOICE_PAID_SHIP = "Inv/Paid/Ship"; + public static final String INVOICE_TAX = "invoiceTax"; + public static final String IS_PAID = "isPaid"; + public static final String KEYWORD1_LINK_LIST = "keyword1LinkList"; + public static final String KEYWORD2_LINK_LIST = "keyword2LinkList"; + + public static final String KIA = "kia"; + public static final String LEFT_MENUS = "leftMenus"; + public static final String LICENSING_AREA="licensingAreas"; + public static final String LICENSING_INFORMATION = "licensingInformation"; + public static final String APP_LICENSING_INFORMATION = "appLicensingInformation"; + public static final String LOCATORS = "locators"; + public static final String LOGIN = "login"; + + public static final String LOGIN_LINK = "link"; + public static final String MAKE_ATTRIBUTE_VALUES = "makeAttributeValues"; + public static final String MAX_SOLD_ITEMS = "maxSoldItems"; + public static final String ME = "me"; + public static final String ME_LOCATION = "meLocation"; + public static final String MENU = "menu"; + public static final String MENU_ITEMS = "menuItems"; + + public static final String MENU_LIST = "menuList"; + public static final String MENUS = "menus"; + public static final String MESSAGE = "message"; + public static final String MESSAGE_LOG_BEAN = "messageLogBean"; + public static final String MESSAGE_LOGS = "messageLogs"; + public static final String MIN_SOLD_ITEMS = "minSoldItems"; + public static final String MINOUT = "minout"; + public static final String MINOUT_ACTION_CANCEL = "Cancel"; + public static final String MINOUT_ACTION_COMPLETE = "Complete"; + public static final String MINOUT_ACTION_DELETE = "Delete"; + + public static final String MINOUT_ACTION_RECEIVE = "Receive"; + public static final String MINOUT_ACTION_SHIP = "Ship"; + public static final String MINOUT_LINES_COLLECTION = "minOutLinesCollection"; + public static final String MINVOICE = "minvoice"; + public static final String MINVOICE_LINES_COLLECTION = "invoiceLinesCollection"; + public static final String MMOVEMENT_LOCATOR = "toLocator"; + public static final String MMOVEMENT_LOCATORS = "organisationLocators"; + + public static final String MMOVEMENT_PRODUCT = "materialMovementProduct"; + public static final String MMOVEMENT_PRODUCTS = "organisationProducts"; + public static final String MMOVEMENT_WAREHOUSES = "organisationWarehouses"; + + public static final String MODEL_ATTRIBUTE_VALUE_ID = "modelAttributeValueId"; + public static final String MODEL_ATTRIBUTE_VALUES="modelAttributeValues"; + public static final String MODEL_MATCHING_MODELS = "modelMatchingModels"; + public static final String MODEL_MATCHING_YEARS = "modelMatchingYears"; + public static final String MODELCODE_LIST = "modelCodeList"; + public static final String MODELGROUP_ATTRIBUTE_VALUES = "modelGroupAttributeValues"; + public static final String MODELMATCH = "modelmatch"; + public static final String MONTH_SALES = "monthSales"; + public static final String MORDER = "morder"; + public static final String MORDER_LINES_COLLECTION = "orderLinesCollection"; + public static final String MPAYMENT = "payment"; + public static final String MY_RECEIVED_MESSAGE = "myReceivedMessage"; + public static final String MY_RECEIVED_MESSAGES = "myReceivedMessages"; + public static final String MY_SENT_MESSAGES = "mySentMessages"; + public static final String MY_STOCKS = "myStocks"; + public static final String NAAMSA_REPORT = "Naamsa Report"; + public static final String NAAMSAINFO = "naamsaInfo"; + public static final String NATIS_RELEASE_INFO = "natisReleaseInfo"; + public static final String NATIS_XML_ENCODING = "ISO-8859-1"; + public static final String NEW_PRODUCT = "newProduct"; + public static final String NO_CHAR = "N"; + public static final String NO_OF_VEHICLES_SOLD = "noOfVehicleSold"; + public static final String OLD_MODELMATCH = "oldmodelmatch"; + public static final String OPEN_CASH_BOOK = "openCashBook"; + public static final String OPENED_CASH_BOOK = "openedCashBook"; + public static final String ORDER_ACTION_ACCEPT = "Accept"; + public static final String ORDER_ACTION_ACCEPT_WO="Create"; + public static final String ORDER_ACTION_CANCEL = "Cancel"; + public static final String ORDER_ACTION_CLOSE = "Close"; + public static final String ORDER_ACTION_COMPLETE = "Complete"; + public static final String ORDER_ACTION_CONFIRM = "Confirm"; + public static final String ORDER_ACTION_DELETE = "Delete"; + public static final String ORDER_ACTION_GENERATE_ORDER = "Generate Order"; + public static final String ORDER_ACTION_PREPARE = "Reserve Stock"; + + public static final String ORDER_ACTION_PREPARE_SCO = "Prepare"; + public static final String ORDER_ACTION_PREPARE_SCO_ORDER="Prepare Order"; + public static final String ORDER_ACTION_REJECT = "Reject"; + public static final String ORDER_ACTION_SAVE = "Save"; + public static final String ORDER_ACTION_SPLIT = "Split"; + + public static final String ORDER_ACTION_SUBMIT = "Submit"; + public static final String ORDER_BEAN = "orderBean"; + public static final String ORDER_COLLECTION = "orderCollection"; + public static final String ORDER_DETAILS = "orderDetails"; + public static final String ORDER_HISTORY = "orderHistory"; + public static final String ORDER_ID = "orderId"; + public static final String ORDER_INFO = "orderInfo"; + public static final String ORDER_LINE_BEAN = "orderLineBean"; + public static final String ORDER_LINE_ID = "orderLineId"; + public static final String ORDER_LINES = "orderLines"; + public static final String ORDER_LINES_FOR_ORDER = "orderLinesForOrder"; + public static final String ORDER_TAX = "orderTax"; + public static final String ORDER_TYPE = "orderType"; + public static final String ORDER_TYPE_BULK = "bulk"; + + public static final String ORDER_TYPE_SIMPLE = "simple"; + + public static final String ORDER_TYPES = "orderTypes"; + public static final String ORG_FOR_RESERVED_PRODUCTS="orgForReservedProducts"; + public static final String ORG_ID = "orgId"; + public static final String ORG_USERS = "orgUsers"; + public static final String ORGANISATION = "organisation"; + public static final String ORGANISATION_VALUES="organisationValues"; + public static final String ORGS = "orgs"; + public static final String ORGTYPE = "orgType"; + + public static final String PAID_INVOICE = "paidInvoice"; + public static final String PAIR_VIN_NUMBERS = "pairVinNos"; + + public static final String PARTIAL_ORDER_SHOPPING_CART = "partialOrderShoppingCart"; + public static final String PARTIAL_ORDER_SHOPPING_CART_ITEMS = "partialOrderShoppingCartItems"; + public static final String PARTIAL_POS_ORDER = "partialPosOrder"; + + public static final String PARTIAL_POS_ORDER_LINES = "partialPOSOrderlines"; + public static final String PASSWORD = "password"; + public static final String PATH_CREATE_TAMAK_ORDER_ACTION = "/CreateTamakOrderAction"; + public static final String PATH_VIEW_ORDER_ACTION = "/ViewOrderAction"; + public static final String PAYMENT_ACTION_CANCEL = "Cancel"; + public static final String PAYMENT_ACTION_COMPLETE = "Complete"; + public static final String PAYMENT_BY_CARD = "paymentByCard"; + + public static final String PAYMENT_BY_CASH = "paymentByCash"; + public static final String PAYMENT_BY_CHEQUE = "paymentByCheque"; + + public static final String PAYMENT_HISTORY = "paymentHistory"; + public static final String PAYMENT_RULE_CARD="Card"; + public static final String PAYMENT_RULE_CASH="Cash"; + public static final String PAYMENT_RULE_CHEQUE="Cheque"; + public static final String PAYMENT_RULE_CREDIT="Credit"; + public static final String PAYMENT_RULE_MIXED="Mixed"; + public static final String PAYMENT_RULES = "paymentRules"; + public static final String PAYMENT_TYPE = "paymentType"; + public static final String PDF = "pdf"; + public static final String POOL_ORDERLINES = "poolOrderLines"; + public static final String POS_GENERAL_STOCK = "posGeneralStock"; + public static final String CARD_AMT_TENDERED = "cardAmtTendered"; + public static final String CHEQUE_AMT_TENDERED = "chequeAmtTendered"; + + public static final String POS_HISTORY = "posHistory"; + + public static final String POS_INFO = "posInfo"; + + public static final String POS_ORDER = "posOrder"; + public static final String POS_ORDER_CUSTOMER_COMPULSORY = "posOrderCustomerCompulsory"; + public static final String POS_ORDER_DOC_NUMBER = "POSOrderDocumentNumber"; + public static final String POS_ORDER_ID = "posOrderId"; + public static final String POS_ORDER_LINES = "posOrderLines"; + public static final String POS_ORDER_WITHOUT_ADVANCED = "posOrderWithoutAdvanced"; + public static final String POS_PRODUCTS_FOR_UPDATE = "posProductsForUpdate"; + public static final String POS_SALES_PRICE_LIST = "posSalesPriceList"; + + public static final String POS_STOCK = "posStock"; + public static final String POSTERMINAL = "POSTerminal"; + public static final String POSTERMINALS = "POSTerminals"; + public static final String PRICE = "price"; + + public static final String PRICE_LIST = "priceList"; + public static final String PRICE_LIST_VERSION = "priceListVersion"; + public static final String PRICE_LIST_VERSION_ID = "priceListVersionId"; + public static final String PriceListForm = "PriceListForm"; + + public static final String PRICEQTY_FILTER = "priceQtyFilter"; + public static final String PROCESS_CLASS = "process.class"; + public static final String PROCESS_NAME = "process.name"; + + public static final String PRODUCT = "product"; + public static final String PRODUCT_ATTRIBUTE_LIST = "productAttributeList"; + public static final String PRODUCT_ATTRIBUTE_SET = "productAttributeSet"; + public static final String PRODUCT_BRANDS = "productBrands"; + public static final String PRODUCT_CART = "productCart"; + public static final String PRODUCT_CART_ITEMS = "productCartItems"; + public static final String PRODUCT_CATEGORY_ID = "productCategoryId"; + //public static final String WEBSTORE_SHIPPING_ADDR = "webstoreShippingAddr"; + //public static final String WEBSTORE_BILLING_ADDR = "webstoreBillingAddr"; + public static final String PRODUCT_CLASSIFICATION ="productClassification"; + public static final String PRODUCT_CREATED = "productsCreated"; + public static final String PRODUCT_DETAIL_INFO = "productDetailInfo"; + public static final String PRODUCT_DETAILS = "productDetails"; + + public static final String PRODUCT_FILTER_BEAN = "productFilterBean"; + + public static final String PRODUCT_ID = "productId"; + + public static final String PRODUCT_IDS = "productIds"; + public static final String PRODUCT_IMAGE = "productImage"; + public static final String PRODUCT_IMAGE_BEAN = "productImageBean"; + public static final String PRODUCT_INFO = "productInfo"; + public static final String PRODUCT_KEYWORDS = "productKeywords"; + + public static final String PRODUCT_LINES = "productLines"; + public static final String PRODUCT_LIST = "productList"; + public static final String PRODUCT_SALES_DETAILS = "productSalesDetails"; + public static final String PRODUCT_SALES_SUMMARY = "productSalesSummary"; + public static final String PRODUCTS = "products"; + public static final String PRODUCTS_IN_STOCK = "productsInStock"; + public static final Integer PROFIT_MARGIN = Integer.valueOf(99999); + public static final String PROGRESS_DO = "progressDO"; + public static final String PROGRESS_DT = "progressDT"; + public static final String PROGRESS_NR = "progressNR"; + public static final String PROGRESS_SCO = "progressSCO"; + public static final String PROGRESS_TI = "progressTI"; + public static final String PROJECT_NAME = "project.name"; + public static final String PURCHASE_PRICELISTS = "purchase.pricelists"; + public static final String QUANTITY = "quantity"; + public static final String QUICK_POS_ORDER = "quickPosOrder"; + public static final String RECEIPT_HISTORY = "receiptHistory"; + public static final String RECEIVED_MESSAGE = "receivedMessage"; + public static final String REGION_VALUES = "regionValues"; + public static final String REGIONS = "regions"; + + public static final String RELATED_PRODUCT_IMAGES = "relatedProductImages"; + public static final String REPORT_URL = "reportURL"; + public static final String REPRICE_ORDER_TYPE ="repriceOrderType"; + + public static final String REQUEST_PRIORITIES = "requestPriorities"; + public static final String REQUEST_STATUS = "requestStatus"; + // --> CRM + public static final String REQUESTS_SUMMARY = "requestsSummary"; + public static final String RESERVE_STATUS_VALUES = "reserveStatusValues"; + public static final String RETAIL_REPORT = "retailReport"; + public static final String REVENUE_RECOGNITION = "Revenue Recognition"; + public static final String ROLE = "role"; + public static final String ROLE_MENUS = "roleMenus"; + public static final String ROLES = "roles"; + + public static final String SALES_ANALYSIS = "salesAnalysis"; + public static final String SALES_REP = "salesRep"; + public static final String SALES_REPORT = "salesReport"; + public static final String SALESGROUP_LIST = "salesGroupList"; + public static final String SALES_PRICELISTS = "sales.pricelists"; + public static final String SAVING_ACCOUNT_TYPE = "S"; + public static final String SCO_FILTER_BEAN = "SCOFilterBean"; + public static final String SCO_PRODUCT_LIST = "SCO Product List"; + public static final String SEARCH_VIN_NUMBERS="searchVinNumbers"; + public static final String SEARCH_VIN_NUMBERS_INQUIRY="searchVinNumberForInquiry"; + public static final String SELECTED_PRODUCTS_FOR_BULK_ORDER = "selectedProductsForBulkOrder"; + public static final String SELECTED_PRODUCTS_FOR_SIMPLE_ORDER = "selectedProductsForSimpleOrder"; + public static final String SENT_MESSAGE = "sentMessage"; + public static final String SHIPMENT_HISTORY = "shipmentHistory"; + public static final String SHIPPER_LIST = "shipperList"; + public static final String SHOPPING_CART = "shoppingCart"; + public static final String SHOPPING_CART_ITEMS = "shoppingCartItems"; + public static final String CHECKOUT_BEAN = "checkoutBean"; + public static final String SHOPPING_GRN_CART = "shoppingGRNCart"; + public static final String SHOPPING_GRN_CART_ITEMS = "shoppingGRNCartItems"; + public static final String SHOPPING_ORDER_CART = "shoppingOrderCart"; + public static final String SHOPPING_ORDER_CART_ITEMS = "shoppingOrderCartItems"; + public static final String SIMPLE_COMMAND = "simpleCommand"; + + public static final String SIMPLE_PRODUCT_CART = "simpleProductCart"; + public static final String SIZE_ATTRIBUTE_VALUES="sizeAttributeValues"; + public static final String SPLIT_ORDER_PROCESS = "splitOrderProcess"; + public static final String STATUS = "status"; + public static final String STATUS_OFF = "OFF"; + + public static final String STATUS_ON = "ON"; + public static final String STATUS_VALUES = "statusValues"; + public static final String STOCK_HISTORY_REPORT = "stockHistoryReport"; + + public static final String STOCK_MOVEMENT = "stockMovement"; + public static final String SUB_MENU_ITEMS = "subMenuItems"; + public static final String SUB_MENU_NAME = "subMenuName"; + public static final String SUBJECT = "subject"; + public static final String SUB_TOTAL = "subTotal"; + public static final String SUCCESS = "success"; + public static final String SUCCESS_CREATE_CUSTOMER = "successCreateCustomer"; + public static final String SUPERUSER = "superUser"; + public static final String SWAP_PRODUCT_ID = "swapProductId"; + public static final String SWAP_VIN = "swapVin"; + public static final String SWAP_VIN_NOS_ACTION = "Save"; + public static final String SWAP_VIN_NUMBER_BEAN = "swapVinNumberBean"; + public static final String TABULAR_REPORT_DATA = "tabularReportData"; + + public static final String TABULAR_REPORT_DATA2 = "tabularReport2"; + public static final String TABULAR_REPORT_SUBTITLE = "tabularReportSubtitle"; + public static final String TABULAR_REPORT_TITLE = "tabularReportTitle"; + public static final String TARGET_SALES = "targetSales"; + public static final String TAX_CATEGORY_ID = "taxCategoryId"; + + public static final Integer TAX_CREDIT = Integer.valueOf(12610); + public static final Integer TAX_DUE = Integer.valueOf(21610); + public static final String THUMBNAIL = "thumbnail"; + public static final String TIME_REMAINING = "timeRemaining"; + public static final String TO_DATE = "toDate"; + public static final String TOP_MENUS = "topMenus"; + public static final String MAIN_MENUS = "mainMenus"; + public static final String TOTAL_LINES = "totalLines"; + public static final String TRADE_IN_LIST = "tradeInList"; + public static final String TRADE_IN_PRODUCT_ID = "tradeInProductId"; + public static final Integer TRADE_REVENUE = Integer.valueOf(41000); + public static final String TRAFFIC_LIST = "trafficList"; + public static final String TRX_ATTRIBUTE_VALUE_ID = "trxAttributeValueId"; + public static final String TRX_ATTRIBUTE_VALUES="trxAttributeValues"; + public static final String [] TSHIRT_SIZE={"S","M","XL"}; + public static final String UDIADMIN = "udiadmin"; + public static final String UDIADMINAUTO = "udiadminauto"; + public static final String UDIADMINBIKE = "udiadminbike"; + public static final String UNFINISHED_AL = "unfinishedAL"; + + public static final String UNFINISHED_DO = "unfinishedDO"; + public static final String UNFINISHED_DT = "unfinishedDT"; + public static final String UNFINISHED_INV = "unfinishedInvoice"; + public static final String UNFINISHED_NR = "unfinishedNR"; + public static final String UNFINISHED_SCO = "unfinishedSCO"; + public static final String UNFINISHED_WO = "unfinishedWO"; + public static final String UNIMPORTED_VEHICLES = "unimportedVehicles"; + public static final String UNPAID_INVOICE = "unPaidInvoice"; + public static final String UPDATE_PRODUCT_DETAILS = "updateProductDetails"; + public static final String USED_CAR_PURCHASE_ORDER = "usedCarPurchaseOrder"; + public static final String USER_DETAILS = "userDetails"; + public static final String VEHICLE_DETAILS = "vehicleDetails"; + public static final String VEHICLES = "vehicles"; + public static final String VENDOR_DETAILS = "vendorDetails"; + public static final String BLACKLISTED_DETAILS = "blackListedDetails"; + public static final String BLACKLISTED_LISTS="blackListedList"; + + + public static final String VENDOR_LIST = "vendorList"; + public static final String VIEW_ALL_ALLOCATIONS = "viewAllAllocations"; + public static final String VIEW_INVOICE_DETAILS="view.invoice.detail"; + public static final String VIEW_MINOUT = "viewMinOut"; + public static final String VIEW_MY_SENT_MESSAGES="viewMySentMessages"; + public static final String VIEW_PAYMENT = "viewPayment"; + public static final String VIEW_POS_ORDER_ACTION = "/ViewPOSOrderAction"; + + public static final String VIEW_POS_PRODUCTS = "viewPOSProducts"; + + public static final String VIEW_SHOPPING_CART = "viewShoppingCart"; + public static final String VIEW_VIN_NUMBER_DETAILS = "viewVinNumberDetails"; + public static final String VIN_NOS = "vinNos"; + + public static final String VIN_NUMBER_FROM = "vinNumberFrom"; + public static final String WAREHOUSE="warehouse"; + public static final String WAREHOUSE_NAMES = "warehouseNames"; + public static final String WAREHOUSE_TYPES = "warehouseTypes"; + public static final String WAREHOUSEDETAILS="warehouseDetails"; + + public static final String WAREHOUSES = "warehouses"; + public static final String WEB_APPLICATIONS = "WebApplications"; + public static final String WEB_DOCUMENT_HEADER_BEAN = "webDocumentHeaderBean"; + public static final String WEB_INVOICE_BEAN = "webInvoiceBean"; + + + + public static final String WEB_MINOUT_BEAN = "webMinOutBean"; + public static final String WEB_ORDER_BEAN = "webOrderBean"; + public static final String WEB_ORDER_LINE_BEAN = "webOrderLineBean"; + public static final String WEB_PAYMENT_BEAN = "webPaymentBean"; + + + public static final String WEBSTORE_CREATE_CUSTOMER = "webstoreCreateCustomer"; + public static final String WEBSTORE_CREDITCARD_BEAN = "creditCardBean"; + public static final String WEBSTORE_CUSTOMER = "Webstore Customer"; + public static final String WEBSTORE_INVOICE = "webstoreInvoice"; + /*public static final String WEBSTORE_LINK = UDIFilePropertiesManager.getProperty().get(new Properties(), "webstore.url");*/ + public static final String WEBSTORE_LOGIN_ACTION = "/WebstoreLoginAction"; + public static final String WEBSTORE_PROGRESS_DO = "webstoreProgressDO"; + /*public static final String WEBSTORE_SHIPPING_PROMOTION_PRICE = UDIFilePropertiesManager.getProperty().get(new Properties(), "webstore.shipping.promotion.price"); + public static final String WEBSTORE_SHIPPING_PROMOTION_STATUS = UDIFilePropertiesManager.getProperty().get(new Properties(), "webstore.shipping.promotion.status"); +*/ + public static final String WEBSTORE_USER_BEAN = "webstoreUserBean"; + public static final String WEBSTORE_USER_DETAILS = "webstoreUserDetails"; + public static final String WESBANK = "wesbank"; + public static final String WESBANK_RESPONSE = "WesbankResponse"; + public static final String WESBANK_STATUS = "wesbank.status"; + public static final String WHOLESALE_REPORT = "wholesaleReport"; + public static final String YEAR_ATTRIBUTE_VALUE_ID = "yearAttributeValueId"; + public static final String YEAR_ATTRIBUTE_VALUES="yearAttribueValues"; + + + public static final String YES_CHAR = "Y"; + public static final String YOU = "you"; + public static final String YOU_BP_LOCATION = "youbpLocation"; + public static final String YOU_LOCATION = "youLocation"; + public static final String CURRENCY_SYMBOLE_PURCHASE = "currencySymbolePurchase"; + public static final String CREDIT_ORDER = "creditOrder"; + public static final String CREDIT_ORDER_SHOPPING_CART = "creditOrderShoppingCart"; + public static final String CREDIT_ORDER_SHOPPING_CART_ITEMS = "creditOrderShoppingCartItems"; + public static final String OPEN_ITEMS = "openItems"; + public static final String AGING_ITEMS = "agingItems"; + public static final String CREDIT_INVOICE_INFO = "creditInvoiceInfo"; + public static final String DISCOUNT_ALLOWED = "discountAllowed"; + public static final String PRODUCT_SALES_BUCKET = "productSalesBucket"; + public static final String BPARTNERS = "bPartners"; + public static final String CASH_PAYMENT_MADE = "cashPaymentMade"; + public static final String CASH_PAYMENT_LIST = "cashPaymentList"; + public static final String CARD_CHQ_PAYMENT_LIST = "cardChqPaymentList"; + public static final String INVOICE_GRAND_TOTAL = "invoiceGrandTotal"; + public static final String NO_IMAGE_CSV_REPORT = "noImageCSVReport"; + public static final String MCASHLINE = "cashLine"; + public static final String DEBTORS = "debtors"; + public static final String PAYMENT_ALLOCATIONS = "paymentAllocations"; + public static final String PAYMENT_TERM = "paymentTerm"; + public static final String PAYMENT_TERM_ID = "paymentTermId"; + public static final String ALL_PAYMENT_TERMS = "allPaymentsTerms"; + public static final String EDIT_PAYMENT_TERM = "editPaymentTerm"; + public static final String NO_CREDIT_CHECK="No Credit Check"; + public static final String CREDIT_OK="Credit OK"; + public static final String CREDIT_STOP="Credit Stop"; + public static final String BUSINESSPARTNERINFO = "bPartnerInfo"; + public static final String ORDER_NAME = "orderName"; + public static final String COMMISSION_AMT = "commissionAmt"; + public static final String COMMISSION_AMT_DETAILS = "commissionAmtDetails"; + public static final String CREDIT_HOLD = "creditHold"; + public static final String CREDIT_WATCH = "creditWatch"; + public static final String CREDIT_PAYMENT_TERM_ID = "creditPaymentTermId"; + public static final String PRESENT_POS_ORDER = "presentPOSOrder"; + public static final String PRESENT_CREDIT_ORDER = "presentCreditOrder"; + public static final String PRESENT_POS_ORDER_ID = "presentPOSOrderId"; + public static final String PRESENT_GRN_ORDER_ID = "presentGRNOrderId"; + public static final String PRESENT_GRN_ORDER = "presentGRNOrder"; + public static final String PRESENT_GOODS_RET_ORDER = "presentGoodsReturnOrder"; + public static final String PRESENT_GOODS_RET_ORDER_ID = "presentGoodsReturnOrderId"; + public static final String PRESENT_CREDIT_ORDER_ID ="presentCreditOrderId"; + public static final String PRESENT_CUSTOMER_RET_ORDER = "presentCustomerReturnOrder"; + public static final String PRESENT_CUSTOMER_RET_ORDER_ID = "presentCustomerReturnOrderId"; + public static final String CUSTOMER_CART = "customerCart"; + public static final String ALL_CART_CUSTOMERS = "allCartCustomers"; + public static final String ALL_TAX_RATE ="allTaxRates"; + public static final String EDIT_TAX = "editTax"; + public static final String INVENTORY_LINE_LIST = "inventoryLineList"; + public static final String CREDITORDER_BPARTNER = "creditOrderBPartner"; + public static final String ORDER_TITLE = "orderTitle"; + public static final String UNALLOCATED_PAYMENTS = "unallocatedPayments"; + public static final String COMPLETED_INVENTORY_LINE_LIST = "completedInventoryLineList"; + public static final String INVENTORY_HISTORY_LIST = "inventoryHistoryList"; + public static final String WHOLE_INVENTORY_LINE_LIST = "wholeInventoryLineList"; + public static final String SHIPMENT_REQUIRED = "shipmentRequired"; + public static final String INVOICE_FOR_ALLOCATION = "invoiceForAllocation"; + public static final String TO_BE_SHIPPED = "toBeShipped"; + public static final String POS_HISTORY_ORDER_TYPE = "posHistoryOrderType"; + public static final String GROUP1 = "group1"; + public static final String GROUP2 = "group2"; + public static final Object CREATE_PAYMENT = "createPayment"; + public static final String INVENTORY_ID = "inventoryId"; + public static final String PAID="Paid"; + public static final String UNPAID="UnPaid"; + public static final String PARTIALLY_PAID="Partially Paid"; + public static final String OVER_PAID = "overPaid"; + public static final String INVENTORY_DESCRIPTION ="inventoryDescription"; + public static final String PARTIAL_POS_OREDR = "partialPOSOrder"; + public static final String ALL_ORDER_HISTORY = "allOrderHistory"; + + public static final String CLOSE_TILL_PRINT_DATA="closeTillPrintData"; + public static final String SHOPPING_CART_NAME = "shoppingCartName"; + + public static final String PREFERENCE_PRINTER_TYPE = "preference.printerType"; + public static final String UOM_LIST = "uomList"; + public static final String USER_ORGS = "userOrgs"; + public static final String ALL_ORGANISATIONS = "*"; + public static final String ROLE_ORG_ACCESS_LIST = "roleOrgAccessList"; + public static final String DETAILED_SALES_REPORT = "detailedSalesReport"; + // Constants related to Material Movement + public static final String ORG_FROM_ID = "orgFromId"; + public static final String ORG_TO_ID = "orgToId"; + public static final String USER_ORGS_STOCK = "userOrgsStockMovement"; + + public static final String STOCK_LIST = "stockList"; + public static final String MOVE_CONFIRM = "moveConfirm"; + public static final String MATERIAL_MOVEMENT_ITEMS = "materialMovementItems"; + public static final String MATERIAL_MOVEMENT = "materialMovement"; + public static final String MATERIAL_MOVEMENT_LIST = "materialMovementList"; + public static final String MATERIAL_MOVEMENT_LINES = "materialMovementLines"; + public static final String MATERIAL_MOVEMENT_DETAILS = "materialMovementDetails"; + public static final String MATERIAL_MOVEMENT_ID = "materialMovementId"; + public static final String MOVE_CONFIRM_LINES = "moveConfirmLines"; + public static final String MMOVEMENT = "movement"; + public static final String MMOVEMENT_ID = "movementId"; + + public static final String PAYMENT_RULE_CASH_MSG = "payment.rule.cash"; + public static final String PAYMENT_RULE_CARD_MSG = "payment.rule.card"; + public static final String PAYMENT_RULE_CHEQUE_MSG = "payment.rule.cheque"; + public static final String PAYMENT_RULE_MIXED_MSG = "payment.rule.mixed"; + public static final String PAYMENT_RULE_CREDIT_MSG = "payment.rule.credit"; + + + public static final String DOC_STATUS_DRAFTED = "document.status.drafted"; + public static final String DOC_STATUS_INPROGRESS = "document.status.inprogress"; + public static final String DOC_STATUS_COMPLETED = "document.status.completed"; + public static final String DOC_STATUS_INVALID = "document.status.invalid"; + public static final String DOC_STATUS_VOID = "document.status.void"; + public static final String DOC_STATUS_CLOSED = "document.status.closed"; + public static final String STOCK_SALES_REPORT_LIST = "stock.sales.report.list"; + public static final String STOCK_SALES_REPORT_DATA = "stockSalesReportData"; + public static final String SALES_REPORT_LIST = "salesReportList"; + public static final String STOCK_REPORT_LIST = "stockReportList"; + public static final String SALES_REPORT_LIST_COMPLETE = "salesReportListComplete"; + public static final String STOCK_REPORT_LIST_COMPLETE = "stockReportListComplete"; + public static final String PRODUCT_SALES_COMPLETE_SET = "productSalesCompleteSet"; + public static final String PRODUCT_STOCK_COMPLETE_SET = "productStockCompleteSet"; + public static final String PRODUCT_ORG_STOCK_MAP = "productOrgStockMap"; + public static final String PRODUCT_ORG_SALES_MAP = "productOrgSalesMap"; + public static final String STOCK_PRODUCT_LIST = "stockProductList"; + public static final String MMOVEMENT_LINES = "movementLines"; + public static final String STOCKMOVEMENT_MAP = "stockMovementMap"; + public static final String PRE_ORG_FROM_ID = "preOrgFromId"; + public static final int SALES_TYPE = 1; + public static final int STOCK_TYPE = 2; + public static final String STOCK_SALES_REPORT_ORGS = "stockSalesReportOrgs"; + public static final String MONTHLY_SALES_REPORT_DATA = "monthlySalesReportData"; + public static final String DETAILED_SALES_REPORT_PER_PRODUCT = "detailedSalesReportPerProduct"; + public static final String DETAILED_GRN_REPORT_PER_PRODUCT = "detailedGRNReportPerProduct"; + public static final String STOCK_ADJUSTMENTS_REPORT_DATA = "stockAdjustmentsReportData"; + public static final String INVENTORY_MOVE_HISTORY = "viewInventoryMoveHistory"; + public static final String LIST_PRICE_LISTS = "list.price.lists"; + public static final String CREATE_PRICE_LIST = "create.price.list"; + public static final String PRODUCT_PRICE_LISTS = "product.price.lists"; + public static final String PRICE_LIST_HEADERS = "price.list.headers"; + public static final String USER_PRICE_LISTS = "user.price.lists"; + public static final String REGISTER_USERS = "RegisterUser"; + public static final String USER_BEAN = "userBean"; + public static final String USER_PURCHASE_PRICE_LISTS = "user.purchase.price.lists"; + public static final String USER_SALES_PRICE_LISTS = "user.sales.price.lists"; + public static final String CONFIGURATION = "configuration"; + public static final String WEB_COMPONENTS = "web.components"; + public static final String REPORT_DESCRIPTION = "report.description"; + public static final String PROCESS_ID = "process.id"; + public static final String IMPORT_FAIL_CSV_FILE = "import.fail.csv.file"; + + public static final String CURRENCY_LIST = "currencyList"; + public static final String CURRENCY = "currency"; + public static final String IS_FROM_DELETE_PRODUCT_PRICE = "is.from.delete.product.price"; + public static final String REPORT_COMMENT = "report.comment"; + public static final String SHOPPING_CART_TOTAL = "shoppingcartTotal"; + public static final String SHOPPING_CART_DISCOUNTED_TOTAL = "shoppingcartDiscountedTotal"; + public static final String SHOPPING_CART_DISCOUNT_PERCENTAGE = "shoppingcartDiscountPercentage"; + public static final String BPARTNER_ID = "bpartner.id"; + public static final String BPARTNER_NAME = "bpartner.name"; + public static final String BPARTNER_CREDIT = "bpartner.credit"; + public static final String ORDER_PRICE_LIST = "order.price.list"; + public static final String IS_SOTRX = "isSOTrx"; + + public static final String ACCESSIBLE_BANKACCOUNTS = "accessible.bankaccounts"; + public static final String ACCESSIBLE_CASHBOOKS = "accessible.cashbooks"; + public static final String CASHBOOKS = "cashbooks"; + public static final String TERMINALS = "terminals"; + public static final String TERMINAL_TRANSFER_TYPE = "terminalTransferType"; + public static final String DISPLAYTAG_TABLE_ID = "displayTagTableId"; + public static final String ORDER_PAYMENT = "orderPayment"; + public static final String ORDER_WRITE_OFF = "orderWriteOff"; + public static final String ORDER_DICOUNT = "orderDiscount"; + public static final String ORDER_CARD_AMOUNT = MPayment.TENDERTYPE_CreditCard; + public static final String ORDER_CHECK_AMOUNT = MPayment.TENDERTYPE_Check; + public static final String ORDER_CASH_AMOUNT = "cashAmount"; + public static final String DISCOUNT_ON_ORDER_TOTAL = "discountOnOrderTotal"; + public static final String DISCOUNT_ON_ORDER_TOTAL_PERCENT = "discountOnOrderTotalPercent"; + + public static final String CREDITORS = "creditors"; + //public static final String DEBTORS = ""; + public static final String CREDITOR_HISTORY = "creditorHistory"; + public static final String DEBTOR_HISTORY = "debtorHistory"; +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/TangoColors.java b/posterita/posterita/src/main/org/posterita/TangoColors.java new file mode 100644 index 0000000000..fbf1dbc018 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/TangoColors.java @@ -0,0 +1,37 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita; + +/** + * @author servansingh + * May 29, 2008 + */ +public class TangoColors +{ + public static final String ALUMINIUM_1 = "#EEEEEC"; + public static final String ALUMINIUM_2 = "#D3D7CF"; + public static final String BLUE_1 = "#D1E0EF"; + public static final String BLUE_2 = "#98B9DC"; + public static final String GREEN_1 = "#DAF5BC"; + public static final String GREEN_2 = "#ABEA6C"; + public static final String PLUM_1 = "#E9DDE8"; + public static final String PLUM_2 = "#CBAEC9"; + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AddressBean.java b/posterita/posterita/src/main/org/posterita/beans/AddressBean.java new file mode 100644 index 0000000000..d552782ef7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AddressBean.java @@ -0,0 +1,157 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.beans; + +import org.posterita.beans.UDIBean; + +public class AddressBean extends UDIBean +{ + + public Integer getBpartnerId() + { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + public String getAddress1() + { + return address1; + } + + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public String getAddress2() + { + return address2; + } + public void setAddress2(String address2) + { + this.address2 = address2; + } + + public Boolean getBillTo() + { + return billTo; + } + + public void setBillTo(Boolean billTo) + { + this.billTo = billTo; + } + public String getCity() + { + return city; + } + + public void setCity(String city) + { + this.city = city; + } + + public Integer getCountryId() + { + return countryId; + } + public void setCountryId(Integer countryId) + { + this.countryId = countryId; + } + + public String getPostalAddress() + { + return postalAddress; + } + + public void setPostalAddress(String postalAddress) + { + this.postalAddress = postalAddress; + } + + public Boolean getShipTo() + { + return shipTo; + } + + public void setShipTo(Boolean shipTo) + { + this.shipTo = shipTo; + } + + public String getCountryName() + { + return countryName; + } + + public void setCountryName(String countryName) + { + this.countryName = countryName; + } + + public String getUserSurname() + { + return userSurname; + } + + public void setUserSurname(String userSurname) + { + this.userSurname = userSurname; + } + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + + public String getCountryCode() + { + return countryCode; + } + + public void setCountryCode(String countryCode) + { + this.countryCode = countryCode; + } + + public Integer getRegionId() + { + return regionId; + } + + public void setRegionId(Integer regionId) + { + this.regionId = regionId; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AgingBean.java b/posterita/posterita/src/main/org/posterita/beans/AgingBean.java new file mode 100644 index 0000000000..637a2e95ea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AgingBean.java @@ -0,0 +1,232 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 17, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + + +public class AgingBean extends UDIBean +{ + + public Integer getCurrencyId() + { + return currencyId; + } + + public void setCurrencyId(Integer currencyId) + { + this.currencyId = currencyId; + } + + public BigDecimal getDue0() + { + return due0; + } + + public void setDue0(BigDecimal due0) + { + this.due0 = due0; + } + + public BigDecimal getDue0_30() + { + return due0_30; + } + + public void setDue0_30(BigDecimal due0_30) + { + this.due0_30 = due0_30; + } + + public BigDecimal getDue1_7() + { + return due1_7; + } + + public void setDue1_7(BigDecimal due1_7) + { + this.due1_7 = due1_7; + } + + public BigDecimal getDue31_60() + { + return due31_60; + } + + public void setDue31_60(BigDecimal due31_60) + { + this.due31_60 = due31_60; + } + + public BigDecimal getDue61_90() + { + return due61_90; + } + + public void setDue61_90(BigDecimal due61_90) + { + this.due61_90 = due61_90; + } + + public BigDecimal getDue8_30() + { + return due8_30; + } + + public void setDue8_30(BigDecimal due8_30) + { + this.due8_30 = due8_30; + } + + public BigDecimal getDue91_PLUS() + { + return due91_PLUS; + } + + public void setDue91_PLUS(BigDecimal due91_PLUS) + { + this.due91_PLUS = due91_PLUS; + } + + public BigDecimal getDueAmt() + { + return dueAmt; + } + + public void setDueAmt(BigDecimal dueAmt) + { + this.dueAmt = dueAmt; + } + + public Timestamp getDueDate() + { + return dueDate; + } + + public void setDueDate(Timestamp dueDate) + { + this.dueDate = dueDate; + } + + public BigDecimal getInvoicedAmt() + { + return invoicedAmt; + } + + public void setInvoicedAmt(BigDecimal invoicedAmt) + { + this.invoicedAmt = invoicedAmt; + } + + public Integer getInvoiceId() + { + return invoiceId; + } + + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + + public BigDecimal getOpenAmt() + { + return openAmt; + } + + public void setOpenAmt(BigDecimal openAmt) + { + this.openAmt = openAmt; + } + + public BigDecimal getPastDue1_30() + { + return pastDue1_30; + } + + public void setPastDue1_30(BigDecimal pastDue1_30) + { + this.pastDue1_30 = pastDue1_30; + } + + public BigDecimal getPastDue1_7() + { + return pastDue1_7; + } + + public void setPastDue1_7(BigDecimal pastDue1_7) + { + this.pastDue1_7 = pastDue1_7; + } + + public BigDecimal getPastDue31_60() + { + return pastDue31_60; + } + + public void setPastDue31_60(BigDecimal pastDue31_60) + { + this.pastDue31_60 = pastDue31_60; + } + + public BigDecimal getPastDue61_90() + { + return pastDue61_90; + } + + public void setPastDue61_90(BigDecimal pastDue61_90) + { + this.pastDue61_90 = pastDue61_90; + } + + public BigDecimal getPastDue8_30() + { + return pastDue8_30; + } + + public void setPastDue8_30(BigDecimal pastDue8_30) + { + this.pastDue8_30 = pastDue8_30; + } + + public BigDecimal getPastDue91_plus() + { + return pastDue91_plus; + } + + public void setPastDue91_plus(BigDecimal pastDue91_plus) + { + this.pastDue91_plus = pastDue91_plus; + } + + public BigDecimal getPastDueAmt() + { + return pastDueAmt; + } + + public void setPastDueAmt(BigDecimal pastDueAmt) + { + this.pastDueAmt = pastDueAmt; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ApplicationParametersBean.java b/posterita/posterita/src/main/org/posterita/beans/ApplicationParametersBean.java new file mode 100644 index 0000000000..5951222de0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ApplicationParametersBean.java @@ -0,0 +1,54 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * */ +package org.posterita.beans; + + +public class ApplicationParametersBean extends UDIBean +{ + public String getApplicationName() + { + return applicationName; + } + + public void setApplicationName(String applicationName) + { + this.applicationName = applicationName; + } + + public String getApplicationWebContext() + { + return applicationWebContext; + } + + public void setApplicationWebContext(String applicationWebContext) + { + this.applicationWebContext = applicationWebContext; + } + + public Integer getStoreId() + { + return storeId; + } + + public void setStoreId(Integer storeId) + { + this.storeId = storeId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AttachmentBean.java b/posterita/posterita/src/main/org/posterita/beans/AttachmentBean.java new file mode 100644 index 0000000000..e888a7b19e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AttachmentBean.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ +package org.posterita.beans; + + +public class AttachmentBean extends UDIBean +{ + public String getLogoName() + { + return logoName; + } + public void setLogoName(String logoName) + { + this.logoName = logoName; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AttributeBean.java b/posterita/posterita/src/main/org/posterita/beans/AttributeBean.java new file mode 100644 index 0000000000..ee17bc3ac9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AttributeBean.java @@ -0,0 +1,227 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 15, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + + +public class AttributeBean extends UDIBean +{ + public BigDecimal getUnitPrice() + { + return unitPrice; + } + + public void setUnitPrice(BigDecimal unitPrice) + { + this.unitPrice = unitPrice; + } + + public BigDecimal getPrice() + { + return price; + } + + public void setPrice(BigDecimal price) + { + this.price = price; + } + + public String getBarCode() + { + return barCode; + } + + public void setBarCode(String barCode) + { + this.barCode = barCode; + } + + public Integer[] getProductIds() + { + return productIds; + } + + public void setProductIds(Integer[] productIds) + { + this.productIds = productIds; + } + + public String getQtyNumberFilter() + { + return qtyNumberFilter; + } + + public void setQtyNumberFilter(String qtyNumberFilter) + { + this.qtyNumberFilter = qtyNumberFilter; + } + + public String getQtyFilter() + { + return qtyFilter; + } + + public void setQtyFilter(String qtyFilter) + { + this.qtyFilter = qtyFilter; + } + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public Integer getProductId() + { + return productId; + } + public void setProductId(Integer productId) { + this.productId = productId; + } + + public String getProductName() + { + return productName; + } + + public void setProductName(String productName) + { + this.productName = productName; + } + + public BigDecimal getQuantity() + { + return quantity; + } + + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public Integer getAttributeValueId() + { + return attributeValueId; + } + + public void setAttributeValueId(Integer attributeValueId) + { + this.attributeValueId = attributeValueId; + } + + public String getAttributeValue() + { + return attributeValue; + } + + public void setAttributeValue(String attributeValue) + { + this.attributeValue = attributeValue; + } + + public String getAttributeName() + { + return attributeName; + } + + public void setAttributeName(String attributeName) + { + this.attributeName = attributeName; + } + + public Integer getAttributeId() + { + return attributeId; + } + + public void setAttributeId(Integer attributeId) + { + this.attributeId = attributeId; + } + + public Integer getAttributeSetId() + { + return attributeSetId; + } + + public void setAttributeSetId(Integer attributeSetId) + { + this.attributeSetId = attributeSetId; + } + + public String getAttributeSetName() + { + return attributeSetName; + } + + public void setAttributeSetName(String attributeSetName) + { + this.attributeSetName = attributeSetName; + } + + public ArrayList getAttributeValueList() + { + return attributeValueList; + } + + public void setAttributeValueList(ArrayList attributeValueList) + { + this.attributeValueList = attributeValueList; + } + + public String[] getAttributeValueIds() + { + return attributeValueIds; + } + + public void setAttributeValueIds(String[] attributeValueIds) + { + this.attributeValueIds = attributeValueIds; + } + public void setUom(String uom) + { + this.uom = uom; + } + public String getUom() + { + return this.uom; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AttributeInstanceBean.java b/posterita/posterita/src/main/org/posterita/beans/AttributeInstanceBean.java new file mode 100644 index 0000000000..5e435055a3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AttributeInstanceBean.java @@ -0,0 +1,93 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + + +public class AttributeInstanceBean +{ + private int attributeSetInstanceId; + private int attributeId; + private String attributeValue; + private String attribute; + private int attributeValueId; + + + public int getAttributeId() + { + + return attributeId; + } + + public void setAttributeId(int attributeId) + { + this.attributeId = attributeId; + } + + public int getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(int attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public String getAttribute() + { + return attribute; + } + + public void setAttribute(String attribute) + { + this.attribute = attribute; + } + + public String getAttributeValue() + { + return attributeValue; + } + public void setAttributeValue(String attributeValue) + { + this.attributeValue = attributeValue; + } + public int getAttributeValueId() + { + return attributeValueId; + } + + public void setAttributeValueId(int attributeValueId) + { + this.attributeValueId = attributeValueId; + } + + public boolean equals(Object o) + { + if (o == null) + return false; + + AttributeInstanceBean bean = (AttributeInstanceBean) o; + + if (bean.getAttributeSetInstanceId() == this.getAttributeSetInstanceId()) + return true; + + return false; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AttributeValueDetailBean.java b/posterita/posterita/src/main/org/posterita/beans/AttributeValueDetailBean.java new file mode 100644 index 0000000000..b3286e7663 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AttributeValueDetailBean.java @@ -0,0 +1,95 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Feb 3, 2006 by praveen + * + */ +package org.posterita.beans; + +public class AttributeValueDetailBean extends UDIBean +{ + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer id) + { + this.id = id; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public Boolean getIsActive() + { + return isActive; + } + + public void setActive(Boolean isActive) + { + this.isActive = isActive; + } + + public Integer getAttributeId() + { + return attributeId; + } + + public void setAttributeId(Integer attributeId) + { + this.attributeId = attributeId; + } + + public Integer getAttributeValueId() + { + return attributeValueId; + } + + public void setAttributeValueId(Integer attributeValueId) + { + this.attributeValueId = attributeValueId; + } + + public String getNewName() + { + return newName; + } + + public void setNewName(String newName) + { + this.newName = newName; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AttributeValuesBean.java b/posterita/posterita/src/main/org/posterita/beans/AttributeValuesBean.java new file mode 100644 index 0000000000..82293a4373 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AttributeValuesBean.java @@ -0,0 +1,155 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + + +import java.util.ArrayList; + +import org.compiere.util.KeyNamePair; + +public class AttributeValuesBean extends UDIBean +{ + private ArrayList brand = new ArrayList(); + private ArrayList model = new ArrayList(); + private ArrayList design = new ArrayList(); + private ArrayList colour = new ArrayList(); + private ArrayList size = new ArrayList(); + private ArrayList trx = new ArrayList(); + private ArrayList years = new ArrayList(); + private ArrayList ETAList = new ArrayList(); + private ArrayList make = new ArrayList(); + private ArrayList modelGroup = new ArrayList(); + + public void setAttributeId(Integer attributeId) + { + this.attributeId = attributeId; + } + + public Integer getAttributeSetId() + { + return attributeSetId; + } + + public ArrayList getAttributeSet() + { + return attributeSet; + } + public void setAttributeSet(ArrayList attributeSet) + { + this.attributeSet = attributeSet; + } + private ArrayList attributeSet; + + public ArrayList getColour() + { + return colour; + } + + public void setColour(ArrayList colour) + { + this.colour = colour; + } + + public ArrayList getModel() + { + return model; + } + + public void setModel(ArrayList model) + { + this.model = model; + } + + public ArrayList getTrx() + { + return trx; + } + + public void setTrx(ArrayList trx) + { + this.trx = trx; + } + + public ArrayList getYears() + { + return years; + } + + public void setYears(ArrayList years) + { + this.years = years; + } + + public ArrayList getMake() + { + return make; + } + + public void setMake(ArrayList make) + { + this.make = make; + } + + public ArrayList getModelGroup() + { + return modelGroup; + } + + public void setModelGroup(ArrayList modelGroup) + { + this.modelGroup = modelGroup; + } + + public ArrayList getETAList() + { + return ETAList; + } + + public void setETAList(ArrayList list) + { + ETAList = list; + } + + public ArrayList getBrand() { + return brand; + } + + public void setBrand(ArrayList brand) { + this.brand = brand; + } + + public ArrayList getDesign() { + return design; + } + + public void setDesign(ArrayList design) { + this.design = design; + } + + public ArrayList getSize() { + return size; + } + + public void setSize(ArrayList size) { + this.size = size; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AttributeValuesPair.java b/posterita/posterita/src/main/org/posterita/beans/AttributeValuesPair.java new file mode 100644 index 0000000000..5af78d5c87 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AttributeValuesPair.java @@ -0,0 +1,139 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + +import org.compiere.util.KeyNamePair; + + +public class AttributeValuesPair +{ + private KeyNamePair makeAttributeValue; + private KeyNamePair modelAttributeValue; + private KeyNamePair modelGroupAttributeValue; + private KeyNamePair colourAttributeValue; + private KeyNamePair transmissionAttributeValue; + private KeyNamePair yearAttributeValue; + private KeyNamePair styleAttributeValue; + private KeyNamePair sizeAttributeValue; + private KeyNamePair designAttributeValue; + private KeyNamePair brandAttributeValue; + + + public KeyNamePair getBrandAttributeValue() + { + return brandAttributeValue; + } + + public void setBrandAttributeValue(KeyNamePair brandAttributeValue) + { + this.brandAttributeValue = brandAttributeValue; + } + + public KeyNamePair getColourAttributeValue() + { + return colourAttributeValue; + } + + public void setColourAttributeValue(KeyNamePair colourAttributeValue) + { + this.colourAttributeValue = colourAttributeValue; + } + + public KeyNamePair getModelAttributeValue() + { + return modelAttributeValue; + } + + public void setModelAttributeValue(KeyNamePair modelAttributeValue) + { + this.modelAttributeValue = modelAttributeValue; + } + + + public KeyNamePair getTransmissionAttributeValue() + { + return transmissionAttributeValue; + } + + public void setTransmissionAttributeValue(KeyNamePair transmissionAttributeValue) + { + this.transmissionAttributeValue = transmissionAttributeValue; + } + + public KeyNamePair getYearAttributeValue() + { + return yearAttributeValue; + } + + public void setYearAttributeValue(KeyNamePair yearAttributeValue) + { + this.yearAttributeValue = yearAttributeValue; + } + + public KeyNamePair getMakeAttributeValue() + { + return makeAttributeValue; + } + + public void setMakeAttributeValue(KeyNamePair makeAttributeValue) + { + this.makeAttributeValue = makeAttributeValue; + } + + public KeyNamePair getModelGroupAttributeValue() + { + return modelGroupAttributeValue; + } + + public void setModelGroupAttributeValue(KeyNamePair modelGroupAttributeValue) + { + this.modelGroupAttributeValue = modelGroupAttributeValue; + } + + public KeyNamePair getDesignAttributeValue() + { + return designAttributeValue; + } + + public void setDesignAttributeValue(KeyNamePair designAttributeValue) + { + this.designAttributeValue = designAttributeValue; + } + + public KeyNamePair getSizeAttributeValue() + { + return sizeAttributeValue; + } + + public void setSizeAttributeValue(KeyNamePair sizeAttributeValue) + { + this.sizeAttributeValue = sizeAttributeValue; + } + + public KeyNamePair getStyleAttributeValue() + { + return styleAttributeValue; + } + + public void setStyleAttributeValue(KeyNamePair styleAttributeValue) + { + this.styleAttributeValue = styleAttributeValue; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/AvailableProductSizeBean.java b/posterita/posterita/src/main/org/posterita/beans/AvailableProductSizeBean.java new file mode 100644 index 0000000000..812291f8bd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/AvailableProductSizeBean.java @@ -0,0 +1,69 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ +package org.posterita.beans; + + +public class AvailableProductSizeBean extends UDIBean +{ + private Boolean existsInSmall = Boolean.valueOf(false); + private Boolean existsInMedium = Boolean.valueOf(false); + private Boolean existsInLarge = Boolean.valueOf(false); + private Boolean existsInXLarge = Boolean.valueOf(false); + + public Boolean getExistsInLarge() + { + return existsInLarge; + } + + public void setExistsInLarge(Boolean existsInLarge) + { + this.existsInLarge = existsInLarge; + } + + public Boolean getExistsInMedium() + { + return existsInMedium; + } + + public void setExistsInMedium(Boolean existsInMedium) + { + this.existsInMedium = existsInMedium; + } + + public Boolean getExistsInSmall() + { + return existsInSmall; + } + + public void setExistsInSmall(Boolean existsInSmall) + { + this.existsInSmall = existsInSmall; + } + + public Boolean getExistsInXLarge() + { + return existsInXLarge; + } + + public void setExistsInXLarge(Boolean existsInXLarge) + { + this.existsInXLarge = existsInXLarge; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/BPartnerBean.java b/posterita/posterita/src/main/org/posterita/beans/BPartnerBean.java new file mode 100644 index 0000000000..5a9fcc9542 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/BPartnerBean.java @@ -0,0 +1,256 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ +package org.posterita.beans; + +import java.math.BigDecimal; + +public class BPartnerBean +{ + protected String postalCode; + protected Integer orgId; + protected String countryName; + protected Integer countryId; + protected String name2; + protected Integer bpartnerId; + protected String partnerName; + protected Boolean isCustomer; + protected Boolean isEmployee; + protected Boolean isSalesRep; + protected Boolean isVendor; + protected String phone; + protected String address1; + protected String city; + protected String postalAddress; + protected Integer regionId; + protected Boolean isActive; + protected Integer locationId; + protected String address2; + protected String fax; + protected BigDecimal openBalance; + protected BigDecimal actualLifetimeValue; + protected BigDecimal creditLimit; + protected BigDecimal creditUsed; + + public String getPostalCode() + { + return postalCode; + } + + public void setPostalCode(String postalCode) + { + this.postalCode = postalCode; + } + + public Integer getOrgId() { + return orgId; + } + + public void setOrgId(Integer orgId) { + this.orgId = orgId; + } + + public String getCountryName() + { + return countryName; + } + + public void setCountryName(String countryName) + { + this.countryName = countryName; + } + + public Integer getCountryId() + { + return countryId; + } + + public void setCountryId(Integer countryId) + { + this.countryId = countryId; + } + + public String getName2() + { + return name2; + } + public void setName2(String name2) + { + this.name2 = name2; + } + public Integer getBpartnerId() + { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + public String getPartnerName() + { + return partnerName; + } + public void setPartnerName(String partnerName) + { + this.partnerName = partnerName; + } + public Boolean getIsCustomer() + { + return isCustomer; + } + public void setIsCustomer(Boolean isCustomer) + { + this.isCustomer = isCustomer; + } + public Boolean getIsEmployee() + { + return isEmployee; + } + public void setIsEmployee(Boolean isEmployee) + { + this.isEmployee = isEmployee; + } + public Boolean getIsSalesRep() + { + return isSalesRep; + } + public void setIsSalesRep(Boolean isSalesRep) + { + this.isSalesRep = isSalesRep; + } + public Boolean getIsVendor() + { + return isVendor; + } + public void setIsVendor(Boolean isVendor) + { + this.isVendor = isVendor; + } + public String getPhone() + { + return phone; + } + public void setPhone(String phone) + { + this.phone = phone; + } + + public String getAddress1() + { + return address1; + } + public void setAddress1(String address1) + { + this.address1 = address1; + } + public String getCity() + { + return city; + } + public void setCity(String city) + { + this.city = city; + } + + public String getPostalAddress() + { + return postalAddress; + } + public void setPostalAddress(String postalAddress) + { + this.postalAddress = postalAddress; + } + + public Integer getRegionId() + { + return regionId; + } + public void setRegionId(Integer regionId) + { + this.regionId = regionId; + } + + public Boolean getIsActive() + { + return isActive; + } + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + public Integer getLocationId() + { + return locationId; + } + public void setLocationId(Integer locationId) + { + this.locationId = locationId; + } + public String getAddress2() + { + return address2; + } + public void setAddress2(String address2) + { + this.address2 = address2; + } + public String getFax() + { + return fax; + } + public void setFax(String fax) + { + this.fax = fax; + } + + public BigDecimal getOpenBalance() { + return openBalance; + } + + public void setOpenBalance(BigDecimal openBalance) { + this.openBalance = openBalance; + } + + public BigDecimal getActualLifetimeValue() { + return actualLifetimeValue; + } + + public void setActualLifetimeValue(BigDecimal actualLifetimeValue) { + this.actualLifetimeValue = actualLifetimeValue; + } + + public BigDecimal getCreditLimit() { + return creditLimit; + } + + public void setCreditLimit(BigDecimal creditLimit) { + this.creditLimit = creditLimit; + } + + public BigDecimal getCreditUsed() { + return creditUsed; + } + + public void setCreditUsed(BigDecimal creditUsed) { + this.creditUsed = creditUsed; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/BPartnerInfoBean.java b/posterita/posterita/src/main/org/posterita/beans/BPartnerInfoBean.java new file mode 100644 index 0000000000..3cdc47da78 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/BPartnerInfoBean.java @@ -0,0 +1,264 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 26, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class BPartnerInfoBean extends UDIBean +{ + + protected String soCreditStatus; + protected String forward; + + public String getForward() + { + return forward; + } + + public void setForward(String forward) + { + this.forward = forward; + } + + public String getBpfirstSale() + { + return bpfirstSale; + } + + public void setBpfirstSale(String bpfirstSale) + { + this.bpfirstSale = bpfirstSale; + } + + public String getSoCreditStatus() + { + return soCreditStatus; + } + + public void setSoCreditStatus(String soCreditStatus) + { + this.soCreditStatus = soCreditStatus; + } + + public Integer getDunningId() + { + return dunningId; + } + + public void setDunningId(Integer dunningId) + { + this.dunningId = dunningId; + } + + public Integer[] getBpartnerIds() + { + return bpartnerIds; + } + + public void setBpartnerIds(Integer[] bpartnerIds) + { + this.bpartnerIds = bpartnerIds; + } + + public BigDecimal getCreditLimit() + { + return creditLimit; + } + + public void setCreditLimit(BigDecimal creditLimit) + { + this.creditLimit = creditLimit; + } + + public BigDecimal getCreditUsed() + { + return creditUsed; + } + + public void setCreditUsed(BigDecimal creditUsed) + { + this.creditUsed = creditUsed; + } + + public BigDecimal getOpenAmt() + { + return openAmt; + } + + public void setOpenAmt(BigDecimal openAmt) + { + this.openAmt = openAmt; + } + + public BigDecimal getRevenue() + { + return revenue; + } + + public void setRevenue(BigDecimal revenue) + { + this.revenue = revenue; + } + + public BigDecimal getAmount() + { + return amount; + } + + public void setAmount(BigDecimal amount) + { + this.amount = amount; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public String getProductName() + { + return productName; + } + + public void setProductName(String productName) + { + this.productName = productName; + } + + public String getAddress1() + { + return address1; + } + + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public String getAddress2() + { + return address2; + } + + public void setAddress2(String address2) + { + this.address2 = address2; + } + + public String getCity() + { + return city; + } + + public void setCity(String city) + { + this.city = city; + } + + public Boolean getIsCustomer() + { + return isCustomer; + } + + public void setIsCustomer(Boolean isCustomer) + { + this.isCustomer = isCustomer; + } + + public Integer getBpartnerId() + { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getFax() + { + return fax; + } + + public void setFax(String fax) + { + this.fax = fax; + } + + public String getPartnerName() + { + return partnerName; + } + + public void setPartnerName(String partnerName) + { + this.partnerName = partnerName; + } + + public String getPhone2() + { + return phone2; + } + + public void setPhone2(String phone2) + { + this.phone2 = phone2; + } + + public String getPhone() + { + return phone; + } + + public void setPhone(String phone) + { + this.phone = phone; + } + + public BigDecimal getQuantity() + { + return quantity; + } + + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/BankAccountBean.java b/posterita/posterita/src/main/org/posterita/beans/BankAccountBean.java new file mode 100644 index 0000000000..30d004557e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/BankAccountBean.java @@ -0,0 +1,96 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 26, 2005 by praveen + * + */ +package org.posterita.beans; + +public class BankAccountBean extends UDIBean +{ + public String getAccountNo() + { + return accountNo; + } + + public void setAccountNo(String accountNo) + { + this.accountNo = accountNo; + } + + public String getAccountType() + { + return accountType; + } + + public void setAccountType(String accountType) + { + this.accountType = accountType; + } + + public Integer getBankId() + { + return bankId; + } + + public void setBankId(Integer bankId) + { + this.bankId = bankId; + } + + public Double getCurrentBalance() + { + return currentBalance; + } + + public void setCurrentBalance(Double currentBalance) + { + this.currentBalance = currentBalance; + } + + public String getBankName() + { + return bankName; + } + + public void setBankName(String bankName) + { + this.bankName = bankName; + } + + public String getSummary() + { + return bankName + " - " + accountNo; + } + + /** + * @return the bankAccountId + */ + public Integer getBankAccountId() + { + return bankAccountId; + } + + /** + * @param bankAccountId the bankAccountId to set + */ + public void setBankAccountId(Integer bankAccountId) + { + this.bankAccountId = bankAccountId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/BankBean.java b/posterita/posterita/src/main/org/posterita/beans/BankBean.java new file mode 100644 index 0000000000..127791ac04 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/BankBean.java @@ -0,0 +1,84 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Jul-2005 by alok + * + */ +package org.posterita.beans; + + +public class BankBean extends UDIBean +{ + public String getAddress1() + { + return address1; + } + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public Integer getBankId() + { + return bankId; + } + public void setBankId(Integer bankId) + { + this.bankId = bankId; + } + public String getBankName() + { + return bankName; + } + public void setBankName(String bankName) + { + this.bankName = bankName; + } + public String getCity() + { + return city; + } + public void setCity(String city) + { + this.city = city; + } + public String getPostalAddress() + { + return postalAddress; + } + public void setPostalAddress(String postalAddress) + { + this.postalAddress = postalAddress; + } + public String getRoutingNumber() + { + return routingNumber; + } + public void setRoutingNumber(String routingNumber) + { + this.routingNumber = routingNumber; + } + public Integer getLocationId() + { + return locationId; + } + public void setLocationId(Integer locationId) + { + this.locationId = locationId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/BankStatementLineBean.java b/posterita/posterita/src/main/org/posterita/beans/BankStatementLineBean.java new file mode 100644 index 0000000000..11b0769599 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/BankStatementLineBean.java @@ -0,0 +1,114 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + + +public class BankStatementLineBean +{ + private Timestamp dateTrx; + private String documentNo; + private int paymentId; + private int currencyId; + private String isoCode; + private BigDecimal payAmt; + private BigDecimal currencyConvert; + private String bpName; + + + public String getBpName() + { + return bpName; + } + + public void setBpName(String bpName) + { + this.bpName = bpName; + } + + public BigDecimal getCurrencyConvert() + { + return currencyConvert; + } + + public void setCurrencyConvert(BigDecimal currencyConvert) + { + this.currencyConvert = currencyConvert; + } + + public int getCurrencyId() + { + return currencyId; + } + + public void setCurrencyId(int currencyId) + { + this.currencyId = currencyId; + } + public Timestamp getDateTrx() + { + return dateTrx; + } + + public void setDateTrx(Timestamp dateTrx) + { + this.dateTrx = dateTrx; + } + + public String getDocumentNo() + { + return documentNo; + } + + public void setDocumentNo(String documentNo) { + this.documentNo = documentNo; + } + + public String getIsoCode() + { + return isoCode; + } + + + public void setIsoCode(String isoCode) + { + this.isoCode = isoCode; + } + public BigDecimal getPayAmt() { + return payAmt; + } + + public void setPayAmt(BigDecimal payAmt) + { + this.payAmt = payAmt; + } + + public int getPaymentId() + { + return paymentId; + } + + public void setPaymentId(int paymentId) + { + this.paymentId = paymentId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/BlackListedBean.java b/posterita/posterita/src/main/org/posterita/beans/BlackListedBean.java new file mode 100644 index 0000000000..71a2b0c169 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/BlackListedBean.java @@ -0,0 +1,53 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ +package org.posterita.beans; + +public class BlackListedBean extends UDIBean +{ + + public String getBlackListedBankName() + { + return blackListedBankName; + } + public void setBlackListedBankName(String blackListedBankName) + { + this.blackListedBankName = blackListedBankName; + } + public String getBlackListedChequeNo() + { + return blackListedChequeNo; + } + public void setBlackListedChequeNo(String blackListedChequeNo) + { + this.blackListedChequeNo = blackListedChequeNo; + } + public Integer getBlackListedId() + { + return blackListedId; + } + public void setBlackListedId(Integer blackListedId) + { + this.blackListedId = blackListedId; + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CashBean.java b/posterita/posterita/src/main/org/posterita/beans/CashBean.java new file mode 100644 index 0000000000..f1cd43f794 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CashBean.java @@ -0,0 +1,141 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 3, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + + +public class CashBean extends UDIBean +{ + + public Integer getCashId() + { + return cashId; + } + public void setCashId(Integer cashId) + { + this.cashId = cashId; + } + public Timestamp getDateAcct() + { + return dateAcct; + } + public void setDateAcct(Timestamp dateAcct) + { + this.dateAcct = dateAcct; + } + public Timestamp getDateCreated() + { + return dateCreated; + } + public void setDateCreated(Timestamp dateCreated) + { + this.dateCreated = dateCreated; + } + public Timestamp getDateUpdated() + { + return dateUpdated; + } + public void setDateUpdated(Timestamp dateUpdated) + { + this.dateUpdated = dateUpdated; + } + public String getName() + { + return name; + } + public void setName(String name) + { + this.name = name; + } + public String getStatmentDate() + { + return statmentDate; + } + public void setStatmentDate(String statmentDate) + { + this.statmentDate = statmentDate; + } + public String getCashJournalDisc() + { + return cashJournalDisc; + } + public void setCashJournalDisc(String cashJournalDisc) + { + this.cashJournalDisc = cashJournalDisc; + } + public Integer getCashJournalId() + { + return cashJournalId; + } + public void setCashJournalId(Integer cashJournalId) + { + this.cashJournalId = cashJournalId; + } + public String getCashJournalName() + { + return cashJournalName; + } + public void setCashJournalName(String cashJournalName) + { + this.cashJournalName = cashJournalName; + } + public BigDecimal getBeginingBalance() + { + return beginingBalance; + } + + public void setBeginingBalance(BigDecimal beginingBalance) + { + this.beginingBalance = beginingBalance; + } + + public BigDecimal getEndingBalance() + { + return endingBalance; + } + + public void setEndingBalance(BigDecimal endingBalance) + { + this.endingBalance = endingBalance; + } + public String getDocStatus() + { + return docStatus; + } + public void setDocStatus(String docStatus) + { + this.docStatus = docStatus; + } + public String toString() + { + StringBuffer buffer = new StringBuffer(); + buffer.append("\n The Begining Balance = "+getBeginingBalance()); + buffer.append("\n The Ending Balance = "+getEndingBalance()); + + return buffer.toString(); + } +} + diff --git a/posterita/posterita/src/main/org/posterita/beans/CashBookBean.java b/posterita/posterita/src/main/org/posterita/beans/CashBookBean.java new file mode 100644 index 0000000000..09034c35fe --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CashBookBean.java @@ -0,0 +1,155 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.beans; + +/** + * @author Ashley G Ramdass + * May 2, 2008 + */ +public class CashBookBean extends UDIBean +{ + /** + * @return the cashBookId + */ + public Integer getCashBookId() + { + return (cashBookId == null ? 0 : cashBookId); + } + + /** + * @param cashBookId the cashBookId to set + */ + public void setCashBookId(Integer cashBookId) + { + this.cashBookId = cashBookId; + } + + /** + * @return the cashBookName + */ + public String getCashBookName() + { + return cashBookName; + } + + /** + * @param cashBookName the cashBookName to set + */ + public void setCashBookName(String cashBookName) + { + this.cashBookName = cashBookName; + } + + /** + * @return the description + */ + public String getDescription() + { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) + { + this.description = description; + } + + /** + * @return the isActive + */ + public Boolean getIsActive() + { + return isActive; + } + + /** + * @param isActive the isActive to set + */ + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + /** + * @return the isDefault + */ + public Boolean getIsDefault() + { + return isDefault; + } + + /** + * @param isDefault the isDefault to set + */ + public void setIsDefault(Boolean isDefault) + { + this.isDefault = isDefault; + } + + /** + * @return the orgId + */ + public Integer getOrgId() + { + return orgId; + } + + /** + * @param orgId the orgId to set + */ + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + /** + * @return The currencyId + */ + public Integer getCurrencyId() + { + return (currencyId == null ? 0 : currencyId); + } + + /** + * @param currencyId The currencyId to set + */ + public void setCurrencyId(Integer currencyId) + { + this.currencyId = currencyId; + } + + /** + * @return The currency + */ + public String getCurrency() + { + return currency; + } + + /** + * @param currency The currency to set + */ + public void setCurrency(String currency) + { + this.currency = currency; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CashBookDetailBean.java b/posterita/posterita/src/main/org/posterita/beans/CashBookDetailBean.java new file mode 100644 index 0000000000..cf4b10ccce --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CashBookDetailBean.java @@ -0,0 +1,247 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 3, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + + +public class CashBookDetailBean extends UDIBean +{ + public String getTransferType() + { + return transferType; + } + + public void setTransferType(String transferType) + { + this.transferType = transferType; + } + + public BigDecimal getDifferenceAmt() + { + return differenceAmt; + } + + public void setDifferenceAmt(BigDecimal differenceAmt) + { + this.differenceAmt = differenceAmt; + } + + public BigDecimal getAdjustmentAmount() + { + return adjustmentAmount; + } + + public void setAdjustmentAmount(BigDecimal adjustmentAmount) + { + this.adjustmentAmount = adjustmentAmount; + } + + public Boolean getTransferAllAmount() + { + return transferAllAmount; + } + public void setTransferAllAmount(Boolean transferAllAmount) + { + this.transferAllAmount = transferAllAmount; + } + public String getBeginingBalanceAsString() + { + return beginingBalanceAsString; + } + public void setBeginingBalanceAsString(String beginingBalanceAsString) + { + this.beginingBalanceAsString = beginingBalanceAsString; + } + public String getEndingBalanceAsString() + { + return endingBalanceAsString; + } + public void setEndingBalanceAsString(String endingBalanceAsString) + { + this.endingBalanceAsString = endingBalanceAsString; + } + public BigDecimal getTransferAmount() + { + return transferAmount; + } + public void setTransferAmount(BigDecimal transferAmount) + { + this.transferAmount = transferAmount; + } + public Integer getCashJournalId() + { + return cashJournalId; + } + public void setCashJournalId(Integer cashJournalId) + { + this.cashJournalId = cashJournalId; + } + public Integer getCashBookId() + { + return cashBookId; + } + + public void setCashBookId(Integer cashBookId) + { + this.cashBookId = cashBookId; + } + public String getCashJournalName() + { + return cashJournalName; + } + public void setCashJournalName(String cashJournalName) + { + this.cashJournalName = cashJournalName; + } + public String getCashJournalDisc() + { + return cashJournalDisc; + } + public void setCashJournalDisc(String cashJournalDisc) + { + this.cashJournalDisc = cashJournalDisc; + } + public void setDateAcct(Timestamp dateAcct) + { + this.dateAcct = dateAcct; + } + public BigDecimal getBeginingBalance() + { + return beginingBalance; + } + + public void setBeginingBalance(BigDecimal beginingBalance) + { + this.beginingBalance = beginingBalance; + } + public BigDecimal getEndingBalance() + { + return endingBalance; + } + + public void setEndingBalance(BigDecimal endingBalance) + { + this.endingBalance = endingBalance; + } + public BigDecimal getStatementDifference() + { + return statementDifference; + } + + public void setStatementDifference(BigDecimal statementDifference) + { + this.statementDifference = statementDifference; + } + public String getDocStatus() { + return docStatus; + } + public void setDocStatus(String docStatus) { + this.docStatus = docStatus; + } + public String getCashBookName() + { + return cashBookName; + } + + public void setCashBookName(String cashBookName) + { + this.cashBookName = cashBookName; + } + + public BigDecimal getCardTotal() + { + return cardTotal; + } + + public void setCardTotal(BigDecimal cardTotal) + { + this.cardTotal=cardTotal; + } + + public BigDecimal getChequeTotal() + { + return chequeTotal; + } + + public void setChequeTotal(BigDecimal chequeTotal) + { + this.chequeTotal=chequeTotal; + } + + public BigDecimal getCardDifference() + { + return cardDifference; + } + public void setCardDifference(BigDecimal cardDifference) + { + this.cardDifference = cardDifference; + } + public BigDecimal getChequeDifference() + { + return chequeDifference; + } + public void setChequeDifference(BigDecimal chequeDifference) + { + this.chequeDifference = chequeDifference; + } + public String toString() + { + StringBuffer buffer = new StringBuffer(); + buffer.append("\n The Begining Balance = "+getBeginingBalance()); + buffer.append("\n The Ending Balance = "+getEndingBalance()); + + return buffer.toString(); + + } + + /** + * @return The description + */ + public String getDescription() + { + return description; + } + + /** + * @param description + * The description to set + */ + public void setDescription(String description) + { + this.description = description; + } + + private int cash_id; + + public int getCash_id() { + return cash_id; + } + + public void setCash_id(int cash_id) { + this.cash_id = cash_id; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CashLineBean.java b/posterita/posterita/src/main/org/posterita/beans/CashLineBean.java new file mode 100644 index 0000000000..21c41d9ced --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CashLineBean.java @@ -0,0 +1,130 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Sep 11, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +public class CashLineBean extends UDIBean +{ + public Integer getCashId() + { + return cashId; + } + + public void setCashId(Integer cashId) + { + this.cashId = cashId; + } + + public BigDecimal getAmount() + { + return amount; + } + + public void setAmount(BigDecimal amount) + { + this.amount = amount; + } + + public Integer getCashLineId() + { + return cashLineId; + } + + public void setCashLineId(Integer cashLineId) + { + this.cashLineId = cashLineId; + } + + public String getCashType() + { + return cashType; + } + + public void setCashType(String cashType) + { + this.cashType = cashType; + } + + public String getCurrency() + { + return currency; + } + + public void setCurrency(String currency) + { + this.currency = currency; + } + + public Timestamp getDateCreated() + { + return dateCreated; + } + + public void setDateCreated(Timestamp dateCreated) + { + this.dateCreated = dateCreated; + } + + public Integer getInvoiceId() + { + return invoiceId; + } + + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + + public String getCashTypeName() + { + return cashTypeName; + } + + public void setCashTypeName(String cashTypeName) + { + this.cashTypeName = cashTypeName; + } + + /** + * @return The description + */ + public String getDescription() + { + return description; + } + + /** + * @param description The description to set + */ + public void setDescription(String description) + { + this.description = description; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CashSummaryBean.java b/posterita/posterita/src/main/org/posterita/beans/CashSummaryBean.java new file mode 100644 index 0000000000..1384866487 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CashSummaryBean.java @@ -0,0 +1,148 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Sep 11, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +import org.compiere.util.Env; + +public class CashSummaryBean extends UDIBean +{ + public CashSummaryBean() + { + this.setBankAcctTransferAmount(Env.ZERO); + this.setChargeAmount(Env.ZERO); + this.setDifferenceAmount(Env.ZERO); + this.setGeneralExpenseAmount(Env.ZERO); + this.setGeneralReceiptsAmount(Env.ZERO); + this.setInvoiceAmount(Env.ZERO); + } + + public Integer getCashId() + { + return cashId; + } + + public void setCashId(Integer cashId) + { + this.cashId = cashId; + } + + public BigDecimal getBankAcctTransferAmount() + { + return bankAcctTransferAmount; + } + + public void setBankAcctTransferAmount(BigDecimal bankAcctTransferAmount) + { + this.bankAcctTransferAmount = bankAcctTransferAmount; + } + + public BigDecimal getChargeAmount() + { + return chargeAmount; + } + + public void setChargeAmount(BigDecimal chargeAmount) + { + this.chargeAmount = chargeAmount; + } + + public BigDecimal getDifferenceAmount() + { + return differenceAmount; + } + + public void setDifferenceAmount(BigDecimal differenceAmount) + { + this.differenceAmount = differenceAmount; + } + + public BigDecimal getGeneralExpenseAmount() + { + return generalExpenseAmount; + } + + public void setGeneralExpenseAmount(BigDecimal generalExpenseAmount) + { + this.generalExpenseAmount = generalExpenseAmount; + } + + public BigDecimal getGeneralReceiptsAmount() + { + return generalReceiptsAmount; + } + + public void setGeneralReceiptsAmount(BigDecimal generalReceiptsAmount) + { + this.generalReceiptsAmount = generalReceiptsAmount; + } + + public BigDecimal getInvoiceAmount() + { + return invoiceAmount; + } + + public void setInvoiceAmount(BigDecimal invoiceAmount) + { + this.invoiceAmount = invoiceAmount; + } + + /** + * @return The beginingBalance + */ + public BigDecimal getBeginingBalance() + { + return beginingBalance; + } + + /** + * @param beginingBalance The beginingBalance to set + */ + public void setBeginingBalance(BigDecimal beginingBalance) + { + this.beginingBalance = beginingBalance; + } + + /** + * @return The endingBalance + */ + public BigDecimal getEndingBalance() + { + return endingBalance; + } + + /** + * @param endingBalance The endingBalance to set + */ + public void setEndingBalance(BigDecimal endingBalance) + { + this.endingBalance = endingBalance; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ChangeDocumentStatusBean.java b/posterita/posterita/src/main/org/posterita/beans/ChangeDocumentStatusBean.java new file mode 100644 index 0000000000..1d049fbf32 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ChangeDocumentStatusBean.java @@ -0,0 +1,83 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + + +public class ChangeDocumentStatusBean extends DocumentBean +{ + + public String getTrackingNo() + { + return trackingNo; + } + public void setTrackingNo(String trackingNo) + { + this.trackingNo = trackingNo; + } + public Integer getAllocationId() + { + return allocationId; + } + public void setAllocationId(Integer allocationId) + { + this.allocationId = allocationId; + } + public String getPoReference() + { + return poReference; + } + + public void setPoReference(String poReference) + { + this.poReference = poReference; + } + + public void setAgreement(Boolean agreement) + { + this.agreement = agreement; + } + + public Boolean getAgreement() + { + return agreement; + } + + public String getSubmit() + { + return submit; + } + + public void setSubmit(String submit) + { + this.submit = submit; + } + + public Integer getTradeInOrderlineId() + { + return tradeInOrderlineId; + } + + public void setTradeInOrderlineId(Integer tradeInOrderlineId) + { + this.tradeInOrderlineId = tradeInOrderlineId; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ChangePasswordBean.java b/posterita/posterita/src/main/org/posterita/beans/ChangePasswordBean.java new file mode 100644 index 0000000000..747ae4b146 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ChangePasswordBean.java @@ -0,0 +1,64 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 29, 2005 by din + */ + +package org.posterita.beans; + +public class ChangePasswordBean extends UDIBean +{ + + public String getPassword() + { + return password; + } + public void setPassword(String password) + { + this.password = password; + } + + public String getNewPassword() + { + return newPassword; + } + public void setNewPassword(String newPassword) + { + this.newPassword = newPassword; + } + + public String getConfirmPassword() + { + return confirmPassword; + } + + public void setConfirmPassword(String confirmPassword) + { + this.confirmPassword = confirmPassword; + } + + public String getOldPassword() + { + return oldPassword; + } + public void setOldPassword(String oldPassword) + { + this.oldPassword = oldPassword; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CheckoutBean.java b/posterita/posterita/src/main/org/posterita/beans/CheckoutBean.java new file mode 100644 index 0000000000..4c27dbb4ed --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CheckoutBean.java @@ -0,0 +1,375 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Mar 21, 2008 10:31:54 AM by praveen + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +import org.compiere.model.MOrder; +import org.posterita.Constants; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; + +public class CheckoutBean +{ + private BigDecimal amountTendered; + private BigDecimal amountRefunded; + private String cardType; + private String cardNo; + private String chequeNo; + private BigDecimal cashAmt; + private BigDecimal chequeAmt; + private BigDecimal cardAmt; + private Integer bpartnerId; + private String tenderType; + private String paymentRule; + private BigDecimal discount[]; + private BigDecimal discountedPrice[]; + private Boolean[] isDiscOnInclUnitPrice; + private BigDecimal[] discInclUnitPrice; + private String orderType; + private BigDecimal discountLimit; + private Integer priceListId; + private Integer m_productId; + private Boolean toBeShipped; + private BigDecimal discountedTotal; + private Boolean discountOnTotal; + private Boolean discountOnTotalPercent; + private Boolean overridePriceLimit; + private Boolean isDiscountUptoLimitPrice; + private BigDecimal totalDiscount; + private BigDecimal writeOffAmt; + private BigDecimal discountAmt; + private BigDecimal totalAmount; + private Boolean isOverridePinOk; + private Boolean[] isDiscOnPerc; + private Boolean[] isDiscOnTotal; + private BigDecimal[] qtyPerLine; + private BigDecimal grandTotal; + protected Integer roleId; + + public BigDecimal[] getQtyPerLine() + { + return qtyPerLine; + } + public void setQtyPerLine(BigDecimal[] qtyPerLine) + { + this.qtyPerLine = qtyPerLine; + } + public Boolean[] getIsDiscOnPerc() + { + return isDiscOnPerc; + } + public void setIsDiscOnPerc(Boolean[] isDiscOnPerc) + { + this.isDiscOnPerc = isDiscOnPerc; + } + public Boolean[] getIsDiscOnTotal() + { + return isDiscOnTotal; + } + public void setIsDiscOnTotal(Boolean[] isDiscOnTotal) + { + this.isDiscOnTotal = isDiscOnTotal; + } + public Boolean getIsOverridePinOk() { + return isOverridePinOk; + } + public void setIsOverridePinOk(Boolean isOverridePinOk) { + this.isOverridePinOk = isOverridePinOk; + } + public BigDecimal getAmountTendered() { + return amountTendered; + } + public void setAmountTendered(BigDecimal amountTendered) { + this.amountTendered = amountTendered; + } + public String getCardNo() { + return cardNo; + } + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + public String getChequeNo() { + return chequeNo; + } + public void setChequeNo(String chequeNo) { + this.chequeNo = chequeNo; + } + public BigDecimal getCashAmt() { + return cashAmt; + } + public void setCashAmt(BigDecimal cashAmt) { + this.cashAmt = cashAmt; + } + public BigDecimal getChequeAmt() { + return chequeAmt; + } + public void setChequeAmt(BigDecimal chequeAmt) { + this.chequeAmt = chequeAmt; + } + public Integer getBpartnerId() { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + public String getTenderType() { + return tenderType; + } + public void setTenderType(String tenderType) throws OperationException { + this.tenderType = tenderType; + + //set payment rule + if(tenderType == null) return; + + if (Constants.PAYMENT_RULE_CASH.equalsIgnoreCase(tenderType)) + { + paymentRule=MOrder.PAYMENTRULE_Cash; + } + else if(Constants.PAYMENT_RULE_CARD.equalsIgnoreCase(tenderType)) + { + paymentRule=MOrder.PAYMENTRULE_CreditCard; + } + else if(Constants.PAYMENT_RULE_CHEQUE.equalsIgnoreCase(tenderType)) + { + paymentRule=MOrder.PAYMENTRULE_Check; + } + else if(Constants.PAYMENT_RULE_MIXED.equalsIgnoreCase(tenderType)) + { + paymentRule=UdiConstants.PAYMENTRULE_MIXED; + } + else if(Constants.PAYMENT_RULE_CREDIT.equalsIgnoreCase(tenderType)) + { + paymentRule=MOrder.PAYMENTRULE_OnCredit; + } + else + { + throw new OperationException("Invalid Payment Rule :" + tenderType); + } + } + public BigDecimal[] getDiscount() { + return discount; + } + public void setDiscount(BigDecimal[] discount) { + this.discount = discount; + } + public String getOrderType() { + return orderType; + } + public void setOrderType(String orderType) { + this.orderType = orderType; + } + public BigDecimal getDiscountLimit() { + return discountLimit; + } + public void setDiscountLimit(BigDecimal discountLimit) { + this.discountLimit = discountLimit; + } + public BigDecimal getAmountRefunded() { + return amountRefunded; + } + public void setAmountRefunded(BigDecimal amountRefunded) { + this.amountRefunded = amountRefunded; + } + public BigDecimal getCardAmt() { + return cardAmt; + } + public void setCardAmt(BigDecimal cardAmt) { + this.cardAmt = cardAmt; + } + public BigDecimal[] getDiscountedPrice() { + return discountedPrice; + } + public void setDiscountedPrice(BigDecimal[] discountedPrice) { + this.discountedPrice = discountedPrice; + } + public Integer getPriceListId() { + return priceListId; + } + public void setPriceListId(Integer priceListId) { + this.priceListId = priceListId; + } + public Boolean getToBeShipped() { + return toBeShipped; + } + public void setToBeShipped(Boolean toBeShipped) { + this.toBeShipped = toBeShipped; + } + public BigDecimal getDiscountedTotal() { + return discountedTotal; + } + public void setDiscountedTotal(BigDecimal discountedTotal) { + this.discountedTotal = discountedTotal; + } + public Boolean getDiscountOnTotal() { + return discountOnTotal; + } + public void setDiscountOnTotal(Boolean discountOnTotal) { + this.discountOnTotal = discountOnTotal; + } + public Boolean getOverridePriceLimit() { + return overridePriceLimit; + } + public void setOverridePriceLimit(Boolean overridePriceLimit) { + this.overridePriceLimit = overridePriceLimit; + } + public BigDecimal getTotalDiscount() { + return totalDiscount; + } + public void setTotalDiscount(BigDecimal totalDiscount) { + this.totalDiscount = totalDiscount; + } + /** + * @return the cardType + */ + public String getCardType() + { + return cardType; + } + /** + * @param cardType the cardType to set + */ + public void setCardType(String cardType) + { + this.cardType = cardType; + } + /** + * @return the writeOffAmt + */ + public BigDecimal getWriteOffAmt() + { + return writeOffAmt; + } + /** + * @param writeOffAmt the writeOffAmt to set + */ + public void setWriteOffAmt(BigDecimal writeOffAmt) + { + this.writeOffAmt = writeOffAmt; + } + /** + * @return the discountAmt + */ + public BigDecimal getDiscountAmt() + { + return discountAmt; + } + /** + * @param discountAmt the discountAmt to set + */ + public void setDiscountAmt(BigDecimal discountAmt) + { + this.discountAmt = discountAmt; + } + public Boolean[] getIsDiscOnInclUnitPrice() { + return isDiscOnInclUnitPrice; + } + public void setIsDiscOnInclUnitPrice(Boolean[] isDiscOnInclUnitPrice) { + this.isDiscOnInclUnitPrice = isDiscOnInclUnitPrice; + } + public BigDecimal[] getDiscInclUnitPrice() { + return discInclUnitPrice; + } + public void setDiscInclUnitPrice(BigDecimal[] discInclUnitPrice) { + this.discInclUnitPrice = discInclUnitPrice; + } + public Boolean getDiscountOnTotalPercent() { + return discountOnTotalPercent; + } + public void setDiscountOnTotalPercent(Boolean discountOnTotalPercent) { + this.discountOnTotalPercent = discountOnTotalPercent; + } + public String getPaymentRule() { + return paymentRule; + } + public void setPaymentRule(String paymentRule) { + this.paymentRule = paymentRule; + } + + public String getPaymentRuleFromTenderType() + { + if (Constants.PAYMENT_RULE_CASH.equalsIgnoreCase(tenderType)) + { + paymentRule=MOrder.PAYMENTRULE_Cash; + } + else if(Constants.PAYMENT_RULE_CARD.equalsIgnoreCase(tenderType)) + { + paymentRule=MOrder.PAYMENTRULE_CreditCard; + } + else if(Constants.PAYMENT_RULE_CHEQUE.equalsIgnoreCase(tenderType)) + { + paymentRule=MOrder.PAYMENTRULE_Check; + } + else if(Constants.PAYMENT_RULE_MIXED.equalsIgnoreCase(tenderType)) + { + paymentRule=UdiConstants.PAYMENTRULE_MIXED; + } + else if(Constants.PAYMENT_RULE_CREDIT.equalsIgnoreCase(tenderType)) + { + paymentRule=MOrder.PAYMENTRULE_OnCredit; + } + + return paymentRule; + + } + public BigDecimal getTotalAmount() + { + return totalAmount; + } + public void setTotalAmount(BigDecimal totalAmount) + { + this.totalAmount = totalAmount; + } + public Integer getM_productId() + { + return m_productId; + } + public void setM_productId(Integer id) + { + m_productId = id; + } + public Boolean getIsDiscountUptoLimitPrice() + { + return isDiscountUptoLimitPrice; + } + public void setIsDiscountUptoLimitPrice(Boolean isDiscountUptoLimitPrice) + { + this.isDiscountUptoLimitPrice = isDiscountUptoLimitPrice; + } + public BigDecimal getGrandTotal() + { + return grandTotal; + } + public void setGrandTotal(BigDecimal grandTotal) + { + this.grandTotal = grandTotal; + } + public Integer getRoleId() + { + return roleId; + } + public void setRoleId(Integer roleId) + { + this.roleId = roleId; + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/beans/CloseTillBean.java b/posterita/posterita/src/main/org/posterita/beans/CloseTillBean.java new file mode 100644 index 0000000000..738213682e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CloseTillBean.java @@ -0,0 +1,142 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Aug 4, 2008 3:02:32 AM by praveen + * + */ + +package org.posterita.beans; + +import java.io.Serializable; +import java.math.BigDecimal; + +public class CloseTillBean implements Serializable +{ + private String currency; + private String tillNo; + private String tillName; + private BigDecimal beginningBalance; + private BigDecimal netCashTrx; + private BigDecimal balanceEntered; + private BigDecimal difference; + private BigDecimal endingBalance; + private BigDecimal cashTotal; + private BigDecimal cardTotal; + private BigDecimal chequeTotal; + private BigDecimal grandTotal; + private BigDecimal cardAmtEntered; + private BigDecimal cardDifference; + private BigDecimal chequeAmtEntered; + private BigDecimal chequeDifference; + + public String getTillNo() { + return tillNo; + } + public void setTillNo(String tillNo) { + this.tillNo = tillNo; + } + public String getTillName() { + return tillName; + } + public void setTillName(String tillName) { + this.tillName = tillName; + } + public BigDecimal getBeginningBalance() { + return beginningBalance; + } + public void setBeginningBalance(BigDecimal beginningBalance) { + this.beginningBalance = beginningBalance; + } + public BigDecimal getNetCashTrx() { + return netCashTrx; + } + public void setNetCashTrx(BigDecimal netCashTrx) { + this.netCashTrx = netCashTrx; + } + public BigDecimal getBalanceEntered() { + return balanceEntered; + } + public void setBalanceEntered(BigDecimal balanceEntered) { + this.balanceEntered = balanceEntered; + } + public BigDecimal getDifference() { + return difference; + } + public void setDifference(BigDecimal difference) { + this.difference = difference; + } + public BigDecimal getEndingBalance() { + return endingBalance; + } + public void setEndingBalance(BigDecimal endingBalance) { + this.endingBalance = endingBalance; + } + public BigDecimal getCashTotal() { + return cashTotal; + } + public void setCashTotal(BigDecimal cashTotal) { + this.cashTotal = cashTotal; + } + public BigDecimal getCardTotal() { + return cardTotal; + } + public void setCardTotal(BigDecimal cardTotal) { + this.cardTotal = cardTotal; + } + public BigDecimal getChequeTotal() { + return chequeTotal; + } + public void setChequeTotal(BigDecimal chequeTotal) { + this.chequeTotal = chequeTotal; + } + public BigDecimal getGrandTotal() { + return grandTotal; + } + public void setGrandTotal(BigDecimal grandTotal) { + this.grandTotal = grandTotal; + } + public BigDecimal getCardAmtEntered() { + return cardAmtEntered; + } + public void setCardAmtEntered(BigDecimal cardAmtEntered) { + this.cardAmtEntered = cardAmtEntered; + } + public BigDecimal getCardDifference() { + return cardDifference; + } + public void setCardDifference(BigDecimal cardDifference) { + this.cardDifference = cardDifference; + } + public BigDecimal getChequeAmtEntered() { + return chequeAmtEntered; + } + public void setChequeAmtEntered(BigDecimal chequeAmtEntered) { + this.chequeAmtEntered = chequeAmtEntered; + } + public BigDecimal getChequeDifference() { + return chequeDifference; + } + public void setChequeDifference(BigDecimal chequeDifference) { + this.chequeDifference = chequeDifference; + } + public String getCurrency() { + return currency; + } + public void setCurrency(String currency) { + this.currency = currency; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CommandBean.java b/posterita/posterita/src/main/org/posterita/beans/CommandBean.java new file mode 100644 index 0000000000..c2c6826385 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CommandBean.java @@ -0,0 +1,53 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Jul-2005 by alok + * + */ +package org.posterita.beans; + + +public class CommandBean extends UDIBean +{ + + private String[] simpleCommand; + private String[] complexCommand; + + + public void setSimpleCommand(String[] simpleCommand) + { + this.simpleCommand = simpleCommand; + } + + public String[] getSimpleCommand() + { + return simpleCommand; + } + + + public void setComplexCommand(String[] complexCommand) + { + this.complexCommand = complexCommand; + } + + public String[] getComplexCommand() + { + return complexCommand; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CommissionBean.java b/posterita/posterita/src/main/org/posterita/beans/CommissionBean.java new file mode 100644 index 0000000000..b40d206c83 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CommissionBean.java @@ -0,0 +1,160 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 6, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + + + +public class CommissionBean extends UDIBean +{ + + public BigDecimal getSubtractAmt() { + return subtractAmt; + } + public void setSubtractAmt(BigDecimal subtractAmt) { + this.subtractAmt = subtractAmt; + } + public Integer getInvoiceId() { + return invoiceId; + } + public void setInvoiceId(Integer invoiceId) { + this.invoiceId = invoiceId; + } + public Integer getOrderId() { + return orderId; + } + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + public String getPeriodAndCurrencyDesc() { + return periodAndCurrencyDesc; + } + public void setPeriodAndCurrencyDesc(String periodAndCurrencyDesc) { + this.periodAndCurrencyDesc = periodAndCurrencyDesc; + } + public BigDecimal getAmtMultiplier() { + return amtMultiplier; + } + public void setAmtMultiplier(BigDecimal amtMultiplier) { + this.amtMultiplier = amtMultiplier; + } + public String getDocBasisType() { + return docBasisType; + } + public void setDocBasisType(String docBasisType) { + this.docBasisType = docBasisType; + } + public String getFrequencyType() { + return frequencyType; + } + public void setFrequencyType(String frequencyType) { + this.frequencyType = frequencyType; + } + public BigDecimal getActualAmt() { + return actualAmt; + } + public void setActualAmt(BigDecimal actualAmt) { + this.actualAmt = actualAmt; + } + public BigDecimal getActualQty() { + return actualQty; + } + public void setActualQty(BigDecimal actualQty) { + this.actualQty = actualQty; + } + public BigDecimal getCommissionAmt() { + return commissionAmt; + } + public void setCommissionAmt(BigDecimal commissionAmt) { + this.commissionAmt = commissionAmt; + } + public Integer getCommissionAmtId() { + return commissionAmtId; + } + public void setCommissionAmtId(Integer commissionAmtId) { + this.commissionAmtId = commissionAmtId; + } + public Integer getCommissionDetailId() { + return commissionDetailId; + } + public void setCommissionDetailId(Integer commissionDetailId) { + this.commissionDetailId = commissionDetailId; + } + public Integer getCommissionLineId() { + return commissionLineId; + } + public void setCommissionLineId(Integer commissionLineId) { + this.commissionLineId = commissionLineId; + } + public String getCommissionLineName() { + return commissionLineName; + } + public void setCommissionLineName(String commissionLineName) { + this.commissionLineName = commissionLineName; + } + public Integer getCommissionRunId() { + return commissionRunId; + } + public void setCommissionRunId(Integer commissionRunId) { + this.commissionRunId = commissionRunId; + } + public BigDecimal getConvertedAmt() { + return convertedAmt; + } + public void setConvertedAmt(BigDecimal convertedAmt) { + this.convertedAmt = convertedAmt; + } + public Integer getCurrencyId() { + return currencyId; + } + public void setCurrencyId(Integer currencyId) { + this.currencyId = currencyId; + } + public String getInfo() { + return info; + } + public void setInfo(String info) { + this.info = info; + } + public Integer getInvoiceLineId() { + return invoiceLineId; + } + public void setInvoiceLineId(Integer invoiceLineId) { + this.invoiceLineId = invoiceLineId; + } + public Integer getOrderLineId() { + return orderLineId; + } + public void setOrderLineId(Integer orderLineId) { + this.orderLineId = orderLineId; + } + public String getReference() { + return reference; + } + public void setReference(String reference) { + this.reference = reference; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CreditCardBean.java b/posterita/posterita/src/main/org/posterita/beans/CreditCardBean.java new file mode 100644 index 0000000000..7a4a2fe9a3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CreditCardBean.java @@ -0,0 +1,108 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.beans; + +public class CreditCardBean extends UDIBean +{ + + + public String getPaymentMethod() + { + return paymentMethod; + } + public void setPaymentMethod(String paymentMethod) + { + this.paymentMethod = paymentMethod; + } + public String getCreditCardNumberEncrypted() + { + return creditCardNumberEncrypted; + } + public void setCreditCardNumberEncrypted(String creditCardNumberEncrypted) + { + this.creditCardNumberEncrypted = creditCardNumberEncrypted; + } + public String getCreditCardExpMonthName() + { + return creditCardExpMonthName; + } + public void setCreditCardExpMonthName(String creditCardExpMonthName) + { + this.creditCardExpMonthName = creditCardExpMonthName; + } + public String getAccountName() + { + return accountName; + } + public void setAccountName(String accountName) + { + this.accountName = accountName; + } + public String getCreditCardNumber() + { + return creditCardNumber; + } + + public void setCreditCardNumber(String creditCardNumber) + { + this.creditCardNumber = creditCardNumber; + } + + public String getCvv() + { + return cvv; + } + + public void setCvv(String cvv) + { + this.cvv = cvv; + } + + public Integer getCreditCardExpMonth() + { + return creditCardExpMonth; + } + + public void setCreditCardExpMonth(Integer creditCardExpMonth) + { + this.creditCardExpMonth = creditCardExpMonth; + } + + public Integer getCreditCardExpYear() + { + return creditCardExpYear; + } + + public void setCreditCardExpYear(Integer creditCardExpYear) + { + this.creditCardExpYear = creditCardExpYear; + } + public String getCreditCardType() + { + return creditCardType; + } + public void setCreditCardType(String creditCardType) + { + this.creditCardType = creditCardType; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CreditCheckBean.java b/posterita/posterita/src/main/org/posterita/beans/CreditCheckBean.java new file mode 100644 index 0000000000..5ae045eaf2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CreditCheckBean.java @@ -0,0 +1,53 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 1, 2006 + */ + + +package org.posterita.beans; + + + + +public class CreditCheckBean +{ + protected String msg; + protected Boolean valid; + + public String getMsg() { + return msg; + } + public void setMsg(String msg) { + this.msg = msg; + } + public Boolean getValid() { + return valid; + } + public void setValid(Boolean valid) { + this.valid = valid; + } + + + + + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CreditPaymentDetailsBean.java b/posterita/posterita/src/main/org/posterita/beans/CreditPaymentDetailsBean.java new file mode 100644 index 0000000000..d48ead320c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CreditPaymentDetailsBean.java @@ -0,0 +1,160 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 25, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + + +public class CreditPaymentDetailsBean extends UDIBean +{ + + + public Integer getCurrencyId() { + return currencyId; + } + public void setCurrencyId(Integer currencyId) { + this.currencyId = currencyId; + } + public String getCashBookName() { + return cashBookName; + } + public void setCashBookName(String cashBookName) { + this.cashBookName = cashBookName; + } + public Integer getCashId() { + return cashId; + } + public void setCashId(Integer cashId) { + this.cashId = cashId; + } + public Integer getCashLineId() { + return cashLineId; + } + public void setCashLineId(Integer cashLineId) { + this.cashLineId = cashLineId; + } + public String getCashType() { + return cashType; + } + public void setCashType(String cashType) { + this.cashType = cashType; + } + public String getCashTypeName() { + return cashTypeName; + } + public void setCashTypeName(String cashTypeName) { + this.cashTypeName = cashTypeName; + } + public String getChequeNo() { + return chequeNo; + } + public void setChequeNo(String chequeNo) { + this.chequeNo = chequeNo; + } + public String getCreditCardNumber() { + return creditCardNumber; + } + public void setCreditCardNumber(String creditCardNumber) { + this.creditCardNumber = creditCardNumber; + } + public Timestamp getDateCreated() { + return dateCreated; + } + public void setDateCreated(Timestamp dateCreated) { + this.dateCreated = dateCreated; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public BigDecimal getDiscountAmt() { + return discountAmt; + } + public void setDiscountAmt(BigDecimal discountAmt) { + this.discountAmt = discountAmt; + } + public String getDocumentNo() { + return documentNo; + } + public void setDocumentNo(String documentNo) { + this.documentNo = documentNo; + } + public BigDecimal getInvoiceGrandTotal() { + return invoiceGrandTotal; + } + public void setInvoiceGrandTotal(BigDecimal invoiceGrandTotal) { + this.invoiceGrandTotal = invoiceGrandTotal; + } + public Integer getInvoiceId() { + return invoiceId; + } + public void setInvoiceId(Integer invoiceId) { + this.invoiceId = invoiceId; + } + public BigDecimal getPaidAmt() { + return paidAmt; + } + public void setPaidAmt(BigDecimal paidAmt) { + this.paidAmt = paidAmt; + } + public Integer getPaymentId() { + return paymentId; + } + public void setPaymentId(Integer paymentId) { + this.paymentId = paymentId; + } + public String getTenderType() { + return tenderType; + } + public void setTenderType(String tenderType) { + this.tenderType = tenderType; + } + public Integer getUserID() { + return userID; + } + public void setUserID(Integer userID) { + this.userID = userID; + } + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public BigDecimal getWriteOffAmt() { + return writeOffAmt; + } + public void setWriteOffAmt(BigDecimal writeOffAmt) { + this.writeOffAmt = writeOffAmt; + } + + + + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CurrencyBean.java b/posterita/posterita/src/main/org/posterita/beans/CurrencyBean.java new file mode 100644 index 0000000000..c12ab4aa36 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CurrencyBean.java @@ -0,0 +1,66 @@ +package org.posterita.beans; + +import java.math.BigDecimal; + +public class CurrencyBean extends UDIBean +{ + private Integer currencyId; + private BigDecimal roundOffFactor; + private Integer stdPrecision; + private String isoCode; + private String curSymbol; + private String description; + private boolean isActive; + + + public String getDescription() + { + return description; + } + public void setDescription(String description) + { + this.description = description; + } + public String getIsoCode() + { + return isoCode; + } + public void setIsoCode(String isoCode) + { + this.isoCode = isoCode; + } + public Integer getStdPrecision() + { + return stdPrecision; + } + public void setStdPrecision(Integer stdPrecision) + { + this.stdPrecision = stdPrecision; + } + public Integer getCurrencyId() + { + return currencyId; + } + public void setCurrencyId(Integer currencyId) + { + this.currencyId = currencyId; + } + + public BigDecimal getRoundOffFactor() + { + return roundOffFactor; + } + + public void setRoundOffFactor(BigDecimal roundOffFactor) + { + this.roundOffFactor = roundOffFactor; + } + public String getCurSymbol() + { + return curSymbol; + } + public void setCurSymbol(String curSymbol) + { + this.curSymbol = curSymbol; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CurrentTillAmountBean.java b/posterita/posterita/src/main/org/posterita/beans/CurrentTillAmountBean.java new file mode 100644 index 0000000000..46c8fe3087 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CurrentTillAmountBean.java @@ -0,0 +1,88 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 5, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class CurrentTillAmountBean extends UDIBean +{ + + + + public BigDecimal getBeginingBalance() { + return beginingBalance; + } + public void setBeginingBalance(BigDecimal beginingBalance) { + this.beginingBalance = beginingBalance; + } + public BigDecimal getStatementDifference() { + return statementDifference; + } + public void setStatementDifference(BigDecimal statementDifference) { + this.statementDifference = statementDifference; + } + public BigDecimal getTillGrandTotal() + { + return tillGrandTotal; + } + public void setTillGrandTotal(BigDecimal tillGrandTotal) + { + this.tillGrandTotal = tillGrandTotal; + } + public BigDecimal getCashTotal() + { + return cashTotal; + } + + public void setCashTotal(BigDecimal cashTotal) + { + this.cashTotal = cashTotal; + } + + public BigDecimal getCardTotal() + { + return cardTotal; + } + public void setCardTotal(BigDecimal cardTotal) + { + this.cardTotal = cardTotal; + } + public BigDecimal getChequeTotal() + { + return chequeTotal; + } + public void setChequeTotal(BigDecimal chequeTotal) + { + this.chequeTotal = chequeTotal; + } + + + public String getPosName() { + return posName; + } + public void setPosName(String posName) { + this.posName = posName; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/CustomerBean.java b/posterita/posterita/src/main/org/posterita/beans/CustomerBean.java new file mode 100644 index 0000000000..0e5f885f61 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/CustomerBean.java @@ -0,0 +1,584 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 02-Sep-2005 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + +public class CustomerBean extends DocumentBean +{ + public Boolean isEditable; + + + + public Boolean getIsEditable() { + return isEditable; + } + + public void setIsEditable(Boolean isEditable) { + this.isEditable = isEditable; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public String getPaymentTermName() { + return paymentTermName; + } + public void setPaymentTermName(String paymentTermName) { + this.paymentTermName = paymentTermName; + } + public Integer getPaymentTermId() { + return paymentTermId; + } + public void setPaymentTermId(Integer paymentTermId) { + this.paymentTermId = paymentTermId; + } + public String getCreditStatus() { + return creditStatus; + } + public void setCreditStatus(String creditStatus) { + this.creditStatus = creditStatus; + } + public BigDecimal getCreditLimit() { + return creditLimit; + } + public void setCreditLimit(BigDecimal creditLimit) { + this.creditLimit = creditLimit; + } + public Integer getDunningId() { + return dunningId; + } + public void setDunningId(Integer dunningId) { + this.dunningId = dunningId; + } + public Boolean getCreatingFromOrder() { + return creatingFromOrder; + } + public void setCreatingFromOrder(Boolean creatingFromOrder) { + this.creatingFromOrder = creatingFromOrder; + } + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + public Integer getProductId() + { + return productId; + } + public void setProductId(Integer productId) + { + this.productId = productId; + } + public Integer getLicensingDistrictId() { + return licensingDistrictId; + } + public void setLicensingDistrictId(Integer licensingDistrictId) { + this.licensingDistrictId = licensingDistrictId; + } + public String getSurname() { + return surname; + } + public void setSurname(String surname) { + this.surname = surname; + } + public String getAaCardnumber() { + return aaCardnumber; + } + public String getAddress1() { + return address1; + } + public String getAddress2() { + return address2; + } + public String getCity() { + return city; + } + + public String getCustIdNumber() { + return custIdNumber; + } + + public String getMaintenanceContractNumber() { + return maintenanceContractNumber; + } + public String getMobile() { + return mobile; + } + public String getPartnerName() { + return partnerName; + } + + public String getPhone2() { + return phone2; + } + public String getPhone() { + return phone; + } + public String getPostalAddress1() { + return postalAddress1; + } + public String getPostalCity() { + return postalCity; + } + public String getPostalCode() { + return postalCode; + } + public String getPostalPostalCode() { + return postalPostalCode; + } + + + public Integer getRegionId() { + return regionId; + } + + public void setAaCardnumber(String aaCardnumber) { + this.aaCardnumber = aaCardnumber; + } + public void setAddress1(String address1) { + this.address1 = address1; + } + public void setAddress2(String address2) { + this.address2 = address2; + } + public void setCity(String city) { + this.city = city; + } + public void setCustIdNumber(String custIdNumber) { + this.custIdNumber = custIdNumber; + } + public void setMaintenanceContractNumber(String maintenanceContractNumber) { + this.maintenanceContractNumber = maintenanceContractNumber; + } + public void setMobile(String mobile) { + this.mobile = mobile; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public void setPhone2(String phone2) { + this.phone2 = phone2; + } + public void setPhone(String phone) { + this.phone = phone; + } + public void setPostalAddress1(String postalAddress1) { + this.postalAddress1 = postalAddress1; + } + public void setPostalCity(String postalCity) { + this.postalCity = postalCity; + } + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + public void setPostalPostalCode(String postalPostalCode) { + this.postalPostalCode = postalPostalCode; + } + public void setRegionId(Integer regionId) { + this.regionId = regionId; + } + + public Integer getBpartnerId() + { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + public String getLicensingDistrict() + { + return licensingDistrict; + } + + public void setLicensingDistrict(String licensingDistrict) + { + this.licensingDistrict = licensingDistrict; + } + + public String getRegion() + { + return region; + } + + public void setRegion(String region) + { + this.region = region; + } + + public String getCompanyRegNo() + { + return companyRegNo; + } + + public void setCompanyRegNo(String companyRegNo) + { + this.companyRegNo = companyRegNo; + } + + public String getPassportNo() + { + return passportNo; + } + + public void setPassportNo(String passportNo) + { + this.passportNo = passportNo; + } + + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + public Integer getSalesRepId() + { + return salesRepId; + } + + public void setSalesRepId(Integer salesRepId) + { + this.salesRepId = salesRepId; + } + + public String getMakeName() + { + return makeName; + } + + public void setMakeName(String makeName) + { + this.makeName = makeName; + } + + public String getModelName() + { + return modelName; + } + + public void setModelName(String modelName) + { + this.modelName = modelName; + } + + public String getYearName() + { + return yearName; + } + + public void setYearName(String yearName) + { + this.yearName = yearName; + } + + public Integer getCreditCardExpMonth() + { + return creditCardExpMonth; + } + + public void setCreditCardExpMonth(Integer creditCardExpMonth) + { + this.creditCardExpMonth = creditCardExpMonth; + } + + public Integer getCreditCardExpYear() + { + return creditCardExpYear; + } + + public void setCreditCardExpYear(Integer creditCardExpYear) + { + this.creditCardExpYear = creditCardExpYear; + } + + public String getCreditCardNumber() + { + return creditCardNumber; + } + + public void setCreditCardNumber(String creditCardNumber) + { + this.creditCardNumber = creditCardNumber; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getConfirmPassword() + { + return confirmPassword; + } + + public void setConfirmPassword(String confirmPassword) + { + this.confirmPassword = confirmPassword; + } + + public String getCountryName() + { + return countryName; + } + + public void setCountryName(String countryName) + { + this.countryName = countryName; + } + + public String getPostalAddress() + { + return postalAddress; + } + + public void setPostalAddress(String postalAddress) + { + this.postalAddress = postalAddress; + } + + public String getUsername() + { + return username; + } + public void setUsername(String username) + { + this.username = username; + } + + public String getUserSurname() + { + return userSurname; + } + + public void setUserSurname(String userSurname) + { + this.userSurname = userSurname; + } + + public String getFax() + { + return fax; + } + + public void setFax(String fax) + { + this.fax = fax; + } + + public Integer getCountryId() + { + return countryId; + } + + public void setCountryId(Integer countryId) + { + this.countryId = countryId; + } + +/* public Integer getCvv() + { + return cvv; + } + + public void setCvv(Integer cvv) + { + this.cvv = cvv; + } +*/ + public String getCreditCardPayment() + { + return creditCardPayment; + } + + public void setCreditCardPayment(String creditCardPayment) + { + this.creditCardPayment = creditCardPayment; + } + + public String getShipmentMethod() + { + return shipmentMethod; + } + + public void setShipmentMethod(String shipmentMethod) + { + this.shipmentMethod = shipmentMethod; + } + + public String getBirthdate() + { + return birthdate; + } + public void setBirthdate(String birthdate) + { + this.birthdate = birthdate; + } + public String getStartDay() { + return startDay; + } + public void setStartDay(String startDay) { + this.startDay = startDay; + } + public String getStartMonth() { + return startMonth; + } + public void setStartMonth(String startMonth) { + this.startMonth = startMonth; + } + public String getStartYear() { + return startYear; + } + public void setStartYear(String startYear) { + this.startYear = startYear; + } + public Integer getUserId() { + return userId; + } + public void setUserId(Integer userId) { + this.userId = userId; + } + public Integer getPriceListId() + { + return priceListId; + } + + public void setPriceListId(Integer priceListId) + { + this.priceListId = priceListId; + } + + //---------------------------------------------- + private BigDecimal totalOpenBalance; + private BigDecimal creditLimit; + private BigDecimal creditUsed; + private BigDecimal creditAvailable; + + public BigDecimal getTotalOpenBalance() { + return totalOpenBalance; + } + + public void setTotalOpenBalance(BigDecimal totalOpenBalance) { + this.totalOpenBalance = totalOpenBalance; + } + + public BigDecimal getCreditUsed() { + return creditUsed; + } + + public void setCreditUsed(BigDecimal creditUsed) { + this.creditUsed = creditUsed; + } + + public BigDecimal getCreditAvailable() { + return creditAvailable; + } + + public void setCreditAvailable(BigDecimal creditAvailable) { + this.creditAvailable = creditAvailable; + } + + public String getBankName() + { + return bankName; + } + + public void setBankName(String bankName) + { + this.bankName = bankName; + } + + public String getAccountNo() + { + return accountNo; + } + + public void setAccountNo(String accountNo) + { + this.accountNo = accountNo; + } + + public String getBranch() + { + return branch; + } + + public void setBranch(String branch) + { + this.branch = branch; + } + + public String getPriceListName() + { + return priceListName; + } + + public void setPriceListName(String priceListName) + { + this.priceListName = priceListName; + } + + public String getSaleRepName() + { + return saleRepName; + } + + public void setSaleRepName(String saleRepName) + { + this.saleRepName = saleRepName; + } + + public String getTaxNo() + { + return taxNo; + } + + public void setTaxNo(String taxNo) + { + this.taxNo = taxNo; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/DateFilterBean.java b/posterita/posterita/src/main/org/posterita/beans/DateFilterBean.java new file mode 100644 index 0000000000..94ab651d80 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/DateFilterBean.java @@ -0,0 +1,151 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Sep 11, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.beans; + +public class DateFilterBean extends UDIBean +{ + public String getFromDate() + { + return fromDate; + } + + public void setFromDate(String fromDate) + { + this.fromDate = fromDate; + } + + public String getToDate() + { + return toDate; + } + + public void setToDate(String toDate) + { + this.toDate = toDate; + } + + public String getStartDay() + { + return startDay; + } + + public void setStartDay(String startDay) + { + this.startDay = startDay; + } + + public String getStartMonth() + { + return startMonth; + } + + public void setStartMonth(String startMonth) + { + this.startMonth = startMonth; + } + + public String getStartYear() + { + return startYear; + } + + public void setStartYear(String startYear) + { + this.startYear = startYear; + } + + public String getEndDay() + { + return endDay; + } + + public void setEndDay(String endDay) + { + this.endDay = endDay; + } + + public String getEndMonth() + { + return endMonth; + } + + public void setEndMonth(String endMonth) + { + this.endMonth = endMonth; + } + + public String getEndYear() + { + return endYear; + } + + public void setEndYear(String endYear) + { + this.endYear = endYear; + } + + public String getStartHour() + { + return startHour; + } + + public void setStartHour(String startHour) + { + this.startHour = startHour; + } + + public String getStartMinute() + { + return startMinute; + } + + public void setStartMinute(String startMinute) + { + this.startMinute = startMinute; + } + + public String getEndHour() + { + return endHour; + } + + public void setEndHour(String endHour) + { + this.endHour = endHour; + } + + public String getEndMinute() + { + return endMinute; + } + + public void setEndMinute(String endMinute) + { + this.endMinute = endMinute; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/DisplayMessageLogBean.java b/posterita/posterita/src/main/org/posterita/beans/DisplayMessageLogBean.java new file mode 100644 index 0000000000..ce4c6afc89 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/DisplayMessageLogBean.java @@ -0,0 +1,115 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + +import java.sql.Timestamp; + + +public class DisplayMessageLogBean +{ + private String input; + private String output; + private String status; + private String type; + private String documentType; + private Timestamp date; + private Integer documentId; + private String reasonDescription; + + public Timestamp getDate() + { + return date; + } + + public void setDate(Timestamp date) + { + this.date = date; + } + + public String getDocumentType() + { + return documentType; + } + + public void setDocumentType(String documentType) + { + this.documentType = documentType; + } + + public String getInput() + { + return input; + } + + public void setInput(String input) + { + this.input = input; + } + + public String getOutput() + { + return output; + } + + public void setOutput(String output) + { + this.output = output; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getType() + { + return type; + } + + public void setType(String type) + { + this.type = type; + } + + public Integer getDocumentId() + { + return documentId; + } + + public void setDocumentId(Integer documentId) + { + this.documentId = documentId; + } + + public String getReasonDescription() + { + return reasonDescription; + } + + public void setReasonDescription(String reasonDescription) + { + this.reasonDescription = reasonDescription; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/DocumentBean.java b/posterita/posterita/src/main/org/posterita/beans/DocumentBean.java new file mode 100644 index 0000000000..ff146ccc8c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/DocumentBean.java @@ -0,0 +1,84 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + + + +public class DocumentBean extends UDIBean +{ + public Integer getDocumentId() + { + return documentId; + } + + public void setDocumentId(Integer documentId) + { + this.documentId = documentId; + } + + + public String getDocumentType() + { + return documentType; + } + + public void setDocumentType(String documentType) + { + this.documentType = documentType; + } + + public Integer[] getCheckBox() + { + return checkBox; + } + + public void setCheckBox(Integer[] checkBox) + { + this.checkBox = checkBox; + } + + public Integer getBpartnerId() + { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + public String getSubmit() + { + return submit; + } + + public void setSubmit(String submit) + { + this.submit = submit; + } + + public String getOrderType() { + return orderType; + } + + public void setOrderType(String orderType) { + this.orderType = orderType; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/DocumentHistortFilterBean.java b/posterita/posterita/src/main/org/posterita/beans/DocumentHistortFilterBean.java new file mode 100644 index 0000000000..b870d5e162 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/DocumentHistortFilterBean.java @@ -0,0 +1,80 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.beans; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.TreeSet; + + + +/** + * @author alok + */ + +public class DocumentHistortFilterBean +{ + + private TreeSet bPartnerList = new TreeSet(); + private TreeSet docStatusList = new TreeSet(); + + public DocumentHistortFilterBean(ArrayList beans) + { + + if(beans!=null) + { + Iterator iter = beans.iterator(); + + while(iter.hasNext()) + { + DocumentHistoryBean bean = (DocumentHistoryBean) iter.next(); + + if(bean.getBpartnerId()!=null) + { + UDIPair pair = new UDIPair(bean.getBpartnerId(),bean.getPartnerName()); + bPartnerList.add(pair); + } + + if(bean.getDocStatus()!= null) + { + UDIPair docStatusPair = new UDIPair(bean.getDocStatusCode(), bean.getDocStatus()); + docStatusList.add(docStatusPair); + } + } + } + + } + + + public TreeSet getBPartnerList() + { + return bPartnerList; + } + + public TreeSet getDocStatusList() + { + return docStatusList; + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/DocumentHistoryBean.java b/posterita/posterita/src/main/org/posterita/beans/DocumentHistoryBean.java new file mode 100644 index 0000000000..84af7801b2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/DocumentHistoryBean.java @@ -0,0 +1,248 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.beans; + +import java.sql.Timestamp; +import java.util.ArrayList; + +import org.posterita.beans.UDIBean; + +public class DocumentHistoryBean extends UDIBean +{ +/* + protected Integer orderId; + protected Integer paymentId; + protected Integer invoiceId; + protected Integer minOutId; + protected String docStatus; //Shipment DocStatus + protected Integer month; + protected Integer year; + protected Integer bpartnerId; + protected String partnerName; + protected Timestamp dateOrdered; + protected String docStatusCode; +*/ + protected String paymentStatus; + protected String shipmentStatus; + + protected String invoiceNo; + protected String paymentNo; + protected String shipmentNo; + protected ArrayList documentHistoryList; + + + + + + + + + public ArrayList getDocumentHistoryList() { + return documentHistoryList; + } + + public void setDocumentHistoryList(ArrayList documentHistoryList) { + this.documentHistoryList = documentHistoryList; + } + + public Integer getCashLineId() { + return cashLineId; + } + + public void setCashLineId(Integer cashLineId) { + this.cashLineId = cashLineId; + } + + public String getDocumentNo() + { + return documentNo; + } + + public void setDocumentNo(String documentNo) + { + this.documentNo=documentNo; + } + public String getOrderType() + { + return orderType; + } + + public void setOrderType(String orderType) + { + this.orderType=orderType; + } + + + public String getDocStatus() + { + return docStatus; + } + public void setDocStatus(String docStatus) + { + this.docStatus = docStatus; + } + public Integer getInvoiceId() + { + return invoiceId; + } + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + public Integer getMinOutId() + { + return minOutId; + } + public void setMinOutId(Integer minOutId) + { + this.minOutId = minOutId; + } + public Integer getMonth() + { + return month; + } + public void setMonth(Integer month) + { + this.month = month; + } + public Integer getOrderId() + { + return orderId; + } + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + public Integer getPaymentId() + { + return paymentId; + } + public void setPaymentId(Integer paymentId) + { + this.paymentId = paymentId; + } + public Integer getYear() + { + return year; + } + public void setYear(Integer year) + { + this.year = year; + } + public Integer getBpartnerId() + { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + public String getPartnerName() + { + return partnerName; + } + public void setPartnerName(String partnerName) + { + this.partnerName = partnerName; + } + public Timestamp getDateOrdered() + { + return dateOrdered; + } + public void setDateOrdered(Timestamp dateOrdered) + { + this.dateOrdered = dateOrdered; + } + public String getDocStatusCode() + { + return docStatusCode; + } + public void setDocStatusCode(String docStatusCode) + { + this.docStatusCode = docStatusCode; + } + public String getPaymentStatus() + { + return paymentStatus; + } + public void setPaymentStatus(String paymentStatus) + { + this.paymentStatus = paymentStatus; + } + public String getShipmentStatus() + { + return shipmentStatus; + } + public void setShipmentStatus(String shipmentStatus) + { + this.shipmentStatus = shipmentStatus; + } + + public String getInvoiceNo() + { + return invoiceNo; + } + + public void setInvoiceNo(String invoiceNo) + { + this.invoiceNo = invoiceNo; + } + + public String getPaymentNo() + { + return paymentNo; + } + + public void setPaymentNo(String paymentNo) + { + this.paymentNo = paymentNo; + } + + public String getShipmentNo() + { + return shipmentNo; + } + + public void setShipmentNo(String shipmentNo) + { + this.shipmentNo = shipmentNo; + } + + public Boolean getIsCustomer() { + return isCustomer; + } + + public void setIsCustomer(Boolean isCustomer) { + this.isCustomer = isCustomer; + } + + public Boolean getIsVendor() { + return isVendor; + } + + public void setIsVendor(Boolean isVendor) { + this.isVendor = isVendor; + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/DunningBean.java b/posterita/posterita/src/main/org/posterita/beans/DunningBean.java new file mode 100644 index 0000000000..c3f0660196 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/DunningBean.java @@ -0,0 +1,105 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 27, 2006 + */ + + +package org.posterita.beans; + + +public class DunningBean extends UDIBean +{ + + + + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public Integer getDunningId() { + return dunningId; + } + public void setDunningId(Integer dunningId) { + this.dunningId = dunningId; + } + public String getDunningLevelName() { + return dunningLevelName; + } + public void setDunningLevelName(String dunningLevelName) { + this.dunningLevelName = dunningLevelName; + } + public String getDunningName() { + return dunningName; + } + public void setDunningName(String dunningName) { + this.dunningName = dunningName; + } + public Integer getDunningLevelId() { + return dunningLevelId; + } + public void setDunningLevelId(Integer dunningLevelId) { + this.dunningLevelId = dunningLevelId; + } + public String getDunningPrintNote() { + return dunningPrintNote; + } + public void setDunningPrintNote(String dunningPrintNote) { + this.dunningPrintNote = dunningPrintNote; + } + public String getDunningPrintText() { + return dunningPrintText; + } + public void setDunningPrintText(String dunningPrintText) { + this.dunningPrintText = dunningPrintText; + } + public Integer getBP_Group_ID() { + return BP_Group_ID; + } + public void setBP_Group_ID(Integer group_ID) { + BP_Group_ID = group_ID; + } + public Integer getBpartnerId() { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + public Integer getCurrencyId() { + return currencyId; + } + public void setCurrencyId(Integer currencyId) { + this.currencyId = currencyId; + } + + + + + public Integer[] getBpartnerIds() { + return bpartnerIds; + } + public void setBpartnerIds(Integer[] bpartnerIds) { + this.bpartnerIds = bpartnerIds; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/EditPriceBean.java b/posterita/posterita/src/main/org/posterita/beans/EditPriceBean.java new file mode 100644 index 0000000000..5d76d0d0db --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/EditPriceBean.java @@ -0,0 +1,62 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 20, 2005 by praveen + * + */ +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class EditPriceBean extends UDIBean +{ + public BigDecimal getPrice() + { + return price; + } + + public void setPrice(BigDecimal price) + { + this.price = price; + } + + public Integer getPriceListVersionId() + { + return priceListVersionId; + } + + public void setPriceListVersionId(Integer priceListVersionId) + { + this.priceListVersionId = priceListVersionId; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/FilterBean.java b/posterita/posterita/src/main/org/posterita/beans/FilterBean.java new file mode 100644 index 0000000000..e9bab97232 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/FilterBean.java @@ -0,0 +1,137 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 19, 2005 by praveen + * + */ +package org.posterita.beans; + +import java.util.ArrayList; + +public class FilterBean extends UDIBean +{ + private ArrayList bpList; + private ArrayList docStatusList; + public Integer getRefToQuote() + { + return refToQuote; + } + public void setRefToQuote(Integer refToQuote) + { + this.refToQuote = refToQuote; + } + + public String getOrderType() + { + return orderType; + } + public void setOrderType(String orderType) + { + this.orderType = orderType; + } + + public String getDocStatus() + { + return docStatus; + } + + public String getDocStatusCode() + { + return docStatusCode; + } + + public String getDocumentNo() + { + return documentNo; + } + + public Integer getMonth() + { + return month; + } + + + public Integer getPartnerId() + { + return this.partnerId; + } + + public String getPartnerName() + { + return partnerName; + } + + public Integer getYear() + { + return year; + } + public void setDocStatus(String docStatus) + { + this.docStatus = docStatus; + } + + public void setDocStatusCode(String docStatusCode) + { + this.docStatusCode = docStatusCode; + } + + public void setDocumentNo(String documentNo) + { + this.documentNo = documentNo; + } + + public void setMonth(Integer month) + { + this.month = month; + } + + public void setPartnerId(Integer partnerId) + { + this.partnerId = partnerId; + } + public void setPartnerName(String partnerName) + { + this.partnerName = partnerName; + } + + public void setYear(Integer year) + { + this.year = year; + } + + public ArrayList getBpList() + { + return bpList; + } + + public void setBpList(ArrayList bpList) + { + this.bpList = bpList; + } + + public ArrayList getDocStatusList() + { + return docStatusList; + } + + public void setDocStatusList(ArrayList docStatusList) + { + this.docStatusList = docStatusList; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/GenericProductBean.java b/posterita/posterita/src/main/org/posterita/beans/GenericProductBean.java new file mode 100644 index 0000000000..af28427bb5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/GenericProductBean.java @@ -0,0 +1,167 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + + +public class GenericProductBean +{ + private String name; + private Integer qtyOnHand; + private Integer productId; + private String description; + private ProductImageInfo imageInfo; + private Boolean isSmall; + private Boolean isMedium; + private Boolean isLarge; + private Boolean isXLarge; + private Integer qtySmall; + private Integer qtyMedium; + private Integer qtyLarge; + private Integer qtyXLarge; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public Integer getQtyOnHand() + { + return qtyOnHand; + } + + public void setQtyOnHand(Integer qtyOnHand) + { + this.qtyOnHand = qtyOnHand; + } + + + public Integer getProductId() + { + return productId; + } + public void setProductId(Integer productId) + { + this.productId = productId; + } + + + public String getDescription() + { + return description; + } + public void setDescription(String description) + { + this.description = description; + } + + public ProductImageInfo getImageInfo() + { + return imageInfo; + } + public void setImageInfo(ProductImageInfo imageInfo) + { + this.imageInfo = imageInfo; + } + + public Boolean getIsLarge() + { + return isLarge; + } + + public void setIsLarge(Boolean isLarge) + { + this.isLarge = isLarge; + } + + public Boolean getIsMedium() + { + return isMedium; + } + + public void setIsMedium(Boolean isMedium) + { + this.isMedium = isMedium; + } + + public Boolean getIsSmall() + { + return isSmall; + } + + public void setIsSmall(Boolean isSmall) + { + this.isSmall = isSmall; + } + + public Boolean getIsXLarge() + { + return isXLarge; + } + + public void setIsXLarge(Boolean isXLarge) + { + this.isXLarge = isXLarge; + } + + public Integer getQtyLarge() + { + return qtyLarge; + } + + public void setQtyLarge(Integer qtyLarge) + { + this.qtyLarge = qtyLarge; + } + + public Integer getQtyMedium() + { + return qtyMedium; + } + + public void setQtyMedium(Integer qtyMedium) + { + this.qtyMedium = qtyMedium; + } + + public Integer getQtySmall() + { + return qtySmall; + } + + public void setQtySmall(Integer qtySmall) + { + this.qtySmall = qtySmall; + } + + public Integer getQtyXLarge() + { + return qtyXLarge; + } + + public void setQtyXLarge(Integer qtyXLarge) + { + this.qtyXLarge = qtyXLarge; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/InOutHistoryBean.java b/posterita/posterita/src/main/org/posterita/beans/InOutHistoryBean.java new file mode 100644 index 0000000000..84b1f1da54 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/InOutHistoryBean.java @@ -0,0 +1,113 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 08-Aug-2005 by alok + * + */ +package org.posterita.beans; + +import java.sql.Timestamp; + + +public class InOutHistoryBean extends FilterBean +{ + + public String getPartnerName() + { + return partnerName; + } + public void setPartnerName(String partnerName) + { + this.partnerName = partnerName; + } + + public Integer getInOutId() + { + return inOutId; + } + + public void setInOutId(Integer inOutId) + { + this.inOutId = inOutId; + } + + public Timestamp getDateMovement() + { + return dateMovement; + } + public void setDateMovement(Timestamp dateMovement) + { + this.dateMovement = dateMovement; + } + public Timestamp getDateOrdered() + { + return dateOrdered; + } + public void setDateOrdered(Timestamp dateOrdered) + { + this.dateOrdered = dateOrdered; + } + public Integer getInvoiceId() + { + return invoiceId; + } + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + public Boolean getIsSotrx() + { + return isSoTrx; + } + public void setIsSotrx(Boolean isSotrx) + { + this.isSoTrx = isSotrx; + } + public Integer getOrderId() + { + return orderId; + } + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + public String getPoReference() + { + return poReference; + } + public void setPoReference(String poReference) + { + this.poReference = poReference; + } + public Integer getRefInOutId() + { + return refInOutId; + } + public void setRefInOutId(Integer refInOutId) + { + this.refInOutId = refInOutId; + } + public Integer getWarehouseId() + { + return warehouseId; + } + public void setWarehouseId(Integer warehouseId) + { + this.warehouseId = warehouseId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/InventoryBean.java b/posterita/posterita/src/main/org/posterita/beans/InventoryBean.java new file mode 100644 index 0000000000..5be1d7280c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/InventoryBean.java @@ -0,0 +1,166 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 4, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class InventoryBean extends UDIBean +{ + + public Integer[] getInventoryIds() + { + return inventoryIds; + } + public void setInventoryIds(Integer[] inventoryIds) + { + this.inventoryIds = inventoryIds; + } + public BigDecimal getBookQtyValue() { + return bookQtyValue; + } + public void setBookQtyValue(BigDecimal bookQtyValue) { + this.bookQtyValue = bookQtyValue; + } + public BigDecimal getCountQtyValue() { + return countQtyValue; + } + public void setCountQtyValue(BigDecimal countQtyValue) { + this.countQtyValue = countQtyValue; + } + public String getBarCode() { + return barCode; + } + public void setBarCode(String barCode) { + this.barCode = barCode; + } + public String getDocStatus() { + return docStatus; + } + public void setDocStatus(String docStatus) { + this.docStatus = docStatus; + } + public String getInventoryNo() { + return inventoryNo; + } + public void setInventoryNo(String inventoryNo) { + this.inventoryNo = inventoryNo; + } + public String getMovementDate() { + return movementDate; + } + public void setMovementDate(String movementDate) { + this.movementDate = movementDate; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public Integer getProductId() { + return productId; + } + public void setProductId(Integer productId) { + this.productId = productId; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public Integer getInventoryId() { + return inventoryId; + } + public void setInventoryId(Integer inventoryId) { + this.inventoryId = inventoryId; + } + public Integer getInventoryLineId() { + return inventoryLineId; + } + public void setInventoryLineId(Integer inventoryLineId) { + this.inventoryLineId = inventoryLineId; + } + public BigDecimal getQtyBook() { + return qtyBook; + } + public void setQtyBook(BigDecimal qtyBook) { + this.qtyBook = qtyBook; + } + public BigDecimal getQtyCount() { + return qtyCount; + } + public void setQtyCount(BigDecimal qtyCount) { + this.qtyCount = qtyCount; + } + public void setUom(String uom) + { + this.uom = uom; + } + public String getUom() + { + return this.uom; + } + + public String getIfAdd() { + return ifAdd; + } + public void setIfAdd(String ifAdd) { + this.ifAdd = ifAdd; + } + + public Integer getPriceListId() { + return priceListId; + } + public void setPriceListId(Integer priceListId) { + this.priceListId = priceListId; + } + + public BigDecimal getQtyCsv() + { + return qtyCsv; + } + public void setQtyCsv(BigDecimal qtyCsv) + { + this.qtyCsv = qtyCsv; + } + + public Integer getMonth() + { + return month; + } + public void setMonth(Integer month) + { + this.month = month; + } + public Integer getYear() + { + return year; + } + public void setYear(Integer year) + { + this.year = year; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/InventoryCartBean.java b/posterita/posterita/src/main/org/posterita/beans/InventoryCartBean.java new file mode 100644 index 0000000000..c9afd2d08a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/InventoryCartBean.java @@ -0,0 +1,177 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 27 May 2008 12:27:14 by shameem + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + +import org.compiere.util.Env; + +public class InventoryCartBean extends UDIBean +{ + private ArrayList items; + private String currency; + private BigDecimal totalPrice; + private int pricelistId; + + public String getCurrency() + { + return currency; + } + + public void setCurrency(String currency) + { + this.currency = currency; + } + + public ArrayList getItems() + { + return items; + } + + public void setItems(ArrayList items) + { + this.items = items; + } + + public BigDecimal getTotalPrice() + { + return totalPrice; + } + + public void setTotalPrice(BigDecimal totalPrice) + { + this.totalPrice = totalPrice; + } + + public int getPricelistId() { + return pricelistId; + } + + public void setPricelistId(int pricelistId) { + this.pricelistId = pricelistId; + } + + public BigDecimal getQtyCount() { + return qtyCount; + } + public void setQtyCount(BigDecimal qtyCount) { + this.qtyCount = qtyCount; + } + + public String getBarCode() { + return barCode; + } + + public void setBarCode(String barCode) { + this.barCode = barCode; + } + + public Integer getPriceListId() { + return priceListId; + } + + public void setPriceListId(Integer priceListId) { + this.priceListId = priceListId; + } + + public BigDecimal getQtyBook() { + return qtyBook; + } + public void setQtyBook(BigDecimal qtyBook) { + this.qtyBook = qtyBook; + } + + public BigDecimal getQtyCsv() + { + return qtyCsv; + } + + public void setQtyCsv(BigDecimal qtyCsv) + { + this.qtyCsv = qtyCsv; + } + + public void setInventoryId(Integer inventoryId) + { + this.inventoryId = inventoryId; + } + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public Integer getInventoryId() + { + return inventoryId; + } + public String getUom() + { + return uom; + } + public void setUom(String uom) + { + this.uom = uom; + } + public Integer getInventoryLineId() + { + return inventoryLineId; + } + public void setInventoryLineId(Integer inventoryLineId) + { + this.inventoryLineId = inventoryLineId; + } + + public BigDecimal getCountQtyValue() + { + return countQtyValue; + } + public void setCountQtyValue(BigDecimal countQtyValue) + { + this.countQtyValue = countQtyValue; + } + + public Integer getProductId() + { + return productId; + } + public void setProductId(Integer productId) + { + this.productId = productId; + } + public String getProductName() + { + return productName; + } + public void setProductName(String productName) + { + this.productName = productName; + } + public BigDecimal getBookQtyValue() { + return bookQtyValue; + } + public void setBookQtyValue(BigDecimal bookQtyValue) { + this.bookQtyValue = bookQtyValue; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/InventoryLineBean.java b/posterita/posterita/src/main/org/posterita/beans/InventoryLineBean.java new file mode 100644 index 0000000000..4825ceedf6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/InventoryLineBean.java @@ -0,0 +1,475 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + + +public class InventoryLineBean extends DocumentBean implements Comparable +{ + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public Double getTotalActualPrice() { + return totalActualPrice; + } + public void setTotalActualPrice(Double totalActualPrice) { + this.totalActualPrice = totalActualPrice; + } + public Double getPaymentByCard() { + return paymentByCard; + } + public void setPaymentByCard(Double paymentByCard) { + this.paymentByCard = paymentByCard; + } + public Double getPaymentByCash() { + return paymentByCash; + } + public void setPaymentByCash(Double paymentByCash) { + this.paymentByCash = paymentByCash; + } + public Double getPaymentByChq() { + return paymentByChq; + } + public void setPaymentByChq(Double paymentByChq) { + this.paymentByChq = paymentByChq; + } + public String[] getActualPrice() { + return actualPrice; + } + public void setActualPrice(String[] actualPrice) { + this.actualPrice = actualPrice; + } + + public String[] getDiscountPercent() { + return discountPercent; + } + public void setDiscountPercent(String[] discountPercent) { + this.discountPercent = discountPercent; + } + public String getQtyAndItem() { + return qtyAndItem; + } + public void setQtyAndItem(String qtyAndItem) { + this.qtyAndItem = qtyAndItem; + } + public String getBarCode() { + return barCode; + } + public void setBarCode(String barCode) { + this.barCode = barCode; + } + + public String getPartnerName() { + return partnerName; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public Integer[] getInventoryLineIds() + { + return inventoryLineIds; + } + public void setInventoryLineIds(Integer[] inventoryLineIds) + { + this.inventoryLineIds = inventoryLineIds; + } + public String getChequeNo() + { + return chequeNo; + } + + public void setChequeNo(String chequeNo) + { + this.chequeNo = chequeNo; + } + + public Integer getCreditCardExpMonth() + { + return creditCardExpMonth; + } + + public void setCreditCardExpMonth(Integer creditCardExpMonth) + { + this.creditCardExpMonth = creditCardExpMonth; + } + + public Integer getCreditCardExpYear() + { + return creditCardExpYear; + } + + public void setCreditCardExpYear(Integer creditCardExpYear) + { + this.creditCardExpYear = creditCardExpYear; + } + + public String getCreditCardNumber() + { + return creditCardNumber; + } + + public void setCreditCardNumber(String creditCardNumber) + { + this.creditCardNumber = creditCardNumber; + } + + public String getCreditCardType() + { + return creditCardType; + } + + public void setCreditCardType(String creditCardType) + { + this.creditCardType = creditCardType; + } + public Integer getInventoryId() + { + return inventoryId; + } + public void setInventoryId(Integer inventoryId) + { + this.inventoryId = inventoryId; + } + public String getSurname() { + return surname; + } + public void setSurname(String surname) { + this.surname = surname; + } + + public Integer getBpartnerId() + { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + public Boolean getIsQtyReserved() + { + return isQtyReserved; + } + + public void setIsQtyReserved(Boolean isQtyReserved) + { + this.isQtyReserved = isQtyReserved; + } + public String getEngineNo() { + return engineNo; + } + public void setEngineNo(String engineNo) { + this.engineNo = engineNo; + } + public BigDecimal getQuantity() + { + return quantity; + } + + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + + public Integer[] getCheckBox() + { + return checkBox; + } + public void setCheckBox(Integer [] checkBox) + { + this.checkBox = checkBox; + } + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public ArrayList getInventoryLineList() + { + return InventoryLineList; + } + public void setInventoryLineList(ArrayList inventoryLineList) + { + InventoryLineList = inventoryLineList; + } + + public Integer getInventoryLineId() + { + return inventoryLineId; + } + public void setInventoryLineId(Integer inventoryLineId) + { + this.inventoryLineId = inventoryLineId; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public Integer getAllocationId() + { + return allocationId; + } + + public void setAllocationId(Integer allocationId) + { + this.allocationId = allocationId; + } + + public boolean equals(Object obj) + { + OrderLineBean target = (OrderLineBean) obj; + + if ( obj == null) + return false; + + if (this.getAttributeSetInstanceId().equals(target.getAttributeSetInstanceId())) + return true; + + return false; + } + + public String getSubmit() + { + return submit; + } + + public void setSubmit(String submit) + { + this.submit = submit; + } + + + public int compareTo(Object o) + { + InventoryLineBean src = (InventoryLineBean) o; + + if (src.getAttributeSetInstanceId().intValue() == this.getAttributeSetInstanceId().intValue()) + return 0; + + + return -1; + } + + + + + + + public BigDecimal getAmountGiven() + { + return amountGiven; + } + + public void setAmountGiven(BigDecimal amountGiven) + { + this.amountGiven = amountGiven; + } + + public BigDecimal getAmountRefunded() + { + return amountRefunded; + } + + public void setAmountRefunded(BigDecimal amountRefunded) + { + this.amountRefunded = amountRefunded; + } + public String getTrxType() + { + return trxType; + } + + public void setTrxType(String trxType) + { + this.trxType = trxType; + } + + public BigDecimal getTransferAmount() { + return transferAmount; + } + public void setTransferAmount(BigDecimal transferAmount) { + this.transferAmount = transferAmount; + } + + public Integer getCashBookIds() { + return cashBookIds; + } + public void setCashBookIds(Integer cashBookIds) { + this.cashBookIds = cashBookIds; + } + public String getIsSales() { + return isSales; + } + public void setIsSales(String isSales) { + this.isSales = isSales; + } + public String getIfAdd() { + return ifAdd; + } + public void setIfAdd(String ifAdd) { + this.ifAdd = ifAdd; + } + + public String getVendorName() { + return vendorName; + } + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getDocumentNo() { + return documentNo; + } + public void setDocumentNo(String documentNo) { + this.documentNo = documentNo; + } + + public BigDecimal getUserDiscount() { + return userDiscount; + } + public void setUserDiscount(BigDecimal userDiscount) { + this.userDiscount = userDiscount; + } + + public Integer getPaymentTermId() { + return paymentTermId; + } + public void setPaymentTermId(Integer paymentTermId) { + this.paymentTermId = paymentTermId; + } + + public String getPaymentTermName() { + return paymentTermName; + } + public void setPaymentTermName(String paymentTermName) { + this.paymentTermName = paymentTermName; + } + public String getToBeShipped() { + return toBeShipped; + } + public void setToBeShipped(String toBeShipped) { + this.toBeShipped = toBeShipped; + } + + public Boolean getOpenDrawer() { + return openDrawer; + } + public void setOpenDrawer(Boolean openDrawer) { + this.openDrawer = openDrawer; + } + + public void setUom(String uom) + { + this.uom = uom; + } + + public String getUom() + { + return this.uom; + } + public Integer getPriceListId() { + return priceListId; + } + public void setPriceListId(Integer priceListId) { + this.priceListId = priceListId; + } + + public BigDecimal getQtyBook() + { + return qtyBook; + } + public void setQtyBook(BigDecimal qtyBook) + { + this.qtyBook = qtyBook; + } + public BigDecimal getQtyCount() + { + return qtyCount; + } + public void setQtyCount(BigDecimal qtyCount) + { + this.qtyCount = qtyCount; + } + public BigDecimal getQtyCsv() + { + return qtyCsv; + } + public void setQtyCsv(BigDecimal qtyCsv) + { + this.qtyCsv = qtyCsv; + } + public String getProductName() + { + return productName; + } + public void setProductName(String productName) + { + this.productName = productName; + } + public BigDecimal getBookQtyValue() { + return bookQtyValue; + } + public void setBookQtyValue(BigDecimal bookQtyValue) { + this.bookQtyValue = bookQtyValue; + } + public BigDecimal getCountQtyValue() + { + return countQtyValue; + } + public void setCountQtyValue(BigDecimal countQtyValue) + { + this.countQtyValue = countQtyValue; + } + public String getDocStatus() { + return docStatus; + } + public void setDocStatus(String docStatus) { + this.docStatus = docStatus; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/InvoiceHistoryBean.java b/posterita/posterita/src/main/org/posterita/beans/InvoiceHistoryBean.java new file mode 100644 index 0000000000..4114b182d1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/InvoiceHistoryBean.java @@ -0,0 +1,101 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 04-Aug-2005 by alok + * + */ +package org.posterita.beans; + +import java.sql.Timestamp; + + +public class InvoiceHistoryBean extends FilterBean +{ + private PaymentHistoryBean paymentHistoryBean; + + public PaymentHistoryBean getPaymentHistoryBean() + { + return paymentHistoryBean; + } + + public void setPaymentHistoryBean(PaymentHistoryBean paymentHistoryBean) + { + this.paymentHistoryBean = paymentHistoryBean; + } + + public Integer getInvoiceId() + { + return invoiceId; + } + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + public Timestamp getDateInvoiced() + { + return dateInvoiced; + } + public void setDateInvoiced(Timestamp dateInvoiced) + { + this.dateInvoiced = dateInvoiced; + } + + public Integer getGrandTotal() + { + return grandTotal; + } + public void setGrandTotal(Integer grandTotal) + { + this.grandTotal = grandTotal; + } + public String getIsPaid() + { + return isPaid; + } + public void setIsPaid(String isPaid) + { + this.isPaid = isPaid; + } + public Boolean getIsSotrx() + { + return isSoTrx; + } + public void setIsSotrx(Boolean isSotrx) + { + this.isSoTrx = isSotrx; + } + public Integer getOrderId() + { + return orderId; + } + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + + public Integer[] getCheckBox() + { + return checkBox; + } + + public void setCheckBox(Integer[] checkBox) + { + this.checkBox = checkBox; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ItemBean.java b/posterita/posterita/src/main/org/posterita/beans/ItemBean.java new file mode 100644 index 0000000000..7ad2e2cb7d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ItemBean.java @@ -0,0 +1,531 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + +import java.math.BigDecimal; + +import org.compiere.util.Env; + + +public class ItemBean +{ + + private Integer productId; + private Integer priceListId; + private Integer inventoryId; + private Integer inventoryLineId; + private String description; + private String barCode; + private BigDecimal price; + private BigDecimal qty = Env.ONE; + private BigDecimal grandTotal = Env.ZERO; + private BigDecimal discountPercent = Env.ZERO; + private BigDecimal actualPrice; + private BigDecimal taxAmt; + private BigDecimal standardPrice; + private BigDecimal priceLimit; + private BigDecimal priceLimitTotal; + private BigDecimal priceTotal; + private BigDecimal taxTotal; + private BigDecimal qtyTotal = Env.ZERO; + private BigDecimal unitPrice; + private String productName; + private BigDecimal inclPrice; + private BigDecimal taxRate; + private String uom; + private String backOrder; + private BigDecimal discountedLinePrice; + private BigDecimal discountedInclUnitPrice; + private Boolean isDiscountOnInclUnitPrice; + private BigDecimal qtyCsv; + private BigDecimal qtyBook; + private BigDecimal qtyCount; + private BigDecimal bookQtyValue; + private BigDecimal countQtyValue; + private BigDecimal listPrice; + + private Boolean isDiscountOnPercentage; + private Boolean isDiscountOnTotal; + private Boolean isTaxIncluded; + + private BigDecimal stockValue; + private BigDecimal qtyToMove; + private BigDecimal qtyOnHand; + private Integer unitsPerPack; + private Integer noOfPack; + + public Boolean getIsTaxIncluded() { + return isTaxIncluded; + } + + public void setIsTaxIncluded(Boolean isTaxIncluded) { + this.isTaxIncluded = isTaxIncluded; + } + + public Boolean getIsDiscountOnInclUnitPrice() { + return isDiscountOnInclUnitPrice; + } + + public void setIsDiscountOnInclUnitPrice(Boolean isDiscountOnInclUnitPrice) { + this.isDiscountOnInclUnitPrice = isDiscountOnInclUnitPrice; + } + + public BigDecimal getDiscountedLinePrice() { + return discountedLinePrice; + } + + public void setDiscountedLinePrice(BigDecimal discountedLinePrice) { + this.discountedLinePrice = discountedLinePrice; + } + + public BigDecimal getTaxRate() { + return taxRate; + } + + public void setTaxRate(BigDecimal taxRate) { + this.taxRate = taxRate; + } + + public BigDecimal getInclPrice() { + return inclPrice; + } + + public void setInclPrice(BigDecimal inclPrice) { + this.inclPrice = inclPrice; + } + + public String getProductName() + { + return productName; + } + + public void setProductName(String productName) + { + this.productName = productName; + } + + public String getUom() { + return uom; + } + + public void setUom(String uom) { + this.uom = uom; + } + + public BigDecimal getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(BigDecimal unitPrice) { + this.unitPrice = unitPrice; + } + + public BigDecimal getQtyTotal() { + return qtyTotal; + } + + public void setQtyTotal(BigDecimal qtyTotal) { + this.qtyTotal = qtyTotal; + } + + public BigDecimal getPriceTotal() { + return priceTotal; + } + + public void setPriceTotal(BigDecimal priceTotal) { + this.priceTotal = priceTotal; + } + + public BigDecimal getTaxTotal() { + return taxTotal; + } + + public void setTaxTotal(BigDecimal taxTotal) { + this.taxTotal = taxTotal; + } + + public BigDecimal getStandardPrice() { + return standardPrice; + } + + public void setStandardPrice(BigDecimal standardPrice) { + this.standardPrice = standardPrice; + } + + public BigDecimal getTaxAmt() { + return taxAmt; + } + + public void setTaxAmt(BigDecimal taxAmt) { + this.taxAmt = taxAmt; + } + + public void setGrandTotal(BigDecimal grandTotal) { + this.grandTotal = grandTotal; + } + + public String getBackOrder() + { + return backOrder; + } + + public void setBackOrder(String backOrder) + { + this.backOrder = backOrder; + } + + public BigDecimal getActualPrice() { + return actualPrice; + } + + public void setActualPrice(BigDecimal actualPrice) { + this.actualPrice = actualPrice; + } + public BigDecimal getDiscountPercent() { + return discountPercent; + } + public void setDiscountPercent(BigDecimal discountPercent) { + this.discountPercent = discountPercent; + } + public void setgrandTotal(BigDecimal grandTotal) + { + this.grandTotal=grandTotal; + } + + public BigDecimal getGrandTotal() + { + return grandTotal; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public BigDecimal getPrice() + { + return price; + } + + public void setPrice(BigDecimal price) + { + this.price = price; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public BigDecimal getQty() + { + return qty; + } + + public void setQty(BigDecimal qty) + { + this.qty = qty; + } + + /** + * Update Quantity in order + * @param original + * @param itemToAdd + * @param add + */ + public void updateQuantity(ItemBean original, ItemBean itemToAdd,boolean add) + { + BigDecimal originalQuantity = original.getQty(); + + BigDecimal quantityToAdd = itemToAdd.getQty(); + + BigDecimal finalQuantity = null; + + if(!add) + finalQuantity= originalQuantity.subtract(quantityToAdd); + else + finalQuantity= originalQuantity.add(quantityToAdd); + + + original.setQty(finalQuantity); + } + + /** + * Update Quantity count in inventory + * @param original + * @param itemToAdd + * @param add + */ + public void updateQuantityCount(ItemBean original, ItemBean itemToAdd,boolean add) + { + BigDecimal originalQuantity = original.getQtyCount(); + + BigDecimal quantityToAdd = itemToAdd.getQtyCount(); + + BigDecimal finalQuantity = null; + + if(!add) + finalQuantity= originalQuantity.subtract(quantityToAdd); + else + finalQuantity= originalQuantity.add(quantityToAdd); + + + original.setQtyCount(finalQuantity); + } + + /** + * Update Quantity CSV in inventory + * @param original + * @param itemToAdd + * @param add + */ + public void updateQuantityCsv(ItemBean original, ItemBean itemToAdd,boolean add) + { + BigDecimal originalQuantity = original.getQtyCsv(); + + BigDecimal quantityToAdd = itemToAdd.getQtyCsv(); + + BigDecimal finalQuantity = null; + + if(!add) + finalQuantity= originalQuantity.subtract(quantityToAdd); + else + finalQuantity= originalQuantity.add(quantityToAdd); + + + original.setQtyCsv(finalQuantity); + } + + /** + * Update Quantity to move in Stock Transfer + * @param original + * @param itemToAdd + * @param add + */ + public void updateQuantityToMove(ItemBean original, ItemBean itemToAdd,boolean add) + { + BigDecimal originalQuantity = original.getQtyToMove(); + + BigDecimal quantityToAdd = itemToAdd.getQtyToMove(); + + BigDecimal finalQuantity = null; + + if(!add) + finalQuantity= originalQuantity.subtract(quantityToAdd); + else + finalQuantity= originalQuantity.add(quantityToAdd); + + original.setQtyToMove(finalQuantity); + } + + public boolean equals(Object o) + { + if (o == null) + return false; + + ItemBean bean1 = (ItemBean) o; + if (bean1.getProductId().intValue() == this.getProductId().intValue()) + return true; + + return false; + + } + public String getBarCode() { + return barCode; + } + public void setBarCode(String barCode) { + this.barCode = barCode; + } + + public Integer getPriceListId() { + return priceListId; + } + + public void setPriceListId(Integer priceListId) { + this.priceListId = priceListId; + } + + public BigDecimal getPriceLimit() { + return priceLimit; + } + + public void setPriceLimit(BigDecimal priceLimit) { + this.priceLimit = priceLimit; + } + + public BigDecimal getPriceLimitTotal() { + return priceLimitTotal; + } + + public void setPriceLimitTotal(BigDecimal priceLimitTotal) { + this.priceLimitTotal = priceLimitTotal; + } + + public BigDecimal getDiscountedInclUnitPrice() { + return discountedInclUnitPrice; + } + + public void setDiscountedInclUnitPrice(BigDecimal discountedInclUnitPrice) { + this.discountedInclUnitPrice = discountedInclUnitPrice; + } + + public Boolean getIsDiscountOnPercentage() + { + return isDiscountOnPercentage; + } + + public void setIsDiscountOnPercentage(Boolean isDiscountOnPercentage) + { + this.isDiscountOnPercentage = isDiscountOnPercentage; + } + + public BigDecimal getQtyBook() + { + return qtyBook; + } + public void setQtyBook(BigDecimal qtyBook) + { + this.qtyBook = qtyBook; + } + public BigDecimal getQtyCount() + { + return qtyCount; + } + public void setQtyCount(BigDecimal qtyCount) + { + this.qtyCount = qtyCount; + } + public BigDecimal getQtyCsv() + { + return qtyCsv; + } + public void setQtyCsv(BigDecimal qtyCsv) + { + this.qtyCsv = qtyCsv; + } + public BigDecimal getBookQtyValue() { + return bookQtyValue; + } + public void setBookQtyValue(BigDecimal bookQtyValue) { + this.bookQtyValue = bookQtyValue; + } + public Integer getInventoryLineId() + { + return inventoryLineId; + } + public void setInventoryLineId(Integer inventoryLineId) + { + this.inventoryLineId = inventoryLineId; + } + public Boolean getIsDiscountOnTotal() + { + return isDiscountOnTotal; + } + + public BigDecimal getCountQtyValue() + { + return countQtyValue; + } + public void setCountQtyValue(BigDecimal countQtyValue) + { + this.countQtyValue = countQtyValue; + } + public Integer getInventoryId() + { + return inventoryId; + } + public void setInventoryId(Integer inventoryId) + { + this.inventoryId = inventoryId; + } + + public void setIsDiscountOnTotal(Boolean isDiscountOnTotal) + { + this.isDiscountOnTotal = isDiscountOnTotal; + } + + public BigDecimal getListPrice() { + return listPrice; + } + + public void setListPrice(BigDecimal listPrice) { + this.listPrice = listPrice; + } + + public BigDecimal getStockValue() + { + return stockValue; + } + + public void setStockValue(BigDecimal stockValue) + { + this.stockValue = stockValue; + } + + public BigDecimal getQtyToMove() + { + return qtyToMove; + } + + public void setQtyToMove(BigDecimal qtyToMove) + { + this.qtyToMove = qtyToMove; + } + + public BigDecimal getQtyOnHand() + { + return qtyOnHand; + } + + public void setQtyOnHand(BigDecimal qtyOnHand) + { + this.qtyOnHand = qtyOnHand; + } + + public Integer getUnitsPerPack() + { + return unitsPerPack; + } + + public void setUnitsPerPack(Integer unitsPerPack) + { + this.unitsPerPack = unitsPerPack; + } + + public Integer getNoOfPack() + { + return noOfPack; + } + + public void setNoOfPack(Integer noOfPack) + { + this.noOfPack = noOfPack; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/beans/LocatorBean.java b/posterita/posterita/src/main/org/posterita/beans/LocatorBean.java new file mode 100644 index 0000000000..bf65c7f46e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/LocatorBean.java @@ -0,0 +1,116 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Jul-2005 by alok + * + */ +package org.posterita.beans; + + +public class LocatorBean extends UDIBean +{ + + public String getAisle() + { + return aisle; + } + public void setAisle(String aisle) + { + this.aisle = aisle; + } + public String getBin() + { + return bin; + } + public void setBin(String bin) + { + this.bin = bin; + } + public Boolean getIsDefault() + { + return isDefault; + } + public void setIsDefault(Boolean isDefault) + { + this.isDefault = isDefault; + } + public String getLevel() + { + return level; + } + public void setLevel(String level) + { + this.level = level; + } + public Integer getWarehouseId() + { + return warehouseId; + } + public void setWarehouseId(Integer warehouseId) + { + this.warehouseId = warehouseId; + } + + public String getWarehouseName() + { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + + + public Integer getAttributeSetInstance() + { + return attributeSetInstance; + } + public void setAttributeSetInstance(Integer attributeSetInstance) + { + this.attributeSetInstance = attributeSetInstance; + } + public String getSernoAttributeSetInstance() + { + return sernoAttributeSetInstance; + } + public void setSernoAttributeSetInstance(String sernoAttributeSetInstance) + { + this.sernoAttributeSetInstance = sernoAttributeSetInstance; + } + + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public Integer getLocatorId() + { + return locatorId; + } + public void setLocatorId(Integer locatorId) + { + this.locatorId = locatorId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/LoginBean.java b/posterita/posterita/src/main/org/posterita/beans/LoginBean.java new file mode 100644 index 0000000000..d010de9612 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/LoginBean.java @@ -0,0 +1,76 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ +package org.posterita.beans; + + +public class LoginBean extends UDIBean +{ + + public Integer getRoleId() { + return roleId; + } + public void setRoleId(Integer roleId) { + this.roleId = roleId; + } + public String getUserPIN() + { + return userPIN; + } + public void setUserPIN(String userPIN) + { + this.userPIN = userPIN; + } + public String getPassword() + { + return password; + } + public void setPassword(String password) + { + this.password = password; + } + public String getUsername() + { + return username; + } + public void setUsername(String username) + { + this.username = username; + } + + public Integer getId() + { + return id; + } + public void setId(Integer id) + { + this.id = id; + } + + public Integer getUserId() + { + return userId; + } + public void setUserId(Integer userId) + { + this.userId = userId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/MMovementCartBean.java b/posterita/posterita/src/main/org/posterita/beans/MMovementCartBean.java new file mode 100644 index 0000000000..2c4b9b2240 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/MMovementCartBean.java @@ -0,0 +1,84 @@ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + +public class MMovementCartBean extends UDIBean +{ + private ArrayList items; + private String currency; + private BigDecimal totalPrice; + private int pricelistId; + private BigDecimal stockValue; + private BigDecimal qtyToMove; + private BigDecimal qtyOnHand; + + public String getCurrency() + { + return currency; + } + + public void setCurrency(String currency) + { + this.currency = currency; + } + + public ArrayList getItems() + { + return items; + } + + public void setItems(ArrayList items) + { + this.items = items; + } + + public BigDecimal getTotalPrice() + { + return totalPrice; + } + + public void setTotalPrice(BigDecimal totalPrice) + { + this.totalPrice = totalPrice; + } + + public int getPricelistId() { + return pricelistId; + } + + public void setPricelistId(int pricelistId) { + this.pricelistId = pricelistId; + } + + public BigDecimal getStockValue() + { + return stockValue; + } + + public void setStockValue(BigDecimal stockValue) + { + this.stockValue = stockValue; + } + + public BigDecimal getQtyToMove() + { + return qtyToMove; + } + + public void setQtyToMove(BigDecimal qtyToMove) + { + this.qtyToMove = qtyToMove; + } + + public BigDecimal getQtyOnHand() + { + return qtyOnHand; + } + + public void setQtyOnHand(BigDecimal qtyOnHand) + { + this.qtyOnHand = qtyOnHand; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/MenuItemBean.java b/posterita/posterita/src/main/org/posterita/beans/MenuItemBean.java new file mode 100644 index 0000000000..19a8c57bd5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/MenuItemBean.java @@ -0,0 +1,102 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + + +public class MenuItemBean extends UDIBean +{ + + + public Integer getMenuId() + { + return menuId; + } + public void setMenuId(Integer menuId) + { + this.menuId = menuId; + } + public String getMenuItemName() + { + return menuItemName; + } + public void setMenuItemName(String menuItemName) + { + this.menuItemName = menuItemName; + } + public String getMenuLink() + { + return menuLink; + } + public void setMenuLink(String menuLink) + { + this.menuLink = menuLink; + } + public Integer getParentMenuId() + { + return parentMenuId; + } + public void setParentMenuId(Integer parentMenuId) + { + this.parentMenuId = parentMenuId; + } + + public Integer getId() + { + return id; + } + public void setId(Integer id) + { + this.id = id; + } + + public Boolean getIsActive() + { + return isActive; + } + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + public String getName() + { + return name; + } + public void setName(String name) + { + this.name = name; + } + public Boolean getIsClosable() + { + return isClosable; + } + public void setIsClosable(Boolean isClosable) + { + this.isClosable = isClosable; + } + + public String getDescription() + { + return description; + } + public void setDescription(String description) + { + this.description = description; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/MessageBean.java b/posterita/posterita/src/main/org/posterita/beans/MessageBean.java new file mode 100644 index 0000000000..4850a2d410 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/MessageBean.java @@ -0,0 +1,126 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 1, 2005 by din + */ + +package org.posterita.beans; + +import java.sql.Timestamp; + +public class MessageBean extends UDIBean +{ + public String getMessage() + { + return message; + } + public void setMessage(String message) + { + this.message = message; + } + public Integer getMessageID() + { + return messageID; + } + public void setMessageID(Integer messageID) + { + this.messageID = messageID; + } + public String getSubject() + { + return subject; + } + public void setSubject(String subject) + { + this.subject = subject; + } + public Integer getCounterOrgID() + { + return counterOrgID; + } + public void setCounterOrgID(Integer counterOrgID) + { + this.counterOrgID = counterOrgID; + } + public String getCounterOrgName() + { + return counterOrgName; + } + public void setCounterOrgName(String counterOrgName) + { + this.counterOrgName = counterOrgName; + } + public Integer getOrgId() + { + return orgId; + } + public void setOrgID(Integer orgId) + { + this.orgId = orgId; + } + public String getRead() + { + return read; + } + public void setRead(String read) + { + this.read = read; + } + public Timestamp getDateCreated() + { + return dateCreated; + } + public void setDateCreated(Timestamp dateCreated) + { + this.dateCreated = dateCreated; + } + public String getCounterOrderStatusInfo() + { + return counterOrderStatusInfo; + } + public void setCounterOrderStatusInfo(String counterOrderStatusInfo) + { + this.counterOrderStatusInfo = counterOrderStatusInfo; + } + public String getOrderStatusInfo() + { + return orderStatusInfo; + } + public void setOrderStatusInfo(String orderStatusInfo) + { + this.orderStatusInfo = orderStatusInfo; + } + public Boolean getIsActive() + { + return isActive; + } + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + public Integer[] getCheckBox() + { + return checkBox; + } + + public void setCheckBox(Integer[] checkBox) + { + this.checkBox = checkBox; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/MessageLoggerBean.java b/posterita/posterita/src/main/org/posterita/beans/MessageLoggerBean.java new file mode 100644 index 0000000000..fa0eebe47c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/MessageLoggerBean.java @@ -0,0 +1,58 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * */ +package org.posterita.beans; + + +public class MessageLoggerBean +{ + private String cause; + private String error; + private String description; + + public String getCause() + { + return cause; + } + + public void setCause(String cause) + { + this.cause = cause; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getError() + { + return error; + } + + public void setError(String error) + { + this.error = error; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/MinOutHistoryBean.java b/posterita/posterita/src/main/org/posterita/beans/MinOutHistoryBean.java new file mode 100644 index 0000000000..7790d84f93 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/MinOutHistoryBean.java @@ -0,0 +1,44 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + + +public class MinOutHistoryBean extends UDIBean +{ + public Integer getMinOutId() + { + return minOutId; + } + + public void setMinOutId(Integer minOutId) + { + this.minOutId = minOutId; + } + + public Integer getInvoiceId() + { + return invoiceId; + } + + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OpenItemBean.java b/posterita/posterita/src/main/org/posterita/beans/OpenItemBean.java new file mode 100644 index 0000000000..db1f697866 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OpenItemBean.java @@ -0,0 +1,284 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 17, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + + +public class OpenItemBean extends UDIBean +{ + + + public BigDecimal getAvailableAmt() + { + return AvailableAmt; + } + public void setAvailableAmt(BigDecimal availableAmt) + { + AvailableAmt = availableAmt; + } + public BigDecimal getPaymentAllocatedAmt() + { + return paymentAllocatedAmt; + } + public void setPaymentAllocatedAmt(BigDecimal paymentAllocatedAmt) + { + this.paymentAllocatedAmt = paymentAllocatedAmt; + } + public String getAllocationStatus() + { + return allocationStatus; + } + public void setAllocationStatus(String allocationStatus) + { + this.allocationStatus = allocationStatus; + } + public BigDecimal getAllocatedAmount() { + return allocatedAmount; + } + public void setAllocatedAmount(BigDecimal allocatedAmount) { + this.allocatedAmount = allocatedAmount; + } + + public Integer[] getPaymentIds() { + return paymentIds; + } + public void setPaymentIds(Integer[] paymentIds) { + this.paymentIds = paymentIds; + } + public String getTrxDate() { + return trxDate; + } + public void setTrxDate(String trxDate) { + this.trxDate = trxDate; + } + public BigDecimal getTaxedAmt() { + return taxedAmt; + } + public void setTaxedAmt(BigDecimal taxedAmt) { + this.taxedAmt = taxedAmt; + } + public Integer getPaymentId() { + return paymentId; + } + public void setPaymentId(Integer paymentId) { + this.paymentId = paymentId; + } + public String getPaymentNo() { + return paymentNo; + } + public void setPaymentNo(String paymentNo) { + this.paymentNo = paymentNo; + } + + + public String getTenderType() { + return tenderType; + } + public void setTenderType(String tenderType) { + this.tenderType = tenderType; + } + public String getForward() { + return forward; + } + public void setForward(String forward) { + this.forward = forward; + } + public String getPartnerName() { + return partnerName; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public String getPaymentTermName() { + return paymentTermName; + } + public void setPaymentTermName(String paymentTermName) { + this.paymentTermName = paymentTermName; + } + public String getInvoiceNo() { + return invoiceNo; + } + public void setInvoiceNo(String invoiceNo) { + this.invoiceNo = invoiceNo; + } + public String getChequeNo() { + return chequeNo; + } + public void setChequeNo(String chequeNo) { + this.chequeNo = chequeNo; + } + public String getCreditCardNumber() { + return creditCardNumber; + } + public void setCreditCardNumber(String creditCardNumber) { + this.creditCardNumber = creditCardNumber; + } + public String getInvoiceDate() { + return invoiceDate; + } + public void setInvoiceDate(String invoiceDate) { + this.invoiceDate = invoiceDate; + } + public Integer getBpartnerId() { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + public Integer getPaymentTermId() { + return paymentTermId; + } + public Integer getCurrencyId() { + return currencyId; + } + public void setCurrencyId(Integer currencyId) { + this.currencyId = currencyId; + } + + public Integer getDaysDue() { + return daysDue; + } + public void setDaysDue(Integer daysDue) { + this.daysDue = daysDue; + } + public BigDecimal getDiscountAmt() { + return discountAmt; + } + public void setDiscountAmt(BigDecimal discountAmt) { + this.discountAmt = discountAmt; + } + public String getDiscountDate() { + return discountDate; + } + public void setDiscountDate(String discountDate) { + this.discountDate = discountDate; + } + public String getDocumentNo() { + return documentNo; + } + public void setDocumentNo(String documentNo) { + this.documentNo = documentNo; + } + public Timestamp getDueDate() { + return dueDate; + } + public void setDueDate(Timestamp dueDate) { + this.dueDate = dueDate; + } + + public Integer getInvoiceId() { + return invoiceId; + } + public void setInvoiceId(Integer invoiceId) { + this.invoiceId = invoiceId; + } + public Integer getInvoiceScheduleId() { + return invoiceScheduleId; + } + public void setInvoiceScheduleId(Integer invoiceScheduleId) { + this.invoiceScheduleId = invoiceScheduleId; + } + public Boolean getIsSoTrx() { + return isSoTrx; + } + public void setIsSoTrx(Boolean isSoTrx) { + this.isSoTrx = isSoTrx; + } + public Integer getNetDays() { + return netDays; + } + public void setNetDays(Integer netDays) { + this.netDays = netDays; + } + public BigDecimal getOpenAmt() { + return openAmt; + } + public void setOpenAmt(BigDecimal openAmt) { + this.openAmt = openAmt; + } + public Integer getOrderId() { + return orderId; + } + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + public BigDecimal getPaidAmt() { + return paidAmt; + } + public void setPaidAmt(BigDecimal paidAmt) { + this.paidAmt = paidAmt; + } + public Integer getPaumentTermId() { + return paymentTermId; + } + public void setPaymentTermId(Integer paymentTermId) { + this.paymentTermId = paymentTermId; + } + public BigDecimal getInvoiceGrandTotal() { + return invoiceGrandTotal; + } + public void setInvoiceGrandTotal(BigDecimal invoiceGrandTotal) { + this.invoiceGrandTotal = invoiceGrandTotal; + } + + public BigDecimal getOverUnderPayment() { + return overUnderPayment; + } + public void setOverUnderPayment(BigDecimal overUnderPayment) { + this.overUnderPayment = overUnderPayment; + } + + public BigDecimal getPaymentAmt() { + return paymentAmt; + } + public void setPaymentAmt(BigDecimal paymentAmt) { + this.paymentAmt = paymentAmt; + } + public String getTrxType() { + return trxType; + } + public void setTrxType(String trxType) { + this.trxType = trxType; + } + public BigDecimal getWriteOffAmt() { + return writeOffAmt; + } + public void setWriteOffAmt(BigDecimal writeOffAmt) { + this.writeOffAmt = writeOffAmt; + } + public String getCurrencySymbole() { + return currencySymbole; + } + public void setCurrencySymbole(String currencySymbole) { + this.currencySymbole = currencySymbole; + } + public Integer[] getInvoiceIds() { + return invoiceIds; + } + public void setInvoiceIds(Integer[] invoiceIds) { + this.invoiceIds = invoiceIds; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OrderBean.java b/posterita/posterita/src/main/org/posterita/beans/OrderBean.java new file mode 100644 index 0000000000..3ea7d69e09 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OrderBean.java @@ -0,0 +1,172 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +public class OrderBean +{ + private String orderType; + private String docStatus; + private String paymentRule; + private Integer orderId; + private Integer paymentTermId; + private Integer bpartnerId; + private Integer salesRepId; + private Integer priceListId; + private Integer warehouseId; + + //payment details + private BigDecimal amountTendered; + private BigDecimal amountRefunded; + private String cardType; + private String cardNo; + private String chequeNo; + private BigDecimal cashAmt; + private BigDecimal chequeAmt; + private BigDecimal cardAmt; + + private BigDecimal writeOffAmt; + private BigDecimal discountAmt; + + //getters and setters + + public String getOrderType() { + return orderType; + } + public void setOrderType(String orderType) { + this.orderType = orderType; + } + public String getDocStatus() { + return docStatus; + } + public void setDocStatus(String docStatus) { + this.docStatus = docStatus; + } + public String getPaymentRule() { + return paymentRule; + } + public void setPaymentRule(String paymentRule) { + this.paymentRule = paymentRule; + } + public Integer getOrderId() { + return orderId; + } + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + public Integer getPaymentTermId() { + return paymentTermId; + } + public void setPaymentTermId(Integer paymentTermId) { + this.paymentTermId = paymentTermId; + } + public Integer getBpartnerId() { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + public Integer getSalesRepId() { + return salesRepId; + } + public void setSalesRepId(Integer salesRepId) { + this.salesRepId = salesRepId; + } + public Integer getPriceListId() { + return priceListId; + } + public void setPriceListId(Integer priceListId) { + this.priceListId = priceListId; + } + public Integer getWarehouseId() { + return warehouseId; + } + public void setWarehouseId(Integer warehouseId) { + this.warehouseId = warehouseId; + } + public BigDecimal getAmountTendered() { + return amountTendered; + } + public void setAmountTendered(BigDecimal amountTendered) { + this.amountTendered = amountTendered; + } + public BigDecimal getAmountRefunded() { + return amountRefunded; + } + public void setAmountRefunded(BigDecimal amountRefunded) { + this.amountRefunded = amountRefunded; + } + public String getCardType() { + return cardType; + } + public void setCardType(String cardType) { + this.cardType = cardType; + } + public String getCardNo() { + return cardNo; + } + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + public String getChequeNo() { + return chequeNo; + } + public void setChequeNo(String chequeNo) { + this.chequeNo = chequeNo; + } + public BigDecimal getCashAmt() { + return cashAmt; + } + public void setCashAmt(BigDecimal cashAmt) { + this.cashAmt = cashAmt; + } + public BigDecimal getChequeAmt() { + return chequeAmt; + } + public void setChequeAmt(BigDecimal chequeAmt) { + this.chequeAmt = chequeAmt; + } + public BigDecimal getCardAmt() { + return cardAmt; + } + public void setCardAmt(BigDecimal cardAmt) { + this.cardAmt = cardAmt; + } + public BigDecimal getWriteOffAmt() { + return writeOffAmt; + } + public void setWriteOffAmt(BigDecimal writeOffAmt) { + this.writeOffAmt = writeOffAmt; + } + public BigDecimal getDiscountAmt() { + return discountAmt; + } + public void setDiscountAmt(BigDecimal discountAmt) { + this.discountAmt = discountAmt; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OrderHistoryBean.java b/posterita/posterita/src/main/org/posterita/beans/OrderHistoryBean.java new file mode 100644 index 0000000000..e67ff4799d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OrderHistoryBean.java @@ -0,0 +1,339 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 04-Aug-2005 by alok + * + */ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; + + +public class OrderHistoryBean extends FilterBean +{ + public ArrayList orderHistoryBean; + private ArrayList invoiceHistoryList; + private ArrayList orderHistoryList; + + protected Integer refOrderId; + private FilterBean filterBean; + private String serno; + + + + + + public Integer getDocumentId() { + return documentId; + } + public void setDocumentId(Integer documentId) { + this.documentId = documentId; + } + public Integer[] getOrderIds() { + return orderIds; + } + public void setOrderIds(Integer[] orderIds) { + this.orderIds = orderIds; + } + public String getSerno() { + return serno; + } + + public void setSerno(String serno) { + this.serno = serno; + } + + public Integer getRefOrderId() + { + return refOrderId; + } + + public void setRefOrderId(Integer refOrderId) + { + this.refOrderId = refOrderId; + } + + public Integer getRefToQuote() + { + return refToQuote; + } + public void setRefToQuote(Integer refToQuote) + { + this.refToQuote = refToQuote; + } + public String getOrderType() + { + return orderType; + } + public void setOrderType(String orderType) + { + this.orderType = orderType; + } + public ArrayList getOrderHistoryBean() + { + return orderHistoryBean; + } + + public void setOrderHistoryBean(ArrayList orderHistoryBean) + { + this.orderHistoryBean = orderHistoryBean; + } + + public Integer getInOutId() + { + return inOutId; + } + + public void setInOutId(Integer inOutId) + { + this.inOutId = inOutId; + } + + public Integer getInvoiceId() + { + return invoiceId; + } + + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + + public Integer getPaymentId() + { + return paymentId; + } + + public void setPaymentId(Integer paymentId) + { + this.paymentId = paymentId; + } + + public String getPartnerName() + { + return partnerName; + } + + public void setPartnerName(String partnerName) + { + this.partnerName = partnerName; + } + public Integer getBpartnerId() + { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + public Timestamp getDateOrdered() + { + return dateOrdered; + } + public void setDateOrdered(Timestamp dateOrdered) + { + this.dateOrdered = dateOrdered; + } + public String getDatePromised() + { + return datePromised; + } + public void setDatePromised(String datePromised) + { + this.datePromised = datePromised; + } + public BigDecimal getOrderGrandTotal() + { + return orderGrandTotal; + } + public void setOrderGrandTotal(BigDecimal orderGrandTotal) + { + this.orderGrandTotal = orderGrandTotal; + } + public String getIsApproved() + { + return isApproved; + } + public void setIsApproved(String isApproved) + { + this.isApproved = isApproved; + } + public String getIsDelivered() + { + return isDelivered; + } + public void setIsDelivered(String isDelivered) + { + this.isDelivered = isDelivered; + } + public String getIsInvoiced() + { + return isInvoiced; + } + public void setIsInvoiced(String isInvoiced) + { + this.isInvoiced = isInvoiced; + } + public Boolean getIsSotrx() + { + return isSoTrx; + } + public void setIsSotrx(Boolean isSotrx) + { + this.isSoTrx = isSotrx; + } + public Integer getOrderId() + { + return orderId; + } + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + public String getPoReference() + { + return poReference; + } + public void setPoReference(String poReference) + { + this.poReference = poReference; + } + + public Boolean getIsSoTrx() + { + return isSoTrx; + } + + public void setIsSoTrx(Boolean isSoTrx) + { + this.isSoTrx = isSoTrx; + } + + public ArrayList getInvoiceHistoryList() + { + return invoiceHistoryList; + } + + public void setInvoiceHistoryList(ArrayList list) + { + this.invoiceHistoryList = list; + } + + public String getSotrxFlag() + { + return sotrxFlag; + } + + public void setSotrxFlag(String sotrxFlag) + { + this.sotrxFlag = sotrxFlag; + } + + public FilterBean getFilterBean() + { + return filterBean; + } + + public void setFilterBean(FilterBean filterBean) + { + this.filterBean = filterBean; + } + + public String getBpName() + { + return bpName; + } + + public void setBpName(String bpName) + { + this.bpName = bpName; + } + + public String getDocStatus() + { + return docStatus; + } + + public void setDocStatus(String docStatus) + { + this.docStatus = docStatus; + } + + public ArrayList getOrderHistoryList() + { + return orderHistoryList; + } + + public void setOrderHistoryList(ArrayList orderHistoryList) + { + this.orderHistoryList = orderHistoryList; + } + + public String getCompiereDocStatus() + { + return compiereDocStatus; + } + + public void setCompiereDocStatus(String compiereDocStatus) + { + this.compiereDocStatus = compiereDocStatus; + } + + public Integer getOrderlineCount() + { + return orderlineCount; + } + + public void setOrderlineCount(Integer orderlineCount) + { + this.orderlineCount = orderlineCount; + } + + public Integer getOrderlineInvoicedCount() + { + return orderlineInvoicedCount; + } + + public void setOrderlineInvoicedCount(Integer orderlineInvoicedCount) + { + this.orderlineInvoicedCount = orderlineInvoicedCount; + } + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public Timestamp getDateInvoiced() + { + return dateInvoiced; + } + + public void setDateInvoiced(Timestamp dateInvoiced) + { + this.dateInvoiced = dateInvoiced; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OrderInfoBean.java b/posterita/posterita/src/main/org/posterita/beans/OrderInfoBean.java new file mode 100644 index 0000000000..14c2ebd399 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OrderInfoBean.java @@ -0,0 +1,149 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 8, 2005 by praveen + * + */ +package org.posterita.beans; + +import java.sql.Timestamp; + +public class OrderInfoBean +{ + private Integer orderId; + private Integer poReference; + private Timestamp dateOrdered; + private String docStatus; + private String orderedFrom; + private String vinNumber; + private String reserved; + private String assetStatus; + private String orderBy; + private String docType; + private Integer attributeSetInstanceId; + + public Timestamp getDateOrdered() + { + return dateOrdered; + } + + public void setDateOrdered(Timestamp dateOrdered) + { + this.dateOrdered = dateOrdered; + } + + public String getDocStatus() + { + return docStatus; + } + + public void setDocStatus(String docStatus) + { + this.docStatus = docStatus; + } + + public String getOrderedFrom() + { + return orderedFrom; + } + + public void setOrderedFrom(String orderedFrom) + { + this.orderedFrom = orderedFrom; + } + + public Integer getPoReference() + { + return poReference; + } + + public void setPoReference(Integer poReference) + { + this.poReference = poReference; + } + + public Integer getOrderId() + { + return orderId; + } + + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + + public String getAssetStatus() + { + return assetStatus; + } + + public void setAssetStatus(String assetStatus) + { + this.assetStatus = assetStatus; + } + + public String getDocType() + { + return docType; + } + + public void setDocType(String docType) + { + this.docType = docType; + } + + public String getOrderBy() + { + return orderBy; + } + + public void setOrderBy(String orderBy) + { + this.orderBy = orderBy; + } + + public String getReserved() + { + return reserved; + } + + public void setReserved(String reserved) + { + this.reserved = reserved; + } + + public String getVinNumber() + { + return vinNumber; + } + + public void setVinNumber(String vinNumber) + { + this.vinNumber = vinNumber; + } + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OrderLineAttributeSetInstanceBean.java b/posterita/posterita/src/main/org/posterita/beans/OrderLineAttributeSetInstanceBean.java new file mode 100644 index 0000000000..0bea792765 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OrderLineAttributeSetInstanceBean.java @@ -0,0 +1,47 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + + +public class OrderLineAttributeSetInstanceBean +{ + private int orderLineId; + private int attributeSetInstanceId; + + public int getOrderLineId() + { + return orderLineId; + } + + public void setOrderLineId(int orderLineId) + { + this.orderLineId = orderLineId; + } + + public int getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(int attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OrderLineBean.java b/posterita/posterita/src/main/org/posterita/beans/OrderLineBean.java new file mode 100644 index 0000000000..d9edbe6f86 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OrderLineBean.java @@ -0,0 +1,476 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 09-Aug-2005 by alok + * + */ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + +public class OrderLineBean extends DocumentBean implements Comparable +{ + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public Double getTotalActualPrice() { + return totalActualPrice; + } + public void setTotalActualPrice(Double totalActualPrice) { + this.totalActualPrice = totalActualPrice; + } + public Double getPaymentByCard() { + return paymentByCard; + } + public void setPaymentByCard(Double paymentByCard) { + this.paymentByCard = paymentByCard; + } + public Double getPaymentByCash() { + return paymentByCash; + } + public void setPaymentByCash(Double paymentByCash) { + this.paymentByCash = paymentByCash; + } + public Double getPaymentByChq() { + return paymentByChq; + } + public void setPaymentByChq(Double paymentByChq) { + this.paymentByChq = paymentByChq; + } + public String[] getActualPrice() { + return actualPrice; + } + public void setActualPrice(String[] actualPrice) { + this.actualPrice = actualPrice; + } + + public String[] getDiscountPercent() { + return discountPercent; + } + public void setDiscountPercent(String[] discountPercent) { + this.discountPercent = discountPercent; + } + public String getQtyAndItem() { + return qtyAndItem; + } + public void setQtyAndItem(String qtyAndItem) { + this.qtyAndItem = qtyAndItem; + } + public String getBarCode() { + return barCode; + } + public void setBarCode(String barCode) { + this.barCode = barCode; + } + + public String getPartnerName() { + return partnerName; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public Integer[] getPosOrderLineIds() + { + return posOrderLineIds; + } + + public void setPosOrderLineIds(Integer[] posOrderLineIds) + { + this.posOrderLineIds = posOrderLineIds; + } + public String getChequeNo() + { + return chequeNo; + } + + public void setChequeNo(String chequeNo) + { + this.chequeNo = chequeNo; + } + + public Integer getCreditCardExpMonth() + { + return creditCardExpMonth; + } + + public void setCreditCardExpMonth(Integer creditCardExpMonth) + { + this.creditCardExpMonth = creditCardExpMonth; + } + + public Integer getCreditCardExpYear() + { + return creditCardExpYear; + } + + public void setCreditCardExpYear(Integer creditCardExpYear) + { + this.creditCardExpYear = creditCardExpYear; + } + + public String getCreditCardNumber() + { + return creditCardNumber; + } + + public void setCreditCardNumber(String creditCardNumber) + { + this.creditCardNumber = creditCardNumber; + } + + public String getCreditCardType() + { + return creditCardType; + } + + public void setCreditCardType(String creditCardType) + { + this.creditCardType = creditCardType; + } + public Integer getOrderId() + { + return orderId; + } + + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + public String getSurname() { + return surname; + } + public void setSurname(String surname) { + this.surname = surname; + } + + public Integer getBpartnerId() + { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + public Boolean getIsQtyReserved() + { + return isQtyReserved; + } + + public void setIsQtyReserved(Boolean isQtyReserved) + { + this.isQtyReserved = isQtyReserved; + } + public String getEngineNo() { + return engineNo; + } + public void setEngineNo(String engineNo) { + this.engineNo = engineNo; + } + public BigDecimal getQuantity() + { + return quantity; + } + + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + + public Integer[] getCheckBox() + { + return checkBox; + } + public void setCheckBox(Integer [] checkBox) + { + this.checkBox = checkBox; + } + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public ArrayList getOrderLineList() + { + return orderLineList; + } + public void setOrderLineList(ArrayList orderLineList) + { + this.orderLineList = orderLineList; + } + + public Integer getOrderLineId() + { + return orderLineId; + } + + public void setOrderLineId(Integer orderLineId) + { + this.orderLineId = orderLineId; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public Integer getAllocationId() + { + return allocationId; + } + + public void setAllocationId(Integer allocationId) + { + this.allocationId = allocationId; + } + + public boolean equals(Object obj) + { + OrderLineBean target = (OrderLineBean) obj; + + if ( obj == null) + return false; + + if (this.getAttributeSetInstanceId().equals(target.getAttributeSetInstanceId())) + return true; + + return false; + } + + public String getSubmit() + { + return submit; + } + + public void setSubmit(String submit) + { + this.submit = submit; + } + + + public int compareTo(Object o) + { + OrderLineBean src = (OrderLineBean) o; + + if (src.getAttributeSetInstanceId().intValue() == this.getAttributeSetInstanceId().intValue()) + return 0; + + + return -1; + } + + + + + + + public BigDecimal getAmountGiven() + { + return amountGiven; + } + + public void setAmountGiven(BigDecimal amountGiven) + { + this.amountGiven = amountGiven; + } + + public BigDecimal getAmountRefunded() + { + return amountRefunded; + } + + public void setAmountRefunded(BigDecimal amountRefunded) + { + this.amountRefunded = amountRefunded; + } + public String getTrxType() + { + return trxType; + } + + public void setTrxType(String trxType) + { + this.trxType = trxType; + } + + public BigDecimal getTransferAmount() { + return transferAmount; + } + public void setTransferAmount(BigDecimal transferAmount) { + this.transferAmount = transferAmount; + } + + public Integer getCashBookIds() { + return cashBookIds; + } + public void setCashBookIds(Integer cashBookIds) { + this.cashBookIds = cashBookIds; + } + public String getIsSales() { + return isSales; + } + public void setIsSales(String isSales) { + this.isSales = isSales; + } + public String getIfAdd() { + return ifAdd; + } + public void setIfAdd(String ifAdd) { + this.ifAdd = ifAdd; + } + + public String getVendorName() { + return vendorName; + } + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getDocumentNo() { + return documentNo; + } + public void setDocumentNo(String documentNo) { + this.documentNo = documentNo; + } + + public BigDecimal getUserDiscount() { + return userDiscount; + } + public void setUserDiscount(BigDecimal userDiscount) { + this.userDiscount = userDiscount; + } + + public Integer getPaymentTermId() { + return paymentTermId; + } + public void setPaymentTermId(Integer paymentTermId) { + this.paymentTermId = paymentTermId; + } + + public String getPaymentTermName() { + return paymentTermName; + } + public void setPaymentTermName(String paymentTermName) { + this.paymentTermName = paymentTermName; + } + public String getToBeShipped() { + return toBeShipped; + } + public void setToBeShipped(String toBeShipped) { + this.toBeShipped = toBeShipped; + } + + public Boolean getOpenDrawer() { + return openDrawer; + } + public void setOpenDrawer(Boolean openDrawer) { + this.openDrawer = openDrawer; + } + + public void setUom(String uom) + { + this.uom = uom; + } + + public String getUom() + { + return this.uom; + } + public Integer getPriceListId() { + return priceListId; + } + public void setPriceListId(Integer priceListId) { + this.priceListId = priceListId; + } + + public BigDecimal getUnitPurchasePrice() + { + return unitPurchasePrice; + } + + public void setUnitPurchasePrice(BigDecimal unitPurchasePrice) + { + this.unitPurchasePrice = unitPurchasePrice; + } + + public BigDecimal getGrossProfit() + { + return grossProfit; + } + + public void setGrossProfit(BigDecimal grossProfit) + { + this.grossProfit = grossProfit; + } + + public BigDecimal getTotalGrossProfit() + { + return totalGrossProfit; + } + + public void setTotalGrossProfit(BigDecimal totalGrossProfit) + { + this.totalGrossProfit = totalGrossProfit; + } + + protected String paymentRule; + + public String getPaymentRule() { + return paymentRule; + } + + public void setPaymentRule(String paymentRule) { + this.paymentRule = paymentRule; + } + public Integer getRoleId() + { + return roleId; + } + public void setRoleId(Integer roleId) + { + this.roleId = roleId; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OrderLineImporterBean.java b/posterita/posterita/src/main/org/posterita/beans/OrderLineImporterBean.java new file mode 100644 index 0000000000..c7643bab34 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OrderLineImporterBean.java @@ -0,0 +1,28 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Nov 4, 2005 by ashley +* +*/ + +package org.posterita.beans; + +public class OrderLineImporterBean extends UDIBean +{ + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OrgBean.java b/posterita/posterita/src/main/org/posterita/beans/OrgBean.java new file mode 100644 index 0000000000..85002ae5f7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OrgBean.java @@ -0,0 +1,170 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + +public class OrgBean extends UDIBean +{ + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getAddress2() { + return address2; + } + + public void setAddress2(String address2) { + this.address2 = address2; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + public String getAddress1() + { + return address1; + } + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public String getCity() + { + return city; + } + + public void setCity(String city) + { + this.city = city; + } + + public String getOrgName() + { + return orgName; + } + + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + + public String getPostalAddress() + { + return postalAddress; + } + + public void setPostalAddress(String postalAddress1) + { + this.postalAddress = postalAddress1; + } + + public Integer getRegionId() + { + return regionId; + } + + public void setRegionId(Integer regionId) + { + this.regionId = regionId; + } + + public String getRegion() + { + return region; + } + + public void setRegion(String region) + { + this.region = region; + } + + + public String getFax() + { + return fax; + } + + public void setFax(String fax) + { + this.fax = fax; + } + + public String getPhone() + { + return phone; + } + + public void setPhone(String phone) + { + this.phone = phone; + } + + public Boolean getIsActive() + { + return isActive; + } + + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + public String getActive() + { + return active; + } + + public void setActive(String active) + { + this.active = active; + } + + public void setCountryId(Integer countryId) + { + this.countryId = countryId; + } + + public Integer getCountryId() + { + return this.countryId; + } + + public String getReceiptFooterMsg() + { + return receiptFooterMsg; + } + + public void setReceiptFooterMsg(String receiptFooterMsg) + { + this.receiptFooterMsg = receiptFooterMsg; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/OrgUsersBean.java b/posterita/posterita/src/main/org/posterita/beans/OrgUsersBean.java new file mode 100644 index 0000000000..073d4e3375 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/OrgUsersBean.java @@ -0,0 +1,60 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 2, 2005 by din + */ + +package org.posterita.beans; + +import java.util.Vector; + + + + +public class OrgUsersBean extends UDIBean +{ + + + public String getOrgName() + { + return orgName; + } + + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + + public Integer getOrgId() + { + return orgId; + } + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public Vector getOrgUsers() + { + return orgUsers; + } + public void setOrgUsers(Vector orgUsers) + { + this.orgUsers = orgUsers; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/POSBean.java b/posterita/posterita/src/main/org/posterita/beans/POSBean.java new file mode 100644 index 0000000000..2db5f71783 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/POSBean.java @@ -0,0 +1,234 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 17-Mar-2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + + +public class POSBean extends OrderLineBean +{ + public Timestamp getDateCreated() { + return dateCreated; + } + public void setDateCreated(Timestamp dateCreated) { + this.dateCreated = dateCreated; + } + public String getCashJournalDisc() { + return cashJournalDisc; + } + public void setCashJournalDisc(String cashJournalDisc) { + this.cashJournalDisc = cashJournalDisc; + } + public Integer getCashJournalId() { + return cashJournalId; + } + public void setCashJournalId(Integer cashJournalId) { + this.cashJournalId = cashJournalId; + } + public String getCashJournalName() { + return cashJournalName; + } + public void setCashJournalName(String cashJournalName) { + this.cashJournalName = cashJournalName; + } + public Timestamp getDateAcct() { + return dateAcct; + } + public void setDateAcct(Timestamp dateAcct) { + this.dateAcct = dateAcct; + } + public String getDocStatus() { + return docStatus; + } + public void setDocStatus(String docStatus) { + this.docStatus = docStatus; + } + public Integer getGrandTotal() { + return grandTotal; + } + public void setGrandTotal(Integer grandTotal) { + this.grandTotal = grandTotal; + } + public String getPaymentRule() { + return paymentRule; + } + public void setPaymentRule(String paymentRule) { + this.paymentRule = paymentRule; + } + public Integer getPriceListId() { + return priceListId; + } + public void setPriceListId(Integer priceListId) { + this.priceListId = priceListId; + } + public String getPriceListName() { + return priceListName; + } + public void setPriceListName(String priceListName) { + this.priceListName = priceListName; + } + public String getWarehouseName() { + return warehouseName; + } + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + public String getPosDesc() + { + return posDesc; + } + public void setPosDesc(String posDesc) + { + this.posDesc = posDesc; + } + public Integer getPosId() + { + return posId; + } + public void setPosId(Integer posId) + { + this.posId = posId; + } + public String getPosName() + { + return posName; + } + public void setPosName(String posName) + { + this.posName = posName; + } + public String getSaleRepName() + { + return saleRepName; + } + public void setSaleRepName(String saleRepName) + { + this.saleRepName = saleRepName; + } + public Integer getSalesRepId() + { + return salesRepId; + } + public void setSalesRepId(Integer salesRepId) + { + this.salesRepId = salesRepId; + } + public Integer getWarehouseId() + { + return warehouseId; + } + public void setWarehouseId(Integer warehouseId) + { + this.warehouseId = warehouseId; + } + public Integer getCashBookId() + { + return cashBookId; + } + + public void setCashBookId(Integer cashBookId) + { + this.cashBookId = cashBookId; + } + + public String getCashBookName() + { + return cashBookName; + } + + public void setCashBookName(String cashBookName) + { + this.cashBookName = cashBookName; + } + public String getTrxType() + { + return trxType; + } + + + public void setTrxType(String trxType) + { + this.trxType = trxType; + } + public BigDecimal getAmount() + { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + public BigDecimal getBeginingBalance() + { + return beginingBalance; + } + + public void setBeginingBalance(BigDecimal beginingBalance) + { + this.beginingBalance = beginingBalance; + } + + public BigDecimal getEndingBalance() + { + return endingBalance; + } + + public void setEndingBalance(BigDecimal endingBalance) + { + this.endingBalance = endingBalance; + } + + public BigDecimal getStatementDifference() + { + return statementDifference; + } + + public void setStatementDifference(BigDecimal statementDifference) + { + this.statementDifference = statementDifference; + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + buffer.append("\n POS NAME= "+ getPosName()); + buffer.append("\n PAYMENT RULE = " + getPaymentRule()); + buffer.append("\n TOTAL = "+getGrandTotal()); + buffer.append("\n The Begining Balance = "+getBeginingBalance()); + buffer.append("\n The Ending Balance = "+getEndingBalance()); + + return buffer.toString(); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/POSDescriptionBean.java b/posterita/posterita/src/main/org/posterita/beans/POSDescriptionBean.java new file mode 100644 index 0000000000..adff505990 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/POSDescriptionBean.java @@ -0,0 +1,55 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 4, 2006 + */ + + +package org.posterita.beans; + + +public class POSDescriptionBean extends UDIBean +{ + + + public String getPosName() { + return posName; + } + public void setPosName(String posName) { + this.posName = posName; + } + public Integer getPosId() { + return posId; + } + public void setPosId(Integer posId) { + this.posId = posId; + } + public Integer getWareHouseId() { + return wareHouseId; + } + public void setWareHouseId(Integer wareHouseId) { + this.wareHouseId = wareHouseId; + } + public String getWarehouseName() { + return warehouseName; + } + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/POSHelpBean.java b/posterita/posterita/src/main/org/posterita/beans/POSHelpBean.java new file mode 100644 index 0000000000..95f3c7a22d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/POSHelpBean.java @@ -0,0 +1,51 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 6 Feb 2008 18:03:33 by shameem + * + */ + +package org.posterita.beans; + +public class POSHelpBean extends UDIBean +{ + public String getSubject() { + return subject; + } + public void setSubject(String subject) { + this.subject = subject; + } + public String getFromAddress() { + return fromAddress; + } + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + public String getToAddresses() { + return toAddresses; + } + public void setToAddresses(String toAddresses) { + this.toAddresses = toAddresses; + } + public String getTextMessage() { + return textMessage; + } + public void setTextMessage(String textMessage) { + this.textMessage = textMessage; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/POSHistoryBean.java b/posterita/posterita/src/main/org/posterita/beans/POSHistoryBean.java new file mode 100644 index 0000000000..3727a209a5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/POSHistoryBean.java @@ -0,0 +1,214 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on May 15, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + + +public class POSHistoryBean extends UDIBean +{ + public Boolean isCustomer; + private Integer invoiceRefNo; + private String invoiceDocumentNo; + private BigDecimal amountPaid; + + public BigDecimal getGrossProfit() + { + return grossProfit; + } + public void setGrossProfit(BigDecimal grossProfit) + { + this.grossProfit = grossProfit; + } + public String getHistoryType() + { + return historyType; + } + public void setHistoryType(String historyType) + { + this.historyType = historyType; + } + public Integer getBpartnerId() + { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + public String getPaymentRule() { + return paymentRule; + } + public void setPaymentRule(String paymentRule) { + this.paymentRule = paymentRule; + } + public String getOrderType() { + return orderType; + } + public void setOrderType(String orderType) { + this.orderType = orderType; + } + public Integer getMonth() { + return month; + } + public void setMonth(Integer month) { + this.month = month; + } + public Integer getYear() { + return year; + } + public void setYear(Integer year) { + this.year = year; + } + public Timestamp getDateAcct() { + return dateAcct; + } + public void setDateAcct(Timestamp dateAcct) { + this.dateAcct = dateAcct; + } + public String getDocumentNo() { + return documentNo; + } + public void setDocumentNo(String documentNo) { + this.documentNo = documentNo; + } + public BigDecimal getOrderGrandTotal() { + return orderGrandTotal; + } + public void setOrderGrandTotal(BigDecimal orderGrandTotal) { + this.orderGrandTotal = orderGrandTotal; + } + public Integer getInvoiceId() { + return invoiceId; + } + public void setInvoiceId(Integer invoiceId) { + this.invoiceId = invoiceId; + } + public Integer getOrderId() { + return orderId; + } + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + public String getPartnerName() { + return partnerName; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public String getDocStatus() + { + return docStatus; + } + public void setDocStatus(String docStatus) + { + this.docStatus = docStatus; + } + public Boolean getIsCustomer() + { + return isCustomer; + } + public void setIsCustomer(Boolean isCustomer) + { + this.isCustomer = isCustomer; + } + + public Integer getInvoiceRefNo() + { + return invoiceRefNo; + } + + public void setInvoiceRefNo(Integer invoiceRefNo) + { + this.invoiceRefNo = invoiceRefNo; + } + public Integer getOrgId() { + return orgId; + } + public void setOrgId(Integer orgId) { + this.orgId = orgId; + } + + /** + * @return The cashBookId + */ + public Integer getCashBookId() + { + return cashBookId; + } + + /** + * @param cashBookId The cashBookId to set + */ + public void setCashBookId(Integer cashBookId) + { + this.cashBookId = cashBookId; + } + + /** + * @return The invoiceDocumentNo + */ + public String getInvoiceDocumentNo() + { + return invoiceDocumentNo; + } + + /** + * @param invoiceDocumentNo The invoiceDocumentNo to set + */ + public void setInvoiceDocumentNo(String invoiceDocumentNo) + { + this.invoiceDocumentNo = invoiceDocumentNo; + } + + /** + * @return The amountPaid + */ + public BigDecimal getAmountPaid() + { + return amountPaid; + } + + /** + * @param amountPaid The amountPaid to set + */ + public void setAmountPaid(BigDecimal amountPaid) + { + this.amountPaid = amountPaid; + } + /** + * @return The dateOrdered + */ + public Timestamp getDateOrdered() + { + return dateOrdered; + } + /** + * @param dateOrdered The dateOrdered to set + */ + public void setDateOrdered(Timestamp dateOrdered) + { + this.dateOrdered = dateOrdered; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/POSInfoBean.java b/posterita/posterita/src/main/org/posterita/beans/POSInfoBean.java new file mode 100644 index 0000000000..04a878b9f2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/POSInfoBean.java @@ -0,0 +1,107 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 3, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class POSInfoBean extends UDIBean +{ + public String getOrgName() + { + return orgName; + } + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + public String getPosName() + { + return posName; + } + public void setPosName(String posName) + { + this.posName = posName; + } + + public String getPaymentRule() { + return paymentRule; + } + public void setPaymentRule(String paymentRule) { + this.paymentRule = paymentRule; + } + public BigDecimal getOrderGrandTotal() { + return orderGrandTotal; + } + public void setOrderGrandTotal(BigDecimal orderGrandTotal) { + this.orderGrandTotal = orderGrandTotal; + } + + public BigDecimal getTillGrandTotal() + { + return tillGrandTotal; + } + public void setTillGrandTotal(BigDecimal tillGrandTotal) + { + this.tillGrandTotal = tillGrandTotal; + } + public BigDecimal getCashTotal() + { + return cashTotal; + } + + public void setCashTotal(BigDecimal cashTotal) + { + this.cashTotal = cashTotal; + } + + public BigDecimal getCardTotal() + { + return cardTotal; + } + public void setCardTotal(BigDecimal cardTotal) + { + this.cardTotal = cardTotal; + } + public BigDecimal getChequeTotal() + { + return chequeTotal; + } + public void setChequeTotal(BigDecimal chequeTotal) + { + this.chequeTotal = chequeTotal; + } + public String toString() + { + StringBuffer buffer = new StringBuffer(); + buffer.append("\n POS NAME= "+ getPosName()); + buffer.append("\n PAYMENT RULE = " + getPaymentRule()); + buffer.append("\n TOTAL = "+getOrderGrandTotal()); + + + return buffer.toString(); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/POSReportBean.java b/posterita/posterita/src/main/org/posterita/beans/POSReportBean.java new file mode 100644 index 0000000000..c9f2918795 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/POSReportBean.java @@ -0,0 +1,163 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 11, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class POSReportBean extends UDIBean +{ + + + + + + + + public Integer getProductId() { + return productId; + } + public void setProductId(Integer productId) { + this.productId = productId; + } + public BigDecimal getQtyInventoryIn() { + return qtyInventoryIn; + } + public void setQtyInventoryIn(BigDecimal qtyInventoryIn) { + this.qtyInventoryIn = qtyInventoryIn; + } + public BigDecimal getQtyInventoryOut() { + return qtyInventoryOut; + } + public void setQtyInventoryOut(BigDecimal qtyInventoryOut) { + this.qtyInventoryOut = qtyInventoryOut; + } + public String getProductCategory() { + return productCategory; + } + public void setProductCategory(String productCategory) { + this.productCategory = productCategory; + } + public String getBrandName() { + return brandName; + } + public void setBrandName(String brandName) { + this.brandName = brandName; + } + public String getColourName() { + return colourName; + } + public void setColourName(String colourName) { + this.colourName = colourName; + } + public String getDesignName() { + return designName; + } + public void setDesignName(String designName) { + this.designName = designName; + } + public BigDecimal getEndingBalance() + { + return endingBalance; + } + + public void setEndingBalance(BigDecimal endingBalance) + { + this.endingBalance = endingBalance; + } + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getPartnerName() { + return partnerName; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public BigDecimal getQuantity() { + return quantity; + } + public void setQuantity(BigDecimal quantity) { + this.quantity= quantity; + } + public String getSizeName() { + return sizeName; + } + public void setSizeName(String sizeName) { + this.sizeName = sizeName; + } + public BigDecimal getCloseingBalanceQty() { + return closeingBalanceQty; + } + public void setCloseingBalanceQty(BigDecimal closeingBalanceQty) { + this.closeingBalanceQty = closeingBalanceQty; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public BigDecimal getOpeningBalanceQty() { + return openingBalanceQty; + } + public void setOpeningBalanceQty(BigDecimal openingBalanceQty) { + this.openingBalanceQty = openingBalanceQty; + } + public BigDecimal getQtyOfGoodsReceived() { + return qtyOfGoodsReceived; + } + public void setQtyOfGoodsReceived(BigDecimal qtyOfGoodsReceived) { + this.qtyOfGoodsReceived = qtyOfGoodsReceived; + } + public BigDecimal getQtyOfGoodsReturned() { + return qtyOfGoodsReturned; + } + public void setQtyOfGoodsReturned(BigDecimal qtyOfGoodsReturned) { + this.qtyOfGoodsReturned = qtyOfGoodsReturned; + } + public BigDecimal getQtyOfGoodsSold() { + return qtyOfGoodsSold; + } + public void setQtyOfGoodsSold(BigDecimal qtyOfGoodsSold) { + this.qtyOfGoodsSold = qtyOfGoodsSold; + } + public BigDecimal getQtyReturnedByCustomer() { + return qtyReturnedByCustomer; + } + public void setQtyReturnedByCustomer(BigDecimal qtyReturnedByCustomer) { + this.qtyReturnedByCustomer = qtyReturnedByCustomer; + } + public void setUom(String uom) + { + this.uom = uom; + } + public String getUom() + { + return this.uom; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/POSStockBean.java b/posterita/posterita/src/main/org/posterita/beans/POSStockBean.java new file mode 100644 index 0000000000..de9546a608 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/POSStockBean.java @@ -0,0 +1,154 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 8, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.HashMap; + + +public class POSStockBean extends UDIBean +{ + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public String getUom() + { + return uom; + } + + public void setUom(String uom) + { + this.uom = uom; + } + + + public String getQtyFilter() { + return qtyFilter; + } + + public void setQtyFilter(String qtyFilter) { + this.qtyFilter = qtyFilter; + } + + public Boolean getIsTextileProduct() { + return isTextileProduct; + } + + public void setIsTextileProduct(Boolean isTextileProduct) { + this.isTextileProduct = isTextileProduct; + } + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public HashMap getAttributeValuesMap() { + return attributeValuesMap; + } + public void setAttributeValuesMap(HashMap attributeValuesMap) { + this.attributeValuesMap = attributeValuesMap; + } + public Integer getProductId() { + return productId; + } + public void setProductId(Integer productId) { + this.productId = productId; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public BigDecimal getQuantity() { + return quantity; + } + public void setQuantity(BigDecimal quantity) { + this.quantity = quantity; + } + public String getBrandName() { + return brandName; + } + public void setBrandName(String brandName) { + this.brandName = brandName; + } + public String getColourName() { + return colourName; + } + public void setColourName(String colourName) { + this.colourName = colourName; + } + public String getDesignName() { + return designName; + } + public void setDesignName(String designName) { + this.designName = designName; + } + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getSizeName() { + return sizeName; + } + public void setSizeName(String sizeName) { + this.sizeName = sizeName; + } + + public AttributeValuesPair getAttributeValuesPair() + { + return attributeValuesPair; + } + + public void setAttributeValuesPair(AttributeValuesPair attributeValuesPair) + { + this.attributeValuesPair = attributeValuesPair; + } + + public void setQtyOnHand(BigDecimal qtyAvailable) + { + // TODO Auto-generated method stub + + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/POSSupplierBean.java b/posterita/posterita/src/main/org/posterita/beans/POSSupplierBean.java new file mode 100644 index 0000000000..1e926e7f31 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/POSSupplierBean.java @@ -0,0 +1,43 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 8, 2006 + */ + + +package org.posterita.beans; + + +public class POSSupplierBean extends UDIBean +{ + + + public Integer getBpartnerId() { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + public String getPartnerName() { + return partnerName; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PaymentAllocationBean.java b/posterita/posterita/src/main/org/posterita/beans/PaymentAllocationBean.java new file mode 100644 index 0000000000..b1741aee47 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PaymentAllocationBean.java @@ -0,0 +1,156 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 30, 2006 + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +public class PaymentAllocationBean extends UDIBean { + + public Integer getCreditMemoId() { + return creditMemoId; + } + + public void setCreditMemoId(Integer creditMemoId) { + this.creditMemoId = creditMemoId; + } + + public String getCreditMemoNumber() { + return creditMemoNumber; + } + + public void setCreditMemoNumber(String creditMemoNumber) { + this.creditMemoNumber = creditMemoNumber; + } + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public Integer getBpartnerId() { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + + public Integer getCashLineId() { + return cashLineId; + } + + public void setCashLineId(Integer cashLineId) { + this.cashLineId = cashLineId; + } + + public BigDecimal getDiscountAmt() { + return discountAmt; + } + + public void setDiscountAmt(BigDecimal discountAmt) { + this.discountAmt = discountAmt; + } + + public String getDocumentNo() { + return documentNo; + } + + public void setDocumentNo(String documentNo) { + this.documentNo = documentNo; + } + + public Integer getInvoiceId() { + return invoiceId; + } + + public void setInvoiceId(Integer invoiceId) { + this.invoiceId = invoiceId; + } + + public String getInvoiceNo() { + return invoiceNo; + } + + public void setInvoiceNo(String invoiceNo) { + this.invoiceNo = invoiceNo; + } + + public Integer getOrderId() { + return orderId; + } + + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + + public BigDecimal getOverUnderPayment() { + return overUnderPayment; + } + + public void setOverUnderPayment(BigDecimal overUnderPayment) { + this.overUnderPayment = overUnderPayment; + } + + public String getPartnerName() { + return partnerName; + } + + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + + public Integer getPaymentId() { + return paymentId; + } + + public void setPaymentId(Integer paymentId) { + this.paymentId = paymentId; + } + + public BigDecimal getWriteOffAmt() { + return writeOffAmt; + } + + public void setWriteOffAmt(BigDecimal writeOffAmt) { + this.writeOffAmt = writeOffAmt; + } + + public Boolean getIsCustomer() { + return isCustomer; + } + + public void setIsCustomer(Boolean isCustomer) { + this.isCustomer = isCustomer; + } + + public Boolean getIsVendor() { + return isVendor; + } + + public void setIsVendor(Boolean isVendor) { + this.isVendor = isVendor; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PaymentBean.java b/posterita/posterita/src/main/org/posterita/beans/PaymentBean.java new file mode 100644 index 0000000000..aeb94b6e41 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PaymentBean.java @@ -0,0 +1,117 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + +import java.math.BigDecimal; + +public class PaymentBean extends PaymentHistoryBean { + private AttributeValuesPair attributeValuesPair; + private String serno; + + public Integer[] getInvoiceIds() { + return invoiceIds; + } + + public void setInvoiceIds(Integer[] invoiceIds) { + this.invoiceIds = invoiceIds; + } + + public BigDecimal[] getAllocateAmount() { + return allocateAmount; + } + + public void setAllocateAmount(BigDecimal[] allocateAmount) { + this.allocateAmount = allocateAmount; + } + + + public BigDecimal getAllocatedAmount() { + return allocatedAmount; + } + + public void setAllocatedAmount(BigDecimal allocatedAmount) { + this.allocatedAmount = allocatedAmount; + } + + public Integer getBpartnerId() { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + + public AttributeValuesPair getAttributeValuesPair() { + return attributeValuesPair; + } + + public void setAttributeValuesPair(AttributeValuesPair attributeValuesPair) { + this.attributeValuesPair = attributeValuesPair; + } + + public String getSerno() { + return serno; + } + + public void setSerno(String serno) { + this.serno = serno; + } + + public String getTrxType() { + return trxType; + } + + public void setTrxType(String trxType) { + this.trxType = trxType; + } + + public String getChequeNo() { + return chequeNo; + } + + public void setChequeNo(String chequeNo) { + this.chequeNo = chequeNo; + } + + public String getCreditCardNumber() { + return creditCardNumber; + } + + public void setCreditCardNumber(String creditCardNumber) { + this.creditCardNumber = creditCardNumber; + } + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public Boolean getIsSoTrx() { + return isSoTrx; + } + + public void setIsSoTrx(Boolean isSoTrx) { + this.isSoTrx = isSoTrx; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PaymentDetailsBean.java b/posterita/posterita/src/main/org/posterita/beans/PaymentDetailsBean.java new file mode 100644 index 0000000000..6d5df4bf28 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PaymentDetailsBean.java @@ -0,0 +1,87 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * May 21, 2008 1:11:53 PM by praveen + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +import org.compiere.util.Env; + +public class PaymentDetailsBean +{ + private BigDecimal cashAmt = Env.ZERO; + private BigDecimal cardAmt = Env.ZERO; + private BigDecimal chequeAmt = Env.ZERO; + private BigDecimal writeOffAmt = Env.ZERO; + private BigDecimal discountAmt = Env.ZERO; + private BigDecimal tenderedAmt = Env.ZERO; + private BigDecimal refundedAmt = Env.ZERO; + private BigDecimal payAmt = Env.ZERO; + + public BigDecimal getCashAmt() { + return cashAmt; + } + public void setCashAmt(BigDecimal cashAmt) { + this.cashAmt = cashAmt; + } + public BigDecimal getCardAmt() { + return cardAmt; + } + public void setCardAmt(BigDecimal cardAmt) { + this.cardAmt = cardAmt; + } + public BigDecimal getChequeAmt() { + return chequeAmt; + } + public void setChequeAmt(BigDecimal chequeAmt) { + this.chequeAmt = chequeAmt; + } + public BigDecimal getWriteOffAmt() { + return writeOffAmt; + } + public void setWriteOffAmt(BigDecimal writeOffAmt) { + this.writeOffAmt = writeOffAmt; + } + public BigDecimal getDiscountAmt() { + return discountAmt; + } + public void setDiscountAmt(BigDecimal discountAmt) { + this.discountAmt = discountAmt; + } + public BigDecimal getTenderedAmt() { + return tenderedAmt; + } + public void setTenderedAmt(BigDecimal tenderedAmt) { + this.tenderedAmt = tenderedAmt; + } + public BigDecimal getRefundedAmt() { + return refundedAmt; + } + public void setRefundedAmt(BigDecimal refundedAmt) { + this.refundedAmt = refundedAmt; + } + public BigDecimal getPayAmt() { + return payAmt; + } + public void setPayAmt(BigDecimal payAmt) { + this.payAmt = payAmt; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PaymentHistoryBean.java b/posterita/posterita/src/main/org/posterita/beans/PaymentHistoryBean.java new file mode 100644 index 0000000000..46c3e292ad --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PaymentHistoryBean.java @@ -0,0 +1,101 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 05-Aug-2005 by alok + * + */ +package org.posterita.beans; + +import java.sql.Timestamp; + + +public class PaymentHistoryBean extends FilterBean +{ + private MinOutHistoryBean minoutHistoryBean; + + public MinOutHistoryBean getMinoutHistoryBean() + { + return minoutHistoryBean; + } + + public void setMinoutHistoryBean(MinOutHistoryBean bean) + { + this.minoutHistoryBean = bean; + } + + public String getCheckNo() + { + return checkNo; + } + public void setCheckNo(String checkNo) + { + this.checkNo = checkNo; + } + public Timestamp getDateTrx() + { + return dateTrx; + } + public void setDateTrx(Timestamp dateTrx) + { + this.dateTrx = dateTrx; + } + + public Integer getInvoiceId() + { + return invoiceId; + } + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + public String getIsReceipt() + { + return isReceipt; + } + public void setIsReceipt(String isReceipt) + { + this.isReceipt = isReceipt; + } + public Integer getOrderId() + { + return orderId; + } + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + + public Integer getPayAmt() + { + return payAmt; + } + public void setPayAmt(Integer payAmt) + { + this.payAmt = payAmt; + } + public Integer getPaymentId() + { + return paymentId; + } + public void setPaymentId(Integer paymentId) + { + this.paymentId = paymentId; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PaymentTermBean.java b/posterita/posterita/src/main/org/posterita/beans/PaymentTermBean.java new file mode 100644 index 0000000000..11932bef0f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PaymentTermBean.java @@ -0,0 +1,120 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 31, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class PaymentTermBean extends UDIBean +{ + + + + + + + + + public BigDecimal getDiscountAmt1() { + return discountAmt1; + } + public void setDiscountAmt1(BigDecimal discountAmt1) { + this.discountAmt1 = discountAmt1; + } + public BigDecimal getDiscountAmt2() { + return discountAmt2; + } + public void setDiscountAmt2(BigDecimal discountAmt2) { + this.discountAmt2 = discountAmt2; + } + public Integer getDiscountDay1() { + return discountDay1; + } + public void setDiscountDay1(Integer discountDay1) { + this.discountDay1 = discountDay1; + } + public Integer getDiscountDay2() { + return discountDay2; + } + public void setDiscountDay2(Integer discountDay2) { + this.discountDay2 = discountDay2; + } + public Boolean getAfterDelivery() { + return afterDelivery; + } + public void setAfterDelivery(Boolean afterDelivery) { + this.afterDelivery = afterDelivery; + } + public Integer getFiedMonthCutoff() { + return fiedMonthCutoff; + } + public void setFiedMonthCutoff(Integer fiedMonthCutoff) { + this.fiedMonthCutoff = fiedMonthCutoff; + } + public Boolean getFixedDueDate() { + return fixedDueDate; + } + public void setFixedDueDate(Boolean fixedDueDate) { + this.fixedDueDate = fixedDueDate; + } + public Integer getFixedMonthDay() { + return fixedMonthDay; + } + public void setFixedMonthDay(Integer fixedMonthDay) { + this.fixedMonthDay = fixedMonthDay; + } + public Integer getFixedMonthOffset() { + return fixedMonthOffset; + } + public void setFixedMonthOffset(Integer fixedMonthOffset) { + this.fixedMonthOffset = fixedMonthOffset; + } + public Boolean getNextBusinessday() { + return nextBusinessday; + } + public void setNextBusinessday(Boolean nextBusinessday) { + this.nextBusinessday = nextBusinessday; + } + public Integer getPaymentTermId() { + return paymentTermId; + } + public void setPaymentTermId(Integer paymentTermId) { + this.paymentTermId = paymentTermId; + } + + public String getPaymentTermName() { + return paymentTermName; + } + public void setPaymentTermName(String paymentTermName) { + this.paymentTermName = paymentTermName; + } + public Integer getNetDays() { + return netDays; + } + public void setNetDays(Integer netDays) { + this.netDays = netDays; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PaymentTypeBean.java b/posterita/posterita/src/main/org/posterita/beans/PaymentTypeBean.java new file mode 100644 index 0000000000..9ed016c96b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PaymentTypeBean.java @@ -0,0 +1,47 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 25, 2006 + */ + + +package org.posterita.beans; + + +public class PaymentTypeBean +{ + protected String paymentType; + + protected Integer id; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getPaymentType() { + return paymentType; + } + + public void setPaymentType(String paymentType) { + this.paymentType = paymentType; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PopulateHistoryBean.java b/posterita/posterita/src/main/org/posterita/beans/PopulateHistoryBean.java new file mode 100644 index 0000000000..0aec697136 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PopulateHistoryBean.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 09-Aug-2005 by alok + * + */ +package org.posterita.beans; + + +public class PopulateHistoryBean extends UDIBean +{ + + protected String partnerName; + protected String DocStatus; + protected String isDelivered; + protected String isInvoiced; + protected String isPaid; + protected String isReceipt; + protected String isSotrx; + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PriceListBean.java b/posterita/posterita/src/main/org/posterita/beans/PriceListBean.java new file mode 100644 index 0000000000..03a7e2506d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PriceListBean.java @@ -0,0 +1,280 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 19, 2005 by praveen + * + */ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + +public class PriceListBean +{ + protected Boolean isDeleteOldRecords; + protected PriceListBean priceListBean; + protected ArrayList priceListBeanList; + protected Integer index; + protected BigDecimal stdPrice; + protected BigDecimal listPrice; + protected BigDecimal limitPrice; + protected Boolean isDefault; + protected Boolean isPresentForProduct; + protected Boolean isMandatory; + protected String orgName; + protected Boolean isSOPriceList; + protected Integer priceListVersionId; + protected Integer productId; + protected BigDecimal priceList; + protected Integer[] productIds; + protected String name; + protected Integer orgId; + protected Integer priceListId; + protected Boolean isActive; + protected Integer basePriceListId; + protected Boolean isCreatePriceList; + protected Boolean isTaxIncluded; + + public Boolean getIsTaxIncluded() + { + return isTaxIncluded; + } + + public void setIsTaxIncluded(Boolean isTaxIncluded) + { + this.isTaxIncluded = isTaxIncluded; + } + + public Boolean getIsCreatePriceList() + { + return isCreatePriceList; + } + + public void setIsCreatePriceList(Boolean isCreatePriceList) + { + this.isCreatePriceList = isCreatePriceList; + } + + public Boolean getIsDeleteOldRecords() + { + return isDeleteOldRecords; + } + + public void setIsDeleteOldRecords(Boolean isDeleteOldRecords) + { + this.isDeleteOldRecords = isDeleteOldRecords; + } + + public PriceListBean getPriceListBean() + { + return priceListBean; + } + + public void setPriceListBean(PriceListBean priceListBean) + { + this.priceListBean = priceListBean; + } + + public ArrayList getPriceListBeanList() + { + return priceListBeanList; + } + + public void setPriceListBeanList(ArrayList priceListBeanList) + { + this.priceListBeanList = priceListBeanList; + } + + public Integer getIndex() + { + return index; + } + + public void setIndex(Integer index) + { + this.index = index; + } + + public BigDecimal getStdPrice() + { + return stdPrice; + } + + public void setStdPrice(BigDecimal stdPrice) + { + this.stdPrice = stdPrice; + } + + public BigDecimal getListPrice() + { + return listPrice; + } + + public void setListPrice(BigDecimal listPrice) + { + this.listPrice = listPrice; + } + + public BigDecimal getLimitPrice() + { + return limitPrice; + } + + public void setLimitPrice(BigDecimal limitPrice) + { + this.limitPrice = limitPrice; + } + + public Boolean getIsDefault() + { + return isDefault; + } + + public void setIsDefault(Boolean isDefault) + { + this.isDefault = isDefault; + } + + public Boolean getIsPresentForProduct() + { + return isPresentForProduct; + } + + public void setIsPresentForProduct(Boolean isPresentForProduct) + { + this.isPresentForProduct = isPresentForProduct; + } + + public Boolean getIsMandatory() + { + return isMandatory; + } + + public void setIsMandatory(Boolean isMandatory) + { + this.isMandatory = isMandatory; + } + + public String getOrgName() + { + return orgName; + } + + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + + public Boolean getIsSOPriceList() + { + return isSOPriceList; + } + + public void setIsSOPriceList(Boolean isSOPriceList) + { + this.isSOPriceList = isSOPriceList; + } + + public Integer getPriceListVersionId() + { + return priceListVersionId; + } + + public void setPriceListVersionId(Integer priceListVersionId) + { + this.priceListVersionId = priceListVersionId; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public BigDecimal getPriceList() + { + return priceList; + } + + public void setPriceList(BigDecimal priceList) + { + this.priceList = priceList; + } + + public Integer[] getProductIds() + { + return productIds; + } + public void setProductIds(Integer[] productIds) + { + this.productIds = productIds; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public Integer getPriceListId() + { + return priceListId; + } + + public void setPriceListId(Integer priceListId) + { + this.priceListId = priceListId; + } + + public Boolean getIsActive() { + return isActive; + } + + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + public Integer getBasePriceListId() + { + return basePriceListId; + } + + public void setBasePriceListId(Integer basePriceListId) + { + this.basePriceListId = basePriceListId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/PrintBarcodeBean.java b/posterita/posterita/src/main/org/posterita/beans/PrintBarcodeBean.java new file mode 100644 index 0000000000..0d77237e72 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/PrintBarcodeBean.java @@ -0,0 +1,64 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 04-Oct-2006 10:41:05 by praveen + * + */ + +package org.posterita.beans; + +public class PrintBarcodeBean +{ + private int qty; + private String title; + private String subtitle; + private String barcode; + private String price; + + public String getBarcode() { + return barcode; + } + public void setBarcode(String barcode) { + this.barcode = barcode; + } + public String getPrice() { + return price; + } + public void setPrice(String price) { + this.price = price; + } + public int getQty() { + return qty; + } + public void setQty(int qty) { + this.qty = qty; + } + public String getSubtitle() { + return subtitle; + } + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductAttributeBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductAttributeBean.java new file mode 100644 index 0000000000..66f1ede656 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductAttributeBean.java @@ -0,0 +1,141 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 28, 2005 by praveen + * + */ +package org.posterita.beans; + +import java.util.ArrayList; + +public class ProductAttributeBean extends UDIBean +{ + private ArrayList attributeSets; + private ArrayList attributes; + private ArrayList attributeValues; + + public String getAttribute() + { + return attribute; + } + + public void setAttribute(String attribute) + { + this.attribute = attribute; + } + + public Integer getAttributeId() + { + return attributeId; + } + + public void setAttributeId(Integer attributeId) + { + this.attributeId = attributeId; + } + + public Integer getAttributeSetId() + { + return attributeSetId; + } + + public void setAttributeSetId(Integer attributeSetId) + { + this.attributeSetId = attributeSetId; + } + + public String getAttributeValue() + { + return attributeValue; + } + + public void setAttributeValue(String attributeValue) + { + this.attributeValue = attributeValue; + } + + public ArrayList getAttributes() + { + return attributes; + } + + public void setAttributes(ArrayList attributes) + { + this.attributes = attributes; + } + + public ArrayList getAttributeSets() + { + return attributeSets; + } + + public void setAttributeSets(ArrayList attributeSets) + { + this.attributeSets = attributeSets; + } + + public ArrayList getAttributeValues() + { + return attributeValues; + } + + public void setAttributeValues(ArrayList attributeValues) + { + this.attributeValues = attributeValues; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Integer getProductCategoryId() + { + return productCategoryId; + } + + public void setProductCategoryId(Integer productCategoryId) + { + this.productCategoryId = productCategoryId; + } + + + public Integer getAttributeValueId() { + return attributeValueId; + } + public void setAttributeValueId(Integer attributeValueId) { + this.attributeValueId = attributeValueId; + } + public Boolean getShowActiveOnly() { + return showActiveOnly; + } + public void setShowActiveOnly(Boolean showActiveOnly) { + this.showActiveOnly = showActiveOnly; + } + public Integer getUpdateAttrValueId() { + return updateAttrValueId; + } + public void setUpdateAttrValueId(Integer updateAttrValueId) { + this.updateAttrValueId = updateAttrValueId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductAttributeValueBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductAttributeValueBean.java new file mode 100644 index 0000000000..3fb1ea95db --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductAttributeValueBean.java @@ -0,0 +1,69 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 31, 2005 by praveen + * + */ +package org.posterita.beans; + +public class ProductAttributeValueBean extends UDIBean +{ + + protected String attrColour; + protected String attrModel; + protected String attrTrx; + protected String attrYear; + + public String getAttrColour() { + return attrColour; + } + public void setAttrColour(String attrColour) { + this.attrColour = attrColour; + } + public String getAttrModel() { + return attrModel; + } + public void setAttrModel(String attrModel) { + this.attrModel = attrModel; + } + public String getAttrTrx() { + return attrTrx; + } + public void setAttrTrx(String attrTrx) { + this.attrTrx = attrTrx; + } + public String getAttrYear() { + return attrYear; + } + public void setAttrYear(String attrYear) { + this.attrYear = attrYear; + } + public Integer getProductId() { + return productId; + } + public void setProductId(Integer productId) { + this.productId = productId; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductBean.java new file mode 100644 index 0000000000..f18371ffc7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductBean.java @@ -0,0 +1,935 @@ +/* + * + * Copyright (c) 2005 UDI Ltd. All Rights Reserved. + * + * This software is the confidential and proprietary information of UDI Ltd. + * ("Confidential Information"). You shall not disclose such Confidential + * Information and shall use it only in accordance with the terms of the license + * agreement you entered into with UDI. + * + * UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT. UDI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY + * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; + +import org.apache.struts.upload.FormFile; +import org.compiere.util.Env; + +public class ProductBean extends UDIBean implements Comparable +{ + + protected Integer attributeSetId; + protected Integer mAttrSetInstanceId; + protected Boolean isEditable; + protected Boolean isTaxIncluded; + private String productName; + private BigDecimal qtyOnHand = Env.ZERO; + private BigDecimal qtyReserved = Env.ZERO; + private BigDecimal qtyOrdered = Env.ZERO; + private BigDecimal qtyToMove; + private Integer productId; + private BigDecimal priceList; + private BigDecimal priceLimit; + private BigDecimal priceStandard; + private Integer orgId; + + //this is the attributeSetInstance corresponding to the serial number + private Integer sernoAttributeSetInstance; + + //attributeSetInstance for model/colour/transmission/year + private Integer attributeSetInstanceId; + + private Integer priceListVersionId; + + private Integer locatorId; + + private String regionName; + + private ArrayList orderLineList; + + private ArrayList productInstances; + + private String priceListName; + + private String orgName; + + private String serno; + + private AttributeValuesPair attributeValuesPair; + + private Integer productCategoryId; + +// Y/N +private String isOwnedByWholesaler; + +private String isNatisReleased; + +private String reserveStatus; + +private String warehouseName; + +private String ETA; + +private ProductImageInfo imageInfo; + +private HashMap attributeValuesMap; + +private String description; + +private String imageLink; +private String textLink; + +private String customSize; + +private String group1; + +private String group2; + +private Integer uomId; + +private String productCategoryName; + +private String taxCategoryName; + + public Integer getTaxCategoryId() { + return taxCategoryId; + } + public void setTaxCategoryId(Integer taxCategoryId) { + this.taxCategoryId = taxCategoryId; + } + public String getTaxCategoryName() { + return taxCategoryName; + } + public void setTaxCategoryName(String taxCategoryName) { + this.taxCategoryName = taxCategoryName; + } + public String getPartnerName() { + return partnerName; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public Integer getBpartnerId() { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + public String getBarCode() { + return barCode; + } + public void setBarCode(String barCode) { + this.barCode = barCode; + } + //TODO refactor this + private ArrayList availableColours; + + private ArrayList availableSizes; + + + public Integer getLicensingDistrictId() + { + return licensingDistrictId; + } + public void setLicensingDistrictId(Integer licensingDistrictId) { + this.licensingDistrictId = licensingDistrictId; + } + + public String getReserveStatus() + { + return reserveStatus; + } + + public void setReserveStatus(String reserveStatus) + { + this.reserveStatus = reserveStatus; + } + + public String getIsOwnedByWholesaler() + { + return isOwnedByWholesaler; + } + + public void setIsOwnedByWholesaler(String isOwnedByWholesaler) + { + this.isOwnedByWholesaler = isOwnedByWholesaler; + } + + + public BigDecimal getQuantity() + { + return quantity; + } + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + public ArrayList getOrderLineList() + { + return orderLineList; + } + + public void setOrderLineList(ArrayList orderLineList) + { + this.orderLineList = orderLineList; + } + + public String getProductName() + { + return productName; + } + + public void setProductName(String productName) + { + this.productName = productName; + } + + public BigDecimal getQtyOnHand() + { + return qtyOnHand; + } + + public void setQtyOnHand(BigDecimal qtyOnHand) + { + this.qtyOnHand = qtyOnHand; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public BigDecimal getPriceList() + { + return priceList; + } + + public void setPriceList(BigDecimal priceList) + { + this.priceList = priceList; + } + + public BigDecimal getPriceLimit() + { + return priceLimit; + } + + public void setPriceLimit(BigDecimal priceLimit) + { + this.priceLimit = priceLimit; + } + + public BigDecimal getPriceStandard() + { + return priceStandard; + } + + public void setPriceStandard(BigDecimal priceStandard) + { + this.priceStandard = priceStandard; + } + + public ArrayList getProductInstances() + { + return productInstances; + } + + public void setProductInstances(ArrayList productInstances) + { + this.productInstances = productInstances; + } + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public Integer getLocatorId() + { + return locatorId; + } + + public void setLocatorId(Integer locatorId) + { + this.locatorId = locatorId; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public BigDecimal getQtyReserved() + { + return qtyReserved; + } + + public void setQtyReserved(BigDecimal qtyReserved) + { + this.qtyReserved = qtyReserved; + } + + public BigDecimal getQtyOrdered() + { + return qtyOrdered; + } + + public void setQtyOrdered(BigDecimal qtyOrdered) + { + this.qtyOrdered = qtyOrdered; + } + + public String getOrgName() + { + return orgName; + } + + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + + + public int compareTo(Object o) + { + if (o == null && this.getProductId() == null) + return -1; + + ProductBean bean = (ProductBean) o; + + return (bean.getProductId().compareTo(this.getProductId())); + } + + public boolean equals(Object obj) + { + ProductBean bean = (ProductBean) obj; + + if ( obj == null) + return false; + + if (bean.getProductId().intValue() == this.getProductId().intValue()) + return true; + + return false; + } + + public Integer getSernoAttributeSetInstance() + { + return sernoAttributeSetInstance; + } + + public void setSernoAttributeSetInstance(Integer sernoAttributeSetInstance) + { + this.sernoAttributeSetInstance = sernoAttributeSetInstance; + } + + public String getRegionName() + { + return regionName; + } + + public void setRegionName(String regionName) + { + this.regionName = regionName; + } + + public void setSerno(String serno) + { + this.serno = serno; + } + + public String getSerno() + { + return serno; + } + + + public String getIsNatisReleased() + { + return isNatisReleased; + } + + public void setIsNatisReleased(String isNatisReleased) + { + this.isNatisReleased = isNatisReleased; + } + + public String getPriceListName() + { + return priceListName; + } + + public void setPriceListName(String priceListName) + { + this.priceListName = priceListName; + } + + public Integer getPriceListVersionId() + { + return priceListVersionId; + } + + public void setPriceListVersionId(Integer priceListVersionId) + { + this.priceListVersionId = priceListVersionId; + } + + public Integer[] getCheckBox() + { + return checkBox; + } + public void setCheckBox(Integer [] checkBox) + { + this.checkBox = checkBox; + } + + + public AttributeValuesPair getAttributeValuesPair() + { + return attributeValuesPair; + } + + public void setAttributeValuesPair(AttributeValuesPair attributeValuesPair) + { + this.attributeValuesPair = attributeValuesPair; + } + + + public String getEngineNo() { + return engineNo; + } + public void setEngineNo(String engineNo) { + this.engineNo = engineNo; + } + + public Integer getProductCategoryId() + { + return productCategoryId; + } + + public void setProductCategoryId(Integer productCategoryId) + { + this.productCategoryId = productCategoryId; + } + + public String getWarehouseType() + { + return warehouseType; + } + + public void setWarehouseType(String warehouseType) + { + this.warehouseType = warehouseType; + } + + public String toString() + { + return this.getProductName(); + } + + public String getWarehouseName() + { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public Integer getWarehouseId() + { + return warehouseId; + } + + public void setWarehouseId(Integer warehouseId) + { + this.warehouseId = warehouseId; + } + + public String getETA() + { + return ETA; + } + public void setETA(String eta) + { + ETA = eta; + } + + public Integer[] getProductIds() + { + return productIds; + } + + public void setProductIds(Integer[] productIds) + { + this.productIds = productIds; + } + + public ProductImageInfo getImageInfo() + { + return imageInfo; + } + public void setImageInfo(ProductImageInfo imageInfo) + { + this.imageInfo = imageInfo; + } + + public HashMap getAttributeValuesMap() + { + return attributeValuesMap; + } + + public void setAttributeValuesMap(HashMap attributeValuesMap) + { + this.attributeValuesMap = attributeValuesMap; + } + + + public String getDescription() + { + return description; + } + public void setDescription(String description) + { + this.description = description; + } + + public ArrayList getAvailableColours() + { + return availableColours; + } + public void setAvailableColours(ArrayList availableColours) + { + this.availableColours = availableColours; + } + public ArrayList getAvailableSizes() + { + return availableSizes; + } + public void setAvailableSizes(ArrayList availableSizes) + { + this.availableSizes = availableSizes; + } + + public Integer getAttributeId() + { + return attributeId; + } + + public void setAttributeId(Integer attributeId) + { + this.attributeId = attributeId; + } + + + public String getImageLink() + { + return imageLink; + } + + public void setImageLink(String imageLink) + { + this.imageLink = imageLink; + } + + public String getTextLink() + { + return textLink; + } + + public void setTextLink(String textLink) + { + this.textLink = textLink; + } + public String getCurrency() + { + return currency; + } + public void setCurrency(String currency) + { + this.currency = currency; + } + + public String getSalesPriceLimit() { + return salesPriceLimit; + } + public void setSalesPriceLimit(String salesPriceLimit) { + this.salesPriceLimit = salesPriceLimit; + } + public String getSalesPriceList() { + return salesPriceList; + } + public void setSalesPriceList(String salesPriceList) { + this.salesPriceList = salesPriceList; + } + public String getSalesPriceStandard() { + return salesPriceStandard; + } + public void setSalesPriceStandard(String salesPriceStandard) { + this.salesPriceStandard = salesPriceStandard; + } + + + public String getBrandName() { + return brandName; + } + public void setBrandName(String brandName) { + this.brandName = brandName; + } + public String getColourName() { + return colourName; + } + public void setColourName(String colourName) { + this.colourName = colourName; + } + public String getDesignName() { + return designName; + } + public void setDesignName(String designName) { + this.designName = designName; + } + public String getSizeName() { + return sizeName; + } + public void setSizeName(String sizeName) { + this.sizeName = sizeName; + } + public String[] getSizes() + { + return sizes; + } + public void setSizes(String[] sizes) + { + this.sizes = sizes; + } + + + + public String getPurchasePriceLimit() { + return purchasePriceLimit; + } + public void setPurchasePriceLimit(String purchasePriceLimit) { + this.purchasePriceLimit = purchasePriceLimit; + } + public String getPurchasePriceList() { + return purchasePriceList; + } + public void setPurchasePriceList(String purchasePriceList) { + this.purchasePriceList = purchasePriceList; + } + public String getPurchasePriceStandard() { + return purchasePriceStandard; + } + public void setPurchasePriceStandard(String purchasePriceStandard) { + this.purchasePriceStandard = purchasePriceStandard; + } + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getRevenueRecognition() { + return revenueRecognition; + } + public void setRevenueRecognition(String revenueRecognition) { + this.revenueRecognition = revenueRecognition; + } + public Integer getAttributeSetId() { + return attributeSetId; + } + public void setAttributeSetId(Integer attributeSetId) { + this.attributeSetId = attributeSetId; + } + public Integer getMAttrSetInstanceId() { + return mAttrSetInstanceId; + } + public void setMAttrSetInstanceId(Integer attrSetInstanceId) { + mAttrSetInstanceId = attrSetInstanceId; + } + public Integer getRevenueRecoId() { + return revenueRecoId; + } + public void setRevenueRecoId(Integer revenueRecoId) { + this.revenueRecoId = revenueRecoId; + } + + public String getProductType() { + return productType; + } + public void setProductType(String productType) { + this.productType = productType; + } + + public Boolean getIsActive() { + return isActive; + } + public void setIsActive(Boolean isActive) { + this.isActive = isActive; + } + public BigDecimal getTaxRate() { + return taxRate; + } + public void setTaxRate(BigDecimal taxRate) { + this.taxRate = taxRate; + } + public String getCustomSize() { + return customSize; + } + public void setCustomSize(String customSize) { + this.customSize = customSize; + } + public String getProductClassification() + { + return productClassification; + } + public void setProductClassification(String productClassification) + { + this.productClassification = productClassification; + } + public String getKeyword2() + { + return keyword2; + } + public void setKeyword2(String keyword2) + { + this.keyword2 = keyword2; + } + + public Boolean getIsSelfService() + { + return isSelfService; + } + + public void setIsSelfService(Boolean isSelfService) + { + this.isSelfService = isSelfService; + } + + public FormFile getFile() { + return file; + } + public void setFile(FormFile file) { + this.file = file; + } + public String getGroup1() { + return group1; + } + public void setGroup1(String group1) { + this.group1 = group1; + } + public String getGroup2() { + return group2; + } + public void setGroup2(String group2) { + this.group2 = group2; + } + public Integer getUomId() { + return uomId; + } + public void setUomId(Integer uomId) { + this.uomId = uomId; + + } + public Boolean getIsEditable() { + return isEditable; + } + public void setIsEditable(Boolean isEditable) { + this.isEditable = isEditable; + } + public String getUom() + { + return uom; + } + public void setUom(String uom) + { + this.uom = uom; + } + public BigDecimal getQtyToMove() + { + return qtyToMove; + } + public void setQtyToMove(BigDecimal qtyToMove) + { + this.qtyToMove = qtyToMove; + } + public Integer getOrgFromId() + { + return this.orgFromId; + } + public void setOrgFromId(Integer orgFromId) + { + this.orgFromId = orgFromId; + } + public Integer getOrgToId() + { + return orgToId; + } + public void setOrgToId(Integer orgToId) + { + this.orgToId = orgToId; + } + // + public BigDecimal getStdPrice() + { + return stdPrice; + } + + public void setStdPrice(BigDecimal stdPrice) + { + this.stdPrice = stdPrice; + } + + public BigDecimal getListPrice() + { + return listPrice; + } + + public void setListPrice(BigDecimal listPrice) + { + this.listPrice = listPrice; + } + + public BigDecimal getLimitPrice() + { + return limitPrice; + } + + public void setLimitPrice(BigDecimal limitPrice) + { + this.limitPrice = limitPrice; + } + + public Boolean getIsDefault() + { + return isDefault; + } + + public void setIsDefault(Boolean isDefault) + { + this.isDefault = isDefault; + } + + public Boolean getIsPresentForProduct() + { + return isPresentForProduct; + } + + public void setIsPresentForProduct(Boolean isPresentForProduct) + { + this.isPresentForProduct = isPresentForProduct; + } + + public Boolean getIsMandatory() + { + return isMandatory; + } + + public void setIsMandatory(Boolean isMandatory) + { + this.isMandatory = isMandatory; + } + + public Boolean getIsSOPriceList() + { + return isSOPriceList; + } + + public void setIsSOPriceList(Boolean isSOPriceList) + { + this.isSOPriceList = isSOPriceList; + } + public Integer getPriceListId() + { + return priceListId; + } + + public void setPriceListId(Integer priceListId) + { + this.priceListId = priceListId; + } + public ProductBean getProductBean() + { + return productBean; + } + + public void setProductBean(ProductBean productBean) + { + this.productBean = productBean; + } + + public ArrayList getProductBeanList() + { + return productBeanList; + } + + public void setProductBeanList(ArrayList productBeanList) + { + this.productBeanList = productBeanList; + } + public String getProductCategoryName() { + return productCategoryName; + } + public void setProductCategoryName(String productCategoryName) { + this.productCategoryName = productCategoryName; + } + public BigDecimal getListPriceIncl() { + return listPriceIncl; + } + public void setListPriceIncl(BigDecimal listPriceIncl) { + this.listPriceIncl = listPriceIncl; + } + public BigDecimal getStdPriceIncl() { + return stdPriceIncl; + } + public void setStdPriceIncl(BigDecimal stdPriceIncl) { + this.stdPriceIncl = stdPriceIncl; + } + public BigDecimal getLimitPriceIncl() { + return limitPriceIncl; + } + public void setLimitPriceIncl(BigDecimal limitPriceIncl) { + this.limitPriceIncl = limitPriceIncl; + } + public Boolean getIsTaxIncluded() { + return isTaxIncluded; + } + public void setIsTaxIncluded(Boolean isTaxIncluded) { + this.isTaxIncluded = isTaxIncluded; + } + public Integer getUnitsPerPack() + { + return unitsPerPack; + } + public void setUnitsPerPack(Integer unitsPerPack) + { + this.unitsPerPack = unitsPerPack; + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductCategoryBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductCategoryBean.java new file mode 100644 index 0000000000..bd6eed6b3e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductCategoryBean.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 9, 2006 + */ + + +package org.posterita.beans; + + +public class ProductCategoryBean extends UDIBean +{ + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getProductCategoryId() { + return productCategoryId; + } + public void setProductCategoryId(Integer productCategoryId) { + this.productCategoryId = productCategoryId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductDetailsBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductDetailsBean.java new file mode 100644 index 0000000000..608caf241d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductDetailsBean.java @@ -0,0 +1,130 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +public class ProductDetailsBean extends UDIBean +{ + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public String getBarCode() + { + return barCode; + } + + public void setBarCode(String barCode) + { + this.barCode = barCode; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Boolean getHasImage() + { + return hasImage; + } + + public void setHasImage(Boolean hasImage) + { + this.hasImage = hasImage; + } + + public String getProductName() + { + return productName; + } + + public void setProductName(String productName) + { + this.productName = productName; + } + + public String getRevenueRecognition() + { + return revenueRecognition; + } + + public void setRevenueRecognition(String revenueRecognition) + { + this.revenueRecognition = revenueRecognition; + } + + public Double getStdPurchasePrice() + { + return stdPurchasePrice; + } + + public void setStdPurchasePrice(Double stdPurchasePrice) + { + this.stdPurchasePrice = stdPurchasePrice; + } + + public Double getStdSalesPrice() + { + return stdSalesPrice; + } + + public void setStdSalesPrice(Double stdSalesPrice) + { + this.stdSalesPrice = stdSalesPrice; + } + + public String getTaxCategoryName() + { + return taxCategoryName; + } + + public void setTaxCategoryName(String taxCategoryName) + { + this.taxCategoryName = taxCategoryName; + } + + public BigDecimal getQuantity() { + return quantity; + } + + public void setQuantity(BigDecimal quantity) { + this.quantity = quantity; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductImageBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductImageBean.java new file mode 100644 index 0000000000..ed9c2a1421 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductImageBean.java @@ -0,0 +1,158 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 14, 2006 by praveen + * + */ +package org.posterita.beans; + +import java.util.ArrayList; + +import org.apache.struts.upload.FormFile; + +import org.posterita.businesslogic.administration.ProductManager; + + +public class ProductImageBean extends UDIBean +{ + public Integer getProductId() { + return productId; + } + public void setProductId(Integer productId) { + this.productId = productId; + } + public FormFile getFile() { + return file; + } + public void setFile(FormFile file) { + this.file = file; + } + public Integer[] getProductIds() { + return productIds; + } + public void setProductIds(Integer[] productIds) { + this.productIds = productIds; + } + public String getBrandName() + { + return brandName; + } + public void setBrandName(String brandName) + { + this.brandName = brandName; + } + public String getColourName() + { + return colourName; + } + public void setColourName(String colourName) + { + this.colourName = colourName; + } + public String getDesignName() + { + return designName; + } + public void setDesignName(String designName) + { + this.designName = designName; + } + public String getModelName() + { + return modelName; + } + public void setModelName(String modelName) + { + this.modelName = modelName; + } + public String getKeyword1() + { + return keyword1; + } + public void setKeyword1(String keyword1) + { + this.keyword1 = keyword1; + } + public String getKeyword2() + { + return keyword2; + } + public void setKeyword2(String keyword2) + { + this.keyword2 = keyword2; + } + public String[] getSizes() + { + return sizes; + } + public void setSizes(String[] sizes) + { + this.sizes = sizes; + } + + public String toString() + { + StringBuffer productName = new StringBuffer(); + productName.append(brandName + ProductManager.PRODUCT_ATTRIBUTES_DELIMETER); + productName.append(designName + ProductManager.PRODUCT_ATTRIBUTES_DELIMETER); + productName.append(modelName + ProductManager.PRODUCT_ATTRIBUTES_DELIMETER); + productName.append(colourName + ProductManager.PRODUCT_ATTRIBUTES_DELIMETER); + + return productName.toString(); + } + public String getKeyword3() + { + return keyword3; + } + public void setKeyword3(String keyword3) + { + this.keyword3 = keyword3; + } + public String getKeyword4() + { + return keyword4; + } + public void setKeyword4(String keyword4) + { + this.keyword4 = keyword4; + } + public String getImageName() + { + return imageName; + } + public void setImageName(String imageName) + { + this.imageName = imageName; + } + public ArrayList getProductsList() + { + return productsList; + } + public void setProductsList(ArrayList productsList) + { + this.productsList = productsList; + } + public String getBarCode() + { + return barCode; + } + public void setBarCode(String barCode) + { + this.barCode = barCode; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductImageInfo.java b/posterita/posterita/src/main/org/posterita/beans/ProductImageInfo.java new file mode 100644 index 0000000000..1069e34348 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductImageInfo.java @@ -0,0 +1,59 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 15, 2006 by praveen + * + */ +package org.posterita.beans; + +public class ProductImageInfo +{ + private Integer productId; + private Boolean hasAttachment; + private String model; + + public Boolean getHasAttachment() { + return hasAttachment; + } + public void setHasAttachment(Boolean hasAttachment) { + this.hasAttachment = hasAttachment; + } + public String getModel() { + return model; + } + public void setModel(String model) { + this.model = model; + } + public Integer getProductId() { + return productId; + } + public void setProductId(Integer productId) { + this.productId = productId; + } + private String productName; + + + public String getProductName() + { + return productName; + } + public void setProductName(String productName) + { + this.productName = productName; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductInfo.java b/posterita/posterita/src/main/org/posterita/beans/ProductInfo.java new file mode 100644 index 0000000000..b393f07e28 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductInfo.java @@ -0,0 +1,131 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + +import java.sql.Timestamp; +import java.util.ArrayList; + + +public class ProductInfo implements Comparable +{ + private AttributeValuesBean attributeValuesBean = new AttributeValuesBean(); + private ArrayList products = new ArrayList(); + private ArrayList regions = new ArrayList(); + private ArrayList reservedStatusValues = new ArrayList(); + private ArrayList warehouseTypes = new ArrayList(); + private ArrayList organisations = new ArrayList(); + private ArrayList warehouseNames = new ArrayList(); + private Integer productCategoryId; + private Timestamp ETA; + + public ArrayList getOrganisations() + { + return organisations; + } + public void setOrganisations(ArrayList organisations) + { + this.organisations = organisations; + } + + + public AttributeValuesBean getAttributeValuesBean() + { + return attributeValuesBean; + } + + public void setAttributeValuesBean(AttributeValuesBean attributeValuesBean) + { + this.attributeValuesBean = attributeValuesBean; + } + + public ArrayList getProducts() + { + return products; + } + + public void setProducts(ArrayList products) + { + this.products = products; + } + + public void setRegions(ArrayList regions) + { + this.regions = regions; + } + + public ArrayList getRegions() + { + return regions; + } + + public ArrayList getReservedStatusValues() + { + return reservedStatusValues; + } + + public void setReservedStatusValues(ArrayList reservedStatusValues) + { + this.reservedStatusValues = reservedStatusValues; + } + + public Integer getProductCategoryId() + { + return productCategoryId; + } + + public void setProductCategoryId(Integer productCategoryId) + { + this.productCategoryId = productCategoryId; + } + + public ArrayList getWarehouseTypes() + { + return warehouseTypes; + } + + public void setWarehouseTypes(ArrayList warehouseTypes) + { + this.warehouseTypes = warehouseTypes; + } + + public ArrayList getWarehouseNames() + { + return warehouseNames; + } + + public void setWarehouseNames(ArrayList warehouseNames) + { + this.warehouseNames = warehouseNames; + } + + public int compareTo(Object o) + { + return 0; + } + + public Timestamp getETA() + { + return ETA; + } + public void setETA(Timestamp eta) + { + ETA = eta; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductInfoBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductInfoBean.java new file mode 100644 index 0000000000..63652fd231 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductInfoBean.java @@ -0,0 +1,27 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 31, 2005 by praveen + * + */ +package org.posterita.beans; + +public class ProductInfoBean extends StockBean +{ + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductInstanceBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductInstanceBean.java new file mode 100644 index 0000000000..1e0c564b4d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductInstanceBean.java @@ -0,0 +1,81 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + +public class ProductInstanceBean +{ + private int attributeSetInstanceId; + private int attributeId; + private String serNo; + private String description; + private int qtyOnHand; + + public int getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + public void setAttributeSetInstanceId(int attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public int getAttributeId() + { + return attributeId; + } + + public void setAttributeId(int attributeId) + { + this.attributeId = attributeId; + } + + public String getSerno() + { + return serNo; + } + + public void setSerno(String serno) + { + this.serNo = serno; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + //this should return only on because a serial number(vin number) + // must be unique + public int getQtyOnHand() + { + return qtyOnHand; + } + + public void setQtyOnHand(int qtyOnHand) + { + this.qtyOnHand = qtyOnHand; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductKeywordsBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductKeywordsBean.java new file mode 100644 index 0000000000..2a15fbd891 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductKeywordsBean.java @@ -0,0 +1,116 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 12, 2006 by ashley +* +*/ + +package org.posterita.beans; + +import org.apache.struts.upload.FormFile; + +public class ProductKeywordsBean extends UDIBean +{ + + public String getProductClassification() + { + return productClassification; + } + public void setProductClassification(String productClassification) + { + this.productClassification = productClassification; + } + public String getKeyword1() + { + return keyword1; + } + public void setKeyword1(String keyword1) + { + this.keyword1 = keyword1; + } + public String getKeyword2() + { + return keyword2; + } + public void setKeyword2(String keyword2) + { + this.keyword2 = keyword2; + } + public String getKeyword3() + { + return keyword3; + } + public void setKeyword3(String keyword3) + { + this.keyword3 = keyword3; + } + public String getKeyword4() + { + return keyword4; + } + public void setKeyword4(String keyword4) + { + this.keyword4 = keyword4; + } + public Integer[] getProductIds() + { + return productIds; + } + public void setProductIds(Integer[] productIds) + { + this.productIds = productIds; + } + + public String getImageName() + { + return imageName; + } + public void setImageName(String imageName) + { + this.imageName = imageName; + } + public FormFile getFile() + { + return file; + } + public void setFile(FormFile file) + { + this.file = file; + } + + public Boolean getIsSelfService() + { + return isSelfService; + } + + public void setIsSelfService(Boolean isSelfService) + { + this.isSelfService = isSelfService; + } + + public String getDocumentNote() + { + return documentNote; + } + public void setDocumentNote(String documentNote) + { + this.documentNote = documentNote; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductPriceBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductPriceBean.java new file mode 100644 index 0000000000..2ef43bd140 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductPriceBean.java @@ -0,0 +1,76 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 30, 2005 by praveen + * + */ +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class ProductPriceBean extends ProductAttributeValueBean +{ + protected BigDecimal priceList; + protected String priceListName; + protected BigDecimal priceStandard; + + public Integer getPriceListVersionId() + { + return priceListVersionId; + } + + public void setPriceListVersionId(Integer priceListVersionId) + { + this.priceListVersionId = priceListVersionId; + } + + + + public String getPriceListName() + { + return priceListName; + } + + public void setPriceListName(String priceListName) + { + this.priceListName = priceListName; + } + + + + public BigDecimal getPriceList() + { + return priceList; + } + + public void setPriceList(BigDecimal priceList) + { + this.priceList = priceList; + } + + public BigDecimal getPriceStandard() + { + return priceStandard; + } + + public void setPriceStandard(BigDecimal priceStandard) + { + this.priceStandard = priceStandard; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductQuery.java b/posterita/posterita/src/main/org/posterita/beans/ProductQuery.java new file mode 100644 index 0000000000..eab21ab4d5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductQuery.java @@ -0,0 +1,204 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +package org.posterita.beans; + + + +public class ProductQuery +{ + + private int locatorId; + private int attributeSetId; + private int attributeValueIds[]; + private int productId; + private String fromLocatorSQL; + private String regionFilterSQL; + private int hondaOrgId; + private int priceListId; + private int priceListVersionId; + private int warehouseId; + private String reserveStatusFilter; + private String availableForBackOrderFilter; + private int productCategoryId; + private Integer ad_Org_ID; + private String ETAFilter; + private String backOrder; + + + public String getAvailableForBackOrderFilter() { + return availableForBackOrderFilter; + } + public void setAvailableForBackOrderFilter( + String availableForBackOrderFilter) { + this.availableForBackOrderFilter = availableForBackOrderFilter; + } + public String getReserveStatusFilter() + { + return reserveStatusFilter; + } + + public void setReserveStatusFilter(String reserveStatusFilter) + { + this.reserveStatusFilter = reserveStatusFilter; + } + + public int getWarehouseId() + { + return warehouseId; + } + + public void setWarehouseId(int warehouseId) + { + this.warehouseId = warehouseId; + } + + public int getPriceListVersionId() + { + return priceListVersionId; + } + + public void setPriceListVersionId(int priceListVersionId) + { + this.priceListVersionId = priceListVersionId; + } + + public int getPriceListId() + { + return priceListId; + } + + public void setPriceListId(int priceListId) + { + this.priceListId = priceListId; + } + + public int getHondaOrgId() + { + return hondaOrgId; + } + public void setHondaOrgId(int hondaOrgId) + { + this.hondaOrgId = hondaOrgId; + } + + public int getProductId() + { + return productId; + } + + public void setProductId(int productId) + { + this.productId = productId; + } + + + public int getLocatorId() + { + return locatorId; + } + + public void setLocatorId(int locatorId) + { + this.locatorId = locatorId; + } + + + + + public int[] getAttributeValueIds() + { + return attributeValueIds; + } + public void setAttributeValueIds(int[] attributeValueIds) + { + this.attributeValueIds = attributeValueIds; + } + + + public int getAttributeSetId() + { + return attributeSetId; + } + + public void setAttributeSetId(int attributeSetid) + { + this.attributeSetId = attributeSetid; + } + + public String getFromLocatorSQL() + { + return fromLocatorSQL; + } + + public void setFromLocatorSQL(String fromLocatorSQL) + { + this.fromLocatorSQL = fromLocatorSQL; + } + + public String getRegionFilterSQL() + { + return regionFilterSQL; + } + + public void setRegionFilterSQL(String regionFilterSQL) + { + this.regionFilterSQL = regionFilterSQL; + } + + public int getProductCategoryId() + { + return productCategoryId; + } + + public void setProductCategoryId(int productCategoryId) + { + this.productCategoryId = productCategoryId; + } + + public Integer getAd_Org_ID() + { + return ad_Org_ID; + } + + public void setAd_Org_ID(Integer ad_Org_ID) + { + this.ad_Org_ID = ad_Org_ID; + } + + public String getETAFilter() + { + return ETAFilter; + } + public void setETAFilter(String filter) + { + ETAFilter = filter; + } + + public String getBackOrder() + { + return backOrder; + } + + public void setBackOrder(String backOrder) + { + this.backOrder = backOrder; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductRestrictionBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductRestrictionBean.java new file mode 100644 index 0000000000..451de68469 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductRestrictionBean.java @@ -0,0 +1,96 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 30, 2005 by praveen + * + */ +package org.posterita.beans; + +public class ProductRestrictionBean extends StockBean +{ + public Integer getProductCategoryId() + { + return productCategoryId; + } + + public void setProductCategoryId(Integer productCategoryId) + { + this.productCategoryId = productCategoryId; + } + + public Integer[] getCheckBox() + { + return checkBox; + } + public Integer getColour() + { + return colour; + } + + public Integer getModel() + { + return model; + } + + public Integer getOrgId() + { + return orgId; + } + + public Integer getTransmission() + { + return transmission; + } + + public Integer getYear() + { + return year; + } + + public void setCheckBox(Integer[] checkBox) + { + this.checkBox = checkBox; + } + + public void setColour(Integer colour) + { + this.colour = colour; + } + + public void setModel(Integer model) + { + this.model = model; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public void setTransmission(Integer transmission) + { + this.transmission = transmission; + } + + public void setYear(Integer year) + { + this.year = year; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductSalesInfoBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductSalesInfoBean.java new file mode 100644 index 0000000000..52a9fe7505 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductSalesInfoBean.java @@ -0,0 +1,82 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 10-Oct-2006 12:34:54 by praveen + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.Date; + +public class ProductSalesInfoBean { + private String DocumentNo; + private Date dateOrdered; + private String bpartnerName; + private String orderType; + private BigDecimal qtyOrderded; + private Integer orderId; + private BigDecimal lineAmount; + + public String getBpartnerName() { + return bpartnerName; + } + public void setBpartnerName(String bpartnerName) { + this.bpartnerName = bpartnerName; + } + public Date getDateOrdered() { + return dateOrdered; + } + public void setDateOrdered(Date dateOrdered) { + this.dateOrdered = dateOrdered; + } + public String getDocumentNo() { + return DocumentNo; + } + public void setDocumentNo(String documentNo) { + DocumentNo = documentNo; + } + public String getOrderType() { + return orderType; + } + public void setOrderType(String orderType) { + this.orderType = orderType; + } + public BigDecimal getQtyOrderded() { + return qtyOrderded; + } + public void setQtyOrderded(BigDecimal qtyOrderded) { + this.qtyOrderded = qtyOrderded; + } + public Integer getOrderId() { + return orderId; + } + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + public BigDecimal getLineAmount() { + return lineAmount; + } + public void setLineAmount(BigDecimal lineAmount) { + this.lineAmount = lineAmount; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductSalesSummaryBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductSalesSummaryBean.java new file mode 100644 index 0000000000..80b6870660 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductSalesSummaryBean.java @@ -0,0 +1,67 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 10-Oct-2006 12:25:01 by praveen + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +public class ProductSalesSummaryBean { + private Integer productId; + private String productName; + private BigDecimal qtySold; + private BigDecimal totalAmount; + private BigDecimal qtyOnHand; + + public Integer getProductId() { + return productId; + } + public void setProductId(Integer productId) { + this.productId = productId; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public BigDecimal getQtyOnHand() { + return qtyOnHand; + } + public void setQtyOnHand(BigDecimal qtyOnHand) { + this.qtyOnHand = qtyOnHand; + } + public BigDecimal getQtySold() { + return qtySold; + } + public void setQtySold(BigDecimal qtySold) { + this.qtySold = qtySold; + } + public BigDecimal getTotalAmount() { + return totalAmount; + } + public void setTotalAmount(BigDecimal totalAmount) { + this.totalAmount = totalAmount; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductSearchBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductSearchBean.java new file mode 100644 index 0000000000..13889256ff --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductSearchBean.java @@ -0,0 +1,43 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 17, 2006 by ashley +* +*/ + +package org.posterita.beans; + +public class ProductSearchBean extends UDIBean +{ + public Boolean getIsActive() + { + return isActive; + } + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + public Boolean getIsWebstoreFeatured() + { + return isWebstoreFeatured; + } + public void setIsWebstoreFeatured(Boolean isWebstoreFeatured) + { + this.isWebstoreFeatured = isWebstoreFeatured; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductSpecsBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductSpecsBean.java new file mode 100644 index 0000000000..ca858f8598 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductSpecsBean.java @@ -0,0 +1,86 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class ProductSpecsBean +{ + private String model; + private String colour; + private String year; + private String transmission; + private BigDecimal priceStd; + + + public BigDecimal getPriceStd() { + return priceStd; + } + public void setPriceStd(BigDecimal priceStd) { + this.priceStd = priceStd; + } + public String getColour() { + return colour; + } + public void setColour(String colour) { + this.colour = colour; + } + public String getModel() { + return model; + } + public void setModel(String model) { + this.model = model; + } + public String getTransmission() { + return transmission; + } + public void setTransmission(String transmission) { + this.transmission = transmission; + } + public String getYear() { + return year; + } + public void setYear(String year) { + this.year = year; + } + + public boolean equals(Object obj) + { + ProductSpecsBean bean = (ProductSpecsBean) obj; + + if ( obj == null) + return false; + + if (this.getModel().equalsIgnoreCase(bean.getModel()) == false) + return false; + + if (this.getColour().equalsIgnoreCase(bean.getColour()) == false) + return false; + + if (this.getTransmission().equalsIgnoreCase(bean.getTransmission()) == false) + return false; + + if (this.getYear().equalsIgnoreCase(bean.getYear()) == false) + return false; + + return true; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductStatusBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductStatusBean.java new file mode 100644 index 0000000000..8597bc9592 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductStatusBean.java @@ -0,0 +1,253 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jan 18, 2006 by praveen + * + */ +package org.posterita.beans; + +import java.math.BigDecimal; + +public class ProductStatusBean extends UDIBean +{ + private Boolean availability = Boolean.valueOf(true); + private ProductImageInfo imageInfo; + private Boolean hasAttachment; + + public String getProductClassification() + { + return productClassification; + } + public void setProductClassification(String productClassification) + { + this.productClassification = productClassification; + } + + public Integer[] getCheckBox() + { + return checkBox; + } + + public void setCheckBox(Integer[] checkBox) + { + this.checkBox = checkBox; + } + + public Boolean getAvailability() + { + return availability; + } + + public void setAvailability(Boolean availability) + { + this.availability = availability; + } + + private String colour,model,transmission,year; + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public String getColour() + { + return colour; + } + + public void setColour(String colour) + { + this.colour = colour; + } + + public String getModel() + { + return model; + } + + public void setModel(String model) + { + this.model = model; + } + + public String getTransmission() + { + return transmission; + } + + public void setTransmission(String transmission) + { + this.transmission = transmission; + } + + public String getYear() + { + return year; + } + + public void setYear(String year) + { + this.year = year; + } + + public Boolean getIsActive() + { + return isActive; + } + + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + private String productName; + + public String getProductName() + { + return productName; + } + public void setProductName(String productName) + { + this.productName = productName; + } + + public ProductImageInfo getImageInfo() + { + return imageInfo; + } + + public void setImageInfo(ProductImageInfo imageInfo) + { + this.imageInfo = imageInfo; + } + + public Boolean getHasAttachment() + { + return hasAttachment; + } + public void setHasAttachment(Boolean hasAttachment) + { + this.hasAttachment = hasAttachment; + } + public Boolean getIsWebstoreFeatured() + { + return isWebstoreFeatured; + } + + public void setIsWebstoreFeatured(Boolean isWebstoreFeatured) + { + this.isWebstoreFeatured = isWebstoreFeatured; + } + + public String getProductNameComplete() + { + String retVal = ""; + if(productName != null) + retVal = productName.replaceAll("_", " "); + return retVal; + } + + public String getKeyword1() + { + return keyword1; + } + + public void setKeyword1(String keyword1) + { + this.keyword1 = keyword1; + } + + public String getKeyword2() + { + return keyword2; + } + + public void setKeyword2(String keyword2) + { + this.keyword2 = keyword2; + } + + public String getKeyword3() + { + return keyword3; + } + + public void setKeyword3(String keyword3) + { + this.keyword3 = keyword3; + } + + public String getKeyword4() + { + return keyword4; + } + + public void setKeyword4(String keyword4) + { + this.keyword4 = keyword4; + } + + public String getBarCode() + { + return barCode; + } + + public void setBarCode(String barCode) + { + this.barCode = barCode; + } + + public Boolean getIsSelfService() + { + return isSelfService; + } + + public void setIsSelfService(Boolean isSelfService) + { + this.isSelfService = isSelfService; + } + + private String description; + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public BigDecimal getQtyOnHand() { + return qtyOnHand; + } + public void setQtyOnHand(BigDecimal qtyOnHand) { + this.qtyOnHand = qtyOnHand; + } + public BigDecimal getPriceStandard() { + return priceStandard; + } + public void setPriceStandard(BigDecimal priceStandard) { + this.priceStandard = priceStandard; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ProductSupplierBean.java b/posterita/posterita/src/main/org/posterita/beans/ProductSupplierBean.java new file mode 100644 index 0000000000..6a3733974a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ProductSupplierBean.java @@ -0,0 +1,52 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 20, 2006 + */ + + +package org.posterita.beans; + + +public class ProductSupplierBean extends UDIBean +{ + protected Integer bPartnerId; + protected String partnerName; + protected Integer quantity; + + public Integer getBPartnerId() { + return bPartnerId; + } + public void setBPartnerId(Integer partnerId) { + bPartnerId = partnerId; + } + public String getPartnerName() { + return partnerName; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public Integer getQuantity() { + return quantity; + } + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/RemoveSessionBean.java b/posterita/posterita/src/main/org/posterita/beans/RemoveSessionBean.java new file mode 100644 index 0000000000..3aad81c53a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/RemoveSessionBean.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jan 26, 2007 + */ + + +package org.posterita.beans; + + +public class RemoveSessionBean extends UDIBean +{ + + + public String getOrderType() + { + return orderType; + } + + public void setOrderType(String orderType) + { + this.orderType = orderType; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/beans/ReportBean.java b/posterita/posterita/src/main/org/posterita/beans/ReportBean.java new file mode 100644 index 0000000000..6fe738904c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ReportBean.java @@ -0,0 +1,293 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + +import java.util.ArrayList; + + +public class ReportBean extends UDIBean +{ + + public ReportBean getReport() + { + return report; + } + + public void setReport(ReportBean report) + { + this.report = report; + } + + public ArrayList getReportList() + { + return reportList; + } + + public void setStockList(ArrayList reportList) + { + this.reportList = reportList; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public String getProductName() + { + return productName; + } + + public void setProductName(String productName) + { + this.productName = productName; + } + + public String getBarCode() + { + return barCode; + } + public void setBarCode(String barCode) + { + this.barCode = barCode; + } + + public String getDescription() + { + return description; + } + public void setDescription(String description) + { + this.description = description; + } + + public Integer getOrgId() + { + return orgId; + } + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public Integer getNoOfProductsRequired() { + return noOfProductsRequired; + } + public void setNoOfProductsRequired(Integer noOfProductsRequired) { + this.noOfProductsRequired = noOfProductsRequired; + } + public String getReportType() { + return reportType; + } + public void setReportType(String reportType) { + this.reportType = reportType; + } + public String getFromDate() + { + return fromDate; + } + + public void setFromDate(String fromDate) + { + this.fromDate = fromDate; + } + + public String getToDate() + { + return toDate; + } + + public void setToDate(String toDate) + { + this.toDate = toDate; + } + + public String getStartDay() + { + return startDay; + } + + public void setStartDay(String startDay) + { + this.startDay = startDay; + } + + public String getStartMonth() + { + return startMonth; + } + + public void setStartMonth(String startMonth) + { + this.startMonth = startMonth; + } + + public String getStartYear() + { + return startYear; + } + + public void setStartYear(String startYear) + { + this.startYear = startYear; + } + + public String getEndDay() + { + return endDay; + } + + public void setEndDay(String endDay) + { + this.endDay = endDay; + } + + public String getEndMonth() + { + return endMonth; + } + + public void setEndMonth(String endMonth) + { + this.endMonth = endMonth; + } + + public String getEndYear() + { + return endYear; + } + + public void setEndYear(String endYear) + { + this.endYear = endYear; + } + + public String getStartHour() + { + return startHour; + } + + public void setStartHour(String startHour) + { + this.startHour = startHour; + } + + public String getStartMinute() + { + return startMinute; + } + + public void setStartMinute(String startMinute) + { + this.startMinute = startMinute; + } + + public String getEndHour() + { + return endHour; + } + + public void setEndHour(String endHour) + { + this.endHour = endHour; + } + + public String getEndMinute() + { + return endMinute; + } + + public void setEndMinute(String endMinute) + { + this.endMinute = endMinute; + } + public String getAttribute() { + return attribute; + } + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getTimePeriod() { + return timePeriod; + } + public void setTimePeriod(String timePeriod) { + this.timePeriod = timePeriod; + } + + public String getChartType() { + return chartType; + } + public void setChartType(String chartType) { + this.chartType = chartType; + } + + public String getSalesGroup() { + return salesGroup; + } + public void setSalesGroup(String salesGroup) { + this.salesGroup = salesGroup; + } + + public Integer getAccountId() { + return accountId; + } + public void setAccountId(Integer accountId) { + this.accountId = accountId; + } + + public String getDateRange() { + return dateRange; + } + public void setDateRange(String dateRange) { + this.dateRange = dateRange; + } + + public String getPriceQtyFilter() { + return priceQtyFilter; + } + public void setPriceQtyFilter(String priceQtyFilter) { + this.priceQtyFilter = priceQtyFilter; + } + + public String getFullDetails() + { + return fullDetails; + } + + public void setFullDetails(String fullDetails) + { + this.fullDetails = fullDetails; + } + public String getIsSalesReport() + { + return isSalesReport; + } + public void setIsSalesReport(String isSalesReport) + { + this.isSalesReport = isSalesReport; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ReportDataBean.java b/posterita/posterita/src/main/org/posterita/beans/ReportDataBean.java new file mode 100644 index 0000000000..ac3f3f4350 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ReportDataBean.java @@ -0,0 +1,102 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 21, 2005 by praveen + * + */ +package org.posterita.beans; + + +public class ReportDataBean +{ + private String model; + private int count; + private int automatic; + private int manual; + private int sale; + private int target; + + public ReportDataBean() + { + model = ""; + count = 0; + automatic = 0; + manual = 0; + sale = 0; + target = 0; + } + + public int getAutomatic() + { + return automatic; + } + + public void setAutomatic(int automatic) + { + this.automatic = automatic; + } + + public int getCount() + { + return count; + } + + public void setCount(int count) + { + this.count = count; + } + + public int getManual() + { + return manual; + } + + public void setManual(int manual) + { + this.manual = manual; + } + + public String getModel() + { + return model; + } + + public void setModel(String model) + { + this.model = model; + } + + public int getSale() + { + return sale; + } + + public void setSale(int sale) { + this.sale = sale; + } + + public int getTarget() + { + return target; + } + + public void setTarget(int target) + { + this.target = target; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ReportImageBean.java b/posterita/posterita/src/main/org/posterita/beans/ReportImageBean.java new file mode 100644 index 0000000000..ba84e11b8d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ReportImageBean.java @@ -0,0 +1,151 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 17, 2005 by praveen + * + */ +package org.posterita.beans; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; + +import org.posterita.core.TimestampConvertor; + + +public class ReportImageBean +{ + private String imagePath; + private String imageTitle; + private String altText; + private String requestParams; + private String dateFrom; + private String dateTo; + + public ReportImageBean() + { + initDateFrom(); + initDateTo(); + } + + private void initDateFrom() + { + SimpleDateFormat df = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + + Calendar calendar = GregorianCalendar.getInstance(); + + if(calendar.get(Calendar.MONTH) == Calendar.JANUARY) + { + calendar.set(Calendar.DATE,9); + } + else + { + calendar.set(Calendar.DATE,1); + } + + calendar.set(Calendar.HOUR_OF_DAY,9); + calendar.set(Calendar.MINUTE,15); + calendar.set(Calendar.SECOND,0); + dateFrom = df.format(calendar.getTime()); + } + + private void initDateTo() + { + SimpleDateFormat df = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + + Calendar calendar = GregorianCalendar.getInstance(); + //int maxNoOfDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + //calendar.set(Calendar.DATE,maxNoOfDays); + dateTo = df.format(calendar.getTime()); + } + + public String getAltText() + { + return altText; + } + + public void setAltText(String altText) + { + this.altText = altText; + } + + public String getImagePath() + { + return imagePath; + } + + public void setImagePath(String imagePath) + { + this.imagePath = imagePath; + } + + public String getImageTitle() + { + return imageTitle; + } + + public void setImageTitle(String imageTitle) + { + this.imageTitle = imageTitle; + } + + public void setRequestParams(String requestParams) + { + this.requestParams = requestParams; + } + + public String getDateFrom() + { + return dateFrom; + } + + public void setDateFrom(String dateFrom) + { + this.dateFrom = dateFrom; + } + + public String getDateTo() + { + return dateTo; + } + + public void setDateTo(String dateTo) + { + this.dateTo = dateTo; + } + + public String getRequestParams() + { + requestParams = null; + + try + { + requestParams = "dateFrom=" + URLEncoder.encode(dateFrom,"UTF-8") + + "&dateTo=" + URLEncoder.encode(dateTo,"UTF-8") + + "&imagePath=" + URLEncoder.encode(imagePath,"UTF-8") + + "&imageTitle=" + URLEncoder.encode(imageTitle,"UTF-8"); + } + catch (UnsupportedEncodingException e) + { + + } + return requestParams; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/RoleBean.java b/posterita/posterita/src/main/org/posterita/beans/RoleBean.java new file mode 100644 index 0000000000..484a1f1166 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/RoleBean.java @@ -0,0 +1,203 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 16, 2005 by praveen + * + */ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + +public class RoleBean extends UDIBean +{ + protected Boolean isDiscountUptoLimitPrice; + protected Boolean isDiscountAllowedOnTotal; + + + public ArrayList getRoleBeanList() { + return roleBeanList; + } + + public void setRoleBeanList(ArrayList roleBeanList) { + this.roleBeanList = roleBeanList; + } + + public Boolean getIsChecked() { + return isChecked; + } + + public void setIsChecked(Boolean isChecked) { + this.isChecked = isChecked; + } + + public Boolean getIsOverwritePriceLimit() { + return isOverwritePriceLimit; + } + + public void setIsOverwritePriceLimit(Boolean isOverwritePriceLimit) { + this.isOverwritePriceLimit = isOverwritePriceLimit; + } + + public BigDecimal getUserDiscount() { + return userDiscount; + } + + public void setUserDiscount(BigDecimal userDiscount) { + this.userDiscount = userDiscount; + } + + public Integer[] getCheckBox() + { + return checkBox; + } + + public void setCheckBox(Integer[] checkBox) + { + this.checkBox = checkBox; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public Boolean getIsActive() + { + return isActive; + } + + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + public Integer getRoleId() + { + return roleId; + } + + public void setRoleId(Integer roleId) + { + this.roleId = roleId; + } + + public Boolean getIsAccessAllOrgs() + { + return isAccessAllOrgs; + + } + + public void setIsAccessAllOrgs(Boolean isAccessAllOrgs) + { + this.isAccessAllOrgs = isAccessAllOrgs; + } + + + + public Boolean getCanAlterOrder() + { + return canAlterOrder; + } + + public void setCanAlterOrder(Boolean canAlterOrder) + { + this.canAlterOrder = canAlterOrder; + } + + protected Boolean canCreateOrder; + protected Boolean canViewOrder; + + + public Boolean getCanCreateOrder() + { + return canCreateOrder; + } + + public void setCanCreateOrder(Boolean canCreateOrder) + { + this.canCreateOrder = canCreateOrder; + } + + public Boolean getCanViewOrder() + { + return canViewOrder; + } + + public void setCanViewOrder(Boolean canViewOrder) + { + this.canViewOrder = canViewOrder; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public String getOrgName() + { + return orgName; + } + + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + + public Boolean getIsDiscountUptoLimitPrice() + { + return isDiscountUptoLimitPrice; + } + + public void setIsDiscountUptoLimitPrice(Boolean isDiscountUptoLimitPrice) + { + this.isDiscountUptoLimitPrice = isDiscountUptoLimitPrice; + } + + public Boolean getIsDiscountAllowedOnTotal() + { + return isDiscountAllowedOnTotal; + } + + public void setIsDiscountAllowedOnTotal(Boolean isDiscountAllowedOnTotal) + { + this.isDiscountAllowedOnTotal = isDiscountAllowedOnTotal; + } + + public Integer getWebMenuId() + { + return webMenuId; + } + + public void setWebMenuId(Integer webMenuId) + { + this.webMenuId = webMenuId; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/SalesAnalysisReportBean.java b/posterita/posterita/src/main/org/posterita/beans/SalesAnalysisReportBean.java new file mode 100644 index 0000000000..8559560809 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/SalesAnalysisReportBean.java @@ -0,0 +1,86 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 14-Jul-2006 14:00:21 by praveen + * + */ + +package org.posterita.beans; + +public class SalesAnalysisReportBean extends ReportBean +{ + private String supplier,category,brand,model,design,colour,size; + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getColour() { + return colour; + } + + public void setColour(String colour) { + this.colour = colour; + } + + public String getDesign() { + return design; + } + + public void setDesign(String design) { + this.design = design; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public String getSupplier() { + return supplier; + } + + public void setSupplier(String supplier) { + this.supplier = supplier; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/SalesAnalysisReportDataBean.java b/posterita/posterita/src/main/org/posterita/beans/SalesAnalysisReportDataBean.java new file mode 100644 index 0000000000..573242e971 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/SalesAnalysisReportDataBean.java @@ -0,0 +1,86 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 05-Jul-2006 12:32:38 by praveen + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +public class SalesAnalysisReportDataBean +{ + private String supplier,category,brand,model,design,colour,size; + private BigDecimal quantity,amount; + + public BigDecimal getAmount() { + return amount; + } + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + public String getBrand() { + return brand; + } + public void setBrand(String brand) { + this.brand = brand; + } + public String getCategory() { + return category; + } + public void setCategory(String category) { + this.category = category; + } + public String getColour() { + return colour; + } + public void setColour(String colour) { + this.colour = colour; + } + public String getDesign() { + return design; + } + public void setDesign(String design) { + this.design = design; + } + public String getModel() { + return model; + } + public void setModel(String model) { + this.model = model; + } + public BigDecimal getQuantity() { + return quantity; + } + public void setQuantity(BigDecimal quantity) { + this.quantity = quantity; + } + public String getSize() { + return size; + } + public void setSize(String size) { + this.size = size; + } + public String getSupplier() { + return supplier; + } + public void setSupplier(String supplier) { + this.supplier = supplier; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/SalesDetailsBean.java b/posterita/posterita/src/main/org/posterita/beans/SalesDetailsBean.java new file mode 100644 index 0000000000..6ebaafaa03 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/SalesDetailsBean.java @@ -0,0 +1,209 @@ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +public class SalesDetailsBean +{ + private int orderId; + private int[] orderLineId; + private int[] productId; + private int bPartnerId; + private BigDecimal linesTotals; + private BigDecimal grandTotals; + private BigDecimal totalTaxAmount; + private BigDecimal cardAmount; + private BigDecimal cashAmount; + private BigDecimal chequeAmount; + private BigDecimal totalCosts; + private BigDecimal salesExcVat; + private BigDecimal salesExempt; + private BigDecimal purchasesExcVat; + private BigDecimal purchasesExempt; + private BigDecimal creditNoteExcVat; + private BigDecimal creditNoteExempt; + private BigDecimal debitNoteExcVat; + private BigDecimal debitNoteExempt; + private BigDecimal total; + private String orderType; + private Timestamp date; + + public int getOrderId() + { + return orderId; + } + public void setOrderId(int orderId) + { + this.orderId = orderId; + } + public int[] getOrderLineId() + { + return orderLineId; + } + public void setOrderLineId(int[] orderLineId) + { + this.orderLineId = orderLineId; + } + public int[] getProductId() + { + return productId; + } + public void setProductId(int[] productId) + { + this.productId = productId; + } + public int getBPartnerId() + { + return bPartnerId; + } + public void setBPartnerId(int partnerId) + { + bPartnerId = partnerId; + } + public BigDecimal getLinesTotals() + { + return linesTotals; + } + public void setLinesTotals(BigDecimal linesTotals) + { + this.linesTotals = linesTotals; + } + public BigDecimal getGrandTotals() + { + return grandTotals; + } + public void setGrandTotals(BigDecimal grandTotals) + { + this.grandTotals = grandTotals; + } + public BigDecimal getTotalTaxAmount() + { + return totalTaxAmount; + } + public void setTotalTaxAmount(BigDecimal totalTaxAmount) + { + this.totalTaxAmount = totalTaxAmount; + } + public BigDecimal getCardAmount() + { + return cardAmount; + } + public void setCardAmount(BigDecimal cardAmount) + { + this.cardAmount = cardAmount; + } + public BigDecimal getCashAmount() + { + return cashAmount; + } + public void setCashAmount(BigDecimal cashAmount) + { + this.cashAmount = cashAmount; + } + public BigDecimal getChequeAmount() + { + return chequeAmount; + } + public void setChequeAmount(BigDecimal chequeAmount) + { + this.chequeAmount = chequeAmount; + } + public BigDecimal getTotalCosts() + { + return totalCosts; + } + public void setTotalCosts(BigDecimal totalCosts) + { + this.totalCosts = totalCosts; + } + public BigDecimal getSalesExcVat() + { + return salesExcVat; + } + public void setSalesExcVat(BigDecimal salesExcVat) + { + this.salesExcVat = salesExcVat; + } + public BigDecimal getSalesExempt() + { + return salesExempt; + } + public void setSalesExempt(BigDecimal salesExempt) + { + this.salesExempt = salesExempt; + } + public BigDecimal getCreditNoteExcVat() + { + return creditNoteExcVat; + } + public void setCreditNoteExcVat(BigDecimal creditNoteExcVat) + { + this.creditNoteExcVat = creditNoteExcVat; + } + public BigDecimal getCreditNoteExempt() + { + return creditNoteExempt; + } + public void setCreditNoteExempt(BigDecimal creditNoteExempt) + { + this.creditNoteExempt = creditNoteExempt; + } + public BigDecimal getTotal() + { + return total; + } + public void setTotal(BigDecimal total) + { + this.total = total; + } + public String getOrderType() + { + return orderType; + } + public void setOrderType(String orderType) + { + this.orderType = orderType; + } + public Timestamp getDate() + { + return date; + } + public void setDate(Timestamp date) + { + this.date = date; + } + public BigDecimal getDebitNoteExcVat() + { + return debitNoteExcVat; + } + public void setDebitNoteExcVat(BigDecimal debitNoteExcVat) + { + this.debitNoteExcVat = debitNoteExcVat; + } + public BigDecimal getDebitNoteExempt() + { + return debitNoteExempt; + } + public void setDebitNoteExempt(BigDecimal debitNoteExempt) + { + this.debitNoteExempt = debitNoteExempt; + } + public BigDecimal getPurchasesExcVat() + { + return purchasesExcVat; + } + public void setPurchasesExcVat(BigDecimal purchasesExcVat) + { + this.purchasesExcVat = purchasesExcVat; + } + public BigDecimal getPurchasesExempt() + { + return purchasesExempt; + } + public void setPurchasesExempt(BigDecimal purchasesExempt) + { + this.purchasesExempt = purchasesExempt; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/SearchBean.java b/posterita/posterita/src/main/org/posterita/beans/SearchBean.java new file mode 100644 index 0000000000..bc990d6916 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/SearchBean.java @@ -0,0 +1,82 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 15, 2006 by ashley +* +*/ + +package org.posterita.beans; + +import java.util.ArrayList; + +public class SearchBean +{ + + protected String searchText; + protected ArrayList andCriteriasList; + protected ArrayList orCriteriasList; + protected ArrayList notCriteriasList; + + public SearchBean(String searchText) + { + this.searchText = searchText; + andCriteriasList = new ArrayList(); + orCriteriasList = new ArrayList(); + notCriteriasList = new ArrayList(); + } + + public ArrayList getAndCriteriasList() + { + return andCriteriasList; + } + + public void setAndCriteriasList(ArrayList andCriteriasList) + { + this.andCriteriasList = andCriteriasList; + } + + public ArrayList getNotCriteriasList() + { + return notCriteriasList; + } + + public void setNotCriteriasList(ArrayList notCriteriasList) + { + this.notCriteriasList = notCriteriasList; + } + + public ArrayList getOrCriteriasList() + { + return orCriteriasList; + } + + public void setOrCriteriasList(ArrayList orCriteriasList) + { + this.orCriteriasList = orCriteriasList; + } + + public String getSearchText() + { + return searchText; + } + + public void setSearchText(String searchText) + { + this.searchText = searchText; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/SearchOrderBean.java b/posterita/posterita/src/main/org/posterita/beans/SearchOrderBean.java new file mode 100644 index 0000000000..02a2f4c8a2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/SearchOrderBean.java @@ -0,0 +1,51 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 8, 2005 by praveen + * + */ +package org.posterita.beans; + +public class SearchOrderBean extends UDIBean +{ + + public Integer getOrderId() + { + return orderId; + } + + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + + public Integer getFirst() + { + return first; + } + + public void setFirst(Integer first) + { + this.first = first; + } + + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ShipperBean.java b/posterita/posterita/src/main/org/posterita/beans/ShipperBean.java new file mode 100644 index 0000000000..eab92da52f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ShipperBean.java @@ -0,0 +1,45 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + + +public class ShipperBean extends UDIBean +{ + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/ShoppingCartBean.java b/posterita/posterita/src/main/org/posterita/beans/ShoppingCartBean.java new file mode 100644 index 0000000000..36fa13aa98 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/ShoppingCartBean.java @@ -0,0 +1,71 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + + +public class ShoppingCartBean extends UDIBean +{ + private ArrayList items; + private String currency; + private BigDecimal totalPrice; + private int pricelistId; + + public String getCurrency() + { + return currency; + } + + public void setCurrency(String currency) + { + this.currency = currency; + } + + public ArrayList getItems() + { + return items; + } + + public void setItems(ArrayList items) + { + this.items = items; + } + + public BigDecimal getTotalPrice() + { + return totalPrice; + } + + public void setTotalPrice(BigDecimal totalPrice) + { + this.totalPrice = totalPrice; + } + + public int getPricelistId() { + return pricelistId; + } + + public void setPricelistId(int pricelistId) { + this.pricelistId = pricelistId; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/StatementOfAccountBean.java b/posterita/posterita/src/main/org/posterita/beans/StatementOfAccountBean.java new file mode 100644 index 0000000000..d683a280e5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/StatementOfAccountBean.java @@ -0,0 +1,87 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. POSTERITA SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Aug 12, 2008 10:39:24 PM by praveen + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +public class StatementOfAccountBean +{ + private Timestamp date; + private String reference; + private String docType; + private int docId; + private String details; + private BigDecimal credit; + private BigDecimal debit; + private BigDecimal balance; + + public Timestamp getDate() { + return date; + } + public void setDate(Timestamp date) { + this.date = date; + } + public String getReference() { + return reference; + } + public void setReference(String reference) { + this.reference = reference; + } + public String getDocType() { + return docType; + } + public void setDocType(String docType) { + this.docType = docType; + } + public String getDetails() { + return details; + } + public void setDetails(String details) { + this.details = details; + } + public BigDecimal getCredit() { + return credit; + } + public void setCredit(BigDecimal credit) { + this.credit = credit; + } + public BigDecimal getDebit() { + return debit; + } + public void setDebit(BigDecimal debit) { + this.debit = debit; + } + public BigDecimal getBalance() { + return balance; + } + public void setBalance(BigDecimal balance) { + this.balance = balance; + } + public int getDocId() { + return docId; + } + public void setDocId(int docId) { + this.docId = docId; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/StockBean.java b/posterita/posterita/src/main/org/posterita/beans/StockBean.java new file mode 100644 index 0000000000..17fee5e726 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/StockBean.java @@ -0,0 +1,347 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + + + +public class StockBean extends UDIBean +{ + public String getKeyword2() + { + return keyword2; + } + + public void setKeyword2(String keyword2) + { + this.keyword2 = keyword2; + } + + public Integer getProductCategoryId() + { + return productCategoryId; + } + + public void setProductCategoryId(Integer productCategoryId) + { + this.productCategoryId = productCategoryId; + } + + public Integer getMake() + { + return make; + } + public void setMake(Integer make) + { + this.make = make; + } + + public String getAvailableForBackOrderFilter() { + + return availableForBackOrderFilter; + } + + public void setAvailableForBackOrderFilter(String availableForBackOrderFilter) + { + this.availableForBackOrderFilter = availableForBackOrderFilter; + } + + public Integer getModel() + { + return model; + } + + public void setModel(Integer model) + { + this.model = model; + } + + public Integer getColour() + { + return colour; + } + + public void setColour(Integer colour) + { + this.colour = colour; + } + + public Integer getTransmission() + { + return transmission; + } + + public void setTransmission(Integer transmission) + { + this.transmission = transmission; + } + + public Integer getYear() + { + return year; + } + + public void setYear(Integer year) + { + this.year = year; + } + + public Boolean getIsWholesaler() + { + return isWholesaler; + } + + public void setIsWholesaler(Boolean isWholesaler) + { + this.isWholesaler = isWholesaler; + } + + public Integer getRegionId() + { + return regionId; + } + + public void setRegionId(Integer regionId) + { + this.regionId = regionId; + } + + + + public Integer[] getCheckBox() + { + return checkBox; + } + public void setCheckBox(Integer [] checkBox) + { + this.checkBox = checkBox; + } + + public Integer getReserveStatus() + { + return reserveStatus; + } + + public void setReserveStatus(Integer reserveStatus) + { + this.reserveStatus = reserveStatus; + } + + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public Integer getAllocationId() + { + return allocationId; + } + + public void setAllocationId(Integer allocationId) + { + this.allocationId = allocationId; + } + + public String getWarehouseType() + { + return warehouseType; + } + + public void setWarehouseType(String warehouseType) + { + this.warehouseType = warehouseType; + } + + public Integer getFirst() + { + return first; + } + + public void setFirst(Integer first) + { + this.first = first; + } + + public Integer getWarehouseId() + { + return warehouseId; + } + + public void setWarehouseId(Integer warehouseId) + { + this.warehouseId = warehouseId; + } + public Integer getDocumentId() { + return documentId; + } + public void setDocumentId(Integer documentId) { + this.documentId = documentId; + } + + public String getETAFilter() + { + return ETAFilter; + } + + public void setETAFilter(String filter) + { + ETAFilter = filter; + } + + public Integer getDesign() + { + return design; + } + public void setDesign(Integer design) + { + this.design = design; + } + public Integer getSize() + { + return size; + } + public void setSize(Integer size) + { + this.size = size; + } + public Integer getStyle() + { + return style; + } + public void setStyle(Integer style) + { + this.style = style; + } + + public Integer getColourAttributeValueId() + { + return colourAttributeValueId; + } + + public void setColourAttributeValueId(Integer colourAttributeValueId) + { + this.colourAttributeValueId = colourAttributeValueId; + } + + public Integer getDesignAttributeValueId() + { + return designAttributeValueId; + } + + public void setDesignAttributeValueId(Integer designAttributeValueId) + { + this.designAttributeValueId = designAttributeValueId; + } + + public Integer getModelAttributeValueId() + { + return modelAttributeValueId; + } + + public void setModelAttributeValueId(Integer modelAttributeValueId) + { + this.modelAttributeValueId = modelAttributeValueId; + } + + public Integer getSizeAttributeValueId() + { + return sizeAttributeValueId; + } + + public void setSizeAttributeValueId(Integer sizeAttributeValueId) + { + this.sizeAttributeValueId = sizeAttributeValueId; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getOrderType() + { + return orderType; + } + + public void setOrderType(String orderType) + { + this.orderType = orderType; + } + + public Integer getAttributeId() + { + return attributeId; + } + + public void setAttributeId(Integer attributeId) + { + this.attributeId = attributeId; + } + + public String getKeyword() + { + return keyword; + } + + public void setKeyword(String keyword) + { + this.keyword = keyword; + } + + public String getBackOrder() + { + return backOrder; + } + + public void setBackOrder(String backOrder) + { + this.backOrder = backOrder; + } + + public String getFieldName() + { + return fieldName; + } + + public void setFieldName(String fieldName) + { + this.fieldName = fieldName; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/StockMovementBean.java b/posterita/posterita/src/main/org/posterita/beans/StockMovementBean.java new file mode 100644 index 0000000000..4fd1f1dcf3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/StockMovementBean.java @@ -0,0 +1,459 @@ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + +public class StockMovementBean +{ + private String isApproved; + private String address1; + private String address2; + private Integer movementLineId; + private Integer lineNo; + private Integer moveConfirmId; + private String orgFromName; + private String orgToName; + private Integer index; + private String movementDate; + private String documentNo; + private String documentType; + private String docStatus; + private Integer movementId; + private Integer refNo; + private StockMovementBean stock; + private ArrayList stockList; + private Boolean isActive; + private Integer orgFromId; + private Integer orgToId; + private BigDecimal qtyToMove; + private BigDecimal qtyOnHand; + private Integer orgId; + private String uom; + private Integer productId; + private String productName; + private String description; + private String barCode; + private BigDecimal quantity; + private String orgName; + private String fromDate; + private String toDate; + private Integer salesPriceListId; + private BigDecimal stockValue; + private String ifAdd; + private Integer priceListId; + private Integer noOfPack; + private String reference; + private Integer month; + private Integer year; + + public BigDecimal getStockValue() + { + return stockValue; + } + + public void setStockValue(BigDecimal stockValue) + { + this.stockValue = stockValue; + } + + public Integer getSalesPriceListId() + { + return salesPriceListId; + } + + public void setSalesPriceListId(Integer salesPriceListId) + { + this.salesPriceListId = salesPriceListId; + } + + public String getIsApproved() + { + return isApproved; + } + + public void setIsApproved(String isApproved) + { + this.isApproved = isApproved; + } + + public String getAddress1() + { + return address1; + } + + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public String getAddress2() + { + return address2; + } + + public void setAddress2(String address2) + { + this.address2 = address2; + } + + public Integer getMovementLineId() + { + return movementLineId; + } + + public void setMovementLineId(Integer movementLineId) + { + this.movementLineId = movementLineId; + } + + public Integer getLineNo() + { + return lineNo; + } + + public void setLineNo(Integer lineNo) + { + this.lineNo = lineNo; + } + + public Integer getMoveConfirmId() + { + return moveConfirmId; + } + + public void setMoveConfirmId(Integer moveConfirmId) + { + this.moveConfirmId = moveConfirmId; + } + + public String getOrgFromName() + { + return orgFromName; + } + + public void setOrgFromName(String orgFromName) + { + this.orgFromName = orgFromName; + } + + public String getOrgToName() + { + return orgToName; + } + + public void setOrgToName(String orgToName) + { + this.orgToName = orgToName; + } + + public Integer getIndex() + { + return index; + } + + public void setIndex(Integer index) + { + this.index = index; + } + + public String getMovementDate() + { + return movementDate; + } + + public void setMovementDate(String movementDate) + { + this.movementDate = movementDate; + } + + public String getDocumentNo() + { + return documentNo; + } + + public void setDocumentNo(String documentNo) + { + this.documentNo = documentNo; + } + + public String getDocumentType() + { + return documentType; + } + + public void setDocumentType(String documentType) + { + this.documentType = documentType; + } + + public String getDocStatus() + { + return docStatus; + } + + public void setDocStatus(String docStatus) + { + this.docStatus = docStatus; + } + + public Integer getMovementId() + { + return movementId; + } + + public void setMovementId(Integer movementId) + { + this.movementId = movementId; + } + + public Integer getRefNo() + { + return refNo; + } + + public void setRefNo(Integer refNo) + { + this.refNo = refNo; + } + + public StockMovementBean getStock() + { + return stock; + } + + public void setStock(StockMovementBean stock) + { + this.stock = stock; + } + + public ArrayList getStockList() + { + return stockList; + } + + public void setStockList(ArrayList stockList) + { + this.stockList = stockList; + } + + public Boolean getIsActive() + { + return isActive; + } + + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + public Integer getOrgFromId() + { + return orgFromId; + } + + public void setOrgFromId(Integer orgFromId) + { + this.orgFromId = orgFromId; + } + + public Integer getOrgToId() + { + return orgToId; + } + + public void setOrgToId(Integer orgToId) + { + this.orgToId = orgToId; + } + + public BigDecimal getQtyToMove() + { + return qtyToMove; + } + + public void setQtyToMove(BigDecimal qtyToMove) + { + this.qtyToMove = qtyToMove; + } + + public BigDecimal getQtyOnHand() + { + return qtyOnHand; + } + + public void setQtyOnHand(BigDecimal qtyOnHand) + { + this.qtyOnHand = qtyOnHand; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public String getUom() + { + return uom; + } + + public void setUom(String uom) + { + this.uom = uom; + } + + public Integer getProductId() + { + return productId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public String getProductName() + { + return productName; + } + + public void setProductName(String productName) + { + this.productName = productName; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getBarCode() + { + return barCode; + } + + public void setBarCode(String barCode) + { + this.barCode = barCode; + } + + public void setQuantity(BigDecimal quantity) + { + this.quantity = quantity; + } + + public BigDecimal getQuantity() + { + return this.quantity; + } + + public String getOrgName() + { + return orgName; + } + + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + + public String getFromDate() + { + return fromDate; + } + + public void setFromDate(String fromDate) + { + this.fromDate = fromDate; + } + + public String getToDate() + { + return toDate; + } + + public void setToDate(String toDate) + { + this.toDate = toDate; + } + + public String getIfAdd() { + return ifAdd; + } + public void setIfAdd(String ifAdd) { + this.ifAdd = ifAdd; + } + + public void updateQuantity(StockMovementBean original, StockMovementBean itemToAdd, boolean add) + { + BigDecimal originalQuantity = original.getQtyToMove(); + + BigDecimal quantityToAdd = itemToAdd.getQtyToMove(); + + BigDecimal finalQuantity = null; + + if(!add) + finalQuantity= originalQuantity.subtract(quantityToAdd); + else + finalQuantity= originalQuantity.add(quantityToAdd); + + + original.setQtyToMove(finalQuantity); + } + + public Integer getPriceListId() + { + return priceListId; + } + + public void setPriceListId(Integer priceListId) + { + this.priceListId = priceListId; + } + + public Integer getNoOfPack() + { + return noOfPack; + } + + public void setNoOfPack(Integer noOfPack) + { + this.noOfPack = noOfPack; + } + + public String getReference() + { + return reference; + } + + public void setReference(String reference) + { + this.reference = reference; + } + + public Integer getMonth() + { + return month; + } + public void setMonth(Integer month) + { + this.month = month; + } + public Integer getYear() + { + return year; + } + public void setYear(Integer year) + { + this.year = year; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/SynchronizationBean.java b/posterita/posterita/src/main/org/posterita/beans/SynchronizationBean.java new file mode 100644 index 0000000000..80e22b9ba8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/SynchronizationBean.java @@ -0,0 +1,75 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.beans; + +import java.util.ArrayList; + +public class SynchronizationBean +{ + private ArrayList productNotInactivatedList; + private int productsInactivated; + private int errorsProductInactivate; + + public SynchronizationBean() + { + productNotInactivatedList = new ArrayList(); + } + + public int getErrorsProductInactivate() + { + return errorsProductInactivate; + } + + public void setErrorsProductInactivate(int errorsProductInactivate) + { + this.errorsProductInactivate = errorsProductInactivate; + } + + public ArrayList getProductNotInactivatedList() + { + return productNotInactivatedList; + } + + public void setProductNotInactivatedList(ArrayList productNotInactivatedList) + { + this.productNotInactivatedList = productNotInactivatedList; + } + + public int getProductsInactivated() + { + return productsInactivated; + } + + public void setProductsInactivated(int productsInactivated) + { + this.productsInactivated = productsInactivated; + } + + public void addNotInactivatedProduct(String productName) + { + this.productNotInactivatedList.add(productName); + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/SynchronizeCollectionBean.java b/posterita/posterita/src/main/org/posterita/beans/SynchronizeCollectionBean.java new file mode 100644 index 0000000000..833c8c5af2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/SynchronizeCollectionBean.java @@ -0,0 +1,89 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.beans; + +public class SynchronizeCollectionBean extends UDIBean +{ + public String getStartDay() + { + return startDay; + } + + public void setStartDay(String startDay) + { + this.startDay = startDay; + } + + public String getStartHour() + { + return startHour; + } + + public void setStartHour(String startHour) + { + this.startHour = startHour; + } + + public String getStartMinute() + { + return startMinute; + } + + public void setStartMinute(String startMinute) + { + this.startMinute = startMinute; + } + + public String getStartMonth() + { + return startMonth; + } + + public void setStartMonth(String startMonth) + { + this.startMonth = startMonth; + } + + public String getStartYear() + { + return startYear; + } + + public void setStartYear(String startYear) + { + this.startYear = startYear; + } + + public String getFromDate() + { + return fromDate; + } + + public void setFromDate(String fromDate) + { + this.fromDate = fromDate; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/TShirtProductDetailsBean.java b/posterita/posterita/src/main/org/posterita/beans/TShirtProductDetailsBean.java new file mode 100644 index 0000000000..9b05ce4651 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/TShirtProductDetailsBean.java @@ -0,0 +1,61 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 5, 2006 by ashley +* +*/ + +package org.posterita.beans; + +public class TShirtProductDetailsBean extends UDIBean +{ + + + public String[] getColours() + { + return colours; + } + public void setColours(String[] colours) + { + this.colours = colours; + } + public String[] getSizes() + { + return sizes; + } + public void setSizes(String[] sizes) + { + this.sizes = sizes; + } + public Integer getProductId() + { + return productId; + } + public void setProductId(Integer productId) + { + this.productId = productId; + } + public String getImageLink() + { + return imageLink; + } + public void setImageLink(String imageLink) + { + this.imageLink = imageLink; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/TabularReportRecordBean.java b/posterita/posterita/src/main/org/posterita/beans/TabularReportRecordBean.java new file mode 100644 index 0000000000..9c488c5f36 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/TabularReportRecordBean.java @@ -0,0 +1,68 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 06-Oct-2006 10:51:52 by praveen + * + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +public class TabularReportRecordBean +{ + private String productName; + private String date; + private BigDecimal price; + private BigDecimal qty; + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public BigDecimal getQty() { + return qty; + } + + public void setQty(BigDecimal qty) { + this.qty = qty; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/TaxBean.java b/posterita/posterita/src/main/org/posterita/beans/TaxBean.java new file mode 100644 index 0000000000..144239c96d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/TaxBean.java @@ -0,0 +1,81 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 28, 2006 + */ + + +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class TaxBean extends UDIBean +{ + + public Integer getOrgId() { + return orgId; + } + public void setOrgId(Integer orgId) { + this.orgId = orgId; + } + public Boolean getIsActive() { + return isActive; + } + public void setIsActive(Boolean isActive) { + this.isActive = isActive; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public Boolean getIsTaxExempted() { + return isTaxExempted; + } + public void setIsTaxExempted(Boolean isTaxExempted) { + this.isTaxExempted = isTaxExempted; + } + public Integer getTaxCategoryId() { + return taxCategoryId; + } + public void setTaxCategoryId(Integer taxCategoryId) { + this.taxCategoryId = taxCategoryId; + } + public Integer getTaxId() { + return taxId; + } + public void setTaxId(Integer taxId) { + this.taxId = taxId; + } + public String getTaxName() { + return taxName; + } + public void setTaxName(String taxName) { + this.taxName = taxName; + } + public BigDecimal getTaxRate() { + return taxRate; + } + public void setTaxRate(BigDecimal taxRate) { + this.taxRate = taxRate; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/TerminalBean.java b/posterita/posterita/src/main/org/posterita/beans/TerminalBean.java new file mode 100644 index 0000000000..b50d366e9c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/TerminalBean.java @@ -0,0 +1,398 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.beans; + +import java.sql.Timestamp; + +/** + * @author Ashley G Ramdass Apr 14, 2008 + */ +public class TerminalBean extends UDIBean +{ + protected Integer terminalId; + protected Integer purchasePriceListId; + protected Integer salesPriceListId; + + protected String cashbookTransferType; + protected String checkTransferType; + protected String cardTransferType; + protected Integer cardBankAccountId; + protected Integer checkBankAccountId; + protected Integer templateBPartnerId; + protected Integer cashbookTransferCashbookId; + protected Integer cashbookTransferBankAccountId; + protected Integer checkTransferCashbookId; + protected Integer checkTransferBankAccountId; + protected Integer cardTransferCashbookId; + protected Integer cardTransferBankAccountId; + protected Boolean autoLock; + protected Boolean locked; + protected Integer lockingTime; + protected Timestamp lastLockTime; + protected Timestamp unlockingTime; + + private String orgName; + private String poPriceList; + private String soPriceList; + private Boolean isCurrentTerminal = false; + + public Integer getTerminalId() + { + return (terminalId == null ? 0 : terminalId) ; + } + + public void setTerminalId(Integer terminalId) + { + this.terminalId = terminalId; + } + + public String getName() + { + return this.name; + } + + public void setName(String name) + { + this.name = name; + } + + public Integer getOrgId() + { + return (orgId == null ? 0 : orgId); + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public Integer getBpartnerId() + { + return (bpartnerId == null ? 0 : bpartnerId); + } + + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + public Integer getWarehouseId() + { + return (warehouseId == null ? 0 : warehouseId); + } + + public void setWarehouseId(Integer warehouseId) + { + this.warehouseId = warehouseId; + } + + public Integer getPurchasePriceListId() + { + return (purchasePriceListId == null ? 0 : purchasePriceListId); + } + + public void setPurchasePriceListId(Integer purchasePriceListId) + { + this.purchasePriceListId = purchasePriceListId; + } + + public Integer getSalesPriceListId() + { + return (salesPriceListId == null ? 0 : salesPriceListId); + } + + public void setSalesPriceListId(Integer salesPriceListId) + { + this.salesPriceListId = salesPriceListId; + } + + public Integer getCashBookId() + { + return (cashBookId == null ? 0 : cashBookId); + } + + public void setCashBookId(Integer cashBookId) + { + this.cashBookId = cashBookId; + } + + public Integer getCheckBankAccountId() + { + return (checkBankAccountId == null ? 0 : checkBankAccountId); + } + + public void setCheckBankAccountId(Integer checkBankAccountId) + { + this.checkBankAccountId = checkBankAccountId; + } + + public Boolean getAutoLock() + { + return autoLock; + } + + public void setAutoLock(Boolean autoLock) + { + this.autoLock = autoLock; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Integer getTemplateBPartnerId() + { + return (templateBPartnerId == null ? 0 : templateBPartnerId); + } + + public void setTemplateBPartnerId(Integer templateBPartnerId) + { + this.templateBPartnerId = templateBPartnerId; + } + + public Integer getCashbookTransferCashbookId() + { + return (cashbookTransferCashbookId == null ? 0 : cashbookTransferCashbookId); + } + + public void setCashbookTransferCashbookId(Integer cashTransferCashbookId) + { + this.cashbookTransferCashbookId = cashTransferCashbookId; + } + + public Integer getCashbookTransferBankAccountId() + { + return cashbookTransferBankAccountId; + } + + public void setCashbookTransferBankAccountId(Integer cashTransferBankAccountId) + { + this.cashbookTransferBankAccountId = cashTransferBankAccountId; + } + + public Integer getCheckTransferCashbookId() + { + return checkTransferCashbookId; + } + + public void setCheckTransferCashbookId(Integer checkTransferCashbookId) + { + this.checkTransferCashbookId = checkTransferCashbookId; + } + + public Integer getCheckTransferBankAccountId() + { + return checkTransferBankAccountId; + } + + public void setCheckTransferBankAccountId(Integer checkTransferBankAccountId) + { + this.checkTransferBankAccountId = checkTransferBankAccountId; + } + + public Integer getCardTransferCashbookId() + { + return cardTransferCashbookId; + } + + public void setCardTransferCashbookId(Integer cardTransferCashbookId) + { + this.cardTransferCashbookId = cardTransferCashbookId; + } + + public Integer getCardTransferBankAccountId() + { + return (cardTransferBankAccountId == null ? 0 : cardTransferBankAccountId); + } + + public void setCardTransferBankAccountId( + Integer cardTransferBankAccountId) + { + this.cardTransferBankAccountId = cardTransferBankAccountId; + } + + public Boolean getLocked() + { + return locked; + } + + public void setLocked(Boolean locked) + { + this.locked = locked; + } + + public Integer getCardBankAccountId() + { + return (cardBankAccountId == null ? 0 : cardBankAccountId); + } + + public void setCardBankAccountId(Integer cardBankAccountId) + { + this.cardBankAccountId = cardBankAccountId; + } + + public String getCashbookTransferType() + { + return cashbookTransferType; + } + + public void setCashbookTransferType(String cashbookTransferType) + { + this.cashbookTransferType = cashbookTransferType; + } + + public String getCheckTransferType() + { + return checkTransferType; + } + + public void setCheckTransferType(String checkTransferType) + { + this.checkTransferType = checkTransferType; + } + + public String getCardTransferType() + { + return cardTransferType; + } + + public void setCardTransferType(String cardTransferType) + { + this.cardTransferType = cardTransferType; + } + + /** + * @return the lockingTime + */ + public Integer getLockingTime() + { + return lockingTime; + } + + /** + * @param lockingTime the lockingTime to set + */ + public void setLockingTime(Integer lockingTime) + { + this.lockingTime = lockingTime; + } + + /** + * @return the orgName + */ + public String getOrgName() + { + return orgName; + } + + /** + * @param orgName the orgName to set + */ + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + + /** + * @return the poPriceList + */ + public String getPoPriceList() + { + return poPriceList; + } + + /** + * @param poPriceList the poPriceList to set + */ + public void setPoPriceList(String poPriceList) + { + this.poPriceList = poPriceList; + } + + /** + * @return the soPriceList + */ + public String getSoPriceList() + { + return soPriceList; + } + + /** + * @param soPriceList the soPriceList to set + */ + public void setSoPriceList(String soPriceList) + { + this.soPriceList = soPriceList; + } + + /** + * @return the lastLockTime + */ + public Timestamp getLastLockTime() + { + return lastLockTime; + } + + /** + * @param lastLockTime the lastLockTime to set + */ + public void setLastLockTime(Timestamp lastLockTime) + { + this.lastLockTime = lastLockTime; + } + + /** + * @return the unlockingTime + */ + public Timestamp getUnlockingTime() + { + return unlockingTime; + } + + /** + * @param unlockingTime the unlockingTime to set + */ + public void setUnlockingTime(Timestamp unlockingTime) + { + this.unlockingTime = unlockingTime; + } + + /** + * @return The isCurrentTerminal + */ + public Boolean getIsCurrentTerminal() + { + return isCurrentTerminal; + } + + /** + * @param isCurrentTerminal The isCurrentTerminal to set + */ + public void setIsCurrentTerminal(Boolean isCurrentTerminal) + { + this.isCurrentTerminal = isCurrentTerminal; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/TestMod.java b/posterita/posterita/src/main/org/posterita/beans/TestMod.java new file mode 100644 index 0000000000..aedc1ea9ca --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/TestMod.java @@ -0,0 +1,17 @@ +package org.posterita.beans; + +import java.math.BigDecimal; + +public class TestMod +{ + public static void main(String args[]) + { + BigDecimal qtyOnHand = new BigDecimal(100); + BigDecimal qtyEntered = new BigDecimal(50); + BigDecimal qtyOrdered = new BigDecimal(25); + + BigDecimal qty = qtyOnHand.multiply(qtyEntered).divide(qtyOrdered, 12, BigDecimal.ROUND_HALF_UP); + + System.out.println(qty); + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/TradeInBean.java b/posterita/posterita/src/main/org/posterita/beans/TradeInBean.java new file mode 100644 index 0000000000..4f1f3c36a2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/TradeInBean.java @@ -0,0 +1,56 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + + +public class TradeInBean extends CustomerBean +{ + + public Integer getBpartnerId() + { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + public Double getPriceEntered() + { + return priceEntered; + } + + public void setPriceEntered(Double priceEntered) + { + this.priceEntered = priceEntered; + } + + public String getVinNumber() + { + return vinNumber; + } + + public void setVinNumber(String vinNumber) + { + this.vinNumber = vinNumber; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/TrendsBean.java b/posterita/posterita/src/main/org/posterita/beans/TrendsBean.java new file mode 100644 index 0000000000..d6b82b7077 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/TrendsBean.java @@ -0,0 +1,121 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 15, 2005 by praveen + * + */ +package org.posterita.beans; + +public class TrendsBean +{ + private String model; + private String colour; + private int a1,m1; + private int a2,m2; + private int a3,m3; + private int sA1,sA2,sA3; + private int sM1,sM2,sM3; + + public TrendsBean(){} + + + public int getA1() { + return a1; + } + public void setA1(int a1) { + this.a1 = a1; + } + public int getA2() { + return a2; + } + public void setA2(int a2) { + this.a2 = a2; + } + public int getA3() { + return a3; + } + public void setA3(int a3) { + this.a3 = a3; + } + public String getColour() { + return colour; + } + public void setColour(String colour) { + this.colour = colour; + } + public int getM1() { + return m1; + } + public void setM1(int m1) { + this.m1 = m1; + } + public int getM2() { + return m2; + } + public void setM2(int m2) { + this.m2 = m2; + } + public int getM3() { + return m3; + } + public void setM3(int m3) { + this.m3 = m3; + } + public String getModel() { + return model; + } + public void setModel(String model) { + this.model = model; + } + public int getSA1() { + return sA1; + } + public void setSA1(int sa1) { + sA1 = sa1; + } + public int getSA2() { + return sA2; + } + public void setSA2(int sa2) { + sA2 = sa2; + } + public int getSA3() { + return sA3; + } + public void setSA3(int sa3) { + sA3 = sa3; + } + public int getSM1() { + return sM1; + } + public void setSM1(int sm1) { + sM1 = sm1; + } + public int getSM2() { + return sM2; + } + public void setSM2(int sm2) { + sM2 = sm2; + } + public int getSM3() { + return sM3; + } + public void setSM3(int sm3) { + sM3 = sm3; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/UDIBean.java b/posterita/posterita/src/main/org/posterita/beans/UDIBean.java new file mode 100644 index 0000000000..f8428a597e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/UDIBean.java @@ -0,0 +1,816 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Stack; +import java.util.Vector; + +import org.apache.struts.upload.FormFile; +import org.posterita.core.JulianDate; + +public class UDIBean +{ + protected String bpAddress2; + protected String aaCardnumber; + protected String accountNo; + protected String accountType; + protected String accountName; + protected String address1; + protected String address2; + protected Boolean agreement; + protected String aisle; + protected Integer allocationId; + protected String allocationStatus; + protected String area; + protected String attribute; + protected Integer attributeId; + protected Integer attributeSetId; + protected Integer attributeSetInstanceId; + protected Integer [] sernoAttributeSetInstanceIds; + protected String attributeValue; + protected String availableForBackOrderFilter ="availableForBackOrder in ('Y', 'N')"; + protected Integer bankId; + protected Integer bankAccountId; + protected String bankName; + protected Integer basePriceListId; + protected String bin; + protected Integer bpartnerId; + protected Integer bPartnerLocationId; + protected Integer [] checkBox; + protected Boolean isChecked; + protected String checkNo; + protected String city; + protected Timestamp closingDate; + protected Integer colour; + protected String confirmEmail; + protected String confirmPassword; + protected Integer cost; + protected String counterOrderStatusInfo; + protected Integer counterOrgID; + protected String counterOrgName; + protected Double currentBalance; + protected String custIdNumber; + protected Timestamp dateCreated; + protected Timestamp dateUpdated; + protected Timestamp dateInvoiced; + protected Timestamp dateMovement; + protected Timestamp dateOrdered; + protected String datePromised; + protected Timestamp dateTrx; + protected String dealerName; + protected String description; + protected String district; + protected String docStatus; + protected Integer tradeInOrderlineId; + protected Integer attributeValueId; + protected String forward; + protected String birthdate; + + protected Boolean isFullAccess; + protected Boolean isOverwritePriceLimit; + + protected Boolean openDrawer = Boolean.TRUE; + + + + protected String docStatusCode; + + //1 is reserved -0 not reserved + + protected Integer documentId; + protected String documentNo; + + protected String documentType; + protected String email; + protected String endDay; + + protected String endHour; + protected String endMinute; + protected String endMonth; + protected String endYear; + protected String engineNo; + protected String engineNumber; + protected String fax; + protected String fromDate; + protected Integer fromOrderLineId; + protected Integer grandTotal; + protected BigDecimal grossProfit; + protected BigDecimal grossProfitPercentage; + protected BigDecimal totalGrossProfit; + protected BigDecimal totalGrossProfitPercentage; + protected Integer id; + protected Integer index; + protected Integer inOutId; + protected Integer invoiceId; + protected Boolean isAccessAllOrgs; + protected Boolean a; + protected String isApproved; + protected Boolean isAutomobile; + protected Boolean isAvailableForBackOrder = Boolean.valueOf("True"); + protected Boolean isClosable; + protected Boolean isCustomer; + protected Boolean isDefault = false; + protected String isDelivered; + protected Boolean isEmployee; + + protected String isInvoiced; + protected Boolean isMandatory = false; + protected Boolean isMotorcycle; + protected Boolean isNatisReleased; + protected String isPaid; + protected Boolean isPresentForProduct; + protected Boolean isPublic; + protected Boolean isQtyReserved; + protected String isReceipt; + protected Boolean isRetailer; + protected Boolean isSalesRep; + protected Boolean isActive = false; + protected Boolean isSoTrx; + protected Boolean isVendor; + protected Boolean isVisible; + protected Boolean isWholesaler; + protected String level; + protected BigDecimal limitPrice; + protected BigDecimal limitPriceIncl; + protected BigDecimal lineAmt; + protected Integer lineNetAmt; + protected Integer lineNo; + protected Integer lineTotalAmt; + protected ArrayList list; + protected BigDecimal listPrice; + protected BigDecimal listPriceIncl; + protected String location; + protected Integer locationId; + protected Integer locatorId; + protected String locatorName; + protected String logoName; + protected Integer m_attributesetinstance_id; + protected String maintenanceContractNumber; + protected Integer make; + protected Integer menuId; + protected String menuItemName; + protected String menuLink; + protected String message; + protected Integer messageID; + protected Integer minOutId; + protected String mobile; + protected Integer model; + protected Integer modelGroup; + protected Integer month; + protected Integer movementId; + protected Integer moveConfirmId; + protected Integer movementLineId; + protected String name; + + + protected Integer natisReleaseId; + protected String newEmail; + protected String newPassword; + protected Integer nextAvailableLocatorId; + protected String oldPassword; + protected Integer orderId; + protected ArrayList orderLineBean; + protected ArrayList roleBeanList = new ArrayList(); + protected Integer orderLineId; + protected int [] orderLineIds; + protected ArrayList orderLineList = new ArrayList(); + protected ArrayList InventoryLineList = new ArrayList(); + protected String orderStatusInfo; + protected String orderType; + protected Integer orgFromId; + protected String orgFromName; + protected Integer orgToId; + protected String orgToName; + protected String orgName; + protected String orgType; + protected Vector orgUsers; + protected Integer parentMenuId; + protected Integer partnerId; + protected Integer partnerLocationId; + protected String partnerName; + protected String password; + protected Stack path; + protected Integer payAmt; + protected Integer paymentId; + protected String phone; + protected String phone2; + protected String poReference; + protected String POReference; + protected String postalAddress; + protected String postalAddress1; + protected String postalCity; + protected String postalCode; + protected String postalPostalCode; + protected Integer prefOrderLineId; + protected BigDecimal priceActual; + protected Double priceEntered; + protected BigDecimal priceLimit; + protected BigDecimal priceList; + protected PriceListBean priceListBean; + protected ArrayList priceListBeanList; + protected Integer priceListVersionId; + protected ProductBean productBean; + protected ArrayList productBeanList = new ArrayList(); + protected Integer productCategoryId; + protected BigDecimal price; + + protected String productDetails; + protected Integer productId; + protected String productName; + protected Integer productQuantity; + protected Integer qtyInvoiced; + protected String qtyReserved; + protected BigDecimal quantity; + protected BigDecimal qtyOnHand; + protected BigDecimal qtyToMove; + protected String read; + protected Integer refInOutId; + protected Integer refNo; + protected Integer refOrderId; + protected Integer refOrderLineid; + protected Integer refToQuote; + protected ReportBean report; + ArrayList reportList = new ArrayList();; + protected String region; + protected Integer regionId; + protected String regionName; + protected String registerNumber; + + protected Integer reserveStatus; + + protected Integer roleId; + protected String roleName; + protected String routingNumber; + protected String sernoAttributeSetInstance; + protected String startDay; + protected String startHour; + protected String startMinute; + protected String startMonth; + protected String startYear; + protected Boolean status; + protected BigDecimal stdPrice; + protected BigDecimal stdPriceIncl; + protected Double stdPurchasePrice; + protected Double stdSalesPrice; + protected StockMovementBean stock; + protected ArrayList stockList = new ArrayList(); + protected String subject; + protected String submit; + + protected String surname; + protected Integer taxAmt; + protected Integer[] targetId; + protected String termsAgreement; + protected String toDate; + protected Integer toOrderLineId; + protected Integer totalLines; + protected Integer transmission; + protected Integer transmissionAttributeValueId; + protected String uom; + protected Integer userId; + protected Integer userID; + protected String username; + protected String vinNumber; + protected Integer warehouseId; + + protected Integer wareHouseId; + protected String warehouseName; + protected String warehouseType; + protected Integer year; + protected Integer yearAttributeValueId; + protected Integer makeAttributeValueId; + protected String[] qtyTargeted; + protected String sotrxFlag; + protected String bpName; + protected String compiereDocStatus; + protected String hondaDocStatus; + protected Integer first; + protected Integer licensingDistrictId; + protected String licensingDistrict; + + protected String passportNo; + protected String companyRegNo; + + protected String unitNumber; + protected Integer unitsPerPack; + protected String productCode; + protected Integer vehicleSpecsId; + protected String natisApplicationDate; + protected Timestamp processedDate; + + protected Timestamp natisRegistrationDate; + protected Timestamp wholesaleDate; + protected String natisControlNumber; + protected String natisRegisterNumber; + protected Integer natisModelNo; + protected String natisModelDescription; + + protected Integer enginePower; + protected Integer engineCapacity; + protected Integer tare; + protected Integer noOfWheels; + + protected Integer colourCodeMatchId; + protected String colourName; + protected String transmissionName; + protected String yearName; + + protected String mainColourCode; + protected String countryOfImpCode; + protected String shippingInvNo; + protected String estimatedTimeOfArrival; + protected String colourCodeHES; + + protected String licensingDistrictDescription; + protected String licensingDistrictCode; + + protected String bpAddress; + protected String bpPostalAddress; + + protected String bpPostalCode; + protected String bpCity; + protected String bpRegionName; + protected Integer bpRegionId; + + protected String releaseStatus; + protected String releasedBy; + protected String reservedStatus; + protected Timestamp natisreleaseDate; + + protected String uAddress1; + protected String uAddress2; + protected String uPostalAddress; + protected String uPostalCd; + protected String uCity; + protected String uRegion; + + protected String colourGroup; + + protected String modelMatching; + + protected boolean isCar; + protected ArrayList showroomTrafficBean; + + protected ArrayList showroomTrafficList = new ArrayList(); + protected Integer sales; + protected Integer traffic; + protected Integer prospects; + protected String modelName; + protected Integer modelId; + protected Integer trxId; + protected Integer modelCode; + protected Integer modelCodeId; + protected String dealerCode; + protected Integer dealerCodeId; + protected Integer salesRepId; + protected Boolean isAllocationWarehouse; + protected String name2; + protected Boolean canAlterOrder; + protected Boolean canCreateOrder; + protected Boolean canViewOrder; + protected Timestamp wholeSaleDate; + protected Integer orderlineCount; + protected Integer orderlineInvoicedCount; + protected JulianDate startDate; + protected JulianDate endDate; + protected Integer weekNo; + protected Integer attributeSetInstance; + protected String makeName; + protected String financeOption; + + protected String newVinNumber; + protected Integer attributesetinstanceIdFrom; + protected Integer attributesetinstanceIdTo; + protected ArrayList vinNumberList; + protected Integer productIds[]; + protected String reservedBy; + protected Boolean isTradeIn = Boolean.valueOf("true"); + protected String ETAFilter; + protected BigDecimal orderGrandTotal; + protected Integer orderIds[]; + + + protected Integer mImportVehiclesId; + protected String natisModelNumber; + protected Timestamp vehEstimateTimeOfArrival; + protected String vehTare; + protected String vehEngineCapacity; + protected String vehNoOfWheels; + protected String vehEnginePower; + protected Boolean colourMatchingPresent; + protected Boolean modelMatchingPresent; + protected Boolean productPresent; + protected String vehImportErrDesc; + + protected Integer modelMatchID; + protected String natisModelDesc; + protected String modelDesc; + protected String trans; + protected Boolean showActiveOnly; + protected Integer updateAttrValueId; + protected String active; + protected String visible; + protected Integer style; + protected Integer design; + protected Integer size; + protected String clientName; + + protected Integer designAttributeValueId; + protected Integer modelAttributeValueId; + protected Integer sizeAttributeValueId; + protected Integer colourAttributeValueId; + + + protected BigDecimal endingBalance; + protected String endingBalanceAsString; + protected BigDecimal amount; + protected String trxType; + protected BigDecimal amountGiven; + protected BigDecimal amountRefunded; + protected Integer cashBookId; + protected Integer cashId; + protected Integer cashLineId; + protected String cashType; + protected String cashTypeName; + protected String cashBookName; + protected String chequeNo; + protected String creditCardType; + protected String creditCardNumber; + protected String creditCardNumberEncrypted; + protected Integer creditCardExpMonth; + protected String creditCardExpMonthName; + protected Integer creditCardExpYear; + protected Integer [] posOrderLineIds; + protected Integer posId; + protected String posName; + protected String posDesc; + protected String saleRepName; + protected Integer priceListId; + protected String priceListName; + protected String paymentRule; + protected Integer cashJournalId; + protected String cashJournalName; + protected String cashJournalDisc; + protected String statmentDate; + protected Timestamp dateAcct; + protected BigDecimal invoiceAmount; + protected BigDecimal differenceAmount; + protected BigDecimal generalExpenseAmount; + protected BigDecimal generalReceiptsAmount; + protected BigDecimal bankAcctTransferAmount; + protected BigDecimal transferAmount; + protected Integer cashBookIds; + protected BigDecimal beginingBalance; + protected String beginingBalanceAsString; + protected BigDecimal statementDifference; + protected String keyword; + protected String backOrder; + protected String fieldName; + protected String applicationName; + protected String applicationWebContext; + protected Integer storeId; + protected Boolean isWebstoreFeatured; + protected String brandName; + protected String designName; + protected String sizeName; + protected String keyword1; + protected String keyword2; + protected String keyword3; + protected String keyword4; + protected String[] sizes; + protected String[] colours; + protected String imageLink; + + protected BigDecimal priceStandard; + protected String currency;// + + protected BigDecimal cashTotal; + protected BigDecimal chequeTotal; + protected BigDecimal cardTotal; + protected BigDecimal tillGrandTotal; + protected String purchasePriceList; + protected String purchasePriceLimit; + protected String purchasePriceStandard; + protected String barCode; + protected String salesPriceList; + protected String salesPriceLimit; + protected String salesPriceStandard; + protected String reportType; + protected Integer noOfProductsRequired; + protected BigDecimal openingBalanceQty; + protected BigDecimal qtyOfGoodsSold; + protected BigDecimal qtyOfGoodsReceived; + protected BigDecimal qtyOfGoodsReturned; + protected BigDecimal closeingBalanceQty; + protected BigDecimal qtyReturnedByCustomer; + protected String qtyAndItem; + protected String[] discountPercent; + protected String [] actualPrice; + protected FormFile file; + protected FormFile logo; + protected FormFile image; + + protected String userSurname; + protected Integer countryId; + protected String countryName; + protected String countryCode; + + protected String newName; + protected String imageName; + protected ArrayList productsList; + protected Double paymentByCash; + protected String paymentMethod; + protected Double paymentByCard; + protected Double paymentByChq; + protected Boolean isDeleteOldRecords=false; + protected String isSales; + protected Boolean isSOPriceList = false; + protected String ifAdd; + protected String productCategory; + protected String productClassification; + protected String trackingNo; + protected String revenueRecognition; + protected String cvv; + protected String creditCardPayment; + protected String shipmentMethod; + protected Boolean shipTo; + protected Boolean billTo; + protected Integer chargeId; + protected String chargeName; + protected BigDecimal chargeAmount; + + protected Integer revenueRecoId; + + protected int numberOfRequests; + protected String userName; + protected Integer requestId; + protected Integer toUserId; + protected String fromAddress; + protected String toAddresses; + protected String ccAddresses; + protected String bccAddresses; + protected String textMessage; + protected String hostAddress; + protected String priority; + protected String title; + protected Integer statusId; + + protected AttributeValuesPair attributeValuesPair; + protected HashMap attributeValuesMap; + protected Boolean isTextileProduct; + protected String qtyFilter; + protected String productType; + + + protected String attributeSetName; + + protected String attributeName; + protected ArrayList attributeValueList; + protected String [] attributeValueIds; + protected Double totalActualPrice; + protected String qtyNumberFilter; + protected Integer taxCategoryId; + protected String taxCategoryName; + protected String vendorName; + protected String timePeriod; + protected String chartType; + protected String salesGroup; + protected BigDecimal taxRate; + protected Integer accountId; + protected String dateRange; + protected Boolean transferAllAmount; + protected BigDecimal adjustmentAmount; + protected BigDecimal differenceAmt; + protected Boolean creatingFromOrder; + protected String transferType; + protected String priceQtyFilter; + protected Boolean hasImage; + protected String userPIN; + protected Boolean isSelfService; + protected BigDecimal cardDifference; + protected BigDecimal chequeDifference; + protected String documentNote; + protected String currencySymbole; + protected String invoiceDate; + protected Integer netDays; + protected Integer daysDue; + protected Timestamp dueDate; + protected String discountDate; + protected BigDecimal discountAmt; + protected BigDecimal invoiceGrandTotal; + protected BigDecimal paidAmt; + protected BigDecimal openAmt; + protected Integer currencyId; + protected Integer paymentTermId; + protected Integer invoiceScheduleId; + protected BigDecimal userDiscount; + + protected BigDecimal invoicedAmt; + protected BigDecimal pastDue91_plus; + protected BigDecimal pastDue61_90; + protected BigDecimal pastDue31_60; + protected BigDecimal pastDue1_30; + protected BigDecimal pastDue8_30; + protected BigDecimal pastDue1_7; + protected BigDecimal pastDueAmt; + protected BigDecimal dueAmt; + protected BigDecimal due0; + protected BigDecimal due1_7; + protected BigDecimal due8_30; + protected BigDecimal due0_30; + protected BigDecimal due31_60; + protected BigDecimal due61_90; + protected BigDecimal due91_PLUS; + + + protected BigDecimal paymentAmt; + protected BigDecimal overUnderPayment; + protected BigDecimal writeOffAmt; + protected String tenderType; + protected String invoiceNo; + protected BigDecimal creditUsed; + protected BigDecimal creditLimit; + protected BigDecimal revenue; + protected String paymentTermName; + protected Integer [] bpartnerIds; + + protected Integer blackListedId; + protected String blackListedBankName; + protected String blackListedChequeNo; + + protected Integer dunningId; + protected String dunningName; + + protected Integer dunningLevelId; + protected String dunningLevelName; + protected String dunningPrintText; + protected String dunningPrintNote; + protected Integer BP_Group_ID ; + protected String soCreditStatus; + protected String bpfirstSale; + protected String creditStatus; + public String docBasisType; + + //protected String applicationType; + protected BigDecimal amtMultiplier; + + + protected Integer commissionAmtId; + protected Integer commissionRunId; + protected Integer commissionLineId; + protected BigDecimal convertedAmt; + protected BigDecimal actualQty; + protected BigDecimal commissionAmt; + protected String commissionLineName; + protected Integer commissionDetailId; + protected String reference; + protected Integer invoiceLineId; + protected String info; + protected BigDecimal actualAmt; + protected String frequencyType; + protected String periodAndCurrencyDesc; + protected BigDecimal subtractAmt; + protected BigDecimal qtyInventoryIn; + protected BigDecimal qtyInventoryOut; + + protected String taxName; + protected Integer taxId; + protected Boolean isTaxExempted; + protected Integer [] invoiceIds; + protected Integer [] paymentIds; + protected String paymentNo; + protected BigDecimal taxedAmt; + protected String trxDate; + + protected Integer creditMemoId; + protected String creditMemoNumber; + + + protected Integer inventoryLineId; + protected Integer inventoryId; + protected BigDecimal qtyBook; + protected BigDecimal qtyCount; + protected BigDecimal qtyCsv; + + protected String inventoryNo; + protected String movementDate; + + protected Boolean afterDelivery; + protected Boolean fixedDueDate; + protected Boolean nextBusinessday; + protected Integer fixedMonthDay; + protected Integer fixedMonthOffset; + protected Integer fiedMonthCutoff; + protected String toBeShipped; + protected Integer discountDay1; + protected Integer discountDay2; + protected BigDecimal discountAmt1; + protected BigDecimal discountAmt2; + protected BigDecimal allocatedAmount; + protected BigDecimal bookQtyValue; + protected BigDecimal countQtyValue; + + protected PaymentBean paymentBeanIndex; + + protected BigDecimal [] allocateAmount; + + protected BigDecimal paymentAllocatedAmt; + protected BigDecimal AvailableAmt; + protected Integer [] inventoryIds; + protected Integer [] inventoryLineIds; + protected String historyType; + + protected String accountingValues; + + protected String fullDetails; + protected BigDecimal unitPrice; + protected BigDecimal unitPurchasePrice; + + // Additional fields required for user registration + protected String company; + protected String industry; + protected String comments; + + protected BigDecimal roundOffFactor; + protected Integer stdPrecision; + protected String isoCode; + protected String curSymbol; + protected String isSalesReport; + protected String receiptFooterMsg; + protected String branch; + protected String taxNo; + + /** Organisation **/ + protected Integer orgId; + + /** Common field used for searching **/ + protected String searchText; + + protected Integer webMenuId; + + public Boolean getIsActive() + { + return isActive; + } + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + /** + * @param searchText search term + */ + public void setSearchText(String searchText) + { + this.searchText = searchText; + } + + /** + * @return search term + */ + public String getSearchText() + { + return this.searchText; + } + + /** + * @return Organisation + */ + public Integer getOrgId() + { + return orgId; + } + + /** + * @param orgId Organisation + */ + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + +} + + + diff --git a/posterita/posterita/src/main/org/posterita/beans/UDIPair.java b/posterita/posterita/src/main/org/posterita/beans/UDIPair.java new file mode 100644 index 0000000000..437f9277f0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/UDIPair.java @@ -0,0 +1,128 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 28-Jun-2005 by alok + * + */ +package org.posterita.beans; + +import java.util.ArrayList; + + +public class UDIPair implements Comparable +{ + + private Integer ID; + private String key; + private String value; + + private UDIPair pair; + private ArrayList arr; + + public UDIPair(Integer ID, String value) + { + this.ID = ID; + this.value = value; + } + + public UDIPair(String key, String value) + { + this.key = key; + this.value = value; + } + + + public UDIPair(UDIPair pair, ArrayList arr) + { + this.pair = pair; + this.arr = arr; + } + + + + public ArrayList getArr() { + return arr; + } + + + public void setArr(ArrayList arr) { + this.arr = arr; + } + + + public UDIPair getPair() { + return pair; + } + + + public void setPair(UDIPair pair) { + this.pair = pair; + } + + + /** + * @return Returns the iD. + */ + public Integer getID() { + return ID; + } + /** + * @param id The iD to set. + */ + public void setID(Integer id) { + ID = id; + } + /** + * @return Returns the value. + */ + public String getValue() { + return value; + } + /** + * @param value The value to set. + */ + public void setValue(String value) { + this.value = value; + } + /* (non-Javadoc) + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object o) + { + UDIPair pair = (UDIPair) o; + + return this.getValue().compareTo(pair.getValue()); + } + + public String getKey() + { + return key; + } + + public void setKey(String key) + { + this.key = key; + } + + public String toString() + { + String str ="ID:" +getID() + " Value:" +getValue(); + return str; + } + } + diff --git a/posterita/posterita/src/main/org/posterita/beans/UserBean.java b/posterita/posterita/src/main/org/posterita/beans/UserBean.java new file mode 100644 index 0000000000..8e8999676a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/UserBean.java @@ -0,0 +1,355 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 29, 2005 by din + */ + +package org.posterita.beans; + +import java.math.BigDecimal; + +public class UserBean extends UDIBean +{ + public Integer getOrgId() { + return orgId; + } + + public void setOrgId(Integer orgId) { + this.orgId = orgId; + } + + public Boolean getIsFullAccess() { + return isFullAccess; +} + +public void setIsFullAccess(Boolean isFullAccess) { + this.isFullAccess = isFullAccess; +} + + public BigDecimal getSubtractAmt() { + return subtractAmt; +} + +public void setSubtractAmt(BigDecimal subtractAmt) { + this.subtractAmt = subtractAmt; +} + public String getFrequencyType() { + return frequencyType; + } + public void setFrequencyType(String frequencyType) { + this.frequencyType = frequencyType; + } + public BigDecimal getAmtMultiplier() { + return amtMultiplier; +} +public void setAmtMultiplier(BigDecimal amtMultiplier) { + this.amtMultiplier = amtMultiplier; +} + public String getDocBasisType() { + return docBasisType; + } + public void setDocBasisType(String docBasisType) { + this.docBasisType = docBasisType; + } + public String getUserPIN() + { + return userPIN; + } + public void setUserPIN(String userPIN) + { + this.userPIN = userPIN; + } + public Integer getPartnerId() + { + return partnerId; + } + + public void setPartnerId(Integer partnerId) + { + this.partnerId = partnerId; + } + + public String getCountryName() { + return countryName; +} + +public void setCountryName(String countryName) { + this.countryName = countryName; +} + + public Integer getCountryId() { + return countryId; + } + + public void setCountryId(Integer countryId) { + this.countryId = countryId; + } + + public String getUserSurname() { + return userSurname; + } + + public void setUserSurname(String userSurname) { + this.userSurname = userSurname; + } + + public Integer getLocationId() + { + return locationId; + } + + public void setLocationId(Integer locationId) + { + this.locationId = locationId; + } + + public String getAddress1() + { + return address1; + } + + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public String getAddress2() + { + return address2; + } + + public void setAddress2(String address2) + { + this.address2 = address2; + } + + public String getCity() + { + return city; + } + + public void setCity(String city) + { + this.city = city; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + public Boolean getIsActive() + { + return isActive; + } + + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getConfirmPassword() + { + return confirmPassword; + } + + public void setConfirmPassword(String confirmPassword) + { + this.confirmPassword = confirmPassword; + } + + public String getPhone() + { + return phone; + } + + public void setPhone(String phone) + { + this.phone = phone; + } + + public String getPostalAddress() + { + return postalAddress; + } + + public void setPostalAddress(String postalAddress) + { + this.postalAddress = postalAddress; + } + + public String getUsername() + { + return username; + } + public void setUsername(String username) + { + this.username = username; + } + + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + public String getFax() + { + return fax; + } + + public void setFax(String fax) + { + this.fax = fax; + } + + public Integer getRoleId() + { + return roleId; + } + + public void setRoleId(Integer roleId) + { + this.roleId = roleId; + } + public String getRoleName() + { + return roleName; + } + public void setRoleName(String roleName) + { + this.roleName = roleName; + } + public Boolean getIsSalesRep() + { + return isSalesRep; + } + + public void setIsSalesRep(Boolean isSalesRep) + { + this.isSalesRep = isSalesRep; + } + + public Integer getRegionId() + { + return regionId; + } + + public void setRegionId(Integer regionId) + { + this.regionId = regionId; + } + + public Integer getUserId() + { + return userId; + } + + public void setUserId(Integer userId) + { + this.userId = userId; + } + + public String getRegion() + { + return region; + } + public void setRegion(String region) + { + this.region = region; + } + + public String getName() + { + return name; + } + public void setName(String name) + { + this.name = name; + } + public String getCountryCode() + { + return countryCode; + } + public void setCountryCode(String countryCode) + { + this.countryCode = countryCode; + } + + public BigDecimal getUserDiscount() { + return userDiscount; + } + public void setUserDiscount(BigDecimal userDiscount) { + this.userDiscount = userDiscount; + } + + public String getPhone2() { + return phone2; + } + public void setPhone2(String phone2) { + this.phone2 = phone2; + } + + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + public String getIndustry() { + return industry; + } + + public void setIndustry(String industry) { + this.industry = industry; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + /*public String getUserSurname() { + return userSurname; + } + + public void setUserSurname(String userSurname) { + this.userSurname = userSurname; + }*/ +} diff --git a/posterita/posterita/src/main/org/posterita/beans/VendorBean.java b/posterita/posterita/src/main/org/posterita/beans/VendorBean.java new file mode 100644 index 0000000000..faa3c22bae --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/VendorBean.java @@ -0,0 +1,122 @@ +package org.posterita.beans; + +public class VendorBean extends UDIBean +{ + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + public Integer getCountryId() { + return countryId; + } + + public void setCountryId(Integer countryId) { + this.countryId = countryId; + } + + public String getPartnerName() + { + return partnerName; + } + + public void setPartnerName(String partnerName) + { + this.partnerName = partnerName; + } + + public String getAddress1() { + return address1; + } + + public void setAddress1(String address1) { + this.address1 = address1; + } + + public String getAddress2() { + return address2; + } + + public void setAddress2(String address2) { + this.address2 = address2; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getPhone2() { + return phone2; + } + + public void setPhone2(String phone2) { + this.phone2 = phone2; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getFax() { + return fax; + } + + public void setFax(String fax) { + this.fax = fax; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + public Boolean getIsActive() { + return isActive; + } + + public void setIsActive(Boolean isActive) { + this.isActive = isActive; + } + + public Integer getBpartnerId() { + return bpartnerId; + } + + public void setBpartnerId(Integer bpartnerId) { + this.bpartnerId = bpartnerId; + } + public Integer getPriceListId() + { + return priceListId; + } + + public void setPriceListId(Integer priceListId) + { + this.priceListId = priceListId; + } +} + diff --git a/posterita/posterita/src/main/org/posterita/beans/WarehouseBean.java b/posterita/posterita/src/main/org/posterita/beans/WarehouseBean.java new file mode 100644 index 0000000000..15d401f728 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WarehouseBean.java @@ -0,0 +1,187 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 26, 2005 by din + */ + +package org.posterita.beans; + +public class WarehouseBean extends UDIBean +{ + + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getWarehouseType() + { + return warehouseType; + } + + public void setWarehouseType(String warehouseType) + { + this.warehouseType = warehouseType; + } + + public Boolean getIsAllocationWarehouse() + { + return isAllocationWarehouse; + } + + public void setIsAllocationWarehouse(Boolean isAllocationWarehouse) + { + this.isAllocationWarehouse = isAllocationWarehouse; + } + + public Integer getWarehouseId() + { + return warehouseId; + } + + public void setWarehouseId(Integer warehouseId) + { + this.warehouseId = warehouseId; + } + + public String getWarehouseName() + { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getAddress1() + { + return address1; + } + + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public String getCity() + { + return city; + } + + public void setCity(String city) + { + this.city = city; + } + + public String getPostalAddress() + { + return postalAddress; + } + + public void setPostalAddress(String postalAddress) + { + this.postalAddress = postalAddress; + } + + public Integer getRegionId() + { + return regionId; + } + + public void setRegionId(Integer regionId) + { + this.regionId = regionId; + } + + public Boolean getIsPublic() + { + return isPublic; + } + + public void setIsPublic(Boolean isPublic) + { + this.isPublic = isPublic; + } + + public String getAisle() + { + return aisle; + } + + public void setAisle(String aisle) + { + this.aisle = aisle; + } + + public String getBin() + { + return bin; + } + + public void setBin(String bin) + { + this.bin = bin; + } + + public Boolean getIsDefault() + { + return isDefault; + } + + public void setIsDefault(Boolean isDefault) + { + this.isDefault = isDefault; + } + + public String getLevel() + { + return level; + } + + public void setLevel(String level) + { + this.level = level; + } + + public String getRegionName() + { + return regionName; + } + + public void setRegionName(String regionName) + { + this.regionName = regionName; + } + + public Boolean getIsActive() + { + return isActive; + } + + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/WebDocumentBean.java b/posterita/posterita/src/main/org/posterita/beans/WebDocumentBean.java new file mode 100644 index 0000000000..011fa944e9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WebDocumentBean.java @@ -0,0 +1,609 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Jul 26, 2005 by din +*/ + +package org.posterita.beans; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MCashLine; +import org.compiere.model.MInOut; +import org.compiere.model.MInvoice; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MPayment; + + +public class WebDocumentBean extends UDIBean +{ + String[] simpleCommand = new String[0]; + String[] complexCommand = new String[0]; + MBPartner me; + MBPartnerLocation mebpLocation; + MLocation meLocation; + + + + MBPartner you; + MBPartnerLocation youbpLocation; + MLocation youLocation; + String daysRemaining; + String month; + String year; + String displayCheckBox = null; + private String salesRep; + private String description; + + private ArrayList lines = new ArrayList(); + + private MOrder order; + private MInvoice invoice; + private MInOut minOut; + private MPayment payment; + private String tenderType; + private WebDocumentHeaderBean headerBean; + + private Properties ctx; + private ArrayList allocations; + + private BigDecimal totalLines; + private BigDecimal totalTax; + private BigDecimal grandTotal; + private String isPaid; + private String isShipped; + private Double paymentByCash; + private Double paymentByCard; + private Double paymentbyCheque; + private BigDecimal totalQty; + private MCashLine cashLine; + private BigDecimal subTotal; + + public BigDecimal getSubTotal() { + return subTotal; + } + + public void setSubTotal(BigDecimal subTotal) { + this.subTotal = subTotal; + } + + public String getCurrencySymbole() { + return currencySymbole; + } + public void setCurrencySymbole(String currencySymbole) { + this.currencySymbole = currencySymbole; + } + public BigDecimal getTotalQty() { + return totalQty; + } + public void setTotalQty(BigDecimal totalQty) { + this.totalQty = totalQty; + } + public String getIsPaid() + { + return isPaid; + } + public void setIsPaid(String isPaid) + { + this.isPaid = isPaid; + } + public String getIsShipped() + { + return isShipped; + } + public void setIsShipped(String isShipped) + { + this.isShipped = isShipped; + } + public String getTrackingNo() + { + return trackingNo; + } + public void setTrackingNo(String trackingNo) + { + this.trackingNo = trackingNo; + } + + + + public String getSalesRep() { + return salesRep; + } + public void setSalesRep(String salesRep) { + this.salesRep = salesRep; + } + public BigDecimal getGrandTotal() { + return grandTotal; + } + public void setGrandTotal(BigDecimal grandTotal) { + this.grandTotal = grandTotal; + } + public BigDecimal getTotalLines() { + return totalLines; + } + public void setTotalLines(BigDecimal totalLines) { + this.totalLines = totalLines; + } + public BigDecimal getTotalTax() { + return totalTax; + } + public void setTotalTax(BigDecimal totalTax) { + this.totalTax = totalTax; + } + + + public ArrayList getAllocations() { + return allocations; + } + public void setAllocations(ArrayList allocations) { + this.allocations = allocations; + } + + public WebDocumentHeaderBean getHeaderBean() + { + return headerBean; + } + + public void setHeaderBean(WebDocumentHeaderBean headerBean) + { + this.headerBean = headerBean; + } + + + public MOrder getOrder() + { + return order; + } + + public void setOrder(MOrder order) + { + this.order = order; + } + + public MInvoice getInvoice() + { + return invoice; + } + + public void setInvoice(MInvoice invoice) + { + this.invoice = invoice; + } + + + + public String[] getSimpleCommand() { + return simpleCommand; + } + + + public void setSimpleCommand(String[] simpleCommand) + { + this.simpleCommand = simpleCommand; + } + + + public MBPartner getMe() + { + return me; + } + + + public void setMe(MBPartner me) + { + this.me = me; + } + + + public MBPartnerLocation getMebpLocation() + { + return mebpLocation; + } + + + public void setMebpLocation(MBPartnerLocation mebpLocation) + { + this.mebpLocation = mebpLocation; + } + + + public MLocation getMeLocation() + { + return meLocation; + } + + + public void setMeLocation(MLocation meLocation) + { + this.meLocation = meLocation; + } + + + public MBPartner getYou() + { + return you; + } + + + public void setYou(MBPartner you) + { + this.you = you; + } + + + public MBPartnerLocation getYoubpLocation() + { + return youbpLocation; + } + + + public void setYoubpLocation(MBPartnerLocation youbpLocation) + { + this.youbpLocation = youbpLocation; + } + + + public MLocation getYouLocation() + { + return youLocation; + } + + + public void setYouLocation(MLocation youLocation) + { + this.youLocation = youLocation; + } + + + public ArrayList getLines() + { + return lines; + } + + public void setLines(ArrayList lines) + { + this.lines = lines; + } + + + public String[] getComplexCommand() + { + return complexCommand; + } + + + public void setComplexCommand(String[] complexCommand) + { + this.complexCommand = complexCommand; + } + + public String getDaysRemaining() + { + return daysRemaining; + } + + public void setDaysRemaining(String daysRemaining) + { + this.daysRemaining = daysRemaining; + } + + + + public String getMonth() + { + return month; + } + + public void setMonth(String month) + { + this.month = month; + } + + public String getYear() + { + return year; + } + + public void setYear(String year) + { + this.year = year; + } + + public String getDisplayCheckBox() + { + return displayCheckBox; + } + + public void setDisplayCheckBox(String displayCheckBox) + { + this.displayCheckBox = displayCheckBox; + } + + public String getSubmit() + { + return submit; + } + + public void setSubmit(String submit) + { + this.submit = submit; + } + + public Integer getOrderId() + { + return orderId; + } + + public void setOrderId(Integer orderId) + { + this.orderId = orderId; + } + + public String getPoReference() + { + return poReference; + } + + public void setPoReference(String poReference) + { + this.poReference = poReference; + } + + public String getTermsAgreement() + { + return termsAgreement; + } + + public void setTermsAgreement(String termsAgreement) + { + this.termsAgreement = termsAgreement; + } + + public ArrayList getOrderLineBean() + { + return orderLineBean; + } + public void setOrderLineBean(ArrayList orderLineBean) + { + this.orderLineBean = orderLineBean; + } + + public String getAddress1() + { + return address1; + } + + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public String getCity() + { + return city; + } + + public void setCity(String city) + { + this.city = city; + } + + public String getDocStatus() + { + return docStatus; + } + + public void setDocStatus(String docStatus) + { + this.docStatus = docStatus; + } + + + public String getPartnerName() + { + return partnerName; + } + + public void setPartnerName(String partnerName) + { + this.partnerName = partnerName; + } + + + public Timestamp getDateOrdered() + { + return dateOrdered; + } + + public void setDateOrdered(Timestamp dateOrdered) + { + this.dateOrdered = dateOrdered; + } + + + public Integer getBpartnerId() + { + return bpartnerId; + } + public void setBpartnerId(Integer bpartnerId) + { + this.bpartnerId = bpartnerId; + } + + + public String getDatePromised() + { + return datePromised; + } + + public void setDatePromised(String datePromised) + { + this.datePromised = datePromised; + } + + public String getIsApproved() + { + return isApproved; + } + + public void setIsApproved(String isApproved) + { + this.isApproved = isApproved; + } + public String getIsDelivered() + { + return isDelivered; + } + public void setIsDelivered(String isDelivered) + { + this.isDelivered = isDelivered; + } + public String getIsInvoiced() + { + return isInvoiced; + } + public void setIsInvoiced(String isInvoiced) + { + this.isInvoiced = isInvoiced; + } + + public String getDocumentNo() + { + return documentNo; + } + + public void setDocumentNo(String documentNo) + { + this.documentNo = documentNo; + } + + public Boolean isSoTrx() + { + return isSoTrx; + } + + public void setIsSoTrx(Boolean isSoTrx) + { + this.isSoTrx = isSoTrx; + } + + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + + public Integer getInvoiceId() + { + return invoiceId; + } + + + public MInOut getMinOut() + { + return minOut; + } + + public void setMinOut(MInOut minOut) + { + this.minOut = minOut; + } + + public Integer getPaymentId() + { + return paymentId; + } + + public void setPaymentId(Integer paymentId) + { + this.paymentId = paymentId; + } + + public MPayment getPayment() + { + return payment; + } + + public void setPayment(MPayment payment) + { + this.payment = payment; + } + + public Integer getMinOutId() + { + return minOutId; + } + + public void setMinOutId(Integer minOutId) + { + this.minOutId = minOutId; + } + + + public Properties getCtx() { + return ctx; + } + public void setCtx(Properties ctx) { + this.ctx = ctx; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public Double getPaymentByCard() { + return paymentByCard; + } + public void setPaymentByCard(Double paymentByCard) { + this.paymentByCard = paymentByCard; + } + public Double getPaymentByCash() { + return paymentByCash; + } + public void setPaymentByCash(Double paymentByCash) { + this.paymentByCash = paymentByCash; + } + public Double getPaymentbyCheque() { + return paymentbyCheque; + } + public void setPaymentbyCheque(Double paymentbyCheque) { + this.paymentbyCheque = paymentbyCheque; + } + public String getTenderType() + { + return tenderType; + } + public void setTenderType(String tenderType) + { + this.tenderType = tenderType; + } + public MCashLine getCashLine() { + return cashLine; + } + public void setCashLine(MCashLine cashLine) { + this.cashLine = cashLine; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/WebDocumentHeaderBean.java b/posterita/posterita/src/main/org/posterita/beans/WebDocumentHeaderBean.java new file mode 100644 index 0000000000..f6ece97bdb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WebDocumentHeaderBean.java @@ -0,0 +1,194 @@ +/* + * Created on Mar 13, 2005 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.posterita.beans; + +import java.sql.Timestamp; + +public class WebDocumentHeaderBean +{ + private String dcsRef; + private String dcsCounterRef; + private String documentStatus; + private String dealerRef; + private String dealerCounterRef; + private String documentTitle; + private String documentName; + private String from; + private String to; + private String date; + private String counterDate; + private String youName; + private String poReference; + private Timestamp dateOrdered; + private String documentHeader; + private String shipped; + private String paymentType; + private String paymentByCash; + private String paymentByCard; + private String paymentbyCheque; + private String bpartnerId; + + + + + + public String getPaymentType() { + return paymentType; + } + + public void setPaymentType(String paymentType) { + this.paymentType = paymentType; + } + + public String getShipped() + { + return shipped; + } + + public void setShipped(String shipped) + { + this.shipped = shipped; + } + + public String getDocumentHeader() + { + return documentHeader; + } + + public void setDocumentHeader(String documentHeader) + { + this.documentHeader = documentHeader; + } + + public String getYouName() { + return youName; + } + public void setYouName(String youName) { + this.youName = youName; + } + public String getCounterDate() { + return counterDate; + } + public void setCounterDate(String counterDate) { + this.counterDate = counterDate; + } + public String getDate() { + return date; + } + public void setDate(String date) { + this.date = date; + } + public String getDcsCounterRef() { + return dcsCounterRef; + } + public void setDcsCounterRef(String dcsCounterRef) { + this.dcsCounterRef = dcsCounterRef; + } + public String getDcsRef() { + return dcsRef; + } + public void setDcsRef(String dcsRef) { + this.dcsRef = dcsRef; + } + public String getDealerCounterRef() { + return dealerCounterRef; + } + public void setDealerCounterRef(String dealerCounterRef) { + this.dealerCounterRef = dealerCounterRef; + } + public String getDealerRef() { + return dealerRef; + } + public void setDealerRef(String dealerRef) { + this.dealerRef = dealerRef; + } + public String getDocumentName() { + return documentName; + } + public void setDocumentName(String documentName) { + this.documentName = documentName; + } + public String getDocumentStatus() { + return documentStatus; + } + public void setDocumentStatus(String documentStatus) { + this.documentStatus = documentStatus; + } + public String getDocumentTitle() { + return documentTitle; + } + public void setDocumentTitle(String documentTitle) { + this.documentTitle = documentTitle; + } + public String getFrom() { + return from; + } + public void setFrom(String from) { + this.from = from; + } + public String getTo() { + return to; + } + public void setTo(String to) { + this.to = to; + } + + public String getPoReference() + { + return poReference; + } + + public void setPoReference(String poReference) + { + this.poReference = poReference; + } + + public Timestamp getDateOrdered() + { + return dateOrdered; + } + + public void setDateOrdered(Timestamp dateOrdered) + { + this.dateOrdered = dateOrdered; + } + + public String getPaymentByCard() { + return paymentByCard; + } + + public void setPaymentByCard(String paymentByCard) { + this.paymentByCard = paymentByCard; + } + + public String getPaymentByCash() { + return paymentByCash; + } + + public void setPaymentByCash(String paymentByCash) { + this.paymentByCash = paymentByCash; + } + + public String getPaymentbyCheque() { + return paymentbyCheque; + } + + public void setPaymentbyCheque(String paymentbyCheque) { + this.paymentbyCheque = paymentbyCheque; + } + + public String getBpartnerId() + { + return bpartnerId; + } + + public void setBpartnerId(String bpartnerId) + { + this.bpartnerId = bpartnerId; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/WebInvoiceLineBean.java b/posterita/posterita/src/main/org/posterita/beans/WebInvoiceLineBean.java new file mode 100644 index 0000000000..2ebf1a89f4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WebInvoiceLineBean.java @@ -0,0 +1,63 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + +import java.math.BigDecimal; + + +public class WebInvoiceLineBean extends WebOrderLineBean +{ + private Integer invoiceId; + private Integer qtyInvoiced; + //amount including tax + private BigDecimal lineTotalAmount; + + public BigDecimal getLineTotalAmt() + { + return lineTotalAmount; + } + + public void setLineTotalAmt(BigDecimal lineTotalAmt) + { + this.lineTotalAmount = lineTotalAmt; + } + + + + public Integer getInvoiceId() + { + return invoiceId; + } + + public void setInvoiceId(Integer invoiceId) + { + this.invoiceId = invoiceId; + } + + public Integer getQtyInvoiced() + { + return qtyInvoiced; + } + + public void setQtyInvoiced(Integer qtyInvoiced) + { + this.qtyInvoiced = qtyInvoiced; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/WebMinOutLineBean.java b/posterita/posterita/src/main/org/posterita/beans/WebMinOutLineBean.java new file mode 100644 index 0000000000..2273eb5dda --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WebMinOutLineBean.java @@ -0,0 +1,26 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + + +public class WebMinOutLineBean extends WebOrderLineBean +{ + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/WebOrderLineBean.java b/posterita/posterita/src/main/org/posterita/beans/WebOrderLineBean.java new file mode 100644 index 0000000000..f8ba1a220d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WebOrderLineBean.java @@ -0,0 +1,489 @@ +/* + * Created on Mar 3, 2005 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.posterita.beans; + +import java.math.BigDecimal; +import java.util.ArrayList; + + +public class WebOrderLineBean +{ + private AttributeValuesPair attributeValuesPair; + private UDIPair[] actions; + private WebOrderLineBean myPref; + private WebOrderLineBean[] myChoices; + private BigDecimal discountPercentage; + private BigDecimal qtyTotal; + private BigDecimal taxRate; + + + //amount excluding tax + private BigDecimal lineNetAmt; + private BigDecimal taxAmt; + private BigDecimal priceActual; + private Integer orderLineId; + private Integer productId; + private ArrayList vinNumberPairs; + private Integer attributeSetInstanceId; + private String serno; + private Boolean isInvoiced; + private String engineNo; + private Boolean isQtyReserved; + private Integer partnerId; + private BigDecimal totalAmt; + private Integer tradeInOrderlineId; + private BigDecimal lineTotalAmt; + private String tradeInVin; + + private String productName; + private Integer count; + private BigDecimal qtyOrdered; + private BigDecimal grandTotal; + private String trxType; + private BigDecimal amountGiven; + private BigDecimal amountRefunded; + private Boolean isRejectable; + private String currency; + private String description; + private BigDecimal unitPrice; + private String uom; + + private BigDecimal discountAmt; + private BigDecimal writeOffAmt; + private BigDecimal subTotal; + + private BigDecimal unitPurchasePrice; + private BigDecimal grossProfit; + private BigDecimal totalGrossProfit; + private BigDecimal grossProfitPercentage; + private BigDecimal totalGrossProfitPercentage; + + public BigDecimal getGrossProfitPercentage() + { + return grossProfitPercentage; + } + + public void setGrossProfitPercentage(BigDecimal grossProfitPercentage) + { + this.grossProfitPercentage = grossProfitPercentage; + } + + public BigDecimal getTotalGrossProfitPercentage() + { + return totalGrossProfitPercentage; + } + + public void setTotalGrossProfitPercentage(BigDecimal totalGrossProfitPercentage) + { + this.totalGrossProfitPercentage = totalGrossProfitPercentage; + } + + public BigDecimal getSubTotal() { + return subTotal; + } + + public void setSubTotal(BigDecimal subTotal) { + this.subTotal = subTotal; + } + + public BigDecimal getDiscountAmt() { + return discountAmt; + } + + public void setDiscountAmt(BigDecimal discountAmt) { + this.discountAmt = discountAmt; + } + + public BigDecimal getWriteOffAmt() { + return writeOffAmt; + } + + public void setWriteOffAmt(BigDecimal writeOffAmt) { + this.writeOffAmt = writeOffAmt; + } + + public BigDecimal getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(BigDecimal unitPrice) { + this.unitPrice = unitPrice; + } + + public String getCurrency() + { + return currency; + } + + public void setCurrency(String currency) + { + this.currency = currency; + } + + /** + * @return Returns the amountGiven. + */ + public BigDecimal getAmountGiven() { + return amountGiven; + } + /** + * @param amountGiven The amountGiven to set. + */ + public void setAmountGiven(BigDecimal amountGiven) { + this.amountGiven = amountGiven; + } + /** + * @return Returns the amountRefunded. + */ + public BigDecimal getAmountRefunded() { + return amountRefunded; + } + /** + * @param amountRefunded The amountRefunded to set. + */ + public void setAmountRefunded(BigDecimal amountRefunded) { + this.amountRefunded = amountRefunded; + } + public String getTrxType() + { + return trxType; + } + + public void setTrxType(String trxType) + { + this.trxType = trxType; + } + public BigDecimal getGrandTotal() + { + return grandTotal; + } + + public void setGrandTotal(BigDecimal grandTotal) + { + this.grandTotal = grandTotal; + } + public BigDecimal getQtyOrdered() + { + return qtyOrdered; + } + + public void setQtyOrdered(BigDecimal qtyOrdered) + { + this.qtyOrdered=qtyOrdered; + } + + public Integer getCount() + { + return count; + } + + public void setCount(Integer count) + { + this.count=count; + } + + public String getProductName() + { + return productName; + } + + public void setProductName(String productName) + { + this.productName=productName; + } + + public Boolean getIsQtyReserved() + { + return isQtyReserved; + } + + public void setIsQtyReserved(Boolean isQtyReserved) + { + this.isQtyReserved = isQtyReserved; + } + + public String getEngineNo() { + return engineNo; + } + public void setEngineNo(String engineNo) { + this.engineNo = engineNo; + } + public Boolean getIsInvoiced() + { + return isInvoiced; + } + + public void setIsinvoiced(Boolean isInvoiced) + { + this.isInvoiced = isInvoiced; + } + + + public BigDecimal getPriceActual() + { + return priceActual; + } + + public void setPriceActual(BigDecimal priceActual) + { + this.priceActual = priceActual; + } + public BigDecimal getTaxAmt() + { + return taxAmt; + } + + public void setTaxAmt(BigDecimal taxAmt) + { + this.taxAmt = taxAmt; + } + + + public UDIPair[] getActions() + { + return actions; + } + public void setActions(UDIPair[] actions) + { + this.actions = actions; + } + public WebOrderLineBean[] getMyChoices() + { + return myChoices; + } + public void setMyChoices(WebOrderLineBean[] myChoices) + { + this.myChoices = myChoices; + } + public WebOrderLineBean getMyPref() + { + return myPref; + } + public void setMyPref(WebOrderLineBean myPref) + { + this.myPref = myPref; + } + + public void setLineNetAmt(BigDecimal lineNetAmt) + { + this.lineNetAmt = lineNetAmt; + } + + public BigDecimal getLineNetAmt() + { + return lineNetAmt; + } + + public AttributeValuesPair getAttributeValuesPair() + { + return attributeValuesPair; + } + + public void setAttributeValuesPair(AttributeValuesPair attributeValuesPair) + { + this.attributeValuesPair = attributeValuesPair; + } + + public void setOrderLineId(Integer orderLineId) + { + this.orderLineId = orderLineId; + } + + public Integer getOrderLineId() + { + return orderLineId; + } + + public void setProductId(Integer productId) + { + this.productId = productId; + } + + public Integer getProductId() + { + return productId; + } + + public void setAttributeSetInstanceid(Integer attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + + public Integer getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + + + public ArrayList getVinNumberPairs() + { + return vinNumberPairs; + } + + public void setVinNumberPairs(ArrayList vinNumberPairs) + { + this.vinNumberPairs = vinNumberPairs; + } + + public String getSerno() + { + return serno; + } + + public void setSerno(String serno) + { + this.serno = serno; + } + + public Integer getPartnerId() + { + return partnerId; + } + + public void setPartnerId(Integer partnerId) + { + this.partnerId = partnerId; + } + + public BigDecimal getTotalAmt() + { + return totalAmt; + } + + public void setTotalAmt(BigDecimal totalAmt) + { + this.totalAmt = totalAmt; + } + + public Integer getTradeInOrderlineId() + { + return tradeInOrderlineId; + } + + public void setTradeInOrderlineId(Integer tradeInOrderlineId) + { + this.tradeInOrderlineId = tradeInOrderlineId; + } + + public BigDecimal getLineTotalAmt() + { + return lineTotalAmt; + } + + public void setLineTotalAmt(BigDecimal lineTotalAmt) + { + this.lineTotalAmt = lineTotalAmt; + } + + public String getTradeInVin() + { + return tradeInVin; + } + + public void setTradeInVin(String tradeInVin) + { + this.tradeInVin = tradeInVin; + } + + + + public Boolean getIsRejectable() + { + return isRejectable; + } + + public void setIsRejectable(Boolean isRejectable) + { + this.isRejectable = isRejectable; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public BigDecimal getDiscountPercentage() { + return discountPercentage; + } + + public void setDiscountPercentage(BigDecimal discountPercentage) { + this.discountPercentage = discountPercentage; + } + + public BigDecimal getQtyTotal() { + return qtyTotal; + } + + public void setQtyTotal(BigDecimal qtyTotal) { + this.qtyTotal = qtyTotal; + } + + public String getUom() { + return uom; + } + + public void setUom(String uom) { + this.uom = uom; + } + + public BigDecimal getTaxRate() { + return taxRate; + } + + public void setTaxRate(BigDecimal taxRate) { + this.taxRate = taxRate; + } + + public BigDecimal getPurchasePriceList() + { + return unitPurchasePrice; + } + + public void setPurchasePriceList(BigDecimal purchasePriceList) + { + this.unitPurchasePrice = purchasePriceList; + } + + public BigDecimal getGrossProfit() + { + return grossProfit; + } + + public void setGrossProfit(BigDecimal grossProfit) + { + this.grossProfit = grossProfit; + } + + public BigDecimal getUnitPurchasePrice() + { + return unitPurchasePrice; + } + + public void setUnitPurchasePrice(BigDecimal unitPurchasePrice) + { + this.unitPurchasePrice = unitPurchasePrice; + } + + public BigDecimal getTotalGrossProfit() + { + return totalGrossProfit; + } + + public void setTotalGrossProfit(BigDecimal totalGrossProfit) + { + this.totalGrossProfit = totalGrossProfit; + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/beans/WebStockBean.java b/posterita/posterita/src/main/org/posterita/beans/WebStockBean.java new file mode 100644 index 0000000000..7b379e0277 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WebStockBean.java @@ -0,0 +1,49 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.beans; + +import java.util.ArrayList; + + +public class WebStockBean +{ + private AttributeValuesBean attributeValuesBean; + private ArrayList regions; + + public AttributeValuesBean getAttributeValuesBean() + { + return attributeValuesBean; + } + + public void setAttributeValuesBean(AttributeValuesBean attributeValuesBean) + { + this.attributeValuesBean = attributeValuesBean; + } + + public ArrayList getRegions() + { + return regions; + } + + public void setRegions(ArrayList regions) + { + this.regions = regions; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/WebstoreProductImageFileBean.java b/posterita/posterita/src/main/org/posterita/beans/WebstoreProductImageFileBean.java new file mode 100644 index 0000000000..8ff2977a1a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WebstoreProductImageFileBean.java @@ -0,0 +1,104 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.beans; + +import java.util.ArrayList; +import java.util.Iterator; + +public class WebstoreProductImageFileBean +{ + + private String fileName; + private String brandDesignModelColourAttr; + + private ArrayList sizeList; + + public WebstoreProductImageFileBean() + { + sizeList = new ArrayList(); + } + + public String getBrandDesignModelColourAttr() + { + return brandDesignModelColourAttr; + } + + public void setBrandDesignModelColourAttr(String brandDesignModelColourAttr) + { + this.brandDesignModelColourAttr = brandDesignModelColourAttr; + } + + public String getFileName() + { + return fileName; + } + + public void setFileName(String fileName) + { + this.fileName = fileName; + } + + public ArrayList getSizeList() + { + return sizeList; + } + + public void setSizeList(ArrayList sizeList) + { + this.sizeList = sizeList; + } + + public void addSize(String size) + { + sizeList.add(size); + } + + @Override + public boolean equals(Object obj) + { + boolean equals = false; + + if(obj instanceof WebstoreProductImageFileBean) + { + if(((WebstoreProductImageFileBean)obj).brandDesignModelColourAttr.equalsIgnoreCase(this.brandDesignModelColourAttr)) + { + WebstoreProductImageFileBean tWProductImageFileBean = (WebstoreProductImageFileBean)obj; + Iterator sizeIter = tWProductImageFileBean.getSizeList().iterator(); + while(sizeIter.hasNext()) + { + String s = sizeIter.next(); + if(this.sizeList.contains(s)) + { + equals = true; + break; + } + } + } + } + + return equals; + } +} diff --git a/posterita/posterita/src/main/org/posterita/beans/WebstoreUserBean.java b/posterita/posterita/src/main/org/posterita/beans/WebstoreUserBean.java new file mode 100644 index 0000000000..ea428e8fa2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/beans/WebstoreUserBean.java @@ -0,0 +1,127 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.beans; + +import java.math.BigDecimal; + +public class WebstoreUserBean +{ + + protected UserBean userBean; + protected AddressBean shipToAddrBean; + protected CreditCardBean creditCardBean; + protected Integer chargeId; // not in udibean yet + protected String tenderType; //i.e. Payment Method: by card, cash (not in udibean yet) + protected String deliveryViaRule; // MInOut.DELIVERYVIARULE_Shipper etc + protected String chargeName; + protected BigDecimal chargeAmount; + /* + * Will be used only in session. + * Step 1: Delivery Information + * Step 2: Payment Information + * Step 3: Order Confirmation + * Step 4: Finished + */ + protected String step; + + + + public String getStep() + { + return step; + } + public void setStep(String step) + { + this.step = step; + } + + public CreditCardBean getCreditCardBean() + { + return creditCardBean; + } + public void setCreditCardBean(CreditCardBean creditCardBean) + { + this.creditCardBean = creditCardBean; + } + public AddressBean getShipToAddrBean() + { + return shipToAddrBean; + } + public void setShipToAddrBean(AddressBean shipToAddrBean) + { + this.shipToAddrBean = shipToAddrBean; + } + public UserBean getUserBean() + { + return userBean; + } + public void setUserBean(UserBean userBean) + { + this.userBean = userBean; + } + + public String getTenderType() + { + return tenderType; + } + public void setTenderType(String tenderType) + { + this.tenderType = tenderType; + } + public Integer getChargeId() + { + return chargeId; + } + public void setChargeId(Integer chargeId) + { + this.chargeId = chargeId; + } + public String getChargeName() + { + return chargeName; + } + public void setChargeName(String chargeName) + { + this.chargeName = chargeName; + } + public BigDecimal getChargeAmount() + { + return chargeAmount; + } + public void setChargeAmount(BigDecimal chargeAmount) + { + this.chargeAmount = chargeAmount; + } + public String getDeliveryViaRule() + { + return deliveryViaRule; + } + public void setDeliveryViaRule(String deliveryViaRule) + { + this.deliveryViaRule = deliveryViaRule; + } + + + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/AbstractDocumentManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/AbstractDocumentManager.java new file mode 100644 index 0000000000..320f8abc03 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/AbstractDocumentManager.java @@ -0,0 +1,142 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author vishee + */ + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.util.Properties; + +import org.compiere.model.MAttributeSetInstance; +import org.compiere.model.MBPartner; +import org.compiere.model.MTax; +import org.compiere.util.Env; + +import org.posterita.beans.WebDocumentHeaderBean; + + +public class AbstractDocumentManager +{ + public static final String REF_PO = "Ref PO No:"; + public static final String COUNTER_REF_SO = "Ref SO No:"; + + public static final String DEALER_REF = "Dealer Purchase Order No:"; + public static final String DEALER_COUNTER_REF = "Dealer Purchase Order No:"; + + + + public static final String FROM = "From:"; + public static final String TO = "To:"; + + + protected static BigDecimal getLineTaxAmt(Properties ctx, BigDecimal lineNetAmt, int taxId, int lineId) + { + BigDecimal baseAmt = Env.ZERO; + + baseAmt = baseAmt.add(lineNetAmt); + + MTax tax = new MTax(ctx, taxId, null); + + return (tax.calculateTax(baseAmt, false, 4)); + } + + protected static String getSerno(Properties ctx, int attributeSetInstanceId) + { + if (attributeSetInstanceId == 0) + return ""; + + MAttributeSetInstance attributeSetInstance = new MAttributeSetInstance(ctx, attributeSetInstanceId, null); + + return attributeSetInstance.getSerNo(); + } + + protected static WebDocumentHeaderBean createWebDocumentHeader(Properties ctx, int orgId, int bpartnerID, String docStatus, boolean isSoTrx,String paymentType) + { + if (isSoTrx) + return getSalesOrderHeader(ctx, orgId, bpartnerID, docStatus,paymentType); + else + return getPurchaseOrderHeader(ctx, orgId, bpartnerID, docStatus); + } + + protected static WebDocumentHeaderBean getSalesOrderHeader(Properties ctx, int orgId, int bpartnerID, String docStatus,String paymentType) + { + WebDocumentHeaderBean headerBean = new WebDocumentHeaderBean(); + + headerBean.setDcsRef(COUNTER_REF_SO); + headerBean.setDcsCounterRef(REF_PO); + headerBean.setDealerRef(null); + headerBean.setPaymentType(paymentType); + + //set to null because SOReference is not currently available in system + headerBean.setDealerCounterRef(DEALER_COUNTER_REF); + //headerBean.setDocumentStatus(order.getZZ_HondaDocStatus()); + headerBean.setDate("Date Ordered:"); + headerBean.setDocumentName("Sales Order"); + + + String youName = null; + MBPartner youPartner = new MBPartner(ctx, bpartnerID, null); + + youName = youPartner.getName(); + + + headerBean.setYouName(youName); + + headerBean.setFrom(TO); + + headerBean.setTo(FROM); + + return headerBean; + } + + + + + private static WebDocumentHeaderBean getPurchaseOrderHeader(Properties ctx, int orgId, int bpartnerID, String docStatus) + { + WebDocumentHeaderBean headerBean = new WebDocumentHeaderBean(); + + headerBean.setDcsRef(REF_PO); + headerBean.setDcsCounterRef(COUNTER_REF_SO); + headerBean.setDealerRef(DEALER_REF); + //set to null because SOReference is not currently available in system + headerBean.setDealerCounterRef(null); + headerBean.setDocumentStatus(docStatus); + headerBean.setDate("Date Ordered:"); + headerBean.setDocumentName("Purchase order"); + + + MBPartner youBP = new MBPartner(ctx, bpartnerID, null); + String youName = youBP.getName(); + + headerBean.setYouName(youName); + + headerBean.setFrom(TO); + + headerBean.setTo(FROM); + + + return headerBean; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/AttributeValuesManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/AttributeValuesManager.java new file mode 100644 index 0000000000..b0b28ee5ff --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/AttributeValuesManager.java @@ -0,0 +1,326 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author ashley + */ + +package org.posterita.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.model.MAttribute; +import org.compiere.model.MAttributeValue; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.beans.AttributeInstanceBean; +import org.posterita.beans.AttributeValuesPair; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.OperationException; +import org.posterita.keyname.ProductAttributeValueKeyNamePair; +import org.posterita.util.PoManager; + +public class AttributeValuesManager +{ + private static ArrayList getAttributeValues(Properties ctx, int attributeId, int productCategoryId ) throws OperationException + { + ArrayList attributeValues = ProductAttributeValueKeyNamePair.getKeyNamePairs(ctx, attributeId, productCategoryId); + + return attributeValues; + + } + + //retrieve the colour, model, transmission, year from an attributesetinstanceID + //returns a bean containing a colour, model, year, transmission keynamepair + + public static AttributeValuesPair retrieveAttributeValues(Properties ctx,int attributeSetInstanceId) throws OperationException + { + if (attributeSetInstanceId == 0) + return new AttributeValuesPair(); + + ArrayList attributeInstances = getMAttributeInstances(ctx); + + return retrieveAttributeValues(ctx, attributeSetInstanceId, attributeInstances); + } + + public static AttributeValuesPair retrieveAttributeValues(Properties ctx,int attributeSetInstanceId, ArrayList attributeInstances) throws OperationException + { + HashMap attributeValuesMap = getAttributeValues(ctx, attributeSetInstanceId, attributeInstances); + + AttributeValuesPair pair = new AttributeValuesPair(); + pair.setBrandAttributeValue((KeyNamePair)attributeValuesMap.get("Brand")); + pair.setModelAttributeValue((KeyNamePair) attributeValuesMap.get("Model")); + pair.setColourAttributeValue((KeyNamePair) attributeValuesMap.get("Colour")); + pair.setTransmissionAttributeValue((KeyNamePair) attributeValuesMap.get("Transmission")); + pair.setYearAttributeValue((KeyNamePair) attributeValuesMap.get("Year")); + pair.setDesignAttributeValue((KeyNamePair) attributeValuesMap.get("Design")); + pair.setSizeAttributeValue((KeyNamePair) attributeValuesMap.get("Size")); + pair.setStyleAttributeValue((KeyNamePair) attributeValuesMap.get("Style")); + + return pair; + } + + private static HashMap getAttributeValues(Properties ctx, int attributeSetInstanceId, ArrayList attributeInstances) throws OperationException + { + ArrayList sameAttributeSetInstances = getAttributeInstancesByAttributeSetInstance(attributeSetInstanceId, attributeInstances); + + Iterator iter = sameAttributeSetInstances.iterator(); + + HashMap attributeValuesMap = new HashMap(); + + AttributeInstanceBean attributeInstanceBean; + while (iter.hasNext()) + { + attributeInstanceBean = (AttributeInstanceBean) iter.next(); + attributeValuesMap = getAttributeValue(ctx,attributeInstanceBean, attributeValuesMap); + + } + + return attributeValuesMap; + + } + + @SuppressWarnings("unchecked") + private static HashMap getAttributeValue(Properties ctx, AttributeInstanceBean attributeInstanceBean, HashMap attributeValuesMap) throws OperationException + { + KeyNamePair pair = new KeyNamePair(attributeInstanceBean.getAttributeValueId(), attributeInstanceBean.getAttributeValue()); + attributeValuesMap.put(attributeInstanceBean.getAttribute(), pair); + + return attributeValuesMap; + } + + public static ArrayList getMAttributeInstances(Properties ctx) throws OperationException + { +// MOrg org = OrganisationManager.getHsafOrg(ctx); // Honda customised stuff + + int adOrgID = Env.getAD_Org_ID(ctx); + String sql = "select ai.m_attributeSetInstance_id," + + " ai.m_attributevalue_id," + + " ai.value," + + " attr.name," + + " attr.M_Attribute_ID" + + " from m_attributeInstance ai, M_Attribute attr " + + " where ai.m_attribute_id=attr.m_attribute_id" + + " and ai.AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and ai.AD_ORG_ID="+adOrgID; + + PreparedStatement pstmt =null; + + ArrayList attributeInstances = new ArrayList(); + try + { + pstmt = DB.prepareStatement(sql, null); + ResultSet rs = pstmt.executeQuery(); + + AttributeInstanceBean bean; + while (rs.next()) + { + bean = new AttributeInstanceBean(); + bean.setAttributeSetInstanceId(rs.getInt(1)); + bean.setAttributeValueId(rs.getInt(2)); + bean.setAttributeValue(rs.getString(3)); + bean.setAttribute(rs.getString(4)); + bean.setAttributeId(rs.getInt(5)); + attributeInstances.add(bean); + } + + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + } + pstmt = null; + } + + return attributeInstances; + } + + private static ArrayList getAttributeInstancesByAttributeSetInstance(int attributeSetInstanceId, ArrayList allAttributeInstances) + { + Iterator iter = allAttributeInstances.iterator(); + + AttributeInstanceBean bean; + ArrayList sameInstances = new ArrayList(); + while (iter.hasNext()) + { + bean = (AttributeInstanceBean) iter.next(); + if (bean.getAttributeSetInstanceId() == attributeSetInstanceId) + sameInstances.add(bean); + } + + + return sameInstances; + } + + public static MAttributeValue createAttributeValue(Properties ctx, String value, int attributeId, int productCategoryId, String trxName) throws OperationException + { + + MAttributeValue attributeValue = new MAttributeValue(ctx, 0, trxName); + attributeValue.setName(value); + attributeValue.setValue(value); +// attributeValue.setM_Product_Category_ID(productCategoryId); + attributeValue.setM_Attribute_ID(attributeId); + PoManager.save(attributeValue); + return attributeValue; + + } + + public static MAttributeValue getOrCreateAttributeValue(Properties ctx, int attributeId, String value, int productCategoryId, String trxName) throws OperationException + { + //check is attribute value exist before creating new one + int attributeValueIds[] = MAttributeValue.getAllIDs(MAttributeValue.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and Upper(name)=Upper('" + value + "')", trxName); + + MAttributeValue attributeValue; + if (attributeValueIds.length!= 0) + attributeValue = new MAttributeValue(ctx, attributeValueIds[0], trxName); + else + attributeValue = AttributeValuesManager.createAttributeValue(ctx, value, attributeId, productCategoryId, trxName); + + return attributeValue; + } + + public static MAttributeValue getAttributeValue(Properties ctx, int attributeId, int attributeSetInstanceId, String trxName) throws OperationException + { + String selStmt = "Select M_AttributeValue_ID from M_AttributeInstance where "; + selStmt += " AD_Client_ID=" + Env.getAD_Client_ID(ctx); + selStmt += " and M_AttributeSetInstance_ID=" + attributeSetInstanceId; + selStmt += " and M_Attribute_ID=" + attributeId; + + PreparedStatement pstmt = null; + + try + { + pstmt = DB.prepareStatement(selStmt, trxName); + ResultSet rs = pstmt.executeQuery(); + + if(!rs.next()) + throw new OperationException("Could not find Attribute Value id for Attribute id: " + attributeId + " and Attribute Set Instance Id: " + attributeSetInstanceId); + + int attributeValueId = rs.getInt(1); + rs.close(); + MAttributeValue attrValue = new MAttributeValue(ctx, attributeValueId, trxName); + return attrValue; + } + catch(SQLException sqlEx) + { + throw new OperationException("Could not execute query for getting attribute value: " + selStmt); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex) + {} + } + } + + public static ArrayList getAttributeValues(Properties ctx, int AttributeId) throws OperationException + { + StringBuffer whereClause = new StringBuffer(); + whereClause.append("M_AttributeValue_ID in ( "); + whereClause.append("select distinct M_AttributeValue_ID from M_AttributeInstance "); + whereClause.append("where AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " "); + whereClause.append(" and AD_Org_ID=" + Env.getAD_Org_ID(ctx) + " "); + whereClause.append("and M_Attribute_ID=" + AttributeId + " "); + whereClause.append(")"); + try + { + return KeyNamePairUtil.getData(ctx, MAttributeValue.Table_Name, whereClause.toString()); + } + catch(SQLException ex) + { + throw new OperationException("Could not retrieve Attribute Values with WhereClause: " + whereClause, ex); + } + } + + @SuppressWarnings("unchecked") + public static ArrayList getAttributes(Properties ctx) throws OperationException + { + String whereClause = "AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " and IsActive='Y'"; + + try + { + return KeyNamePairUtil.getData(ctx, MAttribute.Table_Name, whereClause); + } + catch(SQLException ex) + { + throw new OperationException("Could not retrieve attributes with WhereClause: " + whereClause, ex); + } + } + + public static int changeAttributeValue(Properties ctx, int attributeValueId, String newValue, String trxName) throws OperationException + { + int retAttributeValueId; + String whereClause = "AD_Client_ID=" + Env.getAD_Client_ID(ctx); + whereClause += " and AD_Org_ID=" + Env.getAD_Org_ID(ctx) + " and Upper(Name)=Upper('" + newValue + "')"; + + int attrValueIds[] = MAttributeValue.getAllIDs(MAttributeValue.Table_Name, whereClause, trxName); + + if(attrValueIds.length > 1) + throw new OperationException("Duplicate name found in Attribute Value: " + newValue); + + MAttributeValue attributeValue = new MAttributeValue(ctx, attributeValueId, trxName); + if(attributeValue.get_ID() == 0) + throw new OperationException("Could not load Attribute Value with ID: " + attributeValueId); + + if(attrValueIds.length == 0) + { + attributeValue.setName(newValue); + attributeValue.setValue(newValue); + retAttributeValueId = attributeValue.get_ID(); + } + else if(attributeValueId == attrValueIds[0]) + { + attributeValue.setIsActive(true); + attributeValue.setName(newValue); + attributeValue.setValue(newValue); + retAttributeValueId = attributeValue.get_ID(); + } + else + { + attributeValue.setIsActive(false); + retAttributeValueId = attrValueIds[0]; + } + + PoManager.save(attributeValue); + + return retAttributeValueId; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/BankManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/BankManager.java new file mode 100644 index 0000000000..56071d09d5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/BankManager.java @@ -0,0 +1,333 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.model.MBankAccount; +import org.compiere.model.MClient; +import org.compiere.model.MLocation; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.BankAccountBean; +import org.posterita.beans.BankBean; +import org.posterita.core.CheckDuplicateEntities; +import org.posterita.exceptions.BankAlreadyExistException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.model.MBank; +import org.posterita.util.PoManager; + + +public class BankManager +{ + private static final CLogger log = CLogger.getCLogger(BankManager.class); + private static final String ROUTING_NUMBER="12345"; + + public static MBank createBank(Properties ctx, String bankName,String address1,String postalAddress1,String city,String routingNumber, String trxName) throws OperationException + { + + MBank bank = new MBank(ctx,0,trxName); + + if(CheckDuplicateEntities.checkDuplicateName(ctx,bankName,MBank.Table_Name)) + throw new BankAlreadyExistException("Bank already exists"); + + try + { + bank.setName(bankName); + bank.setRoutingNo(ROUTING_NUMBER); + + MLocation location = new MLocation(ctx,bank.getC_Location_ID(),trxName); + location.setAddress1(address1); + location.setPostal_Add(postalAddress1); + location.setCity(city); + location.setC_Country_ID(UdiConstants.COUNTRY_MAURITIUS); + + PoManager.save(location); + + bank.setC_Location_ID(location.get_ID()); + + PoManager.save(bank); + + } + catch(OperationException e) + { + throw new OperationException("Cannot create bank!!"); + } + + return bank; + + } + + public static MBankAccount createBankAccount(Properties ctx,int bankId,String accountNo,String accountType,double currentBalance, String trxName) throws OperationException + { + MBankAccount account; + + try + { + account = new MBankAccount(ctx,0,trxName); + account.setC_Bank_ID(bankId); + account.setAccountNo(accountNo); + account.setBankAccountType(accountType); + account.setC_Currency_ID(MClient.get(ctx).getC_Currency_ID()); + account.setIsDefault(true); + account.setCurrentBalance(new BigDecimal(currentBalance)); + + + PoManager.save(account); + } + catch(OperationException e) + { + throw new OperationException("Cannot create bank account!!"); + } + + return account; + + } + + + public static ArrayList getAllBanks(Properties ctx) throws OperationException + { + ArrayList list = new ArrayList(); + + //load all banks + int clientId = Env.getAD_Client_ID(ctx); + int orgId = Env.getAD_Org_ID(ctx); + + int id[] = MBank.getAllIDs(MBank.Table_Name," ad_client_id = "+clientId+" and ad_org_id = "+orgId +" and isactive = 'Y'" ,null); + BankBean bean; + + for(int i=0; i1) + throw new OperationException("Too many banks, not currently supported"); + + BankBean bean = (BankBean)allBanks.get(0); + bankId = bean.getBankId(); + } + + return bankId.intValue(); + } + + public static int getDefaultBankAccountId(Properties ctx, int adOrgId, String trxName) throws OperationException + { + String whereClause = "AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " AND AD_Org_ID=" + adOrgId + " AND IsDefault='Y'"; + + int bankAccountIds[] = MBankAccount.getAllIDs(MBankAccount.Table_Name, whereClause, trxName); + + if (bankAccountIds.length == 0) + { + throw new OperationException("No default bank account found"); + } + else + { + return bankAccountIds[0]; + } + } + + + /** + * Retrieves all the active bank accounts that the user present in the application context can + * have access to + * @param ctx Context + * @param trxName Transaction + * @return List of Bank Account model data + * @throws OperationException If the data cannot be retrieved + */ + public static ArrayList getBankAccounts(Properties ctx, String trxName) throws OperationException + { + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append("SELECT b.C_Bank_ID, b.Name, ba.C_BankAccount_ID, ba.bankAccountType, ba.AccountNo, ba.Description "); + sqlStmt.append("FROM C_Bank b INNER JOIN C_BankAccount ba ON b.C_Bank_ID=ba.C_Bank_ID "); + sqlStmt.append("WHERE b.AD_Client_ID=? AND b.IsActive='Y' AND ba.IsActive='Y' AND b.AD_Org_ID IN ("); + sqlStmt.append(Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)); + sqlStmt.append(")"); + sqlStmt.append(" AND NOT EXISTS (SELECT * FROM AD_OrgInfo oi WHERE oi.TransferBank_ID=b.C_Bank_ID)"); + + ArrayList paramList = new ArrayList(); + paramList.add(new Integer(Env.getAD_Client_ID(ctx))); + + return getBankAccounts(ctx, sqlStmt.toString(), paramList, trxName); + } + + /** + * Retrieves all the active bank accounts present for an organisation + * @param ctx Context + * @param trxName Transaction + * @return List of Bank Account model data + * @throws OperationException If the data cannot be retrieved + */ + public static ArrayList getBankAccounts (Properties ctx, int adOrgId, String trxName) throws OperationException + { + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append("SELECT b.C_Bank_ID, b.Name, ba.C_BankAccount_ID, ba.bankAccountType, ba.AccountNo, ba.Description "); + sqlStmt.append("FROM C_Bank b INNER JOIN C_BankAccount ba ON b.C_Bank_ID=ba.C_Bank_ID "); + sqlStmt.append("WHERE b.AD_Client_ID=? AND b.IsActive='Y' AND ba.IsActive='Y' AND ba.AD_Org_ID=?"); + sqlStmt.append(" AND NOT EXISTS (SELECT * FROM AD_OrgInfo oi WHERE oi.TransferBank_ID=b.C_Bank_ID)"); + + ArrayList paramList = new ArrayList(); + paramList.add(new Integer(Env.getAD_Client_ID(ctx))); + paramList.add(new Integer(adOrgId)); + + return getBankAccounts(ctx, sqlStmt.toString(), paramList, trxName); + } + + /** + * Retrieves list of bank accounts based on the criteria defined in the SQL Statement + * @param ctx Context + * @param sqlSmt SQL Statement + * @param params Parameters to be used to build the SQL + * @param trxName Transaction + * @return List of Bank Account + * @throws OperationException If data cannot be retrieved + */ + private static ArrayList getBankAccounts(Properties ctx, String sqlSmt, ArrayList params, String trxName) throws OperationException + { + ArrayList list = new ArrayList(); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + int paramIndex = 1; + pstmt = DB.prepareStatement(sqlSmt, trxName); + if (params != null) + { + for (int i = 0; i < params.size(); i++) + { + pstmt.setObject(paramIndex++, params.get(i)); + } + } + rs = pstmt.executeQuery(); + + while (rs.next()) + { + BankAccountBean bean = new BankAccountBean(); + bean.setBankId(rs.getInt(1)); + bean.setBankName(rs.getString(2)); + bean.setBankAccountId(rs.getInt(3)); + bean.setAccountType(rs.getString(4)); + bean.setAccountNo(rs.getString(5)); + list.add(bean); + } + } + catch (Exception ex) + { + log.log(Level.SEVERE, "Could not get bank account information", ex); + throw new OperationException("Could not get bank account information", ex); + } + finally + { + DB.close(rs, pstmt); + } + + return list; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/CashManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/CashManager.java new file mode 100644 index 0000000000..808959159c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/CashManager.java @@ -0,0 +1,1409 @@ +/* + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic; + + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.model.MAttachment; +import org.compiere.model.MAttachmentEntry; +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MBankAccount; +import org.compiere.model.MCash; +import org.compiere.model.MCashBook; +import org.compiere.model.MCashLine; +import org.compiere.model.MCurrency; +import org.compiere.model.MDocType; +import org.compiere.model.MInvoice; +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MPayment; +import org.compiere.process.DocumentEngine; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.TimeUtil; +import org.posterita.beans.CashBean; +import org.posterita.beans.CashBookBean; +import org.posterita.beans.CashBookDetailBean; +import org.posterita.beans.CashLineBean; +import org.posterita.beans.CashSummaryBean; +import org.posterita.beans.CurrentTillAmountBean; +import org.posterita.beans.OpenItemBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.beans.WebDocumentHeaderBean; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.core.JulianDate; +import org.posterita.core.utils.FormatBigDecimal; +import org.posterita.exceptions.CanNotCloseTillException; +import org.posterita.exceptions.CashBookAlreadyAssignedException; +import org.posterita.exceptions.DataException; +import org.posterita.exceptions.NoCashJournalPresentException; +import org.posterita.exceptions.NullTransferAmountException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.TransferAmountExceedsTotalAmountException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class CashManager +{ + private static final CLogger log = CLogger.getCLogger(CashManager.class); + + /** + * Adjust cash book (i.e: Expense, Receipts or Bank Transfer) + * @param ctx Context + * @param bean Transaction Details + * @param trxName Transaction + * @return Cash Journal Entry created + * @throws OperationException If entries could not be created or invalid transfer type + */ + public static MCashLine adjustCashBook(Properties ctx, CashBookDetailBean bean, String trxName) throws OperationException + { + MCash cash = getCashJournal(ctx,trxName); + + if(bean.getAdjustmentAmount() == null) + { + throw new NullTransferAmountException("Amount can not be null"); + } + + MCashLine cashLine = null; + + if(bean.getTransferType().equalsIgnoreCase(MCashLine.CASHTYPE_GeneralReceipts)) + { + cashLine = createCashLine(ctx, cash, bean.getAdjustmentAmount(), + MCashLine.CASHTYPE_GeneralReceipts, bean.getDescription(), trxName); + } + + else if(bean.getTransferType().equalsIgnoreCase(MCashLine.CASHTYPE_GeneralExpense)) + { + if(bean.getAdjustmentAmount().compareTo(cash.getEndingBalance()) > 0) + { + throw new TransferAmountExceedsTotalAmountException("cannot transfer amount more than the ending balance"); + } + cashLine = createCashLine(ctx, cash, bean.getAdjustmentAmount().negate(), + MCashLine.CASHTYPE_GeneralExpense, bean.getDescription(), trxName); + } + else if(bean.getTransferType().equalsIgnoreCase(MCashLine.CASHTYPE_BankAccountTransfer)) + { + if(bean.getAdjustmentAmount().compareTo(cash.getEndingBalance()) > 0) + { + throw new TransferAmountExceedsTotalAmountException("cannot transfer amount more than the ending balance"); + } + // @ashley TODO Refactor should be able to chose bank account on which to transfer + int bankAccountId = POSTerminalManager.getBankAccountId(ctx, MPayment.TENDERTYPE_Check); + cashLine = createBankTransferCashEntry(ctx, cash, bean.getAdjustmentAmount(), + bankAccountId, bean.getDescription(), trxName); + } + else + { + throw new OperationException("Invalid transfer type: " + bean.getTransferType()); + } + + return cashLine; + } + + /** + * Creates a new Journal entry + * @param ctx Context + * @param cashJournal Cash Journal + * @param amount Amount + * @param cashType Cash Type + * @param trxName Transaction + * @return The created journal entry (Cash Line) + * @throws OperationException If the entry cannot be created + */ + public static MCashLine createCashLine(Properties ctx, MCash cashJournal, BigDecimal amount, + String cashType, String trxName) throws OperationException + { + return createCashLine(ctx, cashJournal, amount, cashType, "", trxName); + } + + /** + * Creates a new Journal entry + * @param ctx Context + * @param cashJournal Cash Journal + * @param amount Amount + * @param cashType Cash Type + * @param description Description of the entry + * @param trxName Transaction + * @return The created journal entry (Cash Line) + * @throws OperationException If the entry cannot be created + */ + public static MCashLine createCashLine(Properties ctx, MCash cashJournal, BigDecimal transferAmount, + String cashType, String description, String trxName) throws OperationException + { + MCashLine cashLine = new MCashLine(ctx, 0, trxName); + cashLine.setC_Cash_ID(cashJournal.get_ID()); + cashLine.setAmount(transferAmount); + cashLine.setCashType(cashType); + cashLine.setDescription(description); + PoManager.save(cashLine); + return cashLine; + } + + /** + * Creates a new Bank Account transfer Journal entry + * @param ctx Context + * @param cashJournal Cash Journal + * @param amount Amount to transfer + * @param bankAccountId Bank Account + * @param trxName Transaction + * @return Cash Line entry + * @throws OperationException If the entry cannot be created + */ + public static MCashLine createBankTransferCashEntry(Properties ctx, MCash cashJournal, + BigDecimal transferAmount, int bankAccountId, String trxName) throws OperationException + { + return createBankTransferCashEntry(ctx, cashJournal, transferAmount, bankAccountId, null, trxName); + } + + /** + * Creates a new Bank Account transfer Journal entry + * @param ctx Context + * @param cashJournal Cash Journal + * @param amount Amount to transfer + * @param bankAccountId Bank Account + * @param description Description of the line + * @param trxName Transaction + * @return Cash Line entry + * @throws OperationException If the entry cannot be created + */ + public static MCashLine createBankTransferCashEntry(Properties ctx, MCash cashJournal, + BigDecimal amount, int bankAccountId, String description, String trxName) throws OperationException + { + MBankAccount bankAccount = new MBankAccount(ctx, bankAccountId, trxName); + + StringBuffer descr = new StringBuffer(); + // +ve/zero indicates transfer to bankAccount + // Though transfer of zero is meaningless + if (amount.signum() >= 0) + { + descr.append(" -> "); + } + else + { + descr.append(" <- "); + } + descr.append(bankAccount.getAccountNo()).append(" (BA)"); + + if (description != null && description.trim().length() > 0) + { + descr.append(" ").append(description); + } + + MCashLine cashLine = new MCashLine(ctx, 0, trxName); + cashLine.setC_Cash_ID(cashJournal.get_ID()); + cashLine.setDescription(descr.toString()); + cashLine.setAmount(amount.negate()); + cashLine.setCashType(MCashLine.CASHTYPE_BankAccountTransfer); + cashLine.setC_BankAccount_ID(bankAccountId); + PoManager.save(cashLine); + return cashLine; + } + + /** + * @param ctx Context + * @return List of Cash Book Details + * @throws OperationException + */ + public static CashBookDetailBean getCashBookDetails(Properties ctx, String trxName) throws OperationException + { + Integer cashBookId = POSTerminalManager.getCashBookId(ctx); + CashManager.getCashJournal(ctx, cashBookId, trxName); + + String sql ="select cash.C_CASH_ID," +//1 + "cash.C_CASHBOOK_ID," +//2 + "cash.NAME," +//3 + "cash.DESCRIPTION," +//4 + "cash.DATEACCT," +//5 + "cash.BEGINNINGBALANCE," +//6 + "cash.ENDINGBALANCE," +//7 + "cash.STATEMENTDIFFERENCE," +//8 + "cash.DOCSTATUS," +//9 + "book.name as bookName" +//10 + " from C_CASH cash,C_CASHBOOK book " + + " where cash.C_CASHBOOK_ID=book.C_CASHBOOK_ID"+ + " and book.C_CashBook_ID = " + cashBookId + + " and book.ad_client_id=" +Env.getAD_Client_ID(ctx)+ + " and book.AD_ORG_ID=" +Env.getAD_Org_ID(ctx) + + " order by cash.created desc"; + + CashBookDetailBean bean = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, trxName); + rs = pstmt.executeQuery(); + if(rs.next()) + { + bean = new CashBookDetailBean(); + bean.setCashJournalId(Integer.valueOf(rs.getInt(1))); + bean.setCashBookId(Integer.valueOf(rs.getInt(2))); + bean.setCashJournalName(rs.getString(3)); + bean.setCashJournalDisc(rs.getString(4)); + bean.setDateAcct(rs.getTimestamp(5)); + bean.setBeginingBalance( rs.getBigDecimal(6)); + bean.setEndingBalance(rs.getBigDecimal(7)); + bean.setStatementDifference(rs.getBigDecimal(8)); + bean.setDocStatus(rs.getString(9)); + bean.setCashBookName(rs.getString(10)); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + DB.close(rs, pstmt); + } + + if (bean == null) + { + throw new NoCashJournalPresentException("No Cash journal is present"); + } + + return bean; + } + + + public static ArrayList getCashBookDetailsForTill(Properties ctx,int cashBookId, Timestamp fromDate,Timestamp toDate) throws OperationException + { + + + String sql1 ="select c_cash_id from C_CASH where C_CASHBOOK_ID="+cashBookId+ + " and created between "+DB.TO_DATE(fromDate, false) + " AND " + DB.TO_DATE(toDate, false); + + String sql="select nvl(sum(AMOUNT),0)" + + " from C_CASHLINE" + + " where C_CASH_ID in (" +sql1+")"+ + " and AD_CLIENT_ID= " +Env.getAD_Client_ID(ctx)+ + " and CASHTYPE='I'"+ + " and created between " + DB.TO_DATE(fromDate, false) + + " and " + DB.TO_DATE(toDate, false) ; + + + CashBookDetailBean bean; + ArrayList list=new ArrayList(); + PreparedStatement pstmt = DB.prepareStatement(sql,null); + try + { + ResultSet rs=pstmt.executeQuery(); + while(rs.next()) + { + bean=new CashBookDetailBean(); + bean.setStatementDifference(rs.getBigDecimal(1)); + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + if(pstmt != null) + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + return list; + } + + + + + public static ArrayList getCashBookDetailsFyracle(Properties ctx) throws OperationException + { + Integer cashBookId=Integer.valueOf(POSTerminalManager.getCashBook(ctx).get_ID()); + String sql ="select cash.C_CASH_ID," +//1 + " cash.C_CASHBOOK_ID," +//2 + " cash.NAME," +//3 + " cash.DESCRIPTION," +//4 + " cash.DATEACCT," +//5 + " cash.BEGINNINGBALANCE," +//6 + " cash.ENDINGBALANCE," +//7 + " cash.STATEMENTDIFFERENCE," +//8 + " cash.DOCSTATUS," +//9 + " book.name bookName," +//10 + " cash.created, " +//11 + " cash.AD_CLIENT_ID," +//12 + " cash.AD_ORG_ID" +//13 + " from C_CASH cash,C_CASHBOOK book " + + " where cash.C_CASHBOOK_ID=book.C_CASHBOOK_ID"+ + " and cash.C_CASHBOOK_ID="+cashBookId+ + " and cash.ad_client_id="+Env.getAD_Client_ID(ctx)+ + " and cash.ad_org_id="+Env.getAD_Org_ID(ctx) + + " order by cash.created desc"; + + CashBookDetailBean bean; + ArrayList list=new ArrayList(); + PreparedStatement pstmt =DB.prepareStatement(sql,null); + try + { + ResultSet rs=pstmt.executeQuery(); + if(rs.next()) + { + bean=new CashBookDetailBean(); + bean.setCashJournalId(Integer.valueOf(rs.getInt(1))); + bean.setCashBookId(Integer.valueOf(rs.getInt(2))); + bean.setCashJournalName(rs.getString(3)); + bean.setCashJournalDisc(rs.getString(4)); + bean.setDateAcct(rs.getTimestamp(5)); + bean.setBeginingBalance(new BigDecimal(rs.getString(6))); + bean.setEndingBalance(new BigDecimal(rs.getString(7))); + bean.setStatementDifference(new BigDecimal(rs.getString(8))); + bean.setDocStatus(rs.getString(9)); + bean.setCashBookName(rs.getString(10)); + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + if(pstmt != null) + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + return list; + } + + + /** + * Adjusts the beginning balance on the latest Cash journal available for the Cash Book + * @param ctx Context + * @param terminalId Terminal + * @param trxName Transaction + * @throws OperationException If Cash Journal could not be updated + */ + public static void updateBeginningBalance(Properties ctx, int terminalId, String trxName) throws OperationException + { + int cashBookId = POSTerminalManager.getCashBookId(ctx, terminalId); + + updateCashBookBeginningBalance(ctx, cashBookId, trxName); + } + + + public static void updateCashBookBeginningBalance(Properties ctx, int cashBookId, String trxName) throws OperationException + { + int toJournalId=0; + CashBean bean1 = getData(ctx,cashBookId,true,trxName); + if(bean1!=null) + { + toJournalId = bean1.getCashJournalId().intValue(); + } + + CashBean bean2 = getData(ctx,cashBookId,false,trxName); + + BigDecimal endingBalance=null; + + if (bean2!=null) + endingBalance = bean2.getEndingBalance(); + + if (endingBalance==null) + endingBalance=new BigDecimal(0); + + MCash cash = new MCash(ctx,toJournalId,trxName); + + endingBalance = FormatBigDecimal.currency(endingBalance); + + cash.setBeginningBalance(endingBalance);//ending balance of the previous one is the begining balance of the new one + PoManager.save(cash); + } + + + private static String getDataSQL(Properties ctx, int cashBookId) + { + String sql="select * from " + + " (select cash.C_CASH_ID," +//1 + "cash.C_CASHBOOK_ID," +//2 + "cash.ENDINGBALANCE," +//3 + "cash.DOCSTATUS," + //4 + "cash.AD_CLIENT_ID," +//6 + " cash.AD_ORG_ID," +//7 + " cash.created"+//8 + " from C_CASH cash,C_CASHBOOK book" + + " where cash.C_CASHBOOK_ID=book.C_CASHBOOK_ID" + + "@DOCSTATUS@" + + " and book.C_CashBook_ID="+cashBookId+ + " and cash.ad_client_id=?"+ + " and cash.AD_ORG_ID=? order by cash.Created Desc) cashDetails"; + return sql; + } + + public static CashBean getData(Properties ctx,int cashBookId,boolean isLatest,String trxName) throws OperationException + { + + String sql = getDataSQL(ctx, cashBookId); + + if(isLatest) + sql=sql.replaceAll("@DOCSTATUS@"," and cash.docstatus <> 'CO'"); + else + sql=sql.replaceAll("@DOCSTATUS@"," and cash.docstatus = 'CO'"); + + PreparedStatement pstmt = DB.prepareStatement(sql,trxName); + CashBean bean=null; + + try + { + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + pstmt.setInt(2, Env.getAD_Org_ID(ctx)); + ResultSet rs=pstmt.executeQuery(); + if(rs.next()) + { + bean=new CashBean(); + bean.setCashJournalId(Integer.valueOf(rs.getInt(1))); + bean.setEndingBalance(rs.getBigDecimal(3)); + bean.setDocStatus(rs.getString(4)); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + if (pstmt != null) + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + return bean; + } + + public static MCashBook createCashBook(Properties ctx, int orgId, String name, int currencyId, String trxName) throws OperationException + { + MCashBook cashBook = new MCashBook(ctx, 0, trxName); + cashBook.setName(name); + cashBook.setC_Currency_ID(currencyId); + cashBook.setAD_Org_ID(orgId); + PoManager.save(cashBook); + return cashBook; + } + + + private static MCash getCashJournal(Properties ctx, String trxName) throws OperationException + { + int cashBookId = POSTerminalManager.getCashBookId(ctx); + return getCashJournal(ctx, cashBookId, trxName); + } + + public static MCash getCashJournal(Properties ctx, int cashBookId, String trxName) throws OperationException + { + MCash cashJournal = getMcash(ctx, cashBookId, JulianDate.getTodayDateOnly(), trxName); + + if (cashJournal == null) + { + cashJournal = MCash.get(ctx, cashBookId, JulianDate.getTodayDateOnly(), trxName); + CashManager.updateCashBookBeginningBalance(ctx, cashBookId, trxName); + } + + return cashJournal; + } + + + private static MCash getMcash(Properties ctx, int C_CashBook_ID, + Timestamp dateAcct, String trxName) throws OperationException + { + MCash retValue = null; + + String sql; + + sql = "SELECT * FROM C_Cash c " + + "WHERE c.C_CashBook_ID=?" // #1 + //+ " AND TRUNC(c.StatementDate)=?" // #2 + + " AND c.Processed='N'" + + " AND c.docstatus='DR'"; + + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, trxName); + + pstmt.setInt (1, C_CashBook_ID); + //pstmt.setTimestamp (2, TimeUtil.getDay(dateAcct)); + + ResultSet rs = pstmt.executeQuery (); + if (rs.next ()) + retValue = new MCash (ctx, rs, trxName); + rs.close (); + } + catch (Exception e) + { + throw new OperationException(e); + } + finally + { + try + { + if (pstmt != null) + pstmt.close (); + + } + catch (Exception e) + {} + + pstmt = null; + } + + return retValue; + + + } + + + /** + * @param ctx + * @param bean + * @param trxName + * @return + * @throws NullTransferAmountException + * @throws TransferAmountExceedsTotalAmountException + * @throws OperationException + */ + public static CashBookDetailBean CloseTill(Properties ctx, CashBookDetailBean bean, String trxName) + throws NullTransferAmountException, TransferAmountExceedsTotalAmountException, OperationException + { + int terminalId = POSTerminalManager.getTerminalId(ctx); + MCash cashJournal = getCashJournal(ctx, trxName); + + bean.setCash_id(cashJournal.get_ID()); + + BigDecimal transferAmt = (bean.getTransferAmount() == null ? Env.ZERO : bean.getTransferAmount()); + BigDecimal differenceAmt = (bean.getDifferenceAmt() == null ? Env.ZERO : bean.getDifferenceAmt()); + BigDecimal beginingBalance = bean.getBeginingBalance(); + BigDecimal netTransfer = null; + BigDecimal beginningBalanceDifference = Env.ZERO; + + CashBookDetailBean cbDetailsBean = getCashBookDetails(ctx, trxName); + + CurrentTillAmountBean currentAmountBean = POSManager.getCurrentTillAmount(ctx); + + beginningBalanceDifference = beginingBalance.subtract(cbDetailsBean.getBeginingBalance()); + + bean.setBeginingBalance(cbDetailsBean.getBeginingBalance()); + bean.setEndingBalance(cbDetailsBean.getEndingBalance()); + bean.setStatementDifference(cbDetailsBean.getStatementDifference()); + netTransfer = transferAmt.subtract(cbDetailsBean.getBeginingBalance()); + differenceAmt = (bean.getStatementDifference().subtract(netTransfer)).negate(); + bean.setDifferenceAmt(differenceAmt); + bean.setCashBookName(cbDetailsBean.getCashBookName()); + bean.setDocStatus(cbDetailsBean.getDocStatus()); + + if( bean.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + { + throw new CanNotCloseTillException("Already closed,Cannot close till "); + } + + netTransfer = netTransfer.subtract(beginningBalanceDifference); + + if (differenceAmt.compareTo(Env.ZERO) != 0) + { + createCashLine(ctx, cashJournal, differenceAmt, MCashLine.CASHTYPE_Difference, trxName); + } + + BigDecimal cardTotal = currentAmountBean.getCardTotal(); + BigDecimal chequeTotal = currentAmountBean.getChequeTotal(); + + // Do Transfer for CardTotal and Cheque total here + + BigDecimal notifiedCardTotal = (bean.getCardTotal() == null ? Env.ZERO : bean.getCardTotal()); + BigDecimal notifiedChequeTotal = (bean.getChequeTotal() == null ? Env.ZERO : bean.getChequeTotal()); + bean.setCardDifference(Env.ZERO); + bean.setChequeDifference(Env.ZERO); + + if(cardTotal.compareTo(notifiedCardTotal) != 0) + { + bean.setCardDifference(notifiedCardTotal.subtract(cardTotal)); + } + + if(chequeTotal.compareTo(notifiedChequeTotal) != 0) + { + bean.setChequeDifference(notifiedChequeTotal.subtract(chequeTotal)); + } + + PoManager.save(cashJournal); + + POSTerminalManager.closeTerminal(ctx, terminalId, cashJournal, netTransfer, chequeTotal, cardTotal, trxName); + + PoManager.processIt(cashJournal, DocumentEngine.ACTION_Complete); + + return bean; + } + + + public static void closePreviousDraftedCashjournals(Properties ctx, int cashBookId,String trxName) throws OperationException + { + String sql = "SELECT C_CASH_ID FROM C_Cash c " + + "WHERE c.C_CashBook_ID=?" + + " AND c.Processed='N'" + + " AND c.docstatus='DR'" + + " AND TRUNC(c.StatementDate) getCashDetails(Properties ctx, int cashBookId, Integer month, Integer year, String trxName) throws OperationException + { + ArrayList cashList = new ArrayList(); + + int adClientId = Env.getAD_Client_ID(ctx); + String userOrg = Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + + String sql = "Select C_Cash_ID, Name, Created, Updated, StatementDate, DateAcct, BeginningBalance, EndingBalance, DocStatus " + + " from C_Cash" + + " where AD_Client_ID=" + adClientId + + " and AD_Org_ID in (" + userOrg + ")" + + " and IsActive='Y'" + + " AND C_CashBook_ID=" + cashBookId; + + + if (month != null) + { + String mm = String.valueOf(month); + if (mm.length() == 1) + { + mm = "0" + mm; + } + sql = sql + " and to_char(Created, 'mm') = '" + mm +"'"; + } + + if (year != null) + sql = sql + " and to_char(Created, 'yyyy') = '" + year + "'"; + + sql += " order by created desc"; + + PreparedStatement pstmt = null; + + try + { + pstmt = DB.prepareStatement(sql, trxName); + ResultSet rs = pstmt.executeQuery(); + + while (rs.next()) + { + CashBean cashBean = new CashBean(); + cashBean.setCashId(rs.getInt(1)); + cashBean.setName(rs.getString(2)); + cashBean.setDateCreated(rs.getTimestamp(3)); + cashBean.setDateUpdated(rs.getTimestamp(4)); + cashBean.setStatmentDate(rs.getString(5)); + cashBean.setDateAcct(rs.getTimestamp(6)); + cashBean.setBeginingBalance(rs.getBigDecimal(7)); + cashBean.setEndingBalance(rs.getBigDecimal(8)); + cashBean.setDocStatus(rs.getString(9)); + + cashList.add(cashBean); + } + + rs.close(); + } + catch (Exception ex) + { + throw new OperationException("Cannot retrieve Cash with sql: " + sql, ex); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return cashList; + } + + + /** + * Loads a cash book + * @param ctx Context + * @param cashBookId Cash Book ID to be loaded + * @param trxName Transaction + * @return Cash Book PO + * @throws OperationException If teh cash book cannot be loaded + */ + public static MCashBook loadCashBook(Properties ctx, int cashBookId, String trxName) throws OperationException + { + MCashBook cashBook = new MCashBook(ctx, cashBookId, trxName); + if (cashBook.get_ID() <= 0) + { + throw new OperationException("Could not load cash book with id: " + cashBookId); + } + return cashBook; + } + + public static MCash loadCash(Properties ctx, int cashId, String trxName) throws OperationException + { + MCash cash = new MCash(ctx, cashId, trxName); + + if(cash.get_ID() == 0) + throw new OperationException("Could not load cash with i12,435.96d: " + cashId); + + return cash; + } + + public static CashSummaryBean getCashSummary(Properties ctx, int cashId, String trxName) throws OperationException + { + String sql = "select ca.CashType, sum(ca.Amount)" + + " from C_CASHLINE ca where C_cash_ID=" + cashId + + " group by ca.cashtype"; + + MCash cashJournal = new MCash(ctx, cashId, trxName); + CashSummaryBean bean = getCashSummary(ctx, sql, trxName); + bean.setBeginingBalance(cashJournal.getBeginningBalance()); + bean.setEndingBalance(cashJournal.getEndingBalance()); + return bean; + } + + public static CashSummaryBean getCashSummary(Properties ctx, String fromDate, String toDate, String trxName) throws OperationException + { + int adClientId = Env.getAD_Client_ID(ctx); + String userOrg = Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + String sql = "select ca.CashType, sum(ca.Amount)" + + " from C_CASHLINE ca where ca.AD_Client_ID=" + adClientId + + " and ca.AD_Org_ID in (" + userOrg + ")" + + " and ca.Created between to_date('" + fromDate + "','DD-MM-YYYY HH24:MI:SS')" + + " and to_date('" + toDate + "','DD-MM-YYYY HH24:MI:SS') " + + " group by ca.cashtype"; + + return getCashSummary(ctx, sql, trxName); + } + + private static CashSummaryBean getCashSummary(Properties ctx, String sql, String trxName) throws OperationException + { + PreparedStatement pstmt = null; + CashSummaryBean cashSummaryBean = new CashSummaryBean(); + try + { + pstmt = DB.prepareStatement(sql, trxName); + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + String cashType = rs.getString(1); + BigDecimal amount = rs.getBigDecimal(2); + + if(MCashLine.CASHTYPE_BankAccountTransfer.equals(cashType)) + cashSummaryBean.setBankAcctTransferAmount(amount); + else if(MCashLine.CASHTYPE_Charge.equals(cashType)) + cashSummaryBean.setChargeAmount(amount); + else if(MCashLine.CASHTYPE_Difference.equals(cashType)) + cashSummaryBean.setDifferenceAmount(amount); + else if(MCashLine.CASHTYPE_GeneralExpense.equals(cashType)) + cashSummaryBean.setGeneralExpenseAmount(amount); + else if(MCashLine.CASHTYPE_GeneralReceipts.equals(cashType)) + cashSummaryBean.setGeneralReceiptsAmount(amount); + else if(MCashLine.CASHTYPE_Invoice.equals(cashType)) + cashSummaryBean.setInvoiceAmount(amount); + else + throw new OperationException("Unknown CashType: " + cashType); + } + + rs.close(); + } + catch(Exception ex) + { + throw new OperationException("Could not retrieve cash summary with sql: " + sql, ex); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return cashSummaryBean; + } + + public static ArrayList getCashLineHistory(Properties ctx, String fromDate, String todate, String trxName) throws OperationException + { + int adClientId = Env.getAD_Client_ID(ctx); + String userOrg = Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + + String sql = "select cl.C_CashLine_ID, cl.CashType, rl.name, cl.Created, cl.C_Cash_ID, cl.C_Invoice_ID, cl.Amount, cu.CurSymbol, cl.Description " + + " from C_CashLine cl, AD_Ref_List rl, C_Currency cu " + + " where cl.AD_Client_ID= " + adClientId + + " and cl.AD_Org_ID in (" + userOrg + ") " + + " and rl.AD_Reference_ID = " + MCashLine.CASHTYPE_AD_Reference_ID + + " and cl.CashType = rl.Value" + + " and cu.C_Currency_ID = cl.C_Currency_ID" + + " and cl.Created between to_date('"+ fromDate+"','DD-MM-YYYY HH24:MI:SS') " + + " and to_date('" + todate+"','DD-MM-YYYY HH24:MI:SS') " + + " order by cl.created"; + + return getCashLineHistory(ctx, sql, trxName); + + } + + public static ArrayList getCashLineHistory(Properties ctx, int cashId, String trxName) throws OperationException + { + int adClientId = Env.getAD_Client_ID(ctx); + String userOrg = Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + String sql = "select cl.C_CashLine_ID, cl.CashType, rl.name, cl.Created, cl.C_Cash_ID, cl.C_Invoice_ID, cl.Amount, cu.CurSymbol, cl.Description " + + " from C_CashLine cl, AD_Ref_List rl, C_Currency cu " + + " where cl.AD_Client_ID= " + adClientId + + " and cl.AD_Org_ID in (" + userOrg + ") " + + " and rl.AD_Reference_ID = " + MCashLine.CASHTYPE_AD_Reference_ID + + " and cl.CashType = rl.Value" + + " and cu.C_Currency_ID = cl.C_Currency_ID" + + " and cl.C_Cash_ID=" + cashId + + " order by cl.created"; + + + return getCashLineHistory(ctx, sql, trxName); + } + + private static ArrayList getCashLineHistory(Properties ctx, String sql, String trxName) throws OperationException + { + ArrayList repSummaryList = new ArrayList(); + + PreparedStatement pstmt = null; + + try + { + pstmt = DB.prepareStatement(sql, trxName); + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + int i = 0; + CashLineBean repSummaryBean = new CashLineBean(); + repSummaryBean.setCashLineId(rs.getInt(++i)); + repSummaryBean.setCashType(rs.getString(++i)); + repSummaryBean.setCashTypeName(rs.getString(++i)); + repSummaryBean.setDateCreated(rs.getTimestamp(++i)); + repSummaryBean.setCashId(rs.getInt(++i)); + repSummaryBean.setInvoiceId(rs.getInt(++i)); + repSummaryBean.setAmount(rs.getBigDecimal(++i)); + repSummaryBean.setCurrency(rs.getString(++i)); + repSummaryBean.setDescription(rs.getString(++i)); + repSummaryList.add(repSummaryBean); + } + + rs.close(); + } + catch(Exception ex) + { + throw new OperationException("Could not retrieve data for report summary with sql: " + sql, ex); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + return repSummaryList; + } + + + public static MCashLine createCashLineForInvoice(Properties ctx,OpenItemBean bean,String trxName) throws OperationException + { + int cashBookId = POSTerminalManager.getCashBookId(ctx); + MCash cash = MCash.get(ctx,cashBookId,JulianDate.getTodayDateOnly(),trxName); + + MCashLine [] cashLines = cash.getLines(true); + if(cashLines.length==0) + { + updateCashBookBeginningBalance(ctx, cashBookId, trxName); + } + + //Load invoice + MInvoice invoice = new MInvoice(ctx, bean.getInvoiceId(), trxName); + MDocType dt = MDocType.get(ctx, invoice.getC_DocType_ID()); + + BigDecimal amt = bean.getPaymentAmt(); + BigDecimal discountAmt = bean.getDiscountAmt() == null ? Env.ZERO : bean.getDiscountAmt(); + BigDecimal writeOffAmt = bean.getWriteOffAmt() == null ? Env.ZERO : bean.getWriteOffAmt(); + + + if (MDocType.DOCBASETYPE_APInvoice.equals(dt.getDocBaseType()) + || MDocType.DOCBASETYPE_ARCreditMemo.equals(dt.getDocBaseType()) ) + { + amt = amt.negate(); + discountAmt = discountAmt.negate(); + writeOffAmt = writeOffAmt.negate(); + } + + MCashLine cashLine = new MCashLine(ctx,0,trxName); + cashLine.setC_Cash_ID(cash.get_ID()); + cashLine.setCashType(MCashLine.CASHTYPE_Invoice); + cashLine.setC_Invoice_ID(bean.getInvoiceId()); + cashLine.setC_Currency_ID(invoice.getC_Currency_ID()); + cashLine.setAmount(amt); + cashLine.setDiscountAmt(discountAmt); + cashLine.setWriteOffAmt(writeOffAmt); + + PoManager.save(cashLine); + return cashLine; + } + + /** + * Creates a new Cash Journal entry with the amount specified for the invoice + * @param ctx Context + * @param cashId Cash Journal + * @param invoiceId Invoice + * @param amount Cash Amount + * @param trxName Transaction + * @return Cash Journal Entry + * @throws OperationException If Cash Line creation failed + */ + public static MCashLine createCashLine(Properties ctx, int cashId, int invoiceId, + BigDecimal amount, BigDecimal writeOffAmout, BigDecimal discountAmt, + String trxName) throws OperationException + { + MInvoice invoice = new MInvoice(ctx, invoiceId, trxName); + if (invoice.get_ID() == 0) + { + throw new OperationException("Could not load invoice!!!"); + } + + MCashLine cashLine = new MCashLine(ctx, 0, trxName); + cashLine.setC_Cash_ID(cashId); + cashLine.setInvoice(invoice); + cashLine.setAmount(amount); + cashLine.setWriteOffAmt(writeOffAmout); + cashLine.setDiscountAmt(discountAmt); + PoManager.save(cashLine); + return cashLine; + } + + public static WebDocumentBean getWebCashPaymentBean(Properties ctx, int cashLineId) throws OperationException, DataException + { + MCashLine cashLine = new MCashLine(ctx,cashLineId,null); + MInvoice invoice = new MInvoice(ctx,cashLine.getC_Invoice_ID(),null); + if (cashLine == null) + throw new OperationException("Invalid operation payment is null"); + + if (cashLine.get_ID() == 0) + throw new OperationException("You have deleted this payment. You cannot view this payment."); + + WebDocumentBean bean = new WebDocumentBean(); + + bean.setPaymentId(Integer.valueOf(cashLine.get_ID())); + + int currencyId = cashLine.getC_Currency_ID(); + MCurrency currency = new MCurrency(ctx,currencyId,null); + bean.setCurrencySymbole(currency.getCurSymbol()); + + + MOrg myOrg = OrganisationManager.getMyOrg(ctx); + MBPartner me = new MBPartner(ctx, myOrg.getLinkedC_BPartner_ID(null), null); + bean.setMe(me); + // MOrg orderOrg = new MOrg(ctx, cashLine.getAD_Org_ID(), null); + + /* if (orderOrg.getLinkedC_BPartner_ID() != myOrg.getLinkedC_BPartner_ID()) + throw new DocumentDoesNotBelongToYouException("This payment does not belong to you. You do not have access to it."); + */ + + MBPartnerLocation meLocation[] = MBPartnerLocation.getForBPartner(ctx,me.get_ID()); + if (meLocation.length == 0) + throw new OperationException("No location has been set for your organisation. Please ask your administrator to set one for you"); + + MLocation location = new MLocation(ctx, meLocation[0].getC_Location_ID(), null); + + if (location == null) + throw new OperationException("You must have a location set for your business partner, Please ask your administrator to set one for you"); + + bean.setMeLocation(location); + + MBPartner you = new MBPartner(ctx, invoice.getC_BPartner_ID(), null); + + MBPartnerLocation youBPLocation[] = MBPartnerLocation.getForBPartner(ctx, you.get_ID()); + + if (youBPLocation.length ==0) + throw new OperationException("No location has been set for the dealer organisation. Please ask your administrator to set one for you"); + + MLocation youLocation = new MLocation(ctx, youBPLocation[0].getC_Location_ID(), null); + + bean.setYou(you); + bean.setYoubpLocation(youBPLocation[0]); + bean.setYouLocation(youLocation); + bean.setCashLine(cashLine); + + WebDocumentHeaderBean headerBean = PaymentManager.createWebDocumentHeader(ctx, invoice.getAD_Org_ID(),invoice.getC_BPartner_ID(), "Completed", true,"Cash"); + String tenderTypeName = "Cash"; + + + + headerBean.setPaymentType(tenderTypeName); + + bean.setHeaderBean(headerBean); + bean.setInvoice(invoice); + + return bean; + } + + /** + * Retrieves all the cash books having a name like the search criteria + * @param ctx Context + * @param searchText Search criteria based on the name of cash book + * @param trxName Transaction + * @return List of Cash book data model + * @throws OperationException If data could not retrieved + */ + public static ArrayList getCashBooks(Properties ctx, String searchText, String trxName) throws OperationException + { + String whereClause = "C_CashBook.Name LIKE (?)"; + + if (searchText == null) + { + searchText = ""; + } + + searchText = "%" + searchText.trim() + "%"; + + ArrayList paramsList = new ArrayList(); + paramsList.add(searchText); + + return getCashBooks(ctx, whereClause, null, paramsList, trxName); + } + + /** + * Retrieves all the active Cash books + * @param ctx Context + * @param trxName Transaction + * @return List of Cash book data model + * @throws OperationException If data could not be retrieved + */ + public static ArrayList getCashBooks(Properties ctx, String trxName) throws OperationException + { + return getCashBooks(ctx, "C_CashBook.IsActive='Y'", " ORDER BY C_CashBook.Name", null, trxName); + } + + /** + * Retrives all the cash book for a particular organisation + * @param ctx Context + * @param adOrgId Organisation Id + * @param trxName Transaction + * @return List of Cash book data model + * @throws OperationException If data could not retrieved + */ + public static ArrayList getAllCashbooks(Properties ctx, int adOrgId, String trxName) throws OperationException + { + String whereClause = "C_CashBook.IsActive='Y'AND C_CashBook.AD_Org_ID=?"; + + ArrayList paramsList = new ArrayList(); + paramsList.add(new Integer(adOrgId)); + return getCashBooks(ctx, whereClause, null, paramsList, trxName); + } + + /** + * Retrieves all the cash book that can be assigned on a terminal (i.e: Not already present on another terminal). + * @param ctx Context + * @param adOrgId Organisation + * @param trxName Transaction + * @return List of Cash book data model + * @throws OperationException If data could not be retrieved + */ + public static ArrayList getCashBooksForTerminal(Properties ctx, int adOrgId, int terminalId, String trxName) throws OperationException + { + StringBuffer whereClause = new StringBuffer(); + whereClause.append("C_CashBook.IsActive='Y'AND C_CashBook.AD_Org_ID=? "); + whereClause.append("AND NOT EXISTS (SELECT * FROM U_POSTerminal WHERE U_POSTerminal.U_POSTerminal_ID<>? "); + whereClause.append("AND U_POSTerminal.C_CashBook_ID=C_CashBook.C_CashBook_ID AND U_POSTerminal.IsActive='Y')"); + + ArrayList paramsList = new ArrayList(); + paramsList.add(new Integer(adOrgId)); + paramsList.add(new Integer(terminalId)); + + return getCashBooks(ctx, whereClause.toString(), " ORDER BY C_CashBook.Name", paramsList, trxName); + } + + /** + * Retrieves all the cash books based on the criteria defined in the where clause statement. + * @param ctx Context + * @param whereClause SQL Where clause + * @param orderByClause Order by clause + * @param params Parameters to set for the queries + * @param trxName Transaction + * @return List of Cash Book data model + * @throws OperationException If the data could not be retrieved + */ + private static ArrayList getCashBooks(Properties ctx, String whereClause, + String orderByClause, ArrayList params, String trxName) throws OperationException + { + ArrayList cashBookList = new ArrayList(); + PreparedStatement pstmt = null; + ResultSet rs = null; + + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append("SELECT * FROM C_CashBook WHERE C_CashBook.AD_Client_ID=? "); + + if (whereClause != null && whereClause.trim().length() > 0) + { + sqlStmt.append(" AND "); + sqlStmt.append(whereClause); + } + sqlStmt.append(" AND C_CashBook.AD_Org_ID IN (") + .append(Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)) + .append(") "); + + if (orderByClause == null || orderByClause.length() == 0) + { + orderByClause = "ORDER BY Name"; + } + sqlStmt.append(orderByClause); + + try + { + int paramIndex = 1; + pstmt = DB.prepareStatement(sqlStmt.toString(), trxName); + pstmt.setInt(paramIndex++, Env.getAD_Client_ID(ctx)); + + if (params != null) + { + for (int i = 0; i < params.size(); i++) + { + pstmt.setObject(paramIndex++, params.get(i)); + } + } + + rs = pstmt.executeQuery(); + + while (rs.next()) + { + MCashBook cashBook = new MCashBook(ctx, rs, trxName); + CashBookBean bean = new CashBookBean(); + bean.setCashBookId(cashBook.get_ID()); + bean.setCashBookName(cashBook.getName()); + bean.setDescription(cashBook.getDescription()); + bean.setOrgId(cashBook.getAD_Org_ID()); + bean.setIsActive(cashBook.isActive()); + bean.setIsDefault(cashBook.isDefault()); + bean.setCurrencyId(cashBook.getC_Currency_ID()); + bean.setCurrency(cashBook.getC_Currency().getISO_Code()); + cashBookList.add(bean); + } + } + catch (Exception ex) + { + log.log(Level.SEVERE, "Could not get cash books", ex); + throw new OperationException("Could not retrieve cash books", ex); + } + finally + { + DB.close(rs, pstmt); + } + + return cashBookList; + } + + /** + * Returns the Cash book data model from its PO + * @param cashBook Cash Book PO + * @return Cash Book data model + */ + public static CashBookBean getBean(MCashBook cashBook) + { + CashBookBean bean = new CashBookBean(); + bean.setOrgId(cashBook.getAD_Org_ID()); + bean.setCashBookId(cashBook.get_ID()); + bean.setCashBookName(cashBook.getName()); + bean.setCurrencyId(cashBook.getC_Currency_ID()); + bean.setDescription(cashBook.getDescription()); + bean.setIsActive(cashBook.isActive()); + bean.setIsDefault(cashBook.isDefault()); + + return bean; + } + + /** + * Returns the PO for the Cash Book from it's data model + * @param ctx Context + * @param bean Cash Book data model + * @param trxName Transaction + * @return Cash Book PO + * @throws OperationException If the Cash Book PO could not be loaded + */ + public static MCashBook getPO(Properties ctx, CashBookBean bean, String trxName) throws OperationException + { + MCashBook cashBook = new MCashBook(ctx, bean.getCashBookId(), trxName); + if (cashBook.get_ID() != bean.getCashBookId()) + { + // Happens only when trying to load a cash book that is not present + // and the PO model resets the Id to 0 + throw new OperationException("Could not load cash book"); + } + cashBook.setAD_Org_ID(bean.getOrgId()); + cashBook.setC_Currency_ID(bean.getCurrencyId()); + cashBook.setDescription(bean.getDescription()); + cashBook.setName(bean.getCashBookName()); + cashBook.setIsActive(bean.getIsActive()); + cashBook.setIsDefault(bean.getIsDefault()); + + return cashBook; + } + + /** + * Returns the data model of the Cash Book PO + * @param ctx Context + * @param cashBookId Cash Book ID + * @param trxName Transaction + * @return Cash Book data model + * @throws OperationException If Cash book PO could not be loaded + */ + public static CashBookBean getCashBook(Properties ctx, int cashBookId, String trxName) throws OperationException + { + MCashBook cashBook = new MCashBook(ctx, cashBookId, trxName); + if (cashBook.get_ID() <= 0) + { + throw new OperationException("Could not load Cash Book with id: " + cashBookId); + } + + return getBean(cashBook); + } + + /** + * Creates or updates a Cash Book. For creation the cash book id in the data model should be 0 + * otherwise it will try to load a cash book with the id provided + * @param ctx Context + * @param bean Data Model of the cash book + * @param trxName Transaction + * @return Cash Book PO + * @throws OperationException If the Cash Book PO could not be loaded or updated + */ + public static MCashBook createUpdateCashBook(Properties ctx, CashBookBean bean, String trxName) throws OperationException + { + MCashBook cashBook = getPO(ctx, bean, trxName); + if (!cashBook.isActive() && POSTerminalManager.isCashbookPresentOnTerminal(ctx, cashBook.get_ID(), trxName)) + { + throw new CashBookAlreadyAssignedException("Cannot deactivate the cash book as it has been assigned to a terminal"); + } + PoManager.save(cashBook); + bean.setCashBookId(cashBook.get_ID()); + return cashBook; + } + + + /** + * Updates the active status of a cash book + * @param ctx Context + * @param cashBookId Cash book ID + * @param active Whether to set the cash book active or not + * @param trxName Transaction + * @throws OperationException If Cash Book could not be loaded or updated + */ + public static void updateCashBookStatus(Properties ctx, int cashBookId, boolean active, String trxName) throws OperationException + { + MCashBook cashBook = loadCashBook(ctx, cashBookId, trxName); + + if (!active && POSTerminalManager.isCashbookPresentOnTerminal(ctx, cashBookId, trxName)) + { + throw new CashBookAlreadyAssignedException("Cannot deactivate the cash book as it has been assigned to a terminal"); + } + + cashBook.setIsActive(active); + PoManager.save(cashBook); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/CashTransferManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/CashTransferManager.java new file mode 100644 index 0000000000..ec6c4c9d5e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/CashTransferManager.java @@ -0,0 +1,171 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Properties; + +import org.compiere.model.MBankAccount; +import org.compiere.model.MCash; +import org.compiere.model.MCashBook; +import org.compiere.model.MCashLine; +import org.compiere.process.DocumentEngine; +import org.posterita.exceptions.OperationException; +import org.posterita.util.PoManager; + +/** + * @author Ashley G Ramdass + * May 26, 2008 + */ +public class CashTransferManager +{ + /** + * Transfers money from a Bank Account to another one. + * + * @param ctx Context + * @param fromBankAccountId From Bank Account + * @param toBankAccountId To Bank Account + * @param currencyId Currency + * @param amount Amount to Transfer + * @param dateAcct Accounting Date + * @param trxName Transaction + * @throws OperationException if documents can't be created or processed + */ + public static void transferBankToBank(Properties ctx, int fromBankAccountId, int toBankAccountId, + int currencyId, BigDecimal amount, Timestamp dateAcct, String trxName) throws OperationException + { + MBankAccount fromBankAccount = new MBankAccount(ctx, fromBankAccountId, trxName); + MBankAccount toBankAccount = new MBankAccount(ctx, toBankAccountId, trxName); + + int fromCashBookId = OrganisationManager.getCreateTransferCashBook(ctx, fromBankAccount.getAD_Org_ID(), currencyId, trxName); + int toCashBookId = OrganisationManager.getCreateTransferCashBook(ctx, toBankAccount.getAD_Org_ID(), currencyId, trxName); + + MCash fromCashJournal = MCash.get(ctx, fromCashBookId, dateAcct, trxName); + if (fromCashJournal == null) + { + throw new OperationException("Could not create Cash Journal entry"); + } + + MCash toCashJournal = MCash.get(ctx, toCashBookId, dateAcct, trxName); + if (toCashJournal == null) + { + throw new OperationException("Could not create Cash Journal entry"); + } + + String description = fromBankAccount.getAccountNo() + " (BA) -> " + toBankAccount.getAccountNo() + " (BA)"; + + // Transfer from the bank account to the cash journal + MCashLine fromCashLine = new MCashLine(fromCashJournal); + fromCashLine.setC_Currency_ID(currencyId); + fromCashLine.setDescription(description); + fromCashLine.setCashType(MCashLine.CASHTYPE_BankAccountTransfer); + fromCashLine.setC_BankAccount_ID(fromBankAccountId); + fromCashLine.setAmount(amount); + fromCashLine.setIsGenerated(true); + PoManager.save(fromCashLine); + + // Transfer from the cash journal to the bank account + MCashLine toCashLine = new MCashLine(toCashJournal); + toCashLine.setC_Currency_ID(currencyId); + toCashLine.setDescription(description); + toCashLine.setCashType(MCashLine.CASHTYPE_BankAccountTransfer); + toCashLine.setC_BankAccount_ID(toBankAccountId); + toCashLine.setAmount(amount.negate()); + toCashLine.setIsGenerated(true); + PoManager.save(toCashLine); + + PoManager.processIt(fromCashJournal, DocumentEngine.ACTION_Complete); + + if (fromCashJournal.get_ID() != toCashJournal.get_ID()) + { + PoManager.processIt(toCashJournal, DocumentEngine.ACTION_Complete); + } + } + + /** + * Transfer money from a Cash Book to another + * @param ctx Context + * @param fromCashBookId From Cash Book + * @param toCashBookId To Cash Book + * @param currencyId Currency + * @param amount Amount to transfer + * @param dateAcct Accounting Date + * @param trxName Transaction + * @throws OperationException If documents can't be created or processed + */ + public static void transferCashBookToCashBook(Properties ctx, int fromCashBookId, int toCashBookId, + int currencyId, BigDecimal amount, Timestamp dateAcct, String trxName) throws OperationException + { + MCash fromJournal = MCash.get(ctx, fromCashBookId, dateAcct, trxName); + transferFromJournalToCashBook(ctx, fromJournal, toCashBookId, currencyId, amount, dateAcct, trxName); + } + + /** + * Transfer money from a Cash Book to another + * @param ctx Context + * @param fromCashBookId From Cash Book + * @param toCashBookId To Cash Book + * @param currencyId Currency + * @param amount Amount to transfer + * @param dateAcct Accounting Date + * @param trxName Transaction + * @throws OperationException If documents can't be created or processed + */ + public static void transferFromJournalToCashBook(Properties ctx, MCash cashJournal, int toCashBookId, + int currencyId, BigDecimal amount, Timestamp dateAcct, String trxName) throws OperationException + { + MCashBook fromCashBook = new MCashBook(ctx, cashJournal.getC_CashBook_ID(), trxName); + MCashBook toCashBook = new MCashBook(ctx, toCashBookId, trxName); + + int fromBankAccountId = OrganisationManager.getCreateTransferBankAccount(ctx, fromCashBook.getAD_Org_ID(), currencyId, null); + int toBankAccountId = OrganisationManager.getCreateTransferBankAccount(ctx, toCashBook.getAD_Org_ID(), currencyId, null); + + MCash toCash = MCash.get(ctx, toCashBookId, dateAcct, trxName); + + String description = fromCashBook.getName() + " (CB) -> " + toCashBook.getName() + " (CB)"; + + // Transfers the money from the cash book to the dummy bank account + MCashLine fromCashLine = new MCashLine(cashJournal); + fromCashLine.setDescription(description); + fromCashLine.setC_Currency_ID(currencyId); + fromCashLine.setCashType(MCashLine.CASHTYPE_BankAccountTransfer); + fromCashLine.setC_BankAccount_ID(fromBankAccountId); + fromCashLine.setAmount(amount.negate()); + fromCashLine.setIsGenerated(true); + PoManager.save(fromCashLine); + + if (fromBankAccountId != toBankAccountId) + { + // Transfer the amount between the two bank accounts + transferBankToBank(ctx, fromBankAccountId, toBankAccountId, currencyId, amount, dateAcct, trxName); + } + + // Transfers the money from the dummy bank account the cash book + MCashLine toCashLine = new MCashLine(toCash); + toCashLine.setDescription(description); + toCashLine.setC_Currency_ID(currencyId); + toCashLine.setCashType(MCashLine.CASHTYPE_BankAccountTransfer); + toCashLine.setC_BankAccount_ID(toBankAccountId); + toCashLine.setAmount(amount); + toCashLine.setIsGenerated(true); + PoManager.save(toCashLine); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/ClientManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/ClientManager.java new file mode 100644 index 0000000000..5431f8aec1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/ClientManager.java @@ -0,0 +1,333 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ + +/** + @author ashley + */ + +package org.posterita.businesslogic; + +import java.io.File; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MClient; +import org.compiere.model.MCountry; +import org.compiere.model.MElement; +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MOrgInfo; +import org.compiere.model.MPeriodControl; +import org.compiere.model.MSetup; +import org.compiere.model.PO; +import org.compiere.print.PrintUtil; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.core.businesslogic.ImportManager; +import org.posterita.exceptions.NoClientFoundException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PathInfo; +import org.posterita.util.PoManager; + +public class ClientManager +{ + public static final String ACCOUNTING_FILE_PATH = PathInfo.PROJECT_HOME + + "/config/accounting/AccountingUS.csv"; + public static final String ACCOUNTS_IMPORT_FORMAT = "Accounting - Accounts"; + + // public static String ACCOUNTS_IMPORT_TABLE = "I_ElementValue"; + + private static MClient createClient(Properties nCtx, String clientName, + String orgName, int currencyId, String currencyName, int countryId, + String city, File file) throws OperationException + { + Properties ctx = Env.getCtx(); + + Env.setContext(ctx, "#AD_User_ID", 100); // set user as SuperUser + Env.setContext(ctx, UdiConstants.CLIENT_ID_CTX_PARAM, "11"); // Garden + // World + + MCountry.get(ctx, countryId); + + MSetup setup = new MSetup(ctx, 0); + + // Step 1 + boolean ok = setup.createClient(clientName, orgName, clientName + + " Client User", clientName + " Org User"); + + if (ok) + { + // Generate Accounting + KeyNamePair currency = new KeyNamePair(currencyId, currencyName); + + if (!setup.createAccounting(currency, true, true, false, false, + false, file)) + { + throw new OperationException("Could not create accounting for client"); + } + + // Generate Entities + if (!setup.createEntities(countryId, city, 0, currency.getKey())) + { + throw new OperationException( + "Could not create setup entities"); + } + + // Create Print Documents + PrintUtil.setupPrintForm(setup.getAD_Client_ID()); + } + else + { + throw new OperationException("Could not create client"); + } + int clientId = setup.getAD_Client_ID(); + + MClient client = MClient.get(ctx, clientId); + + return client; + } + + protected static void updateAccountingProcessor(Properties ctx, + int adClientId, String trxName) throws OperationException + { + String updStmt = "Update C_AcctProcessor set FrequencyType='M' where AD_Client_ID=" + + adClientId; + + int updates = DB.executeUpdate(updStmt, trxName); + + if (updates == -1) + throw new OperationException( + "Accounting Processor could not be updated"); + } + + public static void createClientDependencies(Properties ctx, MClient client, + MOrg org, String address, int countryId, String city, + String postalAddress, String smtpHost, File file, String trxName) + throws OperationException { + // Set client smtp host for sending emails + client.setSMTPHost(smtpHost); + // client.setIsPostImmediate(true); + // client.setIsCostImmediate(true); + PoManager.save(client); + + // Create Organisation location + MLocation location = LocationManager.createLocation(ctx, org.get_ID(), address, "", postalAddress, city, 0, countryId, trxName); + + // Create Linked Business Partner + MBPartner bpartner = BPartnerManager.createLinkedBPartner(ctx, org.get_ID(), 0, org + .getName(), " ", false, false, false, false, address, + postalAddress, city, " ", countryId, trxName); + bpartner.setAD_OrgBP_ID(org.get_ID()); + PoManager.save(bpartner); + MOrgInfo orgInfo = org.getInfo(); + orgInfo.set_TrxName(trxName); + orgInfo.setC_Location_ID(location.getC_Location_ID()); + PoManager.save(orgInfo); + + openPeriods(ctx, trxName); + + ImportManager.importFile(ctx, file, ACCOUNTS_IMPORT_FORMAT, trxName); + ImportManager.importAccounting(ctx, Env.getAD_Client_ID(ctx), + getAccoutingElementId(ctx), false, true, true, trxName); + updateAccountingProcessor(ctx, Env.getAD_Client_ID(ctx), trxName); + } + + public static MClient getCreateClient(Properties ctx, String clientName, + String orgName, int currencyId, String currencyName, int countryId, + String city, String address, String postalAddress, String smtpHost, File file) + throws OperationException + { + MClient client; + Properties rctx = (Properties) ctx.clone(); + + if (isClientPresent(clientName)) + { + int clientId = getClientId(clientName); + client = new MClient(ctx, clientId, null); + } + else + { + client = createClient(rctx, clientName, orgName, currencyId, + currencyName, countryId, city, file); + Env.setContext(rctx, UdiConstants.CLIENT_ID_CTX_PARAM, client.get_ID()); + MOrg org = OrganisationManager.getOrgByName(rctx, orgName, null); + createClientDependencies(rctx, client, org, address, countryId, + city, postalAddress, smtpHost, file, null); + } + + return client; + } + + public static Properties getCtx(Properties ctx, String clientName, + String orgName) throws OperationException + { + int clientId = ClientManager.getClientId(clientName); + + // Set AD_Client_ID in the context + Env.setContext(ctx, UdiConstants.CLIENT_ID_CTX_PARAM, clientId); + + MOrg org = OrganisationManager.getOrgByName(ctx, orgName, null); + int orgId = org.get_ID(); + Env.setContext(ctx, UdiConstants.ORG_ID_CTX_PARAM, orgId); + Env.setContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM, orgId); + + return ctx; + } + + public static Properties getCtx(Properties ctx, int clientId, int orgId) { + Env.setContext(ctx, UdiConstants.CLIENT_ID_CTX_PARAM, clientId); + Env.setContext(ctx, UdiConstants.ORG_ID_CTX_PARAM, orgId); + Env.setContext(ctx, UdiConstants.USER_ID_CTX_PARAM, 100); + + return ctx; + } + + public static void openPeriods(Properties ctx, String trxName) + throws OperationException + { + int idPCs[] = PO.getAllIDs(MPeriodControl.Table_Name, " AD_CLIENT_ID =" + + Env.getAD_Client_ID(ctx), trxName); + + for (int i = 0; i < idPCs.length; i++) + { + MPeriodControl period = new MPeriodControl(ctx, idPCs[i], trxName); + period.setPeriodStatus(MPeriodControl.PERIODSTATUS_Open); + PoManager.save(period); + + } + } + + public static MClient loadClient(Properties ctx, int clientId, + String trxName) throws OperationException + { + MClient client = new MClient(ctx, clientId, trxName); + if (client.get_ID() == 0) + { + throw new OperationException("Could not load client with id: " + + + clientId); + } + return client; + } + + public static int getAccoutingElementId(Properties ctx) + throws OperationException { + int adClientId = Env.getAD_Client_ID(ctx); + + String whereClause = "AD_Client_ID=" + adClientId; + + int elementIds[] = MElement.getAllIDs(MElement.Table_Name, whereClause, + null); + + if (elementIds.length == 0) + throw new OperationException( + "No accounting element found for client with id: " + + adClientId); + else if (elementIds.length > 1) + throw new OperationException(elementIds.length + + " account elements found for client with id: " + + adClientId); + else + return elementIds[0]; + } + + public static void changeClientName(Properties ctx, String clientName, + String trxName) throws OperationException { + if (clientName == null || clientName.trim().length() == 0) + throw new OperationException("Client Name cannot be null"); + + int adClientId = Env.getAD_Client_ID(ctx); + + MClient client = loadClient(ctx, adClientId, trxName); + + if (!client.getName().equals(clientName)) { + client.setName(clientName); + + PoManager.save(client); + } + } + + public static void cleanData(Properties ctx, boolean deleteAll) + throws OperationException { + throw new RuntimeException("This operation is no more supported"); + } + + public static int getClientId(String clientName) throws OperationException { + String sql = "select ad_client_id from ad_client where upper(name)=upper('" + + clientName + "')"; + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = null; + + int clientID = 0; + try { + rs = pstmt.executeQuery(); + while (rs.next()) { + clientID = rs.getInt(1); + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + pstmt.close(); + } catch (Exception ex) { + } + + pstmt = null; + } + + if (clientID == 0) + throw new NoClientFoundException("no client found for clientName " + + clientName); + + return clientID; + } + + public static boolean isClientPresent(String clientName) + throws OperationException { + try { + getClientId(clientName); + } catch (NoClientFoundException e) { + return false; + } + + return true; + } + + /* + * Retrieve all clients in the system for which POS/Webstore transactions + * are valid + */ + public static int[] getAvailableClientIds() { + int clientIds[] = MClient.getAllIDs(MClient.Table_Name, + "IsActive='Y' and AD_Client_ID not in (0)", null); + + return clientIds; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/CurrencyManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/CurrencyManager.java new file mode 100644 index 0000000000..80e6d828e7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/CurrencyManager.java @@ -0,0 +1,112 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MCurrency; +import org.compiere.model.MPriceList; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.Constants; +import org.posterita.exceptions.OperationException; + +public class CurrencyManager +{ + + /** + * Retrieves the currency symbol for the currency ID specified + * @param currencyId Currency ID + * @return Currency Symbol + */ + public static String getCurrencySymbol(int currencyId) throws OperationException + { + MCurrency cur = new MCurrency(new Properties(), currencyId, null); + + if (cur.get_ID() == 0) + return ""; //Do not throw error here + + return cur.getCurSymbol(); + } + + public static int getCurrencyPrecision(Properties ctx) throws OperationException + { + int pricelistId = Env.getContextAsInt(ctx, Constants.PRICE_LIST); + MPriceList priceList = MPriceList.get(ctx, pricelistId, null); + + if (priceList == null) + { + throw new OperationException("Price list cannot be null!"); + } + + MCurrency mCurrency = new MCurrency(ctx, priceList.getC_Currency_ID(), null); + + return mCurrency.getCostingPrecision(); + } + + public static MCurrency getCurrency(Properties ctx) throws OperationException + { + int pricelistId = POSTerminalManager.getSOPriceListId(ctx); + MPriceList priceList = MPriceList.get(ctx, pricelistId, null); + + if (priceList == null) + { + throw new OperationException("No price list set for POS Terminal"); + } + + MCurrency mCurrency = MCurrency.get(ctx, priceList.getC_Currency_ID()); + + return mCurrency; + } + + public static ArrayList getAllCurrencies() throws OperationException + { + ArrayList knPairList = new ArrayList(); + + String sql = "Select C_Currency_ID, Description from C_Currency order by description"; + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + int currencyId = rs.getInt(1); + String currencyDescription = rs.getString(2); + + knPairList.add(new KeyNamePair(currencyId, currencyDescription)); + } + } + catch(SQLException ex) + { + throw new OperationException("Could not get currencies with sql: " + sql, ex); + } + + return knPairList; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/CustomerCart.java b/posterita/posterita/src/main/org/posterita/businesslogic/CustomerCart.java new file mode 100644 index 0000000000..bb3a1dc5c9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/CustomerCart.java @@ -0,0 +1,161 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Praveen Beekoo + */ +package org.posterita.businesslogic; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.posterita.beans.CustomerBean; +import org.posterita.businesslogic.administration.CustomerManager; +import org.posterita.exceptions.InvalidDateTimeException; +import org.posterita.exceptions.OperationException; + +public class CustomerCart +{ + + private HashMap customers = null; + private int noOfCustomers = 0; + private Properties ctx; + + + public CustomerCart(Properties ctx) + { + this.ctx = ctx; + customers = new HashMap(); + } + + public void addCustomer(int customer_id, int qty) + { + noOfCustomers++; + + Integer previousQty = customers.get(Integer.valueOf(customer_id)); + + if(previousQty == null) + { + customers.put(Integer.valueOf(customer_id),Integer.valueOf(qty)); + } + else + { + int newQty = previousQty.intValue() + qty; + customers.put(Integer.valueOf(customer_id),Integer.valueOf(newQty)); + } + } + + public void addCustomer(int customer_id) + { + addCustomer(customer_id, 1); + } + + public void removeCustomer(int customer_id, int qty) + { + Integer oldQty = customers.get(Integer.valueOf(customer_id)); + + if( oldQty == null ) + { + return; + } + else + { + if( oldQty.intValue() <= qty ) + { + removeCustomer( customer_id ); + noOfCustomers = noOfCustomers - oldQty.intValue(); + } + else + { + int newQty = oldQty.intValue() - qty; + customers.put(Integer.valueOf(customer_id),Integer.valueOf(newQty)); + noOfCustomers = noOfCustomers - qty; + } + } + } + + public void removeCustomer(int customer_id) + { + Integer qty = customers.remove(Integer.valueOf(customer_id)); + + if( qty == null ) + { + return; + } + + noOfCustomers = noOfCustomers - qty.intValue(); + } + + public void clear() + { + customers.clear(); + noOfCustomers = 0; + } + + public int getNoOfCustomers() + { + return noOfCustomers; + } + + public ArrayList getCustomers() throws Exception + { + ArrayList customerList = new ArrayList(); + CustomerBean bean = null; + Integer customerId = null; + + Set> entrySet = customers.entrySet(); + + for (Map.Entry entry : entrySet) + { + customerId = entry.getKey(); + + bean = CustomerManager.getCustomerDetails(ctx, customerId); + + customerList.add(bean); + } + + return customerList; + } + + public Integer[] getCustomerIDs() + { + Set set = customers.keySet(); + + if( set.isEmpty() ) + { + return new Integer[]{}; + } + + Integer[] ids = new Integer[]{}; + ids = set.toArray( ids ); + + return ids; + } + + public boolean hasCustomer( int customer_id ) + { + return customers.containsKey( Integer.valueOf(customer_id) ); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/EditBulkProductFromFileManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/EditBulkProductFromFileManager.java new file mode 100644 index 0000000000..72eb26fb45 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/EditBulkProductFromFileManager.java @@ -0,0 +1,336 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.apache.struts.upload.FormFile; +import org.posterita.beans.ItemBean; +import org.posterita.beans.ProductBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.exceptions.BarcodeAlreadyExistsException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductAlreadyExistException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; + + +public class EditBulkProductFromFileManager +{ + /* @SuppressWarnings("unchecked") + public static ShoppingCartBean addToProductCart(Properties ctx,ProductBean bean, ShoppingCartBean cartBean) throws OperationException,ProductNotFoundException,ProductNotOnPriceListException + { + ArrayList oldItems; + if (cartBean == null) + { + cartBean = new ShoppingCartBean(); + oldItems = new ArrayList(); + } + else + { + oldItems = cartBean.getItems(); + } + + ArrayList oldItemsClone = (ArrayList) oldItems.clone(); + ArrayList itemsToBeAdded = getProducts(bean); + oldItems = addToItemList(oldItemsClone, itemsToBeAdded); + + cartBean.setItems(oldItems); + return cartBean; + } + + private static ArrayList getProducts(ProductBean bean) + { + ArrayList list = new ArrayList(); + + Integer [] productIds = bean.getProductIds(); + ItemBean itemBean=null; + for(int i=0;i addToItemList(ArrayList items, ArrayList itemsToBeAdded) throws ProductNotOnPriceListException, OperationException + { + Iterator iter = itemsToBeAdded.iterator(); + ItemBean itemBean; + + ItemBean foundItemBean; + while (iter.hasNext()) + { + itemBean = (ItemBean) iter.next(); + + foundItemBean = StockManager.findItem(itemBean, items); + + if (foundItemBean == null) + items.add(itemBean); + + } + + return items; + } + + public static String createCSVFile(Properties ctx, Integer[] productIds) throws OperationException + { + + ArrayList fileData = new ArrayList(); + + Object[] headers = new Object[]{ + "Product ID", + "Name", + "Barcode", + "Purchase Price", + "Marked Price", + "Discounted Price"}; + + fileData.add(headers); + + Object[] productInfo = null; + + if( productIds != null ) + { + for( int i = 0; i< productIds.length; i++) + { + int productId = productIds[i]; + + ProductBean bean= POSProductManager.viewPOSProduct(ctx,productId, null); + + productInfo = new Object[6]; + + productInfo[0] = productId; + productInfo[1]=bean.getProductName(); + + + if( bean.getBarCode() == null ) + { + productInfo[2]=""; + } + else + { + productInfo[2]=bean.getBarCode(); + } + productInfo[3]=bean.getPurchasePriceStandard(); + productInfo[4]=bean.getSalesPriceList(); + productInfo[5]=bean.getSalesPriceStandard(); + + fileData.add(productInfo); + } + } + + + return CSVReportManager.generateCSVReport(ctx, fileData); + + } + + public static String createCSVFile(Properties ctx,ArrayList cartBeanItems) throws OperationException + { + + Iterator iter = cartBeanItems.iterator(); + ItemBean itemBean=null; + + ArrayList fileData = new ArrayList(); + + Object[] headers = new Object[]{ + "Product ID", + "Name", + "Barcode", + "Purchase Price", + "Marked Price", + "Discounted Price"}; + + fileData.add(headers); + + Object[] productInfo = null; + + while(iter.hasNext()) + { + productInfo = new Object[headers.length]; + + itemBean =(ItemBean)iter.next(); + + //TODO + int productId=itemBean.getProductId(); + + ProductBean bean= POSProductManager.viewPOSProduct(ctx,productId, null); + + productInfo[0] = productId; + productInfo[1]=bean.getProductName(); + productInfo[2]=bean.getBarCode(); + productInfo[3]=bean.getPurchasePriceStandard(); + productInfo[4]=bean.getSalesPriceList(); + productInfo[5]=bean.getSalesPriceStandard(); + fileData.add(productInfo); + } + + return CSVReportManager.generateCSVReport(ctx, fileData); + + } + + public static ArrayList updateAllProducts(Properties ctx, FormFile formFile,String trxName) throws NumberFormatException, ProductAlreadyExistException,BarcodeAlreadyExistsException, OperationException + { + ArrayList list=new ArrayList(); + + InputStream is = null; + BufferedInputStream bis = null; + BufferedReader reader = null; + + try + { + is = formFile.getInputStream(); + + bis = new BufferedInputStream(is); + + reader = new BufferedReader(new InputStreamReader(bis)); + + String s = null; + ProductBean bean=null; + String productId; + String name=null; + String purchasePrice=null; + String salePriceList=null; + String salePriceStd=null; + String barCode=null; + reader.readLine(); + + while((s=reader.readLine()) != null && s.trim().length()>0) + { + StringTokenizer st = new StringTokenizer(s,","); + + bean=new ProductBean(); + + productId=st.nextToken(); + productId=productId.replaceAll("\"",""); + name=st.nextToken(); + name=name.replaceAll("\"",""); + barCode=st.nextToken(); + barCode=barCode.replaceAll("\"",""); + purchasePrice=st.nextToken(); + purchasePrice=purchasePrice.replaceAll("\"",""); + salePriceList=st.nextToken(); + salePriceList=salePriceList.replaceAll("\"",""); + salePriceStd=st.nextToken(); + salePriceStd=salePriceStd.replaceAll("\"",""); + + bean.setProductId(Integer.valueOf(productId)); + bean.setBarCode(barCode); + bean.setProductName(name); + bean.setDescription(name); + bean.setPurchasePriceStandard(purchasePrice); + bean.setSalesPriceList(salePriceList); + bean.setSalesPriceStandard(salePriceStd); + bean.setIsActive(true); + bean.setSalesPriceLimit(salePriceStd); + POSProductManager.editProduct(ctx,bean,null,trxName); + } + } + catch (FileNotFoundException e) + { + throw new OperationException(e); + } + catch (IOException e) + { + throw new OperationException(e); + } + + finally + { + if (is != null) + { + try + { + is.close(); + } + catch(Exception ex) + {} + } + + if (bis != null) + { + try + { + bis.close(); + } + catch(Exception ex) + {} + } + + if (reader != null) + { + try + { + reader.close(); + } + catch(Exception ex) + {} + } + } + + return list; + } + + public static ProductCart addToCart( Properties ctx, ProductCart cart, int productId) + { + if ( ! cart.hasProduct (productId ) ) + { + cart.addProduct( productId ); + } + + return cart; + } + + public static ArrayList getProductList(Properties ctx, Integer[] productIds) throws OperationException + { + ArrayList productList = new ArrayList(); + + if( productIds != null ) + { + for( int i = 0; i< productIds.length; i++) + { + int productId = productIds[i]; + ProductBean bean= POSProductManager.viewPOSProduct(ctx,productId, null); + productList.add( bean ); + + } + } + + return productList; + }*/ +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/FileAttachmentManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/FileAttachmentManager.java new file mode 100644 index 0000000000..972fcafe29 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/FileAttachmentManager.java @@ -0,0 +1,30 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 13, 2006 by praveen + * + */ +package org.posterita.businesslogic; + +import org.posterita.businesslogic.core.AttachmentManager; + + +public class FileAttachmentManager extends AttachmentManager +{ + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/GenericStockManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/GenericStockManager.java new file mode 100644 index 0000000000..f34605faf7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/GenericStockManager.java @@ -0,0 +1,280 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 6, 2005 by alok + **/ +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.compiere.model.MProduct; +import org.compiere.util.DB; +import org.compiere.util.Env; + +import org.posterita.beans.AvailableProductSizeBean; +import org.posterita.beans.GenericProductBean; +import org.posterita.beans.ItemBean; +import org.posterita.beans.ProductImageInfo; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.exceptions.OperationException; + + +public class GenericStockManager +{ + public static final String DELIMITER = "_"; + + public static ArrayList getProducts(Properties ctx, int productCategoryId) throws OperationException + { + + ArrayList products = getProductsInStock(ctx, productCategoryId); + products = setImageInfo(ctx, products); + + return products; + } + + public static ArrayList getProductsInStock(Properties ctx, int productCategoryId) throws OperationException + { + String sql = "select p.name," + + " sum(s.qtyonhand)," + + " p.m_product_id," + + " p.description" + + " from m_product p, m_storage s" + + " where p.m_product_id = s.m_product_id" + + " and p.ad_client_id = " + Env.getAD_Client_ID(ctx) + + " and p.m_product_category_id = " + productCategoryId + + " and s.qtyonhand > 0" + + " group by p.name, p.m_product_id, description" + + " order by p.name"; + + PreparedStatement pstmt = null; + + ArrayList stock = new ArrayList(); + + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, null); + rs = pstmt.executeQuery(); + + GenericProductBean stockBean; + while(rs.next()) + { + stockBean = new GenericProductBean(); + stockBean.setName(rs.getString(1)); + stockBean.setQtyOnHand(Integer.valueOf(rs.getInt(2))); + stockBean.setProductId(Integer.valueOf(rs.getInt(3))); + stockBean.setDescription(rs.getString(4)); + + stock.add(stockBean); + } + + rs.close(); + } + catch(SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + throw new OperationException(ex); + } + pstmt = null; + } + return stock; + } + + public static ArrayList setImageInfo(Properties ctx, ArrayList products) + { + Iterator iter = products.iterator(); + + ProductImageInfo info; + GenericProductBean bean; + while (iter.hasNext()) + { + bean = (GenericProductBean) iter.next(); + info = ProductManager.getProductImageInfo(ctx, bean.getProductId()); + bean.setImageInfo(info); + } + + return products; + } + + public static String getSize(String productName) + { + StringTokenizer tokenizer = new StringTokenizer(productName, DELIMITER); + + String size = tokenizer.nextToken(); + + + return size; + } + + public static AvailableProductSizeBean setSize(String size, AvailableProductSizeBean bean) + { + //TODO create a new sizeType which contains Small, Medium, Large and XLarge + if (size.equalsIgnoreCase("Small")) + bean.setExistsInSmall(Boolean.valueOf(true)); + + if (size.equalsIgnoreCase("Medium")) + bean.setExistsInMedium(Boolean.valueOf(true)); + + if (size.equalsIgnoreCase("Large")) + bean.setExistsInLarge(Boolean.valueOf(true)); + + if (size.equalsIgnoreCase("XLarge")) + bean.setExistsInXLarge(Boolean.valueOf(true)); + + return bean; + } + + public static String getLikeProductQueryString(Properties ctx, String productName) + { + StringTokenizer tokenizer = new StringTokenizer(productName, DELIMITER); + String colour = tokenizer.nextToken(); + String model = tokenizer.nextToken(); + + String likeProductQueryString = "'%" + colour + "%" + model + "'"; + + return likeProductQueryString; + } + + public static AvailableProductSizeBean getAvailableSizesForProduct(Properties ctx, int productId) throws OperationException + { + ArrayList sizes = getAvailableSizes(ctx, productId); + Iterator iter = sizes.iterator(); + AvailableProductSizeBean sizeBean = new AvailableProductSizeBean(); + String size; + + while (iter.hasNext()) + { + GenericProductBean bean = (GenericProductBean) iter.next(); + size = getSize(bean.getName()); + setSize(size, sizeBean); + } + + return sizeBean; + } + + public static ArrayList getAvailableSizes(Properties ctx, int productId) throws OperationException + { + MProduct product = new MProduct(ctx, productId, null); + + String productName = product.getName(); + + String likeQuery = getLikeProductQueryString(ctx, productName); + + String sql = "select p.name," + + " sum(s.qtyonhand)," + + " p.m_product_id," + + " p.description" + + " from m_product p, m_storage s" + + " where p.m_product_id = s.m_product_id" + + " and p.ad_client_id = " + Env.getAD_Client_ID(ctx) + + " and p.name like " + likeQuery + + " and s.qtyonhand > 0" + + " group by p.name, p.m_product_id, description" + + " order by p.name"; + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ArrayList sizes = new ArrayList(); + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + + GenericProductBean bean; + String name; + + while (rs.next()) + { + bean = new GenericProductBean(); + name = rs.getString(1); + bean.setName(name); + sizes.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return sizes; + } + + + + public static int getProduct(String name, String productSize) throws OperationException + { + StringTokenizer tokenizer = new StringTokenizer(name, DELIMITER); + String colour = tokenizer.nextToken(); + String size = tokenizer.nextToken(); + String model = tokenizer.nextToken(); + + size = productSize; + String productName = colour + DELIMITER + size + DELIMITER + model; + + int productIds[] = MProduct.getAllIDs(MProduct.Table_Name, "ad_client_id=1001806" + " and name='" + + productName + "'", null); + + if (productIds.length == 0) + throw new OperationException("Product not found!"); + + if (productIds.length > 1) + throw new OperationException("More than 1 product found for " + productName); + + return productIds[0]; + } + + public static ItemBean setBean(Integer productId, BigDecimal qty) + { + ItemBean itemBean = new ItemBean(); + itemBean.setProductId(productId); + itemBean.setQty(qty); + + return itemBean; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/HistoryFilterBean.java b/posterita/posterita/src/main/org/posterita/businesslogic/HistoryFilterBean.java new file mode 100644 index 0000000000..bf91648e25 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/HistoryFilterBean.java @@ -0,0 +1,76 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 15, 2005 by praveen + * + */ +package org.posterita.businesslogic; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.TreeSet; + +import org.posterita.beans.FilterBean; +import org.posterita.beans.UDIPair; + +public class HistoryFilterBean +{ + private TreeSet bPartnerList = new TreeSet(); + private TreeSet docStatusList = new TreeSet(); + + public HistoryFilterBean(ArrayList beans) + { + + if(beans!=null) + { + Iterator iter = beans.iterator(); + + while(iter.hasNext()) + { + FilterBean bean = (FilterBean) iter.next(); + + if(bean.getPartnerId()!=null) + { + UDIPair pair = new UDIPair(bean.getPartnerId(),bean.getPartnerName()); + bPartnerList.add(pair); + } + + if(bean.getDocStatus()!= null) + { + UDIPair docStatusPair = new UDIPair(bean.getDocStatusCode(), bean.getDocStatus()); + docStatusList.add(docStatusPair); + } + } + } + + } + + + public TreeSet getBPartnerList() + { + return bPartnerList; + } + + public TreeSet getDocStatusList() + { + return docStatusList; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/ImportPosProductManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/ImportPosProductManager.java new file mode 100644 index 0000000000..922a8a3a7f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/ImportPosProductManager.java @@ -0,0 +1,338 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on May 16, 2006 by alok + */ + + +package org.posterita.businesslogic; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.NoSuchElementException; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.apache.struts.upload.FormFile; +import org.compiere.model.MStorage; +import org.compiere.model.MTax; +import org.compiere.model.MTransaction; +import org.compiere.model.MUOM; +import org.compiere.model.MWarehouse; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.beans.ProductBean; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.RandomStringGenerator; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.BarcodeAlreadyExistsException; +import org.posterita.exceptions.DuplicateUOMException; +import org.posterita.exceptions.ImportProductException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductAlreadyExistException; +import org.posterita.exceptions.ProductNotImportedException; +import org.posterita.exceptions.TaxRateNotDefineException; +import org.posterita.exceptions.UOMNotFoundException; +import org.posterita.exceptions.UOMValuePrecisionNotValidException; +import org.posterita.formatter.BigDecimalFormatter; +import org.posterita.util.PoManager; + + +public class ImportPosProductManager +{ + + public static ArrayList importSingleProducts(Properties ctx, FormFile formFile, int salesPriceListId, int purchasePriceListId, String trxName) throws NumberFormatException, ProductAlreadyExistException,BarcodeAlreadyExistsException, OperationException + { + ProductBean pbean = new ProductBean(); + ArrayList list=new ArrayList(); + InputStream is = null; + BufferedInputStream bis = null; + BufferedReader reader = null; + + int orgId = 0; //Import all products under org * so that it may be accessible to all orgs + StringBuffer csv = new StringBuffer(); + StringBuffer importProductEx = new StringBuffer(); + try + { + is = formFile.getInputStream(); + + bis = new BufferedInputStream(is); + + reader = new BufferedReader(new InputStreamReader(bis)); + + String s = null; + ProductBean bean=null; + String revenueRecognition=null; + String name=null; + String description= null; + String uom= null; + String purchasePrice=null; + String salePriceList=null; + String salePriceStd=null; + String salePriceLimit=null; + String barCode=null; + String taxRate=null; + String qty=null; + + Integer uomId = null; + Integer lineNumber = 1; //Skip Header in Import File + ArrayList uomErrorList = new ArrayList(); + BigDecimal qtyDB = new BigDecimal(0); + + boolean isProductImported = true; + String filename = ""; + String header = reader.readLine(); + + csv.append(header).append("\n"); + while((s=reader.readLine())!=null && s.trim().length()>0) + { + lineNumber++; + + StringTokenizer st = new StringTokenizer(s,","); + + bean=new ProductBean(); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + trx.start(); + try + { + revenueRecognition=st.nextToken(); + revenueRecognition=revenueRecognition.replaceAll("\"",""); + barCode=st.nextToken(); + barCode=barCode.replaceAll("\"",""); + name=st.nextToken(); + name=name.replaceAll("\"",""); + description=st.nextToken(); + description=description.replaceAll("\"",""); + uom=st.nextToken(); + uom=uom.replaceAll("\"",""); + purchasePrice=st.nextToken(); + purchasePrice=purchasePrice.replaceAll("\"",""); + salePriceList=st.nextToken(); + salePriceList=salePriceList.replaceAll("\"",""); + salePriceStd=st.nextToken(); + salePriceStd=salePriceStd.replaceAll("\"",""); + salePriceLimit=st.nextToken(); + salePriceLimit=salePriceLimit.replaceAll("\"",""); + taxRate=st.nextToken(); + taxRate=taxRate.replaceAll("\"",""); + qty=st.nextToken(); + qty=qty.replaceAll("\"",""); + + } + catch (NoSuchElementException e) + { + // TODO: handle exception + throw new ImportProductException("An error occurred while passing the data in the file."); + } + + if ((uom != null) || (uom != "")) + { + int[] uomIds = MUOM.getAllIDs(MUOM.Table_Name, "UPPER(name)='" + uom.toUpperCase() + "'" + "AND isActive = 'Y' AND AD_CLient_ID IN (0," + Env.getAD_Client_ID(ctx) +")", trxName); + + if (uomIds.length == 0) + throw new UOMNotFoundException("UOM '" + uom + "' does not exist. "); + else + if (uomIds.length > 1) + throw new DuplicateUOMException("Duplicate UOM name found - " + uom + ". Please make sure that the name is unique as it is not case sensitive."); + + MUOM muom = MUOM.get(ctx, uomIds[0]); + + int uomPrecision = MUOM.getPrecision(ctx, muom.getC_UOM_ID()); + uomId = muom.get_ID(); + qtyDB = new BigDecimal(qty); + + int enteredPrecision = StockManager.getQtyPrecision(qtyDB); + + if (enteredPrecision > uomPrecision) + throw new UOMValuePrecisionNotValidException("The precision entered for the quantity field of the product: '"+ name + + "' should not be greater than '" + uomPrecision); + } + + String whereClause=" AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and RATE="+taxRate; + int taxId []= MTax.getAllIDs(MTax.Table_Name,whereClause,trxName); + if(taxId.length==0) + throw new TaxRateNotDefineException(", the tax rate in the file ="+taxRate+" does not exist
    "); + + MTax tax = new MTax(ctx,taxId[0],trxName); + + bean.setRevenueRecognition(revenueRecognition); + bean.setBarCode(barCode); + bean.setProductName(name); + bean.setIsActive(true); + bean.setDescription(description); + bean.setUomId(uomId); + bean.setPurchasePriceStandard(purchasePrice); + bean.setSalesPriceList(salePriceList); + bean.setSalesPriceStandard(salePriceStd); + bean.setSalesPriceLimit(salePriceLimit); + bean.setTaxCategoryId(tax.getC_TaxCategory_ID()); + bean.setOrgId(orgId); + + int productId = ProductManager.getSimilarProduct(ctx,name,trxName); + if (productId == 0) + { + pbean=POSProductManager.createSinglePOSProductForImport(ctx,bean,qtyDB,trxName); + productId = pbean.getProductId(); + } + else + { + pbean = POSProductManager.viewPOSProduct(ctx, productId, trxName); + } + BigDecimalFormatter formatter = new BigDecimalFormatter(); + BigDecimal salesPriceStd = (BigDecimal)formatter.unformat(salePriceStd); + BigDecimal salesPriceList = (BigDecimal)formatter.unformat(salePriceList); + BigDecimal salesPriceLimit = (BigDecimal)formatter.unformat(salePriceLimit); + + BigDecimal purchasePriceStd = (BigDecimal)formatter.unformat(purchasePrice); + PriceListManager.updatePriceLists(ctx, productId, salesPriceListId, salesPriceStd, + salesPriceList, salesPriceLimit, trx.getTrxName()); + PriceListManager.updatePriceLists(ctx, productId, purchasePriceListId, purchasePriceStd, + Env.ZERO, Env.ZERO, trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + importProductEx = importProductEx.append("
    Product "+ name + " at line " + lineNumber + " not imported. ").append(e.getMessage()); + isProductImported = false; + csv.append(s).append("\"\n"); + } + finally + { + trx.close(); + } + list.add(pbean); + + } + if (!isProductImported) + { + filename = RandomStringGenerator.randomstring() + ".csv"; + String filepath = ReportManager.getReportPath(filename); + try + { + FileWriter writer = new FileWriter(filepath); + writer.write(csv.toString()); + writer.flush(); + writer.close(); + } + catch (IOException e1) + { + throw new OperationException(e1); + } + throw new ProductNotImportedException(filename+importProductEx.toString()); + } + } + catch (FileNotFoundException e) + { + e.printStackTrace(); + } + catch (IOException e) + { + e.printStackTrace(); + } + finally + { + if (is != null) + { + try + { + is.close(); + } + catch(Exception ex) + {} + } + + if (bis != null) + { + try + { + bis.close(); + } + catch(Exception ex) + {} + } + + if (reader != null) + { + try + { + reader.close(); + } + catch(Exception ex) + {} + } + } + return list; + } + + public static void importStockMStorage(Properties ctx,int m_product_id,BigDecimal qty,String trxName) throws OperationException + { + + int warehouseId=POSTerminalManager.getWarehouse(ctx).get_ID(); + + if (warehouseId==0) + throw new OperationException("no warehouse for this org"); + + MWarehouse warehouse = new MWarehouse(ctx,warehouseId,null); + int locatorId = warehouse.getDefaultLocator().get_ID(); + + MStorage st = MStorage.getCreate(ctx, locatorId, m_product_id, 0, trxName); + st.setQtyOnHand(st.getQtyOnHand().add(qty)); + st.setQtyReserved(new BigDecimal(0)); + st.setQtyOrdered(new BigDecimal(0)); + + PoManager.save(st); + + } + + public static void importStockMTransaction(Properties ctx,int m_product_id,BigDecimal qty, String trxName) throws OperationException + { + + int warehouseId=POSTerminalManager.getWarehouse(ctx).get_ID(); + + if (warehouseId==0) + throw new OperationException("no warehouse for this org"); + + MWarehouse warehouse = new MWarehouse(ctx,warehouseId,null); + + MTransaction trans = new MTransaction(ctx,0,trxName); + + trans.setM_Product_ID(m_product_id); + trans.setM_Locator_ID(warehouse.getDefaultLocator().get_ID()); + trans.setMovementQty(qty); + trans.setMovementType(MTransaction.MOVEMENTTYPE_InventoryIn); + trans.setMovementDate(new Timestamp(System.currentTimeMillis())); + + PoManager.save(trans); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/InvoiceManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/InvoiceManager.java new file mode 100644 index 0000000000..4f3c41681b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/InvoiceManager.java @@ -0,0 +1,1124 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 05-Jul-2005 by alok + * + */ +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MCharge; +import org.compiere.model.MClient; +import org.compiere.model.MCurrency; +import org.compiere.model.MDocType; +import org.compiere.model.MInOut; +import org.compiere.model.MInvoice; +import org.compiere.model.MInvoiceLine; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.compiere.model.MOrg; +import org.compiere.model.MPInstance; +import org.compiere.model.MPInstancePara; +import org.compiere.model.MProcess; +import org.compiere.model.MProduct; +import org.compiere.model.MTax; +import org.compiere.print.ReportEngine; +import org.compiere.process.DocumentEngine; +import org.compiere.process.InvoiceGenerate; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.AttributeValuesPair; +import org.posterita.beans.CommandBean; +import org.posterita.beans.InvoiceHistoryBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.beans.WebDocumentHeaderBean; +import org.posterita.beans.WebInvoiceLineBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.core.ChargeManager; +import org.posterita.core.UDIMap; +import org.posterita.exceptions.DataException; +import org.posterita.exceptions.NoOrderLineSelectedException; +import org.posterita.exceptions.OperationException; +import org.posterita.formatter.PrintFormatter; +import org.posterita.order.UDIOrderTypes; +import org.posterita.util.PoManager; + +public class InvoiceManager extends AbstractDocumentManager +{ + + private static final String CUSTOMER_INVOICE = "Customer Invoice"; + private static final String VENDOR_INVOICE = "Vendor Invoice"; + + public static MInvoice createCustomerInvoice(Properties ctx, int salesOrderId, String trxName) throws OperationException + { + MOrder so = new MOrder(ctx, salesOrderId, trxName); + + MOrderLine lines[] = so.getLines(); + + Integer soLinesIds[] = new Integer[lines.length]; + + if (soLinesIds.length == 0) + throw new NoOrderLineSelectedException("No order line selected"); + + MInvoice returnInvoice = null; + + for (int i = 0; i list = new ArrayList(); + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + InvoiceHistoryBean bean; + while(rs.next()) + { + bean = new InvoiceHistoryBean(); + bean.setInvoiceId(Integer.valueOf(rs.getInt(1))); + bean.setPartnerName(rs.getString(2)); + bean.setPartnerId(Integer.valueOf(rs.getInt(3))); + bean.setDocumentNo(rs.getString(4)); + bean.setDocStatus(UDIMap.docStatusMap.get(rs.getString(5))); + bean.setDocStatusCode(rs.getString(5)); + bean.setOrderId(Integer.valueOf(rs.getInt(6))); + bean.setDateInvoiced(rs.getTimestamp(7)); + bean.setGrandTotal(Integer.valueOf(rs.getInt(8))); + bean.setIsPaid(rs.getString(9)); + list.add(bean); + + } + + rs.close(); + } + catch (SQLException e) + { + throw new SQLException(); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + + } + + public static ArrayList viewInvoice(Properties ctx, Integer invoiceId) throws OperationException + { + if (invoiceId.intValue() == 0) + throw new OperationException("cannot view invoice with id 0"); + + MInvoice invoice = new MInvoice(ctx, invoiceId.intValue(), null); + + if (invoice.get_ID() == 0) + throw new OperationException("cannot view invoice with id 0"); + + ArrayList invoiceLines = retrieveInvoiceLineValues(ctx, invoice.getLines()); + + return invoiceLines; + + } + public static ArrayList retrieveInvoiceLineValues(Properties ctx, MInvoiceLine[] lines) throws OperationException + { + MInvoiceLine line; + MProduct product; + AttributeValuesPair attributeValuesPair; + WebInvoiceLineBean invoiceLinebean; + ArrayList invoiceLines = new ArrayList(); + for (int i = 0; i < lines.length; i++) + { + line = lines[i]; + product = new MProduct(ctx, line.getM_Product_ID(), null); + attributeValuesPair = AttributeValuesManager.retrieveAttributeValues(ctx, product.getM_AttributeSetInstance_ID()); + invoiceLinebean = new WebInvoiceLineBean(); + invoiceLinebean.setAttributeValuesPair(attributeValuesPair); + invoiceLinebean.setSerno(OrderReferenceManager.getSerno(ctx, line.getM_AttributeSetInstance_ID())); + invoiceLinebean.setLineNetAmt(line.getLineNetAmt()); + invoiceLinebean.setLineTotalAmt(line.getLineTotalAmt()); + invoiceLinebean.setTaxAmt(line.getTaxAmt()); + invoiceLines.add(invoiceLinebean); + } + + return invoiceLines; + + } + + public static WebDocumentBean getWebInvoiceBean(MInvoice invoice) throws OperationException, DataException + { + if (invoice == null) + throw new OperationException("Invalid operation invoice is null"); + + if (invoice.get_ID() == 0) + throw new OperationException("You have deleted this invoice. You cannot view this invoice."); + + WebDocumentBean bean = new WebDocumentBean(); + + bean.setInvoiceId(Integer.valueOf(invoice.get_ID())); + + Properties ctx = invoice.getCtx(); + + MOrg myOrg = OrganisationManager.getMyOrg(ctx); + MBPartner me = new MBPartner(ctx, myOrg.getLinkedC_BPartner_ID(null), null); + bean.setMe(me); + + // MOrg orderOrg = new MOrg(ctx, invoice.getAD_Org_ID(), null); + + int currencyId = invoice.getC_Currency_ID(); + MCurrency currency = new MCurrency(ctx,currencyId,null); + bean.setCurrencySymbole(currency.getCurSymbol()); + + + /*if (orderOrg.getLinkedC_BPartner_ID() != myOrg.getLinkedC_BPartner_ID()) + throw new DocumentDoesNotBelongToYouException("This invoice does not belong to you. You do not have access to it."); + */ + MBPartnerLocation meLocation[] = MBPartnerLocation.getForBPartner(ctx,me.get_ID()); + if (meLocation.length ==0) + throw new OperationException("No location has been set for your organisation. Please ask your administrator to set one for you"); + + + MLocation location = new MLocation(ctx, meLocation[0].getC_Location_ID(), null); + + if (meLocation == null) + throw new OperationException("You must have a location set for your business partner, Please ask your administrator to set one for you"); + + bean.setMeLocation(location); + + MBPartner you = new MBPartner(ctx, invoice.getC_BPartner_ID(), null); + bean.setYou(you); + + MBPartnerLocation youBPLocation[] = MBPartnerLocation.getForBPartner(ctx,you.get_ID()); + MLocation youLocation = new MLocation(ctx, youBPLocation[0].getC_Location_ID(), null); + + bean.setYoubpLocation(youBPLocation[0]); + bean.setYouLocation(youLocation); + + ArrayList lines = populateInvoiceLines(ctx , invoice.getLines()); + bean.setLines(lines); + bean = calculateInvoiceTotals(lines, bean); + + + WebDocumentHeaderBean headerBean = createWebDocumentHeader(ctx, invoice.getAD_Org_ID(), invoice.getC_BPartner_ID(), invoice.getDocStatus(), invoice.isSOTrx(),invoice.getPaymentRule()); + headerBean.setDocumentHeader(getDocumentHeader(invoice)); + + + int invoiceId = invoice.get_ID(); + + int[] shipmentIds = MInOut.getAllIDs(MInOut.Table_Name, "c_invoice_id=" + invoiceId, null); + + if (shipmentIds.length == 0) + headerBean.setShipped("No"); + else + headerBean.setShipped("Yes"); + + bean.setHeaderBean(headerBean); + + bean.setInvoice(invoice); + + MOrder order = new MOrder(ctx, invoice.getC_Order_ID(), null); + bean.setOrder(order); + + CommandBean cmdBean = new CommandBean(); + if (!invoice.isSOTrx()) + cmdBean = getVendorInvoiceWebCommands(invoice); + else + cmdBean = getCustomerInvoiceWebCommands(invoice); + + bean.setSimpleCommand(cmdBean.getSimpleCommand()); + bean.setComplexCommand(cmdBean.getComplexCommand()); + + + return bean; + } + + public static String getDocumentHeader(MInvoice invoice) + { + if (invoice.isSOTrx()) + return CUSTOMER_INVOICE; + + return VENDOR_INVOICE; + } + + + private static WebDocumentBean calculateInvoiceTotals(ArrayList webOrderLineList, WebDocumentBean webInvoiceLineBean) + { + Iterator iter = webOrderLineList.iterator(); + + WebInvoiceLineBean bean; + + BigDecimal totalLines = new BigDecimal(0); + BigDecimal totalTax = new BigDecimal(0); + BigDecimal grandTotal; + + BigDecimal roundedTotalLines; + BigDecimal roundedTotalTax; + BigDecimal roundedGrandTotal; + while(iter.hasNext()) + { + bean = (WebInvoiceLineBean) iter.next(); + totalLines = totalLines.add(bean.getLineNetAmt()); + totalTax = totalTax.add(bean.getTaxAmt()); + } + + grandTotal = totalLines.add(totalTax); + + + roundedTotalLines = round(totalLines, 2); + roundedTotalTax = round(totalTax, 2); + + roundedGrandTotal = round(grandTotal, 2); + + webInvoiceLineBean.setTotalLines(roundedTotalLines); + webInvoiceLineBean.setTotalTax(roundedTotalTax); + webInvoiceLineBean.setGrandTotal(roundedGrandTotal); + + return webInvoiceLineBean; + } + private static BigDecimal round(BigDecimal number, int decimalPlaces) + { + BigDecimal roundedNumber = number.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP); + + return roundedNumber; + } + + private static ArrayList populateInvoiceLines(Properties ctx, MInvoiceLine[] lines) throws OperationException + { + MInvoiceLine line; + MProduct product; + AttributeValuesPair attributeValuesPair; + ArrayList invoiceLines = new ArrayList(); + for (int i = 0; i < lines.length; i++) + { + line = lines[i]; + product = new MProduct(ctx, line.getM_Product_ID(), null); + attributeValuesPair = AttributeValuesManager.retrieveAttributeValues(ctx, product.getM_AttributeSetInstance_ID()); + WebInvoiceLineBean invoiceLineBean = new WebInvoiceLineBean(); + invoiceLineBean.setAttributeValuesPair(attributeValuesPair); + + BigDecimal roundedLineNetAmount = round(line.getLineNetAmt(), 2); + + //line tax amount + BigDecimal lineTaxAmount = getLineTaxAmt(line.getCtx(), line.getLineNetAmt(), line.getC_Tax_ID(), line.get_ID()); + BigDecimal roundedTaxAmount = round(lineTaxAmount, 2); + invoiceLineBean.setTaxAmt(roundedTaxAmount); + + + //lineTotalAmount = lineNetAmount + lineTaxAmount + BigDecimal lineTotalAmount = line.getLineNetAmt().add(lineTaxAmount); + BigDecimal roundedLineTotalAmount = round(lineTotalAmount, 2); + + invoiceLineBean.setLineTotalAmt(roundedLineTotalAmount); + invoiceLineBean.setQtyOrdered(line.getQtyEntered()); + + invoiceLineBean.setLineNetAmt(roundedLineNetAmount); + invoiceLineBean.setPriceActual(line.getPriceActual()); + + invoiceLineBean.setProductId(Integer.valueOf(line.getM_Product_ID())); + invoiceLineBean.setOrderLineId(Integer.valueOf(line.get_ID())); + + invoiceLineBean.setSerno(getSerno(ctx, line.getM_AttributeSetInstance_ID())); + + if(line.getM_Product_ID() == 0) + { + if(line.getC_Charge_ID() != 0) + { + MCharge charge = ChargeManager.loadCharge(ctx, line.getC_Charge_ID(), null); + invoiceLineBean.setDescription(charge.getName()); + } + else + invoiceLineBean.setDescription("Adjustment product"); + } + else + invoiceLineBean.setDescription(ProductManager.getProductName(ctx, line.getM_Product_ID())); + invoiceLines.add(invoiceLineBean); + } + + return invoiceLines; + } + + private static CommandBean getVendorInvoiceWebCommands(MInvoice invoice) throws OperationException + { + + if (invoice.isSOTrx()) + throw new OperationException("Invoice should be a vendor Invoice"); + + + String[] simpleCommands = new String[0]; + String[] complexCommands = new String[0]; + + CommandBean bean = new CommandBean(); + bean.setSimpleCommand(simpleCommands); + bean.setComplexCommand(complexCommands); + return bean; + } + + private static CommandBean getCustomerInvoiceWebCommands(MInvoice invoice) throws OperationException, DataException + { + + if (!invoice.isSOTrx()) + throw new OperationException("Invoice should be a customer invoice"); + + + String[] simpleCommands = null; + String[] complexCommands = null; + + CommandBean bean = new CommandBean(); + + if (invoice.getDocStatus().equals(DocumentEngine.STATUS_Drafted)) + { + simpleCommands = new String[]{Constants.INVOICE_ACTION_COMPLETE}; + complexCommands = new String[]{Constants.INVOICE_ACTION_CANCEL}; + } + + if (invoice.getDocStatus().equals(DocumentEngine.STATUS_Voided)) + { + complexCommands = new String[]{Constants.INVOICE_ACTION_DELETE}; + } + + if (invoice.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + { + bean = getCIWebCommands(invoice); + return bean; + } + + + bean.setSimpleCommand(simpleCommands); + bean.setComplexCommand(complexCommands); + return bean; + } + + public static CommandBean getCIWebCommands(MInvoice invoice) throws OperationException, DataException + { + MOrder order = new MOrder(invoice.getCtx(), invoice.getC_Order_ID(), null); + + int[] docTypes = MDocType.getAllIDs(MDocType.Table_Name, " ad_client_id="+ Env.getAD_Client_ID(invoice.getCtx()) + " and DOCSUBTYPESO='" + MDocType.DOCSUBTYPESO_POSOrder+ "'", null ); + + String simpleCommands[] = null; + String complexCommands[] = null; + + //POS order + if (order.getC_DocType_ID() == docTypes[0]) + { + simpleCommands = new String[]{}; + complexCommands = new String[]{}; + } + + if (invoice.isPaid() && (!MinOutManager.isShipped(invoice.getCtx(), invoice))) + { + int[] shipmentIds = MInOut.getAllIDs(MInOut.Table_Name, "c_invoice_id=" + invoice.get_ID(), null); + + if (shipmentIds.length == 0) + simpleCommands = new String[]{Constants.MINOUT_ACTION_SHIP}; + else + if (shipmentIds.length > 1) + throw new DataException("This invoice has been shipped more than once!"); + + } + if (!invoice.isPaid() && (!MinOutManager.isShipped(invoice.getCtx(), invoice))) + { + simpleCommands = new String[] {Constants.INVOICE_ACTION_PAID, Constants.INVOICE_ACTION_PAID_AND_SHIP}; + } + + CommandBean bean = new CommandBean(); + bean.setSimpleCommand(simpleCommands); + bean.setComplexCommand(complexCommands); + + return bean; + } + + public static MInvoice deleteInvoice(Properties ctx, MInvoice invoice) throws OperationException + { + invoice.setIsActive(false); + PoManager.save(invoice); + + return invoice; + } + + public static boolean allOrderLinesInvoiced(Properties ctx, MOrder order) + { + MOrderLine[] lines = order.getLines(); + + MOrderLine line; + for (int i = 0; i < lines.length; i ++) + { + line = lines[i]; + + if (!line.getQtyInvoiced().equals(line.getQtyOrdered())) + return false; + + } + + return true; + } + + public static MInvoice voidInvoice(Properties ctx, MInvoice invoice) throws OperationException + { + + if (!invoice.isSOTrx()) + throw new OperationException("Only voiding of customer invoice is currently supported."); + + if (!invoice.getDocStatus().equals(DocumentEngine.STATUS_Drafted)) + throw new OperationException("The system only supports voiding of DRAFTED Invoice."); + + //we need to force void here because invoice has already been processed + //invoice.isProcessed=true + forceVoid(ctx, invoice); + + invoice = new MInvoice(ctx, invoice.get_ID(), invoice.get_TrxName()); + + return invoice; + } + + public static void forceVoid(Properties ctx, MInvoice invoice) throws OperationException + { + PreparedStatement pstmt1 = null; + PreparedStatement pstmt2 = null; + + String sql = "update C_Invoice set DOCSTATUS=" + "'" + + DocumentEngine.STATUS_Voided + "'" + + " where AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and C_INVOICE_ID=" + invoice.get_ID(); + + String sql2 = "update C_Invoice set DOCACTION=" + "'" + + DocumentEngine.ACTION_None + "'" + + " where AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and C_INVOICE_ID=" + invoice.get_ID(); + + pstmt1 = DB.prepareStatement(sql,invoice.get_TrxName()); + pstmt2 = DB.prepareStatement(sql2,invoice.get_TrxName()); + + try + { + pstmt1.executeUpdate(); + pstmt2.executeUpdate(); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + pstmt1.close(); + pstmt2.close(); + } + catch (Exception e) + {} + + pstmt1 = null; + pstmt2 = null; + } + + } + + public static int[] getInvoiceIdsForOrder(Properties ctx, int orderId, String trxName) + { + String whereClause = "isACTIVE='Y' and C_Order_ID=" + orderId; + int invoiceIds[] = MInvoice.getAllIDs(MInvoice.Table_Name, whereClause, trxName); + return invoiceIds; + } + + public static MInvoice loadInvoice(Properties ctx, int invoiceId, String trxName) throws OperationException + { + MInvoice invoice = new MInvoice(ctx, invoiceId, trxName); + if(invoice.get_ID() == 0) + throw new OperationException("Could not load invoice with id: " + invoiceId); + + return invoice; + } + public static ArrayList populateInvoiceLines(Properties ctx, MInvoice invoice,boolean abbr) throws OperationException + { + MInvoiceLine [] lines=invoice.getLines(); + MInvoiceLine line; + MProduct product; + // AttributeValuesPair attributeValuesPair; + WebOrderLineBean orderLineBean; + BigDecimal qty = Env.ZERO; + + + ArrayList orderLines = new ArrayList(); + for (int i = 0; i < lines.length; i++) + { + line = lines[i]; + + product = new MProduct(ctx, line.getM_Product_ID(), null); + + int priceScale = line.getLineNetAmt().scale(); + + orderLineBean = new WebOrderLineBean(); + orderLineBean.setLineNetAmt(line.getLineNetAmt()); + BigDecimal lineTaxAmount = POSManager.getLineTaxAmt(line.getCtx(), line.getLineNetAmt(), line.getC_Tax_ID(),line.getQtyEntered()); + lineTaxAmount = lineTaxAmount.setScale(priceScale, RoundingMode.HALF_UP); + orderLineBean.setTaxAmt(lineTaxAmount); + BigDecimal lineTotalAmount = line.getLineNetAmt().add(orderLineBean.getTaxAmt()); + lineTotalAmount = lineTotalAmount.setScale(priceScale, RoundingMode.HALF_UP); + orderLineBean.setLineTotalAmt(lineTotalAmount); + + orderLineBean.setProductId(Integer.valueOf(line.getM_Product_ID())); + + + if (line.getM_Product_ID() == 0) + { + if(line.getC_Charge_ID() != 0) + { + MCharge charge = ChargeManager.loadCharge(ctx, line.getC_Charge_ID(), null); + orderLineBean.setProductName(charge.getName()); + } + else + throw new OperationException("Unknown Order line type with id: " + line.get_ID()); + } + else + { + if(abbr) + orderLineBean.setProductName(new PrintFormatter().format(product).toString()); + else + orderLineBean.setProductName(product.getName().replaceAll("~"," ")); + orderLineBean.setDescription(product.getDescription()); + } + + orderLineBean.setOrderLineId(Integer.valueOf(line.get_ID())); + orderLineBean.setIsinvoiced(Boolean.valueOf(false)); + orderLineBean.setIsQtyReserved(Boolean.valueOf(true)); + qty= qty.add(line.getQtyEntered()); + orderLineBean.setQtyTotal(qty); + + orderLineBean.setQtyOrdered(line.getQtyEntered()); + orderLineBean.setGrandTotal(invoice.getGrandTotal()); + + + + + orderLines.add(orderLineBean); + + } + + return orderLines; + } + + public static void printInvoice(Properties ctx,MInvoice invoice) throws OperationException + { + PrintManager.print(ctx,ReportEngine.INVOICE,invoice.get_ID()); + } + + /** + * + * @param ctx + * @param dateInvoiced + * @param orgId + * @param bPartnerId + * @param orderId + * @param consolidateDoc + * @param docAction + * @param trx + * @throws InstantiationException + * @throws IllegalAccessException + * @throws ClassNotFoundException + */ + public static void generateInvoices(Properties ctx, Timestamp dateInvoiced, int orgId, + int bPartnerId, int orderId, boolean isConsolidateDoc, String docAction, Trx trx) + throws InstantiationException, IllegalAccessException, ClassNotFoundException + { + String trxName = trx.getTrxName(); + int processId = MProcess.getProcess_ID("C_Invoice_Generate", trxName); + MProcess process = new MProcess(ctx, processId, trxName); + + MPInstance processInstance = new MPInstance(ctx, processId, 0); + processInstance.save(trxName); + + MPInstancePara paramDateInvoiced = new MPInstancePara(processInstance, 10); + paramDateInvoiced.setParameterName("DateInvoiced"); + paramDateInvoiced.setP_Date(dateInvoiced); + paramDateInvoiced.save(trxName); + + MPInstancePara paramOrgId = new MPInstancePara(processInstance, 20); + paramOrgId.setParameterName("AD_Org_ID"); + paramOrgId.setP_Number(orgId); + paramOrgId.save(trxName); + + MPInstancePara paramBPartnerId = new MPInstancePara(processInstance, 30); + paramBPartnerId.setParameterName("C_BPartner_ID"); + paramBPartnerId.setP_Number(bPartnerId); + paramBPartnerId.save(trxName); + + MPInstancePara paramOrderId = new MPInstancePara(processInstance, 40); + paramOrderId.setParameterName("C_Order_ID"); + paramOrderId.setP_Number(orderId); + paramOrderId.save(trxName); + + MPInstancePara paramConsolidateDoc = new MPInstancePara(processInstance, 50); + paramConsolidateDoc.setParameterName("ConsolidateDocument"); + paramConsolidateDoc.setP_String(isConsolidateDoc?"Y":"N"); + paramConsolidateDoc.save(trxName); + + MPInstancePara paramDocAction = new MPInstancePara(processInstance, 60); + paramDocAction.setParameterName("DocAction"); + paramDocAction.setP_String(docAction); + paramDocAction.save(trxName); + + ProcessInfo pi = new ProcessInfo(process.getDescription(), processId); + ProcessInfoParameter piDateInvoiced = new ProcessInfoParameter("DateInvoiced", dateInvoiced, null, null, null); + ProcessInfoParameter piOrgId = new ProcessInfoParameter("AD_Org_ID", orgId, null, null, null); + ProcessInfoParameter piBPartnerId = new ProcessInfoParameter("C_BPartner_ID", bPartnerId, null, null, null); + ProcessInfoParameter piOrderId = new ProcessInfoParameter("C_Order_ID", orderId, null, null, null); + ProcessInfoParameter piConsolidateDoc = new ProcessInfoParameter("ConsolidateDocument", isConsolidateDoc?"Y":"N", null, null, null); + ProcessInfoParameter piDocAction = new ProcessInfoParameter("DocAction", docAction, null, null, null); + + ProcessInfoParameter[] piParameters = new ProcessInfoParameter[]{piDateInvoiced, piOrgId, piBPartnerId, piOrderId, piConsolidateDoc, piDocAction}; + pi.setParameter(piParameters); + pi.setAD_PInstance_ID(processInstance.getAD_PInstance_ID()); + pi.setAD_Process_ID(processInstance.getAD_Process_ID()); + + ProcessManager.startProcess(ctx, InvoiceGenerate.class.getName(), pi, trx); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/LocationManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/LocationManager.java new file mode 100644 index 0000000000..e348fefa1b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/LocationManager.java @@ -0,0 +1,133 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 22-Jul-2005 by alok + * + */ +package org.posterita.businesslogic; + +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MLocation; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + + +public class LocationManager +{ + + + public static MLocation saveLocation(Properties ctx, int orgId, int locationId, String address1,String address2, String postalAddress1, Integer regionId, String city,int countryId, String trxName) throws OperationException + { + MLocation location = null; + + if (locationId == 0) + location = new MLocation(ctx,locationId,trxName); + else + location = loadLocation(ctx, locationId, trxName); + + location.setAddress1(address1); + location.setAddress2(address2); + location.setCity(city); + location.setPostal_Add(postalAddress1); + location.setC_Country_ID(countryId); + location.setAD_Org_ID(orgId); + PoManager.save(location); + + return location; + } + + + public static MLocation createLocation(Properties ctx, int orgId, String address1,String address2, String postalAddress1, String city,int regionId, int countryId, String trxName) throws OperationException + { + MLocation location = new MLocation(ctx,0,trxName); + location.setAD_Org_ID(orgId); + location.setAddress1(address1); + location.setAddress2(address2); + location.setCity(city); + location.setPostal_Add(postalAddress1); + location.setC_Region_ID(regionId); + location.setC_Country_ID(countryId); + PoManager.save(location); + + return location; + } + + public static MLocation editLocation(Properties ctx,int locationId,String address1,String postalAddress1, Integer regionId, String city, String trxName) throws OperationException + { + + if(locationId<=0) + throw new OperationException("Location does not exist"); + + MLocation location; + + try + { + location = new MLocation(ctx,locationId,trxName); + + if(location==null) + throw new OperationException("Location does not exist"); + + + location.setAddress1(address1); + location.setCity(city); + location.setPostal_Add(postalAddress1); + + if(regionId!=null) + location.setC_Region_ID(regionId); + + PoManager.save(location); + + } + catch(OperationException e) + { + throw new OperationException("Could not edit location!!"); + } + + + return location; + + } + + public static MBPartnerLocation createDefaultBPLocation(Properties ctx, MBPartner bpartner) throws OperationException + { + MLocation location = LocationManager.createLocation(ctx, bpartner.getAD_Org_ID(), "","","", "",0, UdiConstants.COUNTRY_MAURITIUS, null); + + + MBPartnerLocation bplocation = new MBPartnerLocation(bpartner); + bplocation.setC_Location_ID(location.get_ID()); + PoManager.save(bplocation); + + bpartner.setPrimaryC_BPartner_Location_ID(bplocation.get_ID()); + PoManager.save(bpartner); + + return bplocation; + } + + public static MLocation loadLocation(Properties ctx, int locationId, String trxName) throws OperationException + { + MLocation location = new MLocation(ctx, locationId, trxName); + if(location.get_ID() == 0) + throw new OperationException("Could not load location with id: " + locationId); + return location; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/LoginManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/LoginManager.java new file mode 100644 index 0000000000..0f2c1ea5a6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/LoginManager.java @@ -0,0 +1,473 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ + +package org.posterita.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; +import java.util.Vector; + +import org.compiere.model.MClient; +import org.compiere.model.MOrg; +import org.compiere.model.MUser; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.WebInfo; +import org.compiere.util.WebUser; +import org.posterita.beans.ChangePasswordBean; +import org.posterita.beans.LoginBean; +import org.posterita.beans.OrgUsersBean; +import org.posterita.beans.UserBean; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.businesslogic.administration.UserManager; +import org.posterita.exceptions.DataException; +import org.posterita.exceptions.DuplicatePINException; +import org.posterita.exceptions.EmailNotFoundException; +import org.posterita.exceptions.InvalidPINException; +import org.posterita.exceptions.InvalidPasswordLengthException; +import org.posterita.exceptions.InvalidRoleException; +import org.posterita.exceptions.NotLoggedInException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.SystemException; +import org.posterita.exceptions.UserInactiveException; +import org.posterita.exceptions.UserNotFoundException; +import org.posterita.exceptions.WrongPasswordException; +import org.posterita.lib.UdiConstants; +import org.posterita.pos.help.POSHelpManager; +import org.posterita.user.WebUserInfo; +import org.posterita.util.PoManager; + + +public class LoginManager +{ + + public WebUser checkLoginPassword(Properties ctx, LoginBean bean) throws UserNotFoundException, UserInactiveException, SQLException, OperationException, NotLoggedInException + { + WebUser wu = get (ctx, bean.getUsername()); + + wu.login(bean.getPassword()); + + // Ensure that the right user id is found in ctx, not the 1 used by compiere cache. + Env.setContext(ctx, "#AD_User_ID", wu.getAD_User_ID()); + setRoleContext(ctx); + + if (!wu.isLoggedIn()) + { + throw new NotLoggedInException(); + } + + return wu; + } + + + public void setRoleContext(Properties ctx) throws SQLException, OperationException + { + ArrayList list = RoleManager.getMyRoles(ctx); + + for (KeyNamePair pair : list) + { + Env.setContext(ctx, "#AD_Role_ID", pair.getKey()); + break; + } + + Env.setContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM, RoleManager.getRoleEditableOrgAccess(ctx)); + Env.setContext(ctx,UdiConstants.ROLE_VIEWABLE_ORGS_CTX_PARAM, RoleManager.getRoleViewableOrgAccess(ctx)); + } + + public WebUserInfo login (Properties ctx, WebUser wu) throws NotLoggedInException, InvalidRoleException, DataException, OperationException, SystemException + { + + WebInfo info = new WebInfo(ctx, wu); + WebUserInfo udiInfo = new WebUserInfo(ctx,wu,info); + +// MRole currentRole = new MRole(ctx, udiInfo.getRoleId().intValue(), null); + + return udiInfo; + } + + public WebUserInfo loginUser(Properties ctx, LoginBean bean) throws UserNotFoundException, UserInactiveException, NotLoggedInException, SQLException, OperationException, InvalidRoleException, DataException, SystemException + { + +// int originalRoleID = UserManager.getOriginalRoleID(ctx); + + MUser user = new MUser(ctx,bean.getUserId().intValue(),null); + + bean.setUsername(user.getName()); + bean.setPassword(user.getPassword()); + WebUser wu = checkLoginPassword(ctx, bean); + + WebUserInfo wuInfo = login(ctx, wu); + + return wuInfo; + } + + public boolean sendPassword(Properties ctx, UserBean bean, String subject, String content) throws SQLException, UserNotFoundException, EmailNotFoundException + { + MUser user = load(ctx, bean.getUsername()); + + if (user == null) + throw new UserNotFoundException(); + + String email = user.getEMail(); + + if (email == null || email.trim().length() == 0) + throw new EmailNotFoundException(); + + content = content + user.getPassword(); + + MClient client = new MClient(ctx,Env.getAD_Client_ID(ctx),null); + + String from = "Support "; + + return POSHelpManager.sendEmail(ctx, from, email, subject, content); + + + } + + + public static void changePassword(Properties ctx, ChangePasswordBean bean, WebUserInfo userInfo) throws WrongPasswordException, OperationException + { + + MUser user = new MUser(ctx, userInfo.getUser().getAD_User_ID(),null); + + String oldPassword = bean.getOldPassword(); + + if (!oldPassword.equals(userInfo.getUser().getPassword())) + throw new WrongPasswordException(); + + String newPassword = bean.getNewPassword(); + + if(newPassword.length()<6) + throw new InvalidPasswordLengthException("The password Should be at least six characters long"); + + + user.setPassword(newPassword); + + PoManager.save(user); + + WebUser webUser = WebUser.get(ctx,user.getEMail(),user.getPassword(), false); + + userInfo.setUser(webUser); + } + + + + protected static MUser load(Properties ctx, String username) throws SQLException + { + MUser m_bpc = null; + String sql = "SELECT * " + + "FROM AD_User " + + "WHERE AD_Client_ID=?" + + " AND Name=?"; + + if (username == null) + username = ""; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sql, null); + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + pstmt.setString(2, username); + + rs = pstmt.executeQuery(); + + if (rs.next()) + { + m_bpc = new MUser (ctx, rs, null); + } + + rs.close(); + + } + catch (SQLException e) + { + throw e; + } + finally + { + try + { + pstmt.close (); + } + catch (Exception e) + { + + } + + pstmt = null; + } + + return m_bpc; + } + + + + private static WebUser get(Properties ctx, String username) throws SQLException, UserNotFoundException, UserInactiveException + { + MUser m_bpc = load(ctx, username); + + if (m_bpc == null) + throw new UserNotFoundException(); + + if (!m_bpc.isActive()) + throw new UserInactiveException(); + + WebUser wu = WebUser.get(ctx, m_bpc.getAD_User_ID()); + + return wu; + } + + public static ArrayList getOrgUsers(Properties ctx) + { + ArrayList orgUsers = new ArrayList(); + Vector users = null; + MOrg org = null; + OrgUsersBean bean = null; + + int ad_client_id = Env.getAD_Client_ID(ctx); + + StringBuffer whereClause = new StringBuffer(""); + whereClause.append(" AD_CLIENT_ID = " + ad_client_id); + whereClause.append(" AND ISACTIVE = 'Y'"); + whereClause.append(" AND ISVISIBLE = 'Y'"); + + + whereClause.append(" ORDER BY NAME"); + + int[] orgIds = MOrg.getAllIDs(MOrg.Table_Name,whereClause.toString(),null); + + for(int i=0; i getAccessibleOrgsKeyNamePair(Properties ctx) throws SQLException + { + int ad_user_id = Env.getAD_User_ID(ctx); + int ad_client_id = Env.getAD_Client_ID(ctx); + + String sql = "select distinct(org.AD_ORG_ID), org.name " + + " from AD_USER_ROLES usrRole, AD_USER usr, AD_ROLE role, AD_ORG org " + + " where org.AD_ORG_ID = role.AD_ORG_ID " + + " and usrRole.AD_USER_ID = usr.AD_USER_ID " + + " and usrRole.AD_ROLE_ID = role.AD_ROLE_ID " + + " and role.AD_CLIENT_ID = ? " + + " and usrRole.AD_USER_ID = ? " + + " order by org.name"; + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = null; + ArrayList orgList = new ArrayList(); + + try + { + pstmt.setInt(1,ad_client_id); + pstmt.setInt(2,ad_user_id); + + rs = pstmt.executeQuery(); + + while(rs.next()) + { + KeyNamePair pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + + orgList.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw e; + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + + } + + + return orgList; + } + + public static ArrayList getUserRolesKeyNamePair(Properties ctx, int ad_org_id) throws SQLException + { + int ad_user_id = Env.getAD_User_ID(ctx); + int ad_client_id = Env.getAD_Client_ID(ctx); + + String sql = "select role.AD_ROLE_ID, role.NAME " + + " from AD_USER_ROLES usrRole, AD_USER usr, AD_ROLE role, AD_ORG org " + + " where org.AD_ORG_ID = role.AD_ORG_ID " + + " and usrRole.AD_USER_ID = usr.AD_USER_ID " + + " and usrRole.AD_ROLE_ID = role.AD_ROLE_ID " + + " and role.AD_CLIENT_ID = ? " + + " and role.AD_ORG_ID = ? " + + " and usrRole.AD_USER_ID = ? " + + " order by role.NAME"; + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = null; + ArrayList roleList = new ArrayList(); + + try + { + pstmt.setInt(1,ad_client_id); + pstmt.setInt(2,ad_org_id); + pstmt.setInt(3,ad_user_id); + + rs = pstmt.executeQuery(); + + while(rs.next()) + { + KeyNamePair pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + + roleList.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw e; + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return roleList; + } + + + + private static String getallOrgsAccess(Properties ctx) throws SQLException + { + String sql = "SELECT o.AD_Org_ID,o.Name,o.IsSummary " // 1..3 + + "FROM AD_Role r, AD_Client c" + + " INNER JOIN AD_Org o ON (c.AD_Client_ID=o.AD_Client_ID OR o.AD_Org_ID=0) " + + "WHERE r.AD_Role_ID=?" // #1 + + " AND c.AD_Client_ID=?" // #2 + + " AND o.IsActive='Y'" + + " AND (r.IsAccessAllOrgs='Y' " + + "OR (r.IsUseUserOrgAccess='N' AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_Role_OrgAccess ra " + + "WHERE ra.AD_Role_ID=r.AD_Role_ID AND ra.IsActive='Y')) " + + "OR (r.IsUseUserOrgAccess='Y' AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_User_OrgAccess ua " + + "WHERE ua.AD_User_ID=? AND ua.IsActive='Y'))" // #3 + + ") " + + "ORDER BY o.Name"; + + String orgIds=""; + PreparedStatement pstmt = null; + new ArrayList(); + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sql, null); + pstmt.setInt(1, Env.getAD_Role_ID(ctx)); + pstmt.setInt(2, Env.getAD_Client_ID(ctx)); + pstmt.setInt(3, Env.getAD_User_ID(ctx)); + rs = pstmt.executeQuery(); + + // load Orgs + while (rs.next()) + { + if(orgIds=="") + orgIds = orgIds+rs.getInt(1)+""; + else + orgIds = orgIds+","+rs.getInt(1)+""; + } + + rs.close(); + } + catch (SQLException ex) + { + throw ex; + } + finally + { + try + { + pstmt.close(); + } + catch (Exception e) + {} + + pstmt = null; + } + + return orgIds; + + } + + public LoginBean getUserNameFromPIN(Properties ctx,String userPIN) throws DuplicatePINException, InvalidPINException + { + String whereClause="AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and USERPIN='"+userPIN+"'"; + + int [] userIds = MUser.getAllIDs(MUser.Table_Name,whereClause,null); + + if(userIds.length>1) + throw new DuplicatePINException("More than one user with same pin"); + if(userIds.length<1) + throw new InvalidPINException("Invalid PIN"); + + MUser user = new MUser(ctx,userIds[0],null); + + LoginBean bean = new LoginBean(); + bean.setUsername(user.getName()); + bean.setPassword(user.getPassword()); + + return bean; + + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/MenuManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/MenuManager.java new file mode 100644 index 0000000000..a0c2d68e31 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/MenuManager.java @@ -0,0 +1,571 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 6, 2005 by alok + **/ +package org.posterita.businesslogic; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.Array; +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.compiere.model.MMenu; +import org.compiere.model.X_U_WebMenu; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.MenuItemBean; +import org.posterita.core.MenuItem; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.SystemException; +import org.posterita.factory.AbstractFactory; +import org.posterita.factory.POSMenuFactory; +import org.posterita.keyname.MenuKeyNamePair; +import org.posterita.model.MWebMenu; +import org.posterita.util.PoManager; + + +public class MenuManager +{ + + public static ArrayList getMenus(Properties ctx, int roleId) throws SystemException, OperationException + { + POSMenuFactory.getFactoryInstance(ctx); + ArrayList menuList = new ArrayList(); + int adRoleId = roleId; + + String sqlStatement = ""; + + sqlStatement = " select m.* " + + " from U_WebMENU m, U_RoleMenu rm " + + " where m.U_WebMenu_ID = rm.U_WebMenu_ID "+ + " and M.isActive='Y'"+ + " and rm.AD_Role_ID = " + adRoleId + +// " and m.AD_Client_ID = " + adClientId + // Menu not dependent on client + " order by m.Sequence, m.U_WebMenu_ID"; + + + PreparedStatement prepStatement = null; + try + { + prepStatement = DB.prepareStatement(sqlStatement, null); + ResultSet rs = prepStatement.executeQuery(); + + + while(rs.next()) + { + MWebMenu menu = new MWebMenu(ctx, rs, null); + + if (!menu.isActive()) + { + menu.setMenuLink("#"); + } + + menuList.add(menu); + } + rs.close(); + + } + catch(SQLException ex) + { + throw new SystemException(ex.getMessage()); + } + finally + { + try + { + prepStatement.close(); + } + catch(Exception e) + { + } + prepStatement = null; + } + return menuList; + } + + public static ArrayList getMenus(Properties ctx) throws SystemException, OperationException + { + int adRoleId = Env.getAD_Role_ID(ctx); + return MenuManager.getMenus(ctx, adRoleId); + } + + public static ArrayList getMenus(Properties ctx, HttpServletRequest request) throws SystemException, OperationException + { + ArrayList menuList = getMenus(ctx); + rewriteMenuURL(menuList, request); + + return menuList; + } + + + public static MenuItem buildMenuTree(Properties ctx, ArrayList menuList) + { + MenuItem rootMenuItem = MenuItem.getDummyMenuItem(ctx); + + Iterator menuIter = menuList.iterator(); + Iterator subIterator; + MWebMenu mMenu; + MWebMenu sMenu; + + + while(menuIter.hasNext()) + { + mMenu = (MWebMenu)menuIter.next(); + + if(mMenu.getParentMenu_ID() == 0) // Parent Menu + { + MenuItem mItem = new MenuItem(mMenu); + rootMenuItem.addSubMenu(mItem); + subIterator = menuList.iterator(); + + while(subIterator.hasNext()) + { + sMenu = (MWebMenu)subIterator.next(); + if(sMenu.getParentMenu_ID() == mMenu.get_ID()) + { + MenuItem sItem = new MenuItem(sMenu); + + String menuLink = sItem.getMenuLink(); + if(! menuLink.startsWith("javascript:")) + { + sItem.setMenuLink(sItem.getMenuLink() + sItem.getMenuId()); + } + + //sItem + mItem.addSubMenu(sItem); + } + } + //if(mItem.hasSubMenu()) + mItem.setMenuLink(mItem.getMenuLink() + mItem.getMenuId()); + } + } + + return rootMenuItem; + } + + public static void saveMenu(Properties ctx, MenuItemBean bean) throws OperationException + { + //when creating a new menu + MWebMenu menu; + if (bean.getMenuId().equals(Integer.valueOf(0))) + { + menu = new MWebMenu(ctx,0,null); + } +// when editing a menu + else + { + menu = new MWebMenu(ctx,bean.getMenuId().intValue(),null); + } + + menu.setIsActive(bean.getIsActive().booleanValue()); + menu.setDescription(bean.getDescription()); + PoManager.save(menu); + } + + public static MWebMenu createParentMenu(Properties ctx, String menuName, String moduleName, int sequence) throws OperationException + { + MWebMenu menu = new MWebMenu(ctx, 0, null); + + menu.setMenuLink("GetMenuItemsAction.do?action=getMenuItems&menuId="); + menu.setModule(moduleName); + menu.setPosition(AbstractFactory.MENU_POSITION_LEFT); + menu.setSequence(new BigDecimal(sequence)); + menu.setName(menuName); + + return menu; + } + + public static MWebMenu createSubMenu(Properties ctx,String menuName, String menuLink, String moduleName, int parentId, int sequence) throws OperationException + { + return createSubMenu(ctx, menuName, menuLink, moduleName, parentId, sequence, null); + } + + public static MWebMenu createSubMenu(Properties ctx,String menuName, String menuLink, String moduleName, int parentId, int sequence, String category) throws OperationException + { + MWebMenu menu = new MWebMenu(ctx, 0, null); + menu.setParentMenu_ID(parentId); + + if(!menuLink.contains("javascript")) + { + if (menuLink.endsWith(".do")) + menuLink = menuLink + "?menuId="; + else + menuLink = menuLink + "&menuId="; + } + + menu.setMenuLink(menuLink); + menu.setModule(moduleName); + menu.setSequence(new BigDecimal(sequence)); + menu.setPosition(AbstractFactory.MENU_POSITION_LEFT); + + menu.setName(menuName); + menu.setCategory(category); + return menu; + } + + + public static ArrayList getMenusForOrganisationType(Properties ctx) throws OperationException + { + + // Creating the menus first. +// MenuFactory factory = MenuFactory.getFactoryInstance(ctx); + + ArrayList menuList = new ArrayList(); + + String sqlStatement = ""; + + sqlStatement = "select * " + + "from U_WEBMENU m where " + //m.AD_Client_ID = " + adClientId + + " m.AD_CLIENT_ID=0"+ + " and m.AD_ORG_ID=0" + + " and m.isactive = 'Y'"; + +// sqlStatement += " and m." + OrganisationManager.getOrganisationSqlStatement(ctx); + + sqlStatement += " order by m.U_WebMenu_ID"; + + System.out.println(sqlStatement); + + PreparedStatement prepStatement = null; + ResultSet rs = null; + try + { + prepStatement = DB.prepareStatement(sqlStatement, null); + rs = prepStatement.executeQuery(); + + while(rs.next()) + { + // setting the link name to be either car / bike + //name = formatMenuName(ctx, name); + + MWebMenu menu = new MWebMenu(ctx, rs, null); + menuList.add(menu); + } + rs.close(); + + } + catch(SQLException ex) + { + throw new OperationException("Could not retrieve menu list with sql: " + sqlStatement, ex); + } + finally + { + + + DB.close(rs, prepStatement); + + rs = null; + prepStatement = null; + } + return menuList; + } + + + public static int[] getDefaultMenus(Properties ctx) throws OperationException + { + String whereClause = "AD_Client_ID=0 and AD_Org_ID=0 "; + whereClause += " and Position='TOP' and ParentMenu_ID is null"; + + int menuIds[] = MWebMenu.getAllIDs(MWebMenu.Table_Name, whereClause, null); + + if(menuIds == null) + throw new OperationException("Could not retrieve Default Menus, Where Clause: " + whereClause); + + return menuIds; + } + + public static int[] getMenuIdForOrganisation(Properties ctx) throws OperationException + { + int adClientId = Env.getAD_Client_ID(ctx); + + String whereClause = "AD_CLIENT_ID=" + adClientId; + + int menuIds[] = MWebMenu.getAllIDs(MWebMenu.Table_Name, whereClause, null); + + return menuIds; + } + + public static int[] getMenuIdForSuperUser(Properties ctx) throws OperationException + { + int adClientId = Env.getAD_Client_ID(ctx); + int adOrgId = Env.getAD_Org_ID(ctx); + + String whereClause = "AD_CLIENT_ID =" + adClientId + " and AD_ORG_ID = " + adOrgId + " and ISSUPERUSER = 'Y'"; + + int menuIds[] = MWebMenu.getAllIDs(MWebMenu.Table_Name, whereClause, null); + + return menuIds; + } + + public static ArrayList getClosableMenus(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + + " and isClosable='Y'"; + //+ filter; + + ArrayList menuKeyNamePairs; + + try + { + menuKeyNamePairs = MenuKeyNamePair.getData(ctx, MWebMenu.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return menuKeyNamePairs; + } + + public static MenuItemBean getMenu(Properties ctx, int menuId) + { + MWebMenu menu = new MWebMenu(ctx, menuId, null); + + MenuItemBean bean = new MenuItemBean(); + bean.setDescription(menu.getDescription()); + bean.setMenuId(menu.get_ID()); + bean.setIsActive(menu.isActive()); + + return bean; + } + + public static MenuItemBean editMenu(Properties ctx, MenuItemBean bean) throws OperationException + { + MWebMenu menu = new MWebMenu(ctx, bean.getMenuId(), null); + menu.setDescription(bean.getDescription()); + menu.setIsActive(bean.getIsActive()); + PoManager.save(menu); + + bean.setName(menu.getName()); + + return bean; + } + + public static int[] getMenus(Properties ctx,String module) + { + int ad_client_id = Env.getAD_Client_ID(ctx); + int ad_org_id = Env.getAD_Org_ID(ctx); + + String whereClause = " and ad_client_id = "+ ad_client_id + + " and ad_org_id = "+ ad_org_id +" and isactive = 'Y'"; + + return MWebMenu.getAllIDs(MWebMenu.Table_Name,whereClause,null); + } + + + public static boolean getRoleMenuAccess(Properties ctx,String role) throws OperationException + { + int id = POSMenuFactory.getFactoryInstance(ctx).get(ctx,role).get_ID(); + + String sql="select AD_ROLE_ID from U_ROLEMENU where U_WEBMENU_ID="+id; + boolean access=false; + int currentRoleId=Env.getAD_Role_ID(ctx); + ResultSet rs = null; + PreparedStatement pstmt = DB.prepareStatement(sql,null); + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + if(rs.getInt(1)==currentRoleId) + { + access=true; + break; + } + + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + return access; + } + + public static int getMenuId(Properties ctx, String key) throws SystemException, OperationException + { + + String sqlStatement = "select u_webmenu_id from u_webmenu where lower(name)='" + key.toLowerCase() + "'"; + int menu_id = 0; + + PreparedStatement prepStatement = null; + try + { + prepStatement = DB.prepareStatement(sqlStatement, null); + ResultSet rs = prepStatement.executeQuery(); + + + if(rs.next()) + { + menu_id = rs.getInt(1); + } + rs.close(); + + } + catch(SQLException ex) + { + throw new SystemException(ex.getMessage()); + } + finally + { + try + { + prepStatement.close(); + } + catch(Exception e) + { + } + prepStatement = null; + } + return menu_id; + } + + public static String getMainMenus(Properties ctx, HttpServletRequest request) + { + ArrayList mainMenuList = (ArrayList) request.getSession().getAttribute(Constants.TOP_MENUS); + String mainMenu = ""; + Integer menuId = 0; + String styleClass = ""; + int count = 0; + + //Check which main menu link has been clicked so as to set style + if(request.getParameter("menuId") != null) + { + menuId = Integer.valueOf(request.getParameter("menuId")); + } + + if(mainMenuList != null) + { + Iterator itr = mainMenuList.iterator(); + StringWriter sw = new StringWriter(); + PrintWriter out = new PrintWriter(sw); + ElementBean elementBean = null; + + while(itr.hasNext()) + { + MenuItem menuItem = (MenuItem) itr.next(); + elementBean = ElementManager.getMsg(ctx, menuItem.getName()); + + if(menuId.compareTo(menuItem.getMenuId()) == 0 || (menuId == 0 && count == 0)) + { + styleClass = "currentpage"; + } + else + { + styleClass = ""; + } + + out.print(""); + + count ++; + } + + out.flush(); + + mainMenu = sw.toString(); + request.getSession().setAttribute(Constants.MAIN_MENUS, mainMenu); + + } + + return mainMenu; + } + + /** + * Rewrite all the URLs. Adds session id if not present + * @param menuList + * @param request + */ + public static void rewriteMenuURL(ArrayList menuList, HttpServletRequest request) + { + HttpSession session = request.getSession(); + String sessionID = session.getId(); + + for(MWebMenu menu : menuList) + { + String link = menu.getMenuLink(); + + int index = link.indexOf("?"); + if(index != -1) + { + String part1 = link.substring(0, index); + String part2 = link.substring(index); + + link = part1 + ";jsessionid=" + sessionID + part2; + + menu.setMenuLink(link); + } + } + } + + + public static Boolean isCashSalesAllowed(Properties ctx, int roleId) throws Exception + { + boolean isCashSalesAllowed = false; + ArrayList roleMenus = getMenus(ctx, roleId); + + if(roleMenus != null) + { + Iterator itr = roleMenus.iterator(); + + while(itr.hasNext()) + { + MWebMenu webMenu = (MWebMenu) itr.next(); + + if(webMenu.getName().equalsIgnoreCase("smenu.cash.sales")) + { + isCashSalesAllowed = true; + } + } + } + return isCashSalesAllowed; + } +} + + diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/MinOutManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/MinOutManager.java new file mode 100644 index 0000000000..3a251369e4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/MinOutManager.java @@ -0,0 +1,777 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 08-Jul-2005 by alok + * + */ +package org.posterita.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MDocType; +import org.compiere.model.MInOut; +import org.compiere.model.MInOutConfirm; +import org.compiere.model.MInOutLine; +import org.compiere.model.MInOutLineConfirm; +import org.compiere.model.MInvoice; +import org.compiere.model.MInvoiceLine; +import org.compiere.model.MLocation; +import org.compiere.model.MLocator; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.compiere.model.MOrg; +import org.compiere.model.MProduct; +import org.compiere.model.MWarehouse; +import org.compiere.print.ReportEngine; +import org.compiere.process.DocumentEngine; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.ChangeDocumentStatusBean; +import org.posterita.beans.CommandBean; +import org.posterita.beans.InOutHistoryBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.beans.WebDocumentHeaderBean; +import org.posterita.beans.WebMinOutLineBean; +import org.posterita.core.JulianDate; +import org.posterita.core.UDIMap; +import org.posterita.exceptions.DataException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ShipmentAlreadyExistsException; +import org.posterita.exceptions.TrackingNumberNotfoundException; +import org.posterita.util.PoManager; + +public class MinOutManager extends AbstractDocumentManager +{ + private static final String SHIPMENT_MADE = "Shipment Made"; + + //TODO pass warehouseId in list of arguments + public static MInOut createShipmentFromInvoice(Properties ctx,MInvoice invoice) throws OperationException + { + + + int SOId = invoice.getC_Order_ID(); + + MOrder order = new MOrder(ctx,SOId,invoice.get_TrxName()); + + MInvoiceLine[] lines = invoice.getLines(); + int []orderLineIds = new int[lines.length]; + for(int i=0;i list = new ArrayList(); + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean = new InOutHistoryBean(); + bean.setInOutId(Integer.valueOf(rs.getInt(1))); + bean.setDocumentNo(rs.getString(2)); + bean.setDocStatus(UDIMap.docStatusMap.get(rs.getString(3))); + bean.setDocStatusCode(rs.getString(3)); + bean.setOrderId(Integer.valueOf(rs.getInt(4))); + bean.setDateOrdered(rs.getTimestamp(5)); + bean.setDateMovement(rs.getTimestamp(6)); + bean.setWarehouseId(Integer.valueOf(rs.getInt(7))); + bean.setPoReference(rs.getString(8)); + bean.setInvoiceId(Integer.valueOf(rs.getInt(9))); + bean.setRefInOutId(Integer.valueOf(rs.getInt(10))); + bean.setPartnerName(rs.getString(11)); + bean.setPartnerId(Integer.valueOf(rs.getString(12))); + list.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw e; + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + + return list; + } + + public static ArrayList getShipmentHistory(Properties ctx, String docStatus, Integer partnerId, Integer month, Integer year) throws SQLException + { + return getInOutHistory(ctx,"Y",docStatus,partnerId,month,year); + } + + public static ArrayList getReceiptHistory(Properties ctx, String docStatus, Integer partnerId, Integer month, Integer year) throws SQLException + { + return getInOutHistory(ctx,"N",docStatus,partnerId,month,year); + } + + public static WebDocumentBean getWebMinOutBean(Properties ctx, MInOut minOut) throws OperationException, DataException + { + if (minOut == null) + throw new OperationException("Invalid operation shipment/receipt is null"); + + if (minOut.get_ID() == 0) + throw new OperationException("You have deleted this shipment/receipt. You cannot view this shipment/receipt."); + + WebDocumentBean bean = new WebDocumentBean(); + + bean.setMinOutId(Integer.valueOf(minOut.get_ID())); + + MOrg myOrg = OrganisationManager.getMyOrg(ctx); + MBPartner me = new MBPartner(ctx, myOrg.getLinkedC_BPartner_ID(null), null); + bean.setMe(me); + + //Me Location--------------- + MBPartnerLocation meLocation[] = MBPartnerLocation.getForBPartner(ctx,me.get_ID()); + if (meLocation.length ==0) + throw new OperationException("No location has been set for your organisation. Please ask your administrator to set one for you"); + + MLocation location = new MLocation(ctx, meLocation[0].getC_Location_ID(), null); + + bean.setMeLocation(location); + + //End----------------- + + MBPartner you = new MBPartner(ctx, minOut.getC_BPartner_ID(), null); + bean.setYou(you); + + + //You Location------------ + MBPartnerLocation youBPLocation[] = MBPartnerLocation.getForBPartner(ctx, you.get_ID()); + + if (youBPLocation.length ==0) + throw new OperationException("No location has been set for the dealer organisation. Please ask your administrator to set one for you"); + + MLocation youLocation = new MLocation(ctx, youBPLocation[0].getC_Location_ID(), null); + + bean.setYoubpLocation(youBPLocation[0]); + bean.setYouLocation(youLocation); + + bean.setLines(getWebMinOutLines(ctx, minOut)); + + WebDocumentHeaderBean headerBean = createWebDocumentHeader(ctx, minOut.getAD_Org_ID(),minOut.getC_BPartner_ID(), minOut.getDocStatus(), minOut.isSOTrx(),null); + headerBean.setDocumentHeader(getDocumentHeader(minOut)); + + MDocType doctype = new MDocType(ctx, minOut.getC_DocType_ID(), null); + headerBean.setDocumentTitle(doctype.getName()); + bean.setHeaderBean(headerBean); + + bean.setMinOut(minOut); + + + MInvoice invoice = new MInvoice(ctx, minOut.getC_Invoice_ID(), null); + bean.setInvoice(invoice); + + CommandBean cmdBean = getShipmenttWebCommands(minOut); + + bean.setSimpleCommand(cmdBean.getSimpleCommand()); + bean.setComplexCommand(cmdBean.getComplexCommand()); + + return bean; + } + + public static String getDocumentHeader(MInOut minOut) + { + if (minOut.isSOTrx()) + return SHIPMENT_MADE; + + return SHIPMENT_MADE; + } + + public static ArrayList getMinOutLines(Properties ctx, MInOut inOut) throws OperationException + { + MInOutLine lines[] = inOut.getLines(); + + MInOutLine line; + WebMinOutLineBean inOutLine; + MProduct product; + ArrayList inOutLines = new ArrayList(); + for (int i = 0; i < lines.length; i++) + { + line = lines[i]; + inOutLine = new WebMinOutLineBean(); + product = new MProduct(ctx, line.getM_Product_ID(), null); + inOutLine.setAttributeValuesPair(AttributeValuesManager.retrieveAttributeValues(ctx, product.getM_AttributeSetInstance_ID())); + inOutLine.setSerno(getSerno(ctx,line.getM_AttributeSetInstance_ID())); + inOutLine.setQtyOrdered(line.getMovementQty()); + inOutLines.add(inOutLine); + } + + return inOutLines; + } + + public static ArrayList getWebMinOutLines(Properties ctx, MInOut inOut) throws OperationException + { + MInOutLine lines[] = inOut.getLines(); + + MInOutLine line; + WebMinOutLineBean inOutLine; + MProduct product; + ArrayList inOutLines = new ArrayList(); + for (int i = 0; i < lines.length; i++) + { + line = lines[i]; + + if (line.getM_Product_ID() != 0) + { + inOutLine = new WebMinOutLineBean(); + product = new MProduct(ctx, line.getM_Product_ID(), null); + inOutLine.setProductName(product.getName().replaceAll("~"," ")); + inOutLine.setDescription(product.getDescription()); + inOutLine.setQtyOrdered(line.getQtyEntered()); + + inOutLines.add(inOutLine); + } + } + + return inOutLines; + } + + //get receipt from shipment + public static MInOut getCounterDoc(Properties ctx, int shipmentId, String trxName) + { + MInOut shipment = new MInOut(ctx,shipmentId, trxName); + + if ((shipment == null)||(shipment.get_ID() == 0)) + throw new RuntimeException("no counter document found for shipment----" + shipment.get_ID()); + + if (!shipment.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + throw new RuntimeException("cannot get counter document of shipment which is not completed"); + + + MInOut receipt = new MInOut(ctx, shipment.getRef_InOut_ID(), trxName); + + if ((receipt == null) ||(receipt.get_ID() == 0)) + throw new RuntimeException("no receipt found for shipment"); + + return receipt; + } + + public static MInOut getInitialDoc(Properties ctx, int shipmentId, String trxName) + { + String sql = " AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " and AD_Org_ID=" + Env.getAD_Org_ID(ctx) + " and Ref_InOut_ID=" + shipmentId; + + int minoutIds[] = MInOut.getAllIDs(MInOut.Table_Name, sql, trxName); + + if(minoutIds.length == 0) + throw new RuntimeException("Original shipment doc could not be found!"); + MInOut origInOut = new MInOut(ctx, minoutIds[0], trxName); + + return origInOut; + } + + public static boolean isShipped(Properties ctx, MInvoice invoice) throws OperationException + { + int minOutIds[] = MInOut.getAllIDs(MInOut.Table_Name, " ad_client_id=" + Env.getAD_Client_ID(ctx) + " and c_invoice_id=" + invoice.get_ID(), null); + + if (minOutIds.length == 0) + return false; + + if (minOutIds.length > 1) + throw new OperationException("More than 1 shipment found for invoice " + invoice.get_ID()); + + MInOut minout = new MInOut(ctx, minOutIds[0], null); + + if (!minout.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + return false; + + int refInoutId = minout.getRef_InOut_ID(); + + if (refInoutId == 0) + return false; + + MInOut refInOut = new MInOut(ctx, refInoutId, null); + + if (!refInOut.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + return false; + + return true; + } + + private static CommandBean getShipmenttWebCommands(MInOut inOut) throws OperationException, DataException + { + + String[] simpleCommands = null; + String[] complexCommands = null; + + CommandBean bean = new CommandBean(); + + if (inOut.getDocStatus().equals(DocumentEngine.STATUS_Drafted)) + { + simpleCommands = new String[]{Constants.MINOUT_ACTION_COMPLETE}; + complexCommands =new String[]{Constants.MINOUT_ACTION_CANCEL}; + } + + if (inOut.getDocStatus().equals(DocumentEngine.STATUS_Voided)) + { + complexCommands = new String[]{Constants.MINOUT_ACTION_DELETE}; + } + + + + bean.setSimpleCommand(simpleCommands); + bean.setComplexCommand(complexCommands); + return bean; + } + + public static WebDocumentBean changeMinOutStatus(Properties ctx, MInOut minOut, ChangeDocumentStatusBean bean) throws OperationException, DataException + { + WebDocumentBean webBean = new WebDocumentBean(); + + if(bean.getTrackingNo()==null) + throw new TrackingNumberNotfoundException("Please specify the FexdEx Tracking Number"); + + String submit = bean.getSubmit(); + + if (minOut == null) + { + throw new OperationException("Cannot change the status on an Shipment that does not exist anymore."); + } + + if (submit.equals(Constants.MINOUT_ACTION_COMPLETE)) + { + minOut.setTrackingNo(bean.getTrackingNo()); + PoManager.save(minOut); + minOut = MinOutManager.completeShipment(ctx,minOut); + } + + if (submit.equals(Constants.MINOUT_ACTION_CANCEL)) + { + minOut = forceVoid(ctx, minOut); + } + + if (submit.equals(Constants.MINOUT_ACTION_DELETE)) + { + minOut = deleteInOut(ctx, minOut); + } + + + webBean= MinOutManager.getWebMinOutBean(ctx,minOut); + + return webBean; + } + + + private static MInOut forceVoid(Properties ctx, MInOut inout) throws OperationException + { + PreparedStatement pstmt1 = null; + PreparedStatement pstmt2 = null; + + String sql = "update M_INOUT set DOCSTATUS=" + "'" + + DocumentEngine.STATUS_Voided + "'" + + " where AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and M_INOUT_ID=" + inout.get_ID(); + + String sql2 = "update M_INOUT set DOCACTION=" + "'" + + DocumentEngine.ACTION_None + "'" + + " where AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and M_INOUT_ID=" + inout.get_ID(); + + pstmt1 = DB.prepareStatement(sql,null); + pstmt2 = DB.prepareStatement(sql2,null); + + try + { + pstmt1.executeUpdate(); + pstmt2.executeUpdate(); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + pstmt1.close(); + pstmt2.close(); + } + catch(Exception e) + {} + + pstmt1 = null; + pstmt2 = null; + } + + return inout; + + } + + public static MInOut deleteInOut(Properties ctx, MInOut inOut) throws OperationException + { + inOut.setIsActive(false); + PoManager.save(inOut); + + return inOut; + } + + public static void printInOut(Properties ctx,MInOut inOut) throws OperationException + { + PrintManager.print(ctx,ReportEngine.SHIPMENT,inOut.get_ID()); + } + + public static MInOut loadMInOut(Properties ctx, int minoutId, String trxName) throws OperationException + { + MInOut minout = new MInOut(ctx, minoutId, trxName); + if(minout.get_ID() == 0) + throw new OperationException("Could not load invoice with id: " + minout); + + return minout; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/OrderManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/OrderManager.java new file mode 100644 index 0000000000..7fc44b1ab9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/OrderManager.java @@ -0,0 +1,482 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 8, 2006 by alok + */ + + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MConversionRate; +import org.compiere.model.MDocType; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.compiere.model.MPriceList; +import org.compiere.model.MProduct; +import org.compiere.model.MTax; +import org.compiere.print.ReportEngine; +import org.compiere.process.DocAction; +import org.compiere.process.DocumentEngine; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.CreditCheckBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.businesslogic.administration.TaxManager; +import org.posterita.core.utils.FormatBigDecimal; +import org.posterita.exceptions.BPartnerNoLocationException; +import org.posterita.exceptions.BPartnerOverCreditLimitException; +import org.posterita.exceptions.OperationException; +import org.posterita.order.UDIOrderTypes; +import org.posterita.util.PoManager; + + +public class OrderManager +{ + + public static MOrder createOrder(Properties ctx, int bPartnerId,boolean isSotrx,int priceListId, String orderType, int warehouseId,String paymentRule,String trxName) throws OperationException + { + int terminalId = POSTerminalManager.getTerminalId(ctx); + if (terminalId == 0) + { + throw new OperationException("NO POS Terminal!!!"); + } + + MOrder order = new MOrder(ctx, 0, trxName); + MBPartner bPartner = new MBPartner(ctx, bPartnerId, trxName); + + if(bPartner.getPrimaryC_BPartner_Location_ID() == 0) + throw new BPartnerNoLocationException("Business partner has no location"); + order.setAD_Org_ID(Env.getAD_Org_ID(ctx)); + //order.setC_POS_ID(terminalId); TODO - Trifon; order.setU_POSTerminal_ID(terminalId); + order.setBPartner(bPartner); + order.setC_BPartner_ID(bPartner.get_ID()); + order.setC_BPartner_Location_ID(bPartner.getPrimaryC_BPartner_Location_ID()); + order.setIsSOTrx(isSotrx); + + order.setM_PriceList_ID(priceListId); + + MPriceList priceList = new MPriceList(ctx,priceListId,null); + order.setC_Currency_ID(priceList.getC_Currency_ID()); + order.setDocAction(DocumentEngine.ACTION_Complete); + order.setSalesRep_ID(Env.getAD_User_ID(ctx)); + + if(orderType.equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER_NO_SHIPMENT.getOrderType())) + { + /**because for credit orders, compiere generates shipment + * automatically, so we want a credit order with standard doc type*/ + + order.setC_DocTypeTarget_ID(getDocTypeFromOrderType(ctx, UDIOrderTypes.POS_ORDER.getOrderType(), isSotrx)); + order.setOrderType(UDIOrderTypes.CREDIT_ORDER.getOrderType()); + } + else + { + order.setC_DocTypeTarget_ID(getDocTypeFromOrderType(ctx, orderType, isSotrx)); + order.setOrderType(orderType); + } + + order.setM_Warehouse_ID(warehouseId); + order.setIsDiscountPrinted(true); + if(paymentRule != null) + order.setPaymentRule(paymentRule); + + order.setDateOrdered(new Timestamp(System.currentTimeMillis())); + order.setInvoiceRule(MOrder.INVOICERULE_Immediate); + + PoManager.save(order); + + return order; + } + + public static MOrderLine createOrderLine(Properties ctx,MOrder order,int productId, BigDecimal qty, BigDecimal discount, BigDecimal lineNet) throws OperationException + { + if(qty == null) + { + qty = Env.ONE; + } + + MOrderLine orderLine = new MOrderLine(order); + + MProduct product = new MProduct(ctx,productId, order.get_TrxName()); + MTax tax = TaxManager.getTaxFromCategory(ctx, product.getC_TaxCategory_ID(), order.get_TrxName()); + orderLine.setC_Tax_ID(tax.get_ID()); + orderLine.setC_UOM_ID(product.getC_UOM_ID()); + orderLine.setC_BPartner_ID(order.getC_BPartner_ID()); + // Must set Product Id before quantity Ordered. + orderLine.setM_Product_ID(productId); + orderLine.setQty(qty); + orderLine.setPrice(); + + //Bug fix, set price to 2dp + MPriceList orderPriceList = MPriceList.get(ctx, order.getM_PriceList_ID(), order.get_TrxName()); + + if (!orderPriceList.isTaxIncluded()) + { + BigDecimal taxAmt = tax.calculateTax(lineNet, true, 12); + BigDecimal lineNetWithoutTax = lineNet.subtract(taxAmt); + orderLine.setLineNetAmt(lineNetWithoutTax); + + BigDecimal unitPriceWithoutTax = lineNetWithoutTax.divide(qty, 12, BigDecimal.ROUND_HALF_DOWN); + + orderLine.setPriceEntered(unitPriceWithoutTax.setScale (2, BigDecimal.ROUND_HALF_UP)); + orderLine.setPriceActual(unitPriceWithoutTax.setScale (2, BigDecimal.ROUND_HALF_UP)); + } + else + { + BigDecimal unitPrice = lineNet.divide(qty, 12, BigDecimal.ROUND_HALF_DOWN); + orderLine.setLineNetAmt(lineNet.setScale (2, BigDecimal.ROUND_HALF_UP)); + orderLine.setPriceEntered(unitPrice.setScale (2, BigDecimal.ROUND_HALF_UP)); + orderLine.setPriceActual(unitPrice.setScale (2, BigDecimal.ROUND_HALF_UP)); + } + + if (discount.doubleValue() != 0.0) + { + orderLine.setDiscount(); + } + + PoManager.save(orderLine); + + return orderLine; + } + + public static BigDecimal getLineTaxAmtAfterDis(BigDecimal amt,BigDecimal rate) + { + return new BigDecimal (amt.doubleValue()/(100+rate.doubleValue())*100); + } + + public static MOrder completeOrder(Properties ctx,MOrder order) throws BPartnerOverCreditLimitException,OperationException + { + if(order.isSOTrx()==true) + { + CreditCheckBean crBean = OrderManager.checkBPartnerCreditLimit(ctx,order.getC_BPartner_ID(),order.get_ID(),order.get_TrxName()); + if(crBean.getValid()==false) + throw new BPartnerOverCreditLimitException(crBean.getMsg()); + } + + PoManager.processIt(order, DocumentEngine.ACTION_Complete); + + return order; + } + + static BigDecimal calculateActualPrice(Properties ctx,BigDecimal listPrice, BigDecimal discount) throws OperationException + { + double actualPrice; + double div = (discount.doubleValue()/100)*listPrice.doubleValue(); + actualPrice=listPrice.doubleValue()-(div); + + BigDecimal formattedBigDecimal = FormatBigDecimal.currency(actualPrice); + + return formattedBigDecimal; + } + + public static int getDocTypeFromOrderType(Properties ctx,String orderType, Boolean isSotrx) throws OperationException + { + + MDocType[] docBaseTypes; + + if(orderType.equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType())) + { + + return getDocTypeIDForStandardOrder(ctx); + } + + if(orderType.equalsIgnoreCase(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())) + { + return getDocTypeIDForCustomerReturnOrder(ctx,isSotrx); + } + + + if(orderType.equalsIgnoreCase(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType())) + { + docBaseTypes = MDocType.getOfDocBaseType(ctx, MDocType.DOCBASETYPE_APCreditMemo); + if (docBaseTypes.length > 1) + throw new OperationException("Expected one document type for AP Credit Memo but got more than 1"); + + return docBaseTypes[0].get_ID(); + } + + + if(orderType.equalsIgnoreCase(UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType())) + { + docBaseTypes = MDocType.getOfDocBaseType(ctx, MDocType.DOCBASETYPE_PurchaseOrder); + + for(int i=0; i 1) + throw new OperationException("Expected one document type for Standard order but got more than 1"); + + return docTypes[0]; + } + + public static int getDocTypeIDForCreditOrder(Properties ctx) throws OperationException + { + int [] docTypes = MDocType.getAllIDs(MDocType.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and DOCSUBTYPESO='"+MDocType.DOCSUBTYPESO_OnCreditOrder+"'",null); + if (docTypes.length > 1) + throw new OperationException("Expected one document type for Credit order but got more than 1"); + + return docTypes[0]; + } + + public static int getDocTypeIDForCustomerReturnOrder(Properties ctx, Boolean isSotrx) throws OperationException + { + char sotrx = ' '; + + if (isSotrx.equals(true)) + { + sotrx = 'Y'; + } + else + { + sotrx = 'N'; + } + + int [] docTypes = MDocType.getAllIDs(MDocType.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and DOCSUBTYPESO='"+MDocType.DOCSUBTYPESO_ReturnMaterial+"' and isSotrx='"+sotrx+"'",null); + if (docTypes.length > 1) + throw new OperationException("Expected one document type for Return Material but got more than 1"); + + return docTypes[0]; + } + + public static int[] getAllOrderlineIDs(Properties ctx,int orderId,String trxName) + { + String whereClause = "" + + " C_ORDER_ID =" + orderId + + " AND AD_CLIENT_ID =" + Env.getAD_Client_ID(ctx) + + " AND ISACTIVE = 'Y'"; + + return MOrderLine.getAllIDs(MOrderLine.Table_Name,whereClause,trxName); + } + + /** + * Checks the order to see whether it has some orderlines + * @return true if empty else false is returned + */ + public static boolean isOrderEmpty(Properties ctx,int orderId,String trxName) + { + int[] orderlineIDs = getAllOrderlineIDs(ctx,orderId,trxName); + + if(orderlineIDs==null||orderlineIDs.length==0) + { + return true; + } + + return false; + } + + public static MOrder prepareOrder(Properties ctx,int orderId,String trxName) throws OperationException + { + MOrder order = new MOrder(ctx,orderId,trxName); + order.processIt(DocumentEngine.ACTION_Prepare); + return order; + } + + public static MOrder loadOrder(Properties ctx, int orderId, String trxName) throws OperationException + { + MOrder order = new MOrder(ctx, orderId, trxName); + + if(order.get_ID() == 0) + throw new OperationException("Could not load order with id: " + orderId); + + return order; + } + + + public static void deleteDraftedOrder(Properties ctx, int orderId, String trxName) throws OperationException + { + MOrder order = loadOrder(ctx, orderId, trxName); + deleteDraftedOrder(ctx, order); + } + + + public static void deleteDraftedOrder(Properties ctx, MOrder order) throws OperationException + { + if(order.isProcessed()) + throw new OperationException("Cannot delete order that is already processed"); + + if(!order.getDocStatus().equals(DocAction.STATUS_Drafted)) + throw new OperationException("The order is not a drafted order"); + + deleteOrder(ctx, order); + } + + private static void deleteOrder(Properties ctx, MOrder order) throws OperationException + { + if(order == null) + throw new OperationException("Order cannot be null"); + + if(order.isProcessed()) + throw new OperationException("Cannot delete order that is already processed"); + + if(!order.delete(true)) + throw new OperationException("Could not delete order"); + } + + /** + * Deletes all the orderlines from the order + * @param ctx + * @param order the order + * @param trxName + * @throws OperationException + */ + public static void deleteOrderlines(Properties ctx, MOrder order, String trxName) throws OperationException + { + boolean isEmpty = OrderManager.isOrderEmpty(ctx, order.get_ID(), trxName); + + if(isEmpty) + { + return; + } + + //checks the status of the order + if(order.isProcessed()) + { + throw new OperationException("Cannot delete order that is already processed"); + } + + String sql = "delete from C_ORDERLINE where C_ORDER_ID = " + order.get_ID(); + + int no = DB.executeUpdate(sql, trxName); + + if (no == -1) + { + throw new OperationException("Could not delete order lines"); + } + + }//deleteOrderlines + + + public static void rePrintOrder(Properties ctx,int orderId) throws OperationException + { + PrintManager.printOrder(ctx, orderId, null); + } + + public static void printOrder(Properties ctx,MOrder order) throws OperationException + { + if(order.getOrderType().equals(UDIOrderTypes.POS_ORDER.getOrderType())) + { + PrintManager.openCashDrawer(ctx); + } + PrintManager.printOrder(ctx, order.get_ID(), null); + } + + public static void printOrder(Properties ctx,MOrder order,OrderLineBean bean) throws OperationException + { + if(order.getOrderType().equals(UDIOrderTypes.POS_ORDER.getOrderType())) + { + PrintManager.openCashDrawer(ctx); + } + PrintManager.print(ctx,ReportEngine.ORDER,order.get_ID(),bean); + } + + public static CreditCheckBean checkBPartnerCreditLimit(Properties ctx,int bPartnerId,int orderId, String trxName) + { + MBPartner bp = new MBPartner(ctx,bPartnerId,trxName); + String m_processMsg=null; + + MOrder order = new MOrder(ctx,orderId,trxName); + CreditCheckBean bean= new CreditCheckBean(); + + boolean valid = true; + + if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus())) + { + valid = false; + + m_processMsg = "BPartnerCreditStop - TotalOpenBalance= " + + bp.getTotalOpenBalance() + + ", CreditLimit= " + bp.getSO_CreditLimit(); + } + if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus())) + { + valid = false; + + m_processMsg = "BPartnerCreditHold - TotalOpenBalance= " + + bp.getTotalOpenBalance() + + ", CreditLimit= " + bp.getSO_CreditLimit(); + } + + BigDecimal grandTotal = MConversionRate.convertBase(ctx, + order.getGrandTotal(),order.getC_Currency_ID(), order.getDateOrdered(), + order.getC_ConversionType_ID(), Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx)); + + if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(grandTotal))) + { + valid = false; + + m_processMsg = "BPartnerOverCreditHold - TotalOpenBalance= " + + bp.getTotalOpenBalance() + ", GrandTotal = " + order.getGrandTotal() + + ", CreditLimit= " + bp.getSO_CreditLimit(); + } + + if (MBPartner.SOCREDITSTATUS_NoCreditCheck.equals(bp.getSOCreditStatus())) + { + valid = true; + + m_processMsg = "BPartnerCreditHold - TotalOpenBalance= " + + bp.getTotalOpenBalance() + + ", CreditLimit= " + bp.getSO_CreditLimit(); + } + + if (MBPartner.SOCREDITSTATUS_NoCreditCheck.equals(bp.getSOCreditStatus(order.getGrandTotal()))) + { + valid = true; + + m_processMsg = "BPartnerOverCreditHold - TotalOpenBalance= " + + bp.getTotalOpenBalance() + ", GrandTotal = " + order.getGrandTotal() + + ", CreditLimit= " + bp.getSO_CreditLimit(); + } + bean.setValid(valid); + bean.setMsg(m_processMsg); + return bean; + } + +} + diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/OrderReferenceManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/OrderReferenceManager.java new file mode 100644 index 0000000000..aab150597c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/OrderReferenceManager.java @@ -0,0 +1,356 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 28-Jun-2005 by alok + * + */ +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.model.I_C_CashLine; +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MCharge; +import org.compiere.model.MCurrency; +import org.compiere.model.MInvoice; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.compiere.model.MOrg; +import org.compiere.model.MPayment; +import org.compiere.model.MPriceList; +import org.compiere.model.MPriceListVersion; +import org.compiere.model.MProduct; +import org.compiere.model.MUser; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.AttributeValuesPair; +import org.posterita.beans.WebDocumentBean; +import org.posterita.beans.WebDocumentHeaderBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.core.ChargeManager; +import org.posterita.exceptions.InvalidAddressException; +import org.posterita.exceptions.OperationException; +import org.posterita.order.UDIOrderTypes; + + +public class OrderReferenceManager extends AbstractDocumentManager +{ + + public static final String PURCHASE_ORDER = "Purchase Order"; + public static final String SALES_ORDER = "Sales Order"; + private static final String SO_MATERIAL_RETURN_ORDER = "Material Return Order"; + private static final String PO_MATERIAL_RETURN_ORDER = "Material Return Order"; + + + + public static WebDocumentBean getWebOrderBean(Properties ctx,MOrder order) throws InvalidAddressException,OperationException + { + if (order == null) + throw new OperationException("Invalid operation order is null"); + + if (order.get_ID() == 0) + throw new OperationException("You have deleted this order. You cannot view this order."); + + WebDocumentBean bean = new WebDocumentBean(); + + bean.setOrderId(Integer.valueOf(order.get_ID())); + bean.setDescription(order.getDescription()); + + int currencyId = order.getC_Currency_ID(); + MCurrency currency = new MCurrency(ctx,currencyId,null); + bean.setCurrencySymbole(currency.getCurSymbol()); + + + + MOrg myOrg = OrganisationManager.getMyOrg(ctx); + + MBPartner me = null; + + + me = BPartnerManager.getCreateLinkedBPartner(ctx, myOrg, null); + + MOrg orderOrg = new MOrg(ctx, order.getAD_Org_ID(), null); + + + MBPartnerLocation meLocations[] = MBPartnerLocation.getForBPartner(ctx,me.get_ID()); + + MLocation meLocation = null; + + if (meLocations.length == 0) + { + MBPartnerLocation meBPLocation = LocationManager.createDefaultBPLocation(ctx, me); + meLocation = new MLocation(ctx, meBPLocation.getC_Location_ID(), null); + } + else + meLocation = new MLocation(ctx, meLocations[0].getC_Location_ID(), null); + + MBPartner you = new MBPartner(ctx, order.getC_BPartner_ID(), null); + + MBPartnerLocation youBPLocations[] = MBPartnerLocation.getForBPartner(ctx, you.get_ID()); + MBPartnerLocation youBPLocation = null; + + if (youBPLocations.length==0) + youBPLocation = LocationManager.createDefaultBPLocation(ctx, you); + else + youBPLocation = youBPLocations[0]; + + MLocation youLocation = new MLocation(ctx, youBPLocation.getC_Location_ID(), null); + + ArrayList webOrderLines = getWebOrderLines(order); + bean.setLines(webOrderLines); + + bean = calculateOrderTotals(webOrderLines, bean); + + WebDocumentHeaderBean headerBean=null; + + + bean.setYouLocation(youLocation); + bean.setYou(you); + bean.setMeLocation(meLocation); + bean.setMe(me); + bean.setYoubpLocation(youBPLocation); + + String paymentRule=null; + if(order.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + paymentRule=Constants.PAYMENT_RULE_CASH; + else if + (order.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_Check)) + paymentRule=Constants.PAYMENT_RULE_CHEQUE; + else if + (order.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_CreditCard)) + paymentRule=Constants.PAYMENT_RULE_CARD; + else if + (order.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_DirectDebit)) + paymentRule=Constants.PAYMENT_RULE_CARD; + else if + (order.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_OnCredit)) + paymentRule=Constants.PAYMENT_RULE_CREDIT; + else + paymentRule=Constants.PAYMENT_RULE_MIXED; + + + headerBean = createWebDocumentHeader(ctx, order.getAD_Org_ID(),order.getC_BPartner_ID(), order.getDocStatus(), order.isSOTrx(),paymentRule); + + + + bean.setHeaderBean(headerBean); + + String isPaid = isPaid(ctx, order.getC_Order_ID(), null); + bean.setIsPaid(isPaid); + + //load the order again + order = new MOrder(ctx, order.getC_Order_ID(), null); + bean.setOrder(order); + headerBean.setDocumentHeader(getOrderHeader(order)); + + int salesRepId = order.getSalesRep_ID(); + MUser salesRep = new MUser(ctx, salesRepId, null); + bean.setSalesRep(salesRep.getName()); + + + return bean; + } + + private static String isPaid(Properties ctx, int orderId, String trxName) + { + int[] paymentIds = MPayment.getAllIDs(MPayment.Table_Name, "c_order_id=" + orderId, trxName); + + if (paymentIds.length == 0) + return Constants.NO_CHAR; + + MPayment payment = new MPayment(ctx, paymentIds[0], trxName); + + if (payment.getDocStatus().equals(MPayment.DOCSTATUS_Completed)) + return Constants.YES_CHAR; + else + return Constants.NO_CHAR; + } + + + /* + * calculates totals for tax, lines and grand total + * returns rounded figures to 2 d.p + */ + private static WebDocumentBean calculateOrderTotals(ArrayList webOrderLineList, WebDocumentBean webOrderLineBean) + { + Iterator iter = webOrderLineList.iterator(); + + WebOrderLineBean bean; + + BigDecimal totalLines = new BigDecimal(0); + BigDecimal totalTax = new BigDecimal(0); + BigDecimal grandTotal; + + BigDecimal roundedTotalLines; + BigDecimal roundedTotalTax; + BigDecimal roundedGrandTotal; + while(iter.hasNext()) + { + bean = (WebOrderLineBean) iter.next(); + BigDecimal lineNetAmt = bean.getLineNetAmt() == null?Env.ZERO:bean.getLineNetAmt(); + BigDecimal taxAmt = bean.getTaxAmt() == null? Env.ZERO:bean.getTaxAmt(); + BigDecimal discountAmt = bean.getDiscountAmt() == null?Env.ZERO:bean.getDiscountAmt(); + BigDecimal writeOffAmt = bean.getWriteOffAmt() == null?Env.ZERO:bean.getWriteOffAmt(); + totalLines = totalLines.add(lineNetAmt).subtract(discountAmt).subtract(writeOffAmt); + totalTax = totalTax.add(taxAmt); + } + + grandTotal = totalLines.add(totalTax); + + + roundedTotalLines = round(totalLines, 2); + roundedTotalTax = round(totalTax, 2); + + roundedGrandTotal = round(grandTotal, 2); + + webOrderLineBean.setTotalLines(roundedTotalLines); + webOrderLineBean.setTotalTax(roundedTotalTax); + webOrderLineBean.setGrandTotal(roundedGrandTotal); + + return webOrderLineBean; + } + + private static BigDecimal round(BigDecimal number, int decimalPlaces) + { + BigDecimal roundedNumber = number.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP); + + return roundedNumber; + } + + private static String getOrderHeader(MOrder order) throws OperationException + { + return getMaterialReturnOrderHeader(order); + } + + private static String getMaterialReturnOrderHeader(MOrder order) + { + if (order.isSOTrx()) + return SO_MATERIAL_RETURN_ORDER; + + return PO_MATERIAL_RETURN_ORDER; + } + + + + + + public static ArrayList populateOrderLines(Properties ctx, MOrderLine[] lines, MOrder order) throws OperationException + { + MOrderLine line; + MProduct product; + AttributeValuesPair attributeValuesPair; + WebOrderLineBean orderLineBean; + ArrayList orderLines = new ArrayList(); + + int priceListId = order.getM_PriceList_ID();/*Env.getContextAsInt(ctx,UdiConstants.PRICELIST_CTX_PARAM);*/ + int priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null); + + MPriceListVersion priceListVersion = new MPriceListVersion(ctx, priceListVersionId, null); + MPriceList priceList = new MPriceList(ctx, priceListVersion.getM_PriceList_ID(), null); + MCurrency currency = new MCurrency(ctx, priceList.getC_Currency_ID(), null); + + for (int i = 0; i < lines.length; i++) + { + line = lines[i]; + + product = new MProduct(ctx, line.getM_Product_ID(), null); + attributeValuesPair = AttributeValuesManager.retrieveAttributeValues(ctx, product.getM_AttributeSetInstance_ID()); + orderLineBean = new WebOrderLineBean(); + orderLineBean.setAttributeValuesPair(attributeValuesPair); + + + orderLineBean.setQtyOrdered(line.getQtyOrdered()); + orderLineBean.setPriceActual(line.getPriceActual()); + BigDecimal roundedLineNetAmount = round(line.getLineNetAmt(), 2); + orderLineBean.setLineNetAmt(roundedLineNetAmount); + + //line tax amount + if (UDIOrderTypes.WEBSTORE_ORDER.getOrderType().equals(order.getOrderType())) + { + orderLineBean.setTaxAmt(new BigDecimal(0)); + + if (line.getM_Product_ID() == 0) + { + if(line.getC_Charge_ID() != 0) + { + MCharge charge = ChargeManager.loadCharge(ctx, line.getC_Charge_ID(), null); + orderLineBean.setDescription(charge.getName()); + } + else + throw new OperationException("Unknown Order line type with id: " + line.get_ID()); + } + else + orderLineBean.setDescription(ProductManager.getProductName(ctx, line.getM_Product_ID())); + } + else + { + BigDecimal lineTaxAmount = getLineTaxAmt(line.getCtx(), line.getLineNetAmt(), line.getC_Tax_ID(), line.get_ID()); + BigDecimal roundedTaxAmount = round(lineTaxAmount, 2); + orderLineBean.setTaxAmt(roundedTaxAmount); + } + + + BigDecimal lineTotalAmount = line.getLineNetAmt().add(orderLineBean.getTaxAmt()); + BigDecimal roundedLineTotalAmount = round(lineTotalAmount, 2); + + orderLineBean.setLineTotalAmt(roundedLineTotalAmount); + + orderLineBean.setProductId(Integer.valueOf(line.getM_Product_ID())); + orderLineBean.setOrderLineId(Integer.valueOf(line.get_ID())); + orderLineBean.setIsinvoiced(Boolean.valueOf(false)); + orderLineBean.setIsQtyReserved(Boolean.valueOf(true)); + + orderLineBean.setCurrency(currency.getCurSymbol()); + + + if (line.getQtyInvoiced()!= null) + if (line.getQtyInvoiced().intValue() > 1) + orderLineBean.setIsinvoiced(Boolean.valueOf(true)); + + if(line.getQtyReserved()!=null) + if(line.getQtyReserved().equals(new BigDecimal(0))) + orderLineBean.setIsQtyReserved(Boolean.valueOf(false)); + + orderLineBean.setSerno(getSerno(ctx, line.getM_AttributeSetInstance_ID())); + + + orderLines.add(orderLineBean); + } + + return orderLines; + } + + + + public static ArrayList getWebOrderLines(MOrder order) throws OperationException + { + ArrayList orderLines = OrderReferenceManager.populateOrderLines(order.getCtx(), order.getLines(true, null), order); + + return orderLines; + } + + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/OrganisationManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/OrganisationManager.java new file mode 100644 index 0000000000..3cd76ef68b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/OrganisationManager.java @@ -0,0 +1,609 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 21-Jun-2005 by alok + * + */ +package org.posterita.businesslogic; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.logging.Level; + +import org.compiere.model.MAcctSchema; +import org.compiere.model.MAttachment; +import org.compiere.model.MAttachmentEntry; +import org.compiere.model.MBPartner; +import org.compiere.model.MBank; +import org.compiere.model.MBankAccount; +import org.compiere.model.MCashBook; +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MOrgInfo; +import org.compiere.model.MUser; +import org.compiere.model.MWarehouse; +import org.compiere.print.MPrintFormatItem; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.Constants; +import org.posterita.beans.OrgBean; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.WarehouseManager; +import org.posterita.businesslogic.core.AccountingManager; +import org.posterita.businesslogic.core.AttachmentManager; +import org.posterita.core.CheckDuplicateEntities; +import org.posterita.core.exception.IOOperationException; +import org.posterita.core.utils.IOUtil; +import org.posterita.exceptions.LogoException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.OrganisationAlreadyExistsException; +import org.posterita.exceptions.WarehouseAlreadyExistsException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class OrganisationManager +{ + private static final CLogger logger = CLogger.getCLogger(OrganisationManager.class); + + public static final int COUNTRY_ID = UdiConstants.COUNTRY_MAURITIUS; + + + public static MOrg editOrganisation(Properties ctx, Integer orgId, String orgName, String description, + String address1, String address2, String city, Integer countryId, String postalAddress1, + boolean isActive, String receiptFooterMsg, String trxName) throws OperationException + { + + if(orgId==null) + { + throw new OperationException("Invalid organisation id"); + } + + MOrg mOrg = loadOrganisation(ctx, orgId.intValue(), trxName); + + if (!mOrg.getName().equals(orgName)) + { + if(CheckDuplicateEntities.checkDuplicateName(ctx,orgName,"AD_ORG")) + throw new OrganisationAlreadyExistsException("The Organisation already exists"); + } + + mOrg.setName(orgName); + mOrg.setValue(orgName); + mOrg.setIsActive(isActive); + mOrg.setDescription(description); + // mOrg.setIsVisible(isVisible); + + PoManager.save(mOrg); + + MBPartner bp = new MBPartner(ctx, mOrg.getLinkedC_BPartner_ID(trxName), trxName); + bp.setName(orgName); + bp.setValue(orgName + "_" + orgId); + + PoManager.save(bp); + + MUser user = new MUser(ctx, bp.getPrimaryAD_User_ID(), trxName); + user.setName(orgName); + user.setPassword(orgName); + PoManager.save(user); + + MOrgInfo orgInfo = mOrg.getInfo(); + MLocation location = updateOrCreateLocation(ctx, orgInfo.getC_Location_ID(), orgInfo.getAD_Org_ID(), address1, + address2, postalAddress1, city, countryId, trxName); + + orgInfo.setC_Location_ID(location.get_ID()); + orgInfo.setReceiptFooterMsg(receiptFooterMsg); + + PoManager.save(orgInfo); + orgInfo.set_TrxName(trxName); + + return mOrg; + } + + public static MOrg getMyOrg(Properties ctx) throws OperationException + { + return getMyOrg(ctx, null); + } + + + public static MOrg getMyOrg(Properties ctx, String trxName) throws OperationException + { + MOrg org = new MOrg(ctx, Env.getAD_Org_ID(ctx), trxName); + + if (org == null) + throw new OperationException("Organisation cannot be resolved"); + + return org; + } + + public static int getLinkedBusinessPartnerID(Properties ctx, int orgId) throws OperationException + { + + MOrg org = new MOrg(ctx, orgId, null); + + return org.getLinkedC_BPartner_ID(null); + + } + + + + public static OrgBean getOrganisation(Properties ctx, int orgId) throws OperationException + { + OrgBean bean = null; + + MOrg mOrg = new MOrg(ctx, orgId, null); + + MOrgInfo orgInfo = mOrg.getInfo(); + if (orgInfo != null) + { + MLocation location = MLocation.get(ctx, orgInfo.getC_Location_ID(), null); + + bean = new OrgBean(); + bean.setOrgId(Integer.valueOf(mOrg.get_ID())); + bean.setOrgName(mOrg.getName()); + bean.setCity(location.getCity()); + bean.setPostalAddress(location.getPostal_Add()); + bean.setAddress1(location.getAddress1()); + bean.setAddress2(location.getAddress2()); + bean.setRegion(location.getRegionName()); + bean.setIsActive(Boolean.valueOf(mOrg.isActive())); + bean.setReceiptFooterMsg(orgInfo.getReceiptFooterMsg()); + } + return bean; + } + + public static void deactivateOrganisation(Properties ctx, int orgId) throws OperationException + { + MOrg mOrg = new MOrg(ctx,orgId,null); + + if(mOrg==null) + throw new OperationException("Organisation does not exist"); + + mOrg.setIsActive(false); + + mOrg.save(); + + } + + public static MOrg getOrgByName(Properties ctx, String orgName, String trxName) throws OperationException + { + int orgIds[] = MOrg.getAllIDs(MOrg.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and name='" + orgName + "'", trxName); + + if (orgIds.length == 0) + throw new OperationException("Org not found" + orgName); + + return new MOrg(ctx, orgIds[0], trxName); + } + + + public static MOrg loadOrganisation(Properties ctx, int adOrgID, String trxName) throws OperationException + { + MOrg org = new MOrg(ctx, adOrgID, trxName); + if(org.get_ID() == 0) + throw new OperationException("Cannot load Organisation with id: " + adOrgID); + + return org; + } + + public static void uploadLogo(Properties ctx, InputStream inStream, String trxName) throws OperationException + { + byte imageData[] = IOUtil.getByteArray(inStream); + + int adClientId = Env.getAD_Client_ID(ctx); + + String imageName = UdiConstants.PRINTFORMAT_ITEM_LOGO + UdiConstants.IMAGE_EXTENSION; + String whereClause = "AD_Client_ID=" + adClientId + " and Name = '" + UdiConstants.PRINTFORMAT_ITEM_LOGO + "'"; + + int logoPrintFormatItems[] = MPrintFormatItem.getAllIDs(MPrintFormatItem.Table_Name, whereClause, trxName); + for(int i = 0; i < logoPrintFormatItems.length; i++) + { + MPrintFormatItem printFormatItem = new MPrintFormatItem(ctx, logoPrintFormatItems[i], trxName); + AttachmentManager.deleteAvailableAttachment(ctx, MPrintFormatItem.Table_ID, logoPrintFormatItems[i], trxName); + AttachmentManager.addAttachment(ctx, MPrintFormatItem.Table_ID, logoPrintFormatItems[i], imageName, imageData, trxName); + printFormatItem.setImageIsAttached(true); + PoManager.save(printFormatItem); + } + + int adOrgId = Env.getAD_Org_ID(ctx); + + MAttachment attachment = FileAttachmentManager.deleteAvailableAttachmentEntry(ctx, MOrg.Table_ID, adOrgId, imageName, null); + + //TODO Refactor + if(attachment == null) + FileAttachmentManager.addAttachment(ctx, MOrg.Table_ID, adOrgId, imageName, imageData, null); + else + FileAttachmentManager.addAttachmentEntry(ctx, attachment, imageName, imageData, null); + } + + public static byte[] getLogo(Properties ctx, String trxName) throws LogoException + { + int adOrgId = Env.getAD_Org_ID(ctx); + + MAttachment attachment = MAttachment.get(ctx, MOrg.Table_ID, adOrgId); + + if(attachment == null) + throw new LogoException("Could not load logo for Organisation with id: " + adOrgId); + + ArrayList attachmentList = AttachmentManager.getAttachmentEntriesWithPrefix(ctx, attachment, UdiConstants.PRINTFORMAT_ITEM_LOGO, trxName); + + try + { + if(attachmentList.size() == 0) + throw new LogoException("Could not load logo for Organisation with id: " + adOrgId); + else if(attachmentList.size() > 1) + throw new LogoException("Ambiguity in locating organisation logo; " + attachmentList.size() + " possible logos found for Organisation with id: " + adOrgId); + else + return IOUtil.getByteArray(attachmentList.get(0).getInputStream()); + } + catch(IOOperationException ex) + { + throw new LogoException("Could not retrieve logo for organisation with id: " + adOrgId); + } + } + + + + + //----------------------------------------------------------------------------------------------------------------- + /** + * Returns all organisations that match this organisation name or return all organisations if orgName is null. + * + * @return arraylist of organisation beans + * @param ctx ctx + * @param orgName organisation Name to load + * @param trxName transaction name + * @throws OperationException + */ + public static ArrayList getOrganisations(Properties ctx, String orgName, String trxName) throws OperationException + { + ArrayList list = new ArrayList(); + + if (orgName == null) + { + orgName = ""; + } + orgName = orgName.toUpperCase(); + String whereClause = "AD_CLIENT_ID = " + Env.getAD_Client_ID(ctx) + " AND UPPER(NAME) LIKE '%" +orgName + "%'"; + + int[] ids = MOrg.getAllIDs(MOrg.Table_Name, whereClause, trxName); + + for(int id : ids) + { + OrgBean bean = getOrganisation(ctx, id); + list.add(bean); + } + + return list; + } + + /** + * Updates or Creates organisation + * @param ctx ctx + * @param bean organisation bean + * @param trxName transaction name + * + * @return organisation + * @throws OperationException + * @throws WarehouseAlreadyExistsException + */ + public static MOrg updateOrCreateOrganisation(Properties ctx, OrgBean bean, String trxName) throws OperationException, WarehouseAlreadyExistsException + { + Integer ad_org_id = bean.getOrgId(); + MOrg org = null; + String address1 = bean.getAddress1() == null? "" : bean.getAddress1(); + String address2 = bean.getAddress2() == null? "" : bean.getAddress2(); + + if (ad_org_id == null || ad_org_id == 0) + { + + org = createOrganisation(ctx, bean.getOrgName(),bean.getDescription(),bean.getIsActive(), trxName); + + // set org location + MLocation location = LocationManager.createLocation(ctx, org.get_ID(),address1, address2, bean.getPostalAddress(), + bean.getCity(), 0, bean.getCountryId(), trxName); + + // create a linked business partner for that organisation + BPartnerManager.createLinkedBPartner(ctx, org.getAD_Org_ID(), 0, org.getName(), + "", true, true, false, false, location.getAddress1(), + location.getPostal(), location.getCity(), null, location.getC_Country_ID(), trxName); + + // create a sales representative + MBPartner salesRepBPartner = BPartnerManager.createBPartner(ctx, org.get_ID(), + org.getLinkedC_BPartner_ID(trxName), org.getName() + " Sales Rep", " ", + false, false, true, true, location.getAddress1(), location.getPostal(), location.getCity(), + " ", location.getC_Country_ID(), trxName); + MUser salesRepUser = new MUser(ctx, 0, trxName); + salesRepUser.setC_BPartner_ID(salesRepBPartner.get_ID()); + salesRepUser.setName(org.getName() + " " + "Sales Rep"); + PoManager.save(salesRepUser); + + // warehouse with default locators + String warehouseName = org.getName() + " Warehouse"; + MWarehouse warehouse = WarehouseManager.createWarehouse(ctx, org.get_ID(), warehouseName, address1, location.getPostal(), + location.getCity(), location.getC_Region_ID(), location.getC_Country_ID(), trxName); + + // web store + String hostUrl = "http://www." + org.getName() + ".com/"; + StoreManager.createStore(ctx, org.getName(), org.getName()+" pos", org.getAD_Org_ID(), + Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM), + salesRepUser.getAD_User_ID(), warehouse.getM_Warehouse_ID(), "pos", hostUrl, trxName); + + // load orgInfo and set details + MOrgInfo orgInfo = org.getInfo(); + orgInfo.set_TrxName(trxName); + orgInfo.setC_Location_ID(location.getC_Location_ID()); + orgInfo.setM_Warehouse_ID(warehouse.getM_Warehouse_ID()); + orgInfo.setReceiptFooterMsg(bean.getReceiptFooterMsg()); + PoManager.save(orgInfo); + + // cashbook + String cashBookName = org.getName() + " Cash Book"; + MAcctSchema[] acctSchema = MAcctSchema.getClientAcctSchema(ctx, org.getAD_Client_ID()); + int currencyId = acctSchema[0].getC_Currency_ID(); + MCashBook cashBook = CashManager.createCashBook(ctx, org.get_ID(), cashBookName, currencyId, trxName); + + MBPartner defCashBPartner = BPartnerManager.saveBPartner(ctx, org.getAD_Org_ID(), 0, org.getLinkedC_BPartner_ID(trxName), + org.getName() + " Standard Customer", " ", true, false, false, false, " ", " ", + location.getPostal(), location.getC_Region_ID(),location.getCity(), "", "", "", location.getC_Country_ID(), + true, true, trxName); + + MBank bank = new MBank(ctx, 0, trxName); + bank.setAD_Org_ID(org.getAD_Org_ID()); + bank.setName(org.getName() + " Bank"); + bank.setRoutingNo("123456789"); + bank.setC_Location_ID(orgInfo.getC_Location_ID()); + PoManager.save(bank); + + MBankAccount bankAccount = new MBankAccount(ctx, 0, trxName); + bankAccount.setAD_Org_ID(org.getAD_Org_ID()); + bankAccount.setC_Bank_ID(bank.get_ID()); + bankAccount.setBankAccountType(MBankAccount.BANKACCOUNTTYPE_Checking); + bankAccount.setC_Currency_ID(currencyId); + bankAccount.setAccountNo("123456789"); + bankAccount.setIsDefault(true); + PoManager.save(bankAccount); + + } + + else + { + org = editOrganisation(ctx, ad_org_id, bean.getOrgName(), bean.getDescription(), address1, address2, bean.getCity(), + bean.getCountryId(), bean.getPostalAddress(), bean.getIsActive(), bean.getReceiptFooterMsg(), trxName); + } + + return org; + } + + + private static MOrg createOrganisation(Properties ctx, String orgName, + String description, Boolean isActive,String trxName) throws OperationException + { + + MOrg org = new MOrg(ctx,0,trxName); + org.setName(orgName); + org.setIsActive(isActive); + org.setDescription(description); + PoManager.save(org); + + return org; + } + + public static void activateOrganisation(Properties ctx, OrgBean bean, String trxName) throws OperationException + { + int ad_org_id = bean.getOrgId(); + + MOrg org = MOrg.get(ctx, ad_org_id); + + boolean isActive = org.isActive(); + org.setIsActive(!isActive); + + PoManager.save(org); + } + + public static MLocation updateOrCreateLocation(Properties ctx,Integer locationId, Integer orgId, String address1, + String address2, String postalAddress1,String city,int countryId, String trxName) throws OperationException + { + MLocation location = new MLocation(ctx,locationId,trxName); + location.setAD_Org_ID(orgId); + location.setAddress1(address1); + location.setAddress2(address2); + location.setCity(city); + location.setPostal_Add(postalAddress1); + location.setC_Country_ID(countryId); + PoManager.save(location); + + return location; + } + public static ArrayList getAllOrgPairs(Properties ctx, String trxName) + { + ArrayList pairList = new ArrayList(); + + int clientId = Env.getAD_Client_ID(ctx); + + int[] orgIds = MOrg.getAllIDs(MOrg.Table_Name, "ad_client_id=" + clientId, trxName); + + for (int i = 0; i < orgIds.length; i++) + { + MOrg org = MOrg.get(ctx, orgIds[i]); + KeyNamePair pair = org.getKeyNamePair(); + pairList.add(pair); + } + + return pairList; + } + + public static ArrayList getUserOrgPairs(Properties ctx) + { + return getUserOrgPairs(ctx, true); + } + + public static ArrayList getUserOrgPairs(Properties ctx, boolean viewStarOrg) + { + ArrayList pairList = new ArrayList(); + + String userOrg = Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + + StringTokenizer token = new StringTokenizer(userOrg, ","); + + while (token.hasMoreTokens()) + { + String orgStrId = token.nextToken(); + int orgId = Integer.parseInt(orgStrId); + + if (orgId == 0) + { + if (viewStarOrg) + { + KeyNamePair allOrgPair = new KeyNamePair(0, Constants.ALL_ORGANISATIONS); + pairList.add(allOrgPair); + } + + } + else + { + MOrg org = MOrg.get(ctx, orgId); + pairList.add(org.getKeyNamePair()); + } + + } + + return pairList; + } + + + public static int[] getUserViewableOrganisations(Properties ctx) + { + int defaultOrganisations[] = new int[] {Env.getAD_Org_ID(ctx)}; + String viewableOrganisations = Env.getContext(ctx, UdiConstants.ROLE_VIEWABLE_ORGS_CTX_PARAM); + + if (viewableOrganisations == null || viewableOrganisations.trim().length() == 0) + { + return defaultOrganisations; + } + + ArrayList orgList = new ArrayList(); + + try + { + StringTokenizer tokenizer = new StringTokenizer(viewableOrganisations, ","); + while (tokenizer.hasMoreTokens()) + { + String org = tokenizer.nextToken(); + orgList.add(Integer.parseInt(org.trim())); + } + } + catch (Exception ex) + { + logger.log(Level.SEVERE, "Could not retrieve organisations, cause: " + ex.getMessage(), ex); + } + + if (orgList.size() > 0) + { + int organisations[] = new int[orgList.size()]; + System.arraycopy(orgList.toArray(), 0, organisations, 0, orgList.size()); + return organisations; + } + + return defaultOrganisations; + } + + + public static int getCreateTransferBankAccount(Properties ctx, int adOrgId, int currencyId, String trxName) throws OperationException + { + String sqlStmt = "SELECT C_BankAccount_ID FROM C_BankAccount ba " + + "INNER JOIN C_Bank b ON ba.C_Bank_ID=b.C_Bank_ID " + + "INNER JOIN AD_OrgInfo oi ON b.C_Bank_ID=oi.TransferBank_ID " + + "WHERE oi.AD_Org_ID=? AND ba.C_Currency_ID=? "; + + int bankAccountId = DB.getSQLValue(trxName, sqlStmt, adOrgId, currencyId); + + if (bankAccountId != -1) + { + return bankAccountId; + } + + MOrgInfo orgInfo = MOrgInfo.get(ctx, adOrgId); + int bankId = orgInfo.getTransferBank_ID(); + + if (bankId <= 0) + { + MBank bank = new MBank(ctx, 0, trxName); + bank.setName("BANK ACCOUNT FOR TRANSFERS"); + bank.setDescription("** DO NOT USE **"); + bank.setRoutingNo("NOT USED"); + bank.setC_Location_ID(orgInfo.getC_Location_ID()); + bank.setIsOwnBank(true); + + PoManager.save(bank); + bankId = bank.get_ID(); + + orgInfo.set_TrxName(trxName); + orgInfo.setTransferBank_ID(bankId); + PoManager.save(orgInfo); + } + + MBankAccount bankAccount = new MBankAccount(ctx, 0, trxName); + bankAccount.setC_Bank_ID(bankId); + bankAccount.setBankAccountType(MBankAccount.BANKACCOUNTTYPE_Checking); // TODO Should consider to create a new type + bankAccount.setAccountNo("NOT USED"); + bankAccount.setC_Currency_ID(currencyId); + bankAccount.setIsDefault(false); + bankAccount.setCurrentBalance(Env.ZERO); + PoManager.save(bankAccount); + + return bankAccount.get_ID(); + } + + + public static int getCreateTransferCashBook(Properties ctx, int adOrgId, int currencyId, String trxName) throws OperationException + { + MOrgInfo orgInfo = MOrgInfo.get(ctx, adOrgId); + + if (orgInfo.getTransferCashBook_ID() > 0) + { + return orgInfo.getTransferCashBook_ID(); + } + + MCashBook cashBook = new MCashBook(ctx, 0, trxName); + cashBook.setAD_Org_ID(adOrgId); + cashBook.setName("CASH BOOK FOR TRANSFERS"); + cashBook.setDescription("** DO NOT USE **"); + cashBook.setC_Currency_ID(currencyId); + PoManager.save(cashBook); + + int dummyCashElementValue = AccountingManager.getCreateDummyCashElement(ctx, trxName); + + // No model defined for cashbook accounting + StringBuffer updateStmt = new StringBuffer(); + + updateStmt.append("UPDATE C_CashBook_Acct SET CB_Asset_Acct="); + updateStmt.append(dummyCashElementValue); + updateStmt.append(" WHERE C_CashBook_ID="); + updateStmt.append(cashBook.get_ID()); + + int updated = DB.executeUpdate(updateStmt.toString(), trxName); + if (updated <= 0) + { + throw new OperationException("Could not update cash book accounting"); + } + + return cashBook.get_ID(); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/POSBpartnerInfoManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/POSBpartnerInfoManager.java new file mode 100644 index 0000000000..d493679f00 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/POSBpartnerInfoManager.java @@ -0,0 +1,317 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 26, 2006 by alok + */ + +package org.posterita.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.util.DB; +import org.compiere.util.Env; + +import org.posterita.Constants; +import org.posterita.beans.BPartnerInfoBean; +import org.posterita.beans.POSHistoryBean; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; + +public class POSBpartnerInfoManager { + + public static ArrayList getPartnerInfo(Properties ctx, + boolean isCustomer) throws OperationException { + return getPartnerInfo(ctx, 0, null, isCustomer); + } + + public static ArrayList getPartnerInfo(Properties ctx, + String partnerName, boolean isCustomer) throws OperationException { + return getPartnerInfo(ctx, 0, partnerName, isCustomer); + } + + public static ArrayList getPartnerInfo(Properties ctx, + int bPartnerId, boolean isCustomer) throws OperationException { + return getPartnerInfo(ctx, bPartnerId, null, isCustomer); + } + + public static ArrayList getPartnerInfo(Properties ctx, + int bPartnerId, String partnerName, boolean isCustomer) + throws OperationException { + String sql = "select bp.c_bpartner_id," + + // 1 + "bp.name," + + // 2 //"bp.name||' ' ||bp.name2," + //2 + "loc.address1," + + // 3 + "loc.address2," + + // 4 + "loc.city," + + // 5 + "bploc.phone," + + // 6 + "bploc.phone2," + + // 7 + "bploc.fax," + + // 8 + "bp.TOTALOPENBALANCE," + + // 9 + "bp.SO_CREDITUSED," + + // 10 + "bp.SO_CREDITLIMIT," + + // 11 + "bp.ACTUALLIFETIMEVALUE," + + // 12 + "bp.C_Dunning_id," + + // 13 + "bp.FIRSTSALE, " + + // 14 + //"DECODE(bp.SOCREDITSTATUS,'" + "CASE WHEN bp.SOCREDITSTATUS='" + + MBPartner.SOCREDITSTATUS_CreditHold + //+ "','" + + "' THEN '" + + Constants.CREDIT_HOLD + //+ "'," + //+ "'" + + "' WHEN bp.SOCREDITSTATUS='" + + MBPartner.SOCREDITSTATUS_CreditStop + //+ "','" + + "' THEN '" + + Constants.CREDIT_STOP + //+ "'," + + "' WHEN bp.SOCREDITSTATUS='" + + MBPartner.SOCREDITSTATUS_NoCreditCheck + //+ "','" + + "' THEN '" + + Constants.NO_CREDIT_CHECK + //+ "'," + + "' WHEN bp.SOCREDITSTATUS='" + //+ "'" + + MBPartner.SOCREDITSTATUS_CreditOK + //+ "','" + + "' THEN '" + + Constants.CREDIT_OK + //+ "'," + + "' WHEN bp.SOCREDITSTATUS='" + //+ "'" + + MBPartner.SOCREDITSTATUS_CreditWatch + //+ "','" + + "' THEN '" + + Constants.CREDIT_WATCH + //+ "',bp.SOCREDITSTATUS) creditStatus" + + "' ELSE bp.SOCREDITSTATUS END AS creditStatus" + + // 15 + " from C_BPARTNER bp left join (C_BPARTNER_LOCATION bploc left join C_LOCATION loc on bploc.c_location_id=loc.c_location_id)" + + " on bp.C_BPARTNER_ID=bploc.C_BPARTNER_ID" + + " where bp.AD_ORG_ID in (" + + Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM) + ")" + + " and bp.AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx); + + if (isCustomer) + sql = sql + " and bp.ISCUSTOMER='Y' "; + + else + sql = sql + " and bp.ISVENDOR='Y' "; + + if (bPartnerId != 0) + sql = sql + " and bp.c_bpartner_id=" + bPartnerId; + + if (partnerName != null) + // sql=sql+" and lower(bp.name||' ' ||"+ "bp.name2) like + // lower('%"+partnerName+"%')"; + sql = sql + " and lower(bp.name) like lower('%" + partnerName + + "%')"; + + BPartnerInfoBean bean = null; + + ArrayList list = new ArrayList(); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = null; + + try { + rs = pstmt.executeQuery(); + while (rs.next()) + + { + bean = new BPartnerInfoBean(); + bean.setBpartnerId(rs.getInt(1)); + bean.setPartnerName(rs.getString(2)); + bean.setAddress1(rs.getString(3)); + bean.setAddress2(rs.getString(4)); + bean.setCity(rs.getString(5)); + bean.setPhone(rs.getString(6)); + bean.setPhone2(rs.getString(7)); + bean.setFax(rs.getString(8)); + bean.setIsCustomer(isCustomer); + bean.setOpenAmt(rs.getBigDecimal(9)); + bean.setCreditUsed(rs.getBigDecimal(10)); + bean.setCreditLimit(rs.getBigDecimal(11)); + bean.setRevenue(rs.getBigDecimal(12)); + bean.setDunningId(rs.getInt(13)); + bean.setBpfirstSale(rs.getString(14)); + bean.setSoCreditStatus(rs.getString(15)); + list.add(bean); + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + + return list; + + } + + public static ArrayList getbPartnerTrxDetails( + Properties ctx, int bPartnerId, boolean isCustomer) + throws OperationException { + + String sql = "select pr.name," + // 1 + " acc.M_PRODUCT_ID," + // 2 + "sum(-acc.qty)," + "sum(acc.AMTACCTCR-acc.AMTACCTDR) as amt" + // 4 + " from FACT_ACCT acc,m_product pr" + + " where acc.M_product_id=pr.m_product_id" + + " and acc.C_BPARTNER_ID=" + bPartnerId + + " and acc.ad_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and acc.ACCOUNT_ID ="; + + if (isCustomer) + sql = sql + + "(select C_ELEMENTVALUE_ID from c_elementvalue where VALUE='41000' and AD_CLIENT_ID=" + + Env.getAD_Client_ID(ctx) + ")"; + else + sql = sql + + "(select C_ELEMENTVALUE_ID from c_elementvalue where VALUE='21100' and AD_CLIENT_ID=" + + Env.getAD_Client_ID(ctx) + ")"; + + sql = sql + " group by pr.name,acc.M_PRODUCT_ID"; + + BPartnerInfoBean bean = null; + + ArrayList list = new ArrayList(); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = null; + + try { + rs = pstmt.executeQuery(); + while (rs.next()) + + { + bean = new BPartnerInfoBean(); + bean.setProductName(rs.getString(1)); + bean.setProductId(rs.getInt(2)); + bean.setQuantity(rs.getBigDecimal(3)); + bean.setAmount(rs.getBigDecimal(4)); + list.add(bean); + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + + return list; + + } + + public static ArrayList getBpartnerOrderHistory(Properties ctx, + int bPartnerId) throws OperationException { + String sql = "select ord.C_ORDER_ID," + // 1 + // "inv.c_invoice_id," + + "ord.created," + // 2 + "ord.grandtotal," + // 3 + "ord.DOCUMENTNO," + // 4 + "bp.name," + // 5 + " ord.orderType," + // 6 + " bp.C_BPARTNER_ID" + // 7 + " from c_order ord,C_BPARTNER bp" + + " where ord.C_BPARTNER_ID=bp.C_BPARTNER_ID" + + " and ord.AD_ORG_ID=" + Env.getAD_Org_ID(ctx) + + " and ord.AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and ord.c_bpartner_id=" + bPartnerId + + " and ord.isActive='Y'" + " and ord.docstatus in ('CO','CL')"; + + sql = sql + " order by ord.created desc"; + + System.out.println(sql); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + POSHistoryBean bean = null; + ArrayList list = new ArrayList(); + ResultSet rs = null; + + try { + rs = pstmt.executeQuery(); + + while (rs.next()) { + bean = new POSHistoryBean(); + bean.setOrderId(Integer.valueOf(rs.getInt(1))); + + bean.setDateAcct(rs.getTimestamp(2)); + bean.setOrderGrandTotal(rs.getBigDecimal(3)); + bean.setDocumentNo(rs.getString(4)); + bean.setPartnerName(rs.getString(5)); + bean.setOrderType(rs.getString(6)); + bean.setBpartnerId(rs.getInt(7)); + + list.add(bean); + + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + + return list; + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/POSClientManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/POSClientManager.java new file mode 100644 index 0000000000..38947aca6d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/POSClientManager.java @@ -0,0 +1,319 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ + +/** + @author ashley + */ + +package org.posterita.businesslogic; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MBankAccount; +import org.compiere.model.MCashBook; +import org.compiere.model.MClient; +import org.compiere.model.MCommission; +import org.compiere.model.MCurrency; +import org.compiere.model.MDiscountSchema; +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MOrgInfo; +import org.compiere.model.MPOS; +import org.compiere.model.MPOSTerminal; +import org.compiere.model.MPriceList; +import org.compiere.model.MPriceListVersion; +import org.compiere.model.MRole; +import org.compiere.model.MRoleMenu; +import org.compiere.model.MStore; +import org.compiere.model.MTaxCategory; +import org.compiere.model.MUser; +import org.compiere.model.MWarehouse; +import org.compiere.util.Env; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.businesslogic.administration.TaxManager; +import org.posterita.businesslogic.administration.UserManager; +import org.posterita.businesslogic.administration.WarehouseManager; +import org.posterita.businesslogic.core.ApplicationManager; +import org.posterita.core.FileManager; +import org.posterita.core.bean.ClientBean; +import org.posterita.exceptions.ClientAlreadyExistException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.WarehouseAlreadyExistsException; +import org.posterita.factory.GenericSystemObjectsFactory; +import org.posterita.factory.POSMenuFactory; +import org.posterita.factory.SystemObjectsFactory; +import org.posterita.lib.UdiConstants; +import org.posterita.model.MBank; +import org.posterita.model.MWebMenu; +import org.posterita.util.PoManager; + +public class POSClientManager extends ClientManager +{ + public static final String LOCATOR_SUFFIX = "Locator"; + public static final String SALES_REP_SUFFIX = "Sales Rep"; + public static final String DEFAULT_POS_TERMINAL = "Terminal 1"; + public static final String STORE_SUFFIX = "POS"; + public static final String taxCategoryName1 = "VAT"; + public static final String taxCategoryName2 = "Tax Exempt"; + public static final String CONTEXT_SUFFIX = "pos"; + public static final String STYLESHEET = "posteritaWarmsCSS.jsp"; + + public static Properties createPOSDetails(Properties ctx, int currencyId, String currencyName, String hostURL, String trxName) throws OperationException, WarehouseAlreadyExistsException + { + + int adClientId = Env.getAD_Client_ID(ctx); + int adOrgID = Env.getAD_Org_ID(ctx); + + MClient client = ClientManager.loadClient(ctx, adClientId, trxName); + MOrg org = OrganisationManager.loadOrganisation(ctx, adOrgID, trxName); + + String clientName = client.getName(); + String orgName = org.getName(); + + MOrgInfo orgInfo = org.getInfo(); + if(orgInfo == null) + throw new OperationException("Organisation does not have an Organisation Info"); + + int locationId = orgInfo.getC_Location_ID(); + if(locationId == 0) + throw new OperationException("Organistion does not have a location"); + + MLocation orgLocation = LocationManager.loadLocation(ctx, locationId, trxName); + + String city = orgLocation.getCity(); + int countryId = orgLocation.getCountry().get_ID(); + + String whereClause = "AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " and AD_Org_ID=" + Env.getAD_Org_ID(ctx); + + int discountSchemaIds[] = MDiscountSchema.getAllIDs(MDiscountSchema.Table_Name, whereClause, trxName); + if(discountSchemaIds == null || discountSchemaIds.length == 0) + throw new OperationException("No Discount schema defined"); + + System.out.println("Creating Location..."); + + String cashBookName = orgName + " Cash Book"; + String posTerminalName = DEFAULT_POS_TERMINAL; + String salesPriceListName = orgName + " Sales Price List"; + String salesPriceListVersionName = orgName + " Sales Price List Version"; + String purchasePriceListName = orgName + " Purchase Price List"; + String purchasePriceListVersionName = orgName + " Purchase Price List Version"; + String warehouseName = orgName + " Warehouse"; + + + System.out.println("Creating Cash Book..."); + MCashBook cashBook = CashManager.createCashBook(ctx, org.get_ID(), cashBookName, currencyId, trxName); + + System.out.println("Creating Sales Pricelist..."); + MPriceList salesPriceList = PriceListManager.createPriceList(ctx, salesPriceListName, currencyId, 2, true, trxName); + System.out.println("Creating Purchase Pricelist..."); + MPriceList purchasePriceList = PriceListManager.createPriceList(ctx, purchasePriceListName, currencyId, 2, false, trxName); + + MPriceListVersion salesPriceListVersion = new MPriceListVersion(salesPriceList); + salesPriceListVersion.setName(salesPriceListVersionName); + salesPriceListVersion.setM_DiscountSchema_ID(discountSchemaIds[0]); + + PoManager.save(salesPriceListVersion); + + MPriceListVersion purchasePriceListVersion = new MPriceListVersion(purchasePriceList); + purchasePriceListVersion.setName(purchasePriceListVersionName); + purchasePriceListVersion.setM_DiscountSchema_ID(discountSchemaIds[0]); + PoManager.save(purchasePriceListVersion); + + System.out.println("Creating Bank..."); + MBank bank = new MBank(ctx, 0, trxName); + bank.setName(orgName + " Bank"); + bank.setRoutingNo("123456789"); + bank.setC_Location_ID(orgLocation.get_ID()); + PoManager.save(bank); + + System.out.println("Creating Bank Account..."); + MBankAccount bankAccount = new MBankAccount(ctx, 0, trxName); + bankAccount.setC_Bank_ID(bank.get_ID()); + bankAccount.setBankAccountType(MBankAccount.BANKACCOUNTTYPE_Checking); + bankAccount.setC_Currency_ID(currencyId); + bankAccount.setAccountNo("123456789"); + bankAccount.setIsDefault(true); + PoManager.save(bankAccount); + + + System.out.println("Creating Tax Categories..."); + MTaxCategory taxCategory15 = TaxManager.createTaxCategory(ctx, taxCategoryName1, trxName); + MTaxCategory taxCategory0 = TaxManager.createTaxCategory(ctx, taxCategoryName2, trxName); + + System.out.println("Creating Tax..."); + TaxManager.createTax(ctx, org.get_ID(), taxCategoryName1, taxCategory15.get_ID(), countryId, new BigDecimal("15.0"),taxCategoryName1,false, trxName); + TaxManager.createTax(ctx, org.get_ID(), taxCategoryName2, taxCategory0.get_ID(), countryId, new BigDecimal("0"), taxCategoryName1,true,trxName); + + System.out.println("Creating Warehouse..."); + MWarehouse warehouse = WarehouseManager.createWarehouse(ctx, org.get_ID(), warehouseName, + orgLocation.getC_Location_ID(), trxName); + + //set warehouse in org info + orgInfo.setM_Warehouse_ID(warehouse.getM_Warehouse_ID()); + orgInfo.save(); + + System.out.println("Creating Business Partners..."); + // Create Cash Transaction Business Partner + MBPartner defCashBPartner = BPartnerManager.createBPartner(ctx, org.get_ID(), org.getLinkedC_BPartner_ID(trxName), "Standard Customer", " ", true, false, false, false, " ", " ", city, " ", countryId, trxName); + MBPartner salesRepBPartner = BPartnerManager.createBPartner(ctx, org.get_ID(), org.getLinkedC_BPartner_ID(trxName), orgName + " Sales Rep", " ", false, false, true, true, " ", " ", city, " ", countryId, trxName); + + MUser salesRepUser = new MUser(ctx, 0, trxName); + salesRepUser.setC_BPartner_ID(salesRepBPartner.get_ID()); + salesRepUser.setName(orgName + " " + SALES_REP_SUFFIX); + PoManager.save(salesRepUser); + + + System.out.println("Creating POS Terminal..."); + MPOSTerminal terminal = POSTerminalManager.createPOSTerminal(ctx, org.get_ID(), posTerminalName, + cashBook.get_ID(), bankAccount.get_ID(), purchasePriceList.get_ID(), + salesPriceList.get_ID(), warehouse.get_ID(), defCashBPartner.get_ID(), + salesRepUser.get_ID(), trxName); + + + System.out.println("Creating Web store configuration..."); + + MStore store = StoreManager.createStore(ctx, clientName + " " + STORE_SUFFIX, + clientName + "pos", org.get_ID(), purchasePriceList.get_ID(), + salesRepUser.get_ID(), warehouse.get_ID(), "pos", hostURL, trxName) ; + + // Setting ctx with new configurations + Env.setContext(ctx, UdiConstants.TERMINAL_ID, String.valueOf(terminal.get_ID())); + Env.setContext(ctx, UdiConstants.U_POSTERMINAL_ID, String.valueOf(terminal.get_ID())); + Env.setContext(ctx, UdiConstants.PRICELIST_CTX_PARAM, String.valueOf(purchasePriceList.get_ID())); + Env.setContext(ctx, UdiConstants.POS_PURCHASE_PL_VERSION, String.valueOf(purchasePriceListVersion.get_ID())); + + return ctx; + } + + public static MUser createAdmin(Properties ctx, String userName, int orgId, String roleName, String password, String userPin, String address, String emailAddress, String trxName) throws OperationException + { + Properties nCtx = (Properties)ctx.clone(); + nCtx.setProperty("#AD_Client_ID", "0"); + nCtx.setProperty("#AD_Org_ID", "0"); + + MRole role = RoleManager.getOrCreateRole(ctx, orgId, roleName, true, BigDecimal.ZERO, true, true, true, true, true, true, trxName); + MUser user = UserManager.getOrCreateUser(ctx, 0, userName, true, address, address, address, password, emailAddress, true, "", 0, role.get_ID(), userPin,MCommission.DOCBASISTYPE_Invoice,new BigDecimal(10),MCommission.FREQUENCYTYPE_Monthly,new BigDecimal(0),false,trxName); + + String whereClause = " AD_Role_ID=" + role.get_ID(); + + int roleMenuIds[] = MRoleMenu.getAllIDs(MRoleMenu.Table_Name, whereClause, trxName); + + for(int i = 0; i < roleMenuIds.length; i++) + { + MRoleMenu roleMenu = new MRoleMenu(ctx, roleMenuIds[i], trxName); + //roleMenu.delete(true); + } + + POSMenuFactory posMFactory = POSMenuFactory.getFactoryInstance(nCtx); + Iterator keyIter = posMFactory.getAllKeys(nCtx).iterator(); + + while(keyIter.hasNext()) + { + String key = (String)keyIter.next(); + MWebMenu menu = (MWebMenu)posMFactory.get(nCtx, key); + MRoleMenu roleMenu = new MRoleMenu(ctx, 0, trxName); + roleMenu.setAD_Role_ID(role.get_ID()); + roleMenu.setU_WebMenu_ID(menu.get_ID()); + PoManager.save(roleMenu); + } + + return user; + } + + public static String createClient(ClientBean clientBean) throws ClientAlreadyExistException, OperationException, WarehouseAlreadyExistsException + { + Properties ctx = Env.getCtx(); + Env.setContext(ctx, UdiConstants.USER_ID_CTX_PARAM, "100"); // SuperUser + + if(clientBean == null) + throw new OperationException("Bean cannot be null!!!"); + + if(ClientManager.isClientPresent(clientBean.getClientName())) + throw new ClientAlreadyExistException("Client with name: " + clientBean.getClientName() + " already exist!!!"); + + MCurrency currency = new MCurrency(ctx, clientBean.getCurrencyId(), null); + if(currency.get_ID() == 0) + throw new OperationException("Could not load currency with id: " + clientBean.getCurrencyId()); + + String hostUrl = "http://www." + clientBean.getClientName() + ".com/"; + File file = null; + FileOutputStream fos = null; + + try + { + file = File.createTempFile("accounting_" + System.currentTimeMillis(), ".csv"); + FileManager.write(clientBean.getFile().getInputStream(), file.getAbsolutePath()); + } + catch (FileNotFoundException e) + { + + e.printStackTrace(); + } + catch (IOException e) + { + + e.printStackTrace(); + } + finally + { + if (fos != null) + { + try + { + fos.close(); + } + catch(Exception ex) + {} + } + } + + ClientManager.getCreateClient(ctx, clientBean.getClientName(), clientBean.getOrgName(), clientBean.getCurrencyId(), currency.getDescription(), clientBean.getCountryId(), clientBean.getCity(), clientBean.getAddress1(), clientBean.getPostalAddress(), "", file); + ctx = ClientManager.getCtx(ctx, clientBean.getClientName(), clientBean.getOrgName()); + POSClientManager.createPOSDetails(ctx, clientBean.getCurrencyId(), currency.getDescription(), hostUrl, null); + + try + { + SystemObjectsFactory.reloadFactory(ctx); + GenericSystemObjectsFactory.reloadFactory(ctx); + /*GenericProductAttributeSetFactory.reloadFactory(ctx); + GenericProductAttributeFactory.reloadFactory(ctx);*/ + } + catch(Exception ex) + { + ex.printStackTrace(); + } + + //AD_ORG_ID is set to 0 here so that Admin user can access all orgs + POSClientManager.createAdmin(ctx, clientBean.getUsername(), 0, clientBean.getRoleName(), clientBean.getPassword(), clientBean.getUserPIN(), clientBean.getAddress1(), clientBean.getEmail(), null); + + String storeContext = clientBean.getClientName() + "pos"; + return storeContext; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/POSGoodsManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/POSGoodsManager.java new file mode 100644 index 0000000000..24d62e0927 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/POSGoodsManager.java @@ -0,0 +1,616 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 27-Apr-2006 by alok + */ + + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MInOut; +import org.compiere.model.MInOutConfirm; +import org.compiere.model.MInvoice; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.compiere.model.MPayment; +import org.compiere.model.MWarehouse; +import org.compiere.process.DocumentEngine; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.CreditCheckBean; +import org.posterita.beans.ItemBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.ProductBean; +import org.posterita.beans.ProductCategoryBean; +import org.posterita.businesslogic.creditsales.CreditOrderManager; +import org.posterita.exceptions.BPartnerOverCreditLimitException; +import org.posterita.exceptions.NoOrderLineFoundException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; +import org.posterita.util.PoManager; + + +public class POSGoodsManager +{ + public static final String GET_ALL_VENDORS="getAllVendors"; + public static final String GET_ALL_VENDORS_FOR_RETURN_NOTE="getAllVendorsForReturnNote"; + + public static MOrder createCustomerReturn(Properties ctx,OrderLineBean bean,ArrayList cartBeanItems,Integer bPartnerId,String reason,String trxName) throws BPartnerOverCreditLimitException,OperationException + { + return createGoodsReceiveNote(ctx,bean,cartBeanItems,true,bPartnerId,reason,trxName); + } + + public static MOrder createGoodsReceiveNote(Properties ctx,OrderLineBean bean,ArrayList cartBeanItems,Integer bPartnerId,String SupRef,String trxName)throws OperationException + { + return createGoodsReceiveNote(ctx,bean,cartBeanItems,false,bPartnerId,SupRef,trxName); + } + + + private static MOrder createGoodsReceiveNote(Properties ctx,OrderLineBean orderlineBean,ArrayList cartBeanItems,boolean isCustomerReturn,Integer bPartnerId,String desc,String trxName)throws BPartnerOverCreditLimitException,OperationException + { + MOrder order = null; + MWarehouse warehouse = POSTerminalManager.getWarehouse(ctx); + int priceListId=0; + Integer orderId = orderlineBean.getOrderId(); + String paymentRule=null; + String orderType=null; + + + if(orderId == null) + { + if(isCustomerReturn) + { + priceListId=POSTerminalManager.getSOPriceListId(ctx); + + if(orderlineBean.getOrderType().equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + paymentRule=MOrder.PAYMENTRULE_OnCredit; + orderType=UDIOrderTypes.CREDIT_MEMO.getOrderType(); + } + + else + { + paymentRule = orderlineBean.getPaymentRule(); + orderType=UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType(); + } + + order=OrderManager.createOrder(ctx,bPartnerId.intValue(),true,priceListId,orderType, + warehouse.get_ID(),paymentRule,trxName); + + if(orderlineBean.getPaymentTermId()!=null) + order.setC_PaymentTerm_ID(orderlineBean.getPaymentTermId()); + + int terminalId = POSTerminalManager.getTerminalId(ctx); + String posOrderDocNumber=orderlineBean.getDocumentNo(); + if(posOrderDocNumber!=null) + { + String whereClause1="AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and documentNo ='"+posOrderDocNumber+"'"; + int orderids1 []= MOrder.getAllIDs(MOrder.Table_Name,whereClause1,null); + + String number="R"+posOrderDocNumber; + String whereClause=null; + if(orderlineBean.getOrderType().equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + whereClause="AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and orderType='"+UDIOrderTypes.CREDIT_MEMO.getOrderType()+ + "' and documentNo like('%"+number+"%')"; + } + else + { + whereClause="AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and orderType='"+UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType()+ + "' and documentNo like('%"+number+"%')"; + } + + int orderids []= MOrder.getAllIDs(MOrder.Table_Name,whereClause,null); + int noOfOrders = orderids.length; + String docNumber=number+"_"+(noOfOrders+1); + order.setDocumentNo(docNumber); + order.setRef_Order_ID(orderids1[0]);//using it when complete the credit memo to find whether shipment has to be done or not + } + + if (terminalId == 0) + throw new OperationException("POS Id not present!!"); + + //order.setC_POS_ID(terminalId);TODO - Trifon; order.setU_POSTerminal_ID(terminalId); + } + else + { + priceListId = Env.getContextAsInt(ctx,UdiConstants.POS_PURCHASE_PL); + order=OrderManager.createOrder(ctx,bPartnerId.intValue(),false,priceListId,UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType(), + warehouse.get_ID(),MOrder.PAYMENTRULE_Check,trxName); + } + } + else + { + //load existing order + order = OrderManager.loadOrder(ctx, orderId, trxName); + + //delete previous orderlines + OrderManager.deleteOrderlines(ctx, order, trxName); + } + + + boolean isDirty = false; + + if( bPartnerId != null ) + { + order.setC_BPartner_ID(bPartnerId); + isDirty = true; + } + + + if(desc!=null) + { + order.setDescription(desc); + isDirty = true; + } + + if( isDirty ) + { + PoManager.save(order); + } + + + + Iterator iter = cartBeanItems.iterator(); + ItemBean itemBean; + while(iter.hasNext()) + { + itemBean =(ItemBean)iter.next(); + + int m_product_id = itemBean.getProductId(); + BigDecimal qty = itemBean.getQty(); + BigDecimal actualPrice = itemBean.getActualPrice(); + BigDecimal discount = itemBean.getDiscountPercent(); + BigDecimal price = itemBean.getPrice(); + + OrderManager.createOrderLine(ctx, order, m_product_id, qty, discount, price); + } + + if(order.isSOTrx()==true) + { + CreditCheckBean crBean = OrderManager.checkBPartnerCreditLimit(ctx,order.getC_BPartner_ID(),order.get_ID(),order.get_TrxName()); + if(crBean.getValid()==false) + throw new BPartnerOverCreditLimitException(crBean.getMsg()); + } + + return order; + + } + + public static MOrder createAndCompletePODocuments(Properties ctx, int purchaseOrderId,String trxName) throws OperationException + { + MOrder purchaseOrder = new MOrder(ctx,purchaseOrderId,trxName); + + MOrderLine [] lines=purchaseOrder.getLines(); + + + if(lines.length==0) + { + throw new NoOrderLineFoundException("No OrderLines For This Order"); + } + + MOrder completedPurchaseOrder = completePurchaseOrder(ctx,purchaseOrder,"GRN No "+purchaseOrder.get_ID()); + + MInvoice draftedVendorInvoice = InvoiceManager.createVendorInvoice(ctx,purchaseOrder.get_ID(),trxName); + + MInvoice invoice = InvoiceManager.completeInvoice(ctx, draftedVendorInvoice); + + if(MInvoice.PAYMENTRULE_OnCredit.equals(invoice.getPaymentRule())) + { + //do nothing + } + else + { + MPayment draftedAPPayment = PaymentManager.createAPPayment(ctx,draftedVendorInvoice, trxName); + PaymentManager.completeAPPayment(ctx,draftedAPPayment); + } + + MWarehouse warehouse = new MWarehouse(ctx,purchaseOrder.getM_Warehouse_ID(),trxName); + + MInOut materialReceipt = MinOutManager.createMInOut(ctx,invoice,warehouse.get_ID()); + PoManager.save(materialReceipt); + + MInOutConfirm confirm=MinOutManager.createConfirmation(ctx,materialReceipt); + MinOutManager.completeConfirmation(ctx, confirm); + + MinOutManager.completeShipment(ctx, materialReceipt); + + OrderManager.printOrder(ctx,completedPurchaseOrder); + + return completedPurchaseOrder; + } + + public static MOrder completePurchaseOrder(Properties ctx, MOrder order,String POReference) throws BPartnerOverCreditLimitException,OperationException + { + + if (order.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + throw new OperationException("Order has already been completed"); + + + + order.setPOReference(POReference); + + PoManager.processIt(order, DocumentEngine.ACTION_Complete); + + return order; + } + + + public static MOrder createGoodsReturnNote(Properties ctx,OrderLineBean orderlineBean,ArrayList cartBeanItems,Integer bPartnerId,String supRef,String trxName)throws OperationException + { + int purchasePLID = POSTerminalManager.getPOPriceListId(ctx); + MWarehouse warehouse = POSTerminalManager.getWarehouse(ctx); + + MOrder order = null; + Integer orderId = orderlineBean.getOrderId(); + + if(orderId == null) + { + order = OrderManager.createOrder(ctx,bPartnerId.intValue(),true,purchasePLID,UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType(), + warehouse.get_ID(),MOrder.PAYMENTRULE_Check,trxName); + } + else + { + //load existing order + order = OrderManager.loadOrder(ctx, orderId, trxName); + + //delete previous orderlines + OrderManager.deleteOrderlines(ctx, order, trxName); + } + + boolean isDirty = false; + + if( bPartnerId != null ) + { + MBPartner partner = new MBPartner(ctx, bPartnerId.intValue(), trxName); + order.setBPartner(partner); + isDirty = true; + } + + + if(supRef!=null) + { + order.setDescription(supRef); + isDirty = true; + } + + if( isDirty ) + { + PoManager.save(order); + } + + + Iterator iter = cartBeanItems.iterator(); + ItemBean itemBean; + + while(iter.hasNext()) + { + itemBean =(ItemBean)iter.next(); + OrderManager.createOrderLine(ctx,order,itemBean.getProductId().intValue(),itemBean.getQty(),new BigDecimal(0),new BigDecimal(0)) ; + } + return order; + } + + + public static ArrayList getAllSuppliers(Properties ctx) throws OperationException + { +// String sql = "select name||' '||name2 name," +//1 + String sql = "select name," +//1 FIXME Postgresql Fix, need more investigation to get to above functionality + "c_bpartner_id" +//2 + " from C_BPARTNER" + + " where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx) + + " and ad_org_id in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+")"+ + " and ISVENDOR='Y'"+ + " and isactive='Y'"+ + " order by upper(name)"; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + ArrayList list = new ArrayList(); + OrderLineBean bean = null; + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean = new OrderLineBean(); + bean.setPartnerName(rs.getString(1)); + bean.setBpartnerId(Integer.valueOf(rs.getInt(2))); + list.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + } + + public static String getForward(Properties ctx,String isSales) + { + if(Boolean.valueOf(isSales).booleanValue()==true) + return GET_ALL_VENDORS; + else + return GET_ALL_VENDORS_FOR_RETURN_NOTE; + } + + + public static ArrayList getAllProductCategory(Properties ctx) throws OperationException + { + String sql="select name," + + "m_product_category_id" + + " from m_product_category"+ + " where AD_ORG_ID="+Env.getAD_Org_ID(ctx)+ + " and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ProductCategoryBean bean = null; + ArrayList list = new ArrayList(); + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean = new ProductCategoryBean(); + bean.setName(rs.getString(1)); + bean.setProductCategoryId(Integer.valueOf(rs.getInt(2))); + list.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch (Exception e) + {} + + pstmt = null; + } + + return list; + + } + + + public static ArrayList getAllRevenueRecos(Properties ctx) throws OperationException + { + String sql="select name," + + "C_REVENUERECOGNITION_ID" + + " from C_REVENUERECOGNITION"+ + " where AD_ORG_ID="+Env.getAD_Org_ID(ctx)+ + " and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ProductCategoryBean bean = null; + ArrayList list = new ArrayList(); + ResultSet rs = null; + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean = new ProductCategoryBean(); + bean.setName(rs.getString(1)); + bean.setProductCategoryId(Integer.valueOf(rs.getInt(2))); + list.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + + } + +// private static int getBPartnerForProduct(Properties ctx, int productId) throws OperationException +// { +// +// String sql =" select c_bpartner_id from c_bpartner_product where "+ +// "AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ +// " and AD_ORG_ID="+Env.getAD_Org_ID(ctx)+ +// " and M_PRODUCT_ID="+productId; +// +// int bPartnerId=0; +// +// PreparedStatement pstmt = DB.prepareStatement(sql,null); +// +// try +// { +// ResultSet rs = pstmt.executeQuery(); +// while(rs.next()) +// { +// bPartnerId=rs.getInt(1); +// } +// } +// catch (SQLException e) +// { +// throw new OperationException(e); +// } +// +// +// return bPartnerId; +// } + + public static ArrayList getAllTaxCategory(Properties ctx) throws OperationException + { + // MProduct product = new MProduct(ctx,productId,null); + + + String sql = "select tc.c_taxcategory_id, tc.name||' '||'Rate % '||tx.rate" + + " from c_taxcategory tc,C_TAX tx" + + " where tc.C_TAXCATEGORY_ID=tx.C_TAXCATEGORY_ID" + + " and tx.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and tx.isActive='Y'"; + + + // + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ProductBean bean=null; + ArrayList list = new ArrayList(); + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean = new ProductBean(); + bean.setTaxCategoryId(Integer.valueOf(rs.getInt(1))); + bean.setTaxCategoryName(rs.getString(2)); + list.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + + return list; + } + + public static MOrder completeCustomerReturnOrder( Properties ctx,int orderId, String trxName) throws OperationException + { + MOrder order = new MOrder(ctx, orderId, trxName); + + //this is dne to support the simple customer return order so that the shipment takes place + boolean delivered=true; + + if( order.getOrderType().equals(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())|| order.getOrderType().equals(UDIOrderTypes.CREDIT_MEMO.getOrderType())) + { + if(order.getRef_Order_ID() != 0) //setting it while creating order + { + MOrder originalOrder = new MOrder(ctx,order.getRef_Order_ID(),trxName); + delivered=compareOrders(ctx,originalOrder,order); + } + } + if(delivered) + return POSManager.completePOSOrder(ctx,orderId,trxName); + else + return CreditOrderManager.completeCreditOrderWithOutShipment(ctx,order, trxName); + } + + private static boolean compareOrders(Properties ctx,MOrder orOrder,MOrder retOrder) throws OperationException + { + MOrderLine [] orOrderLine = orOrder.getLines(); + + MOrderLine [] retOrderLine = retOrder.getLines(); + + boolean delivered = false; + + for(int i=0;i maxDiscountAllowed ) + { + throw new DiscountLimitException("Discount Limit exceeded!"); + } + } + } + + if(bean.getBpartnerId() == null) + { + throw new OperationException("Business Partner cannot be null"); + } + + int cashBookId = POSTerminalManager.getCashBookId(ctx); + int terminalId = POSTerminalManager.getTerminalId(ctx); + int priceListId = POSTerminalManager.getSOPriceListId(ctx); + int warehouseId = POSTerminalManager.getWarehouseId(ctx); + + if(firstOrderOfTheDay(ctx)) + { + CashManager.closePreviousDraftedCashjournals(ctx, cashBookId, trxName); + } + + + String paymentRule=null; + + if (bean.getTrxType().equalsIgnoreCase(Constants.PAYMENT_RULE_CASH)) + paymentRule=MOrder.PAYMENTRULE_Cash; + else if(bean.getTrxType().equalsIgnoreCase(Constants.PAYMENT_RULE_CARD)) + paymentRule=MOrder.PAYMENTRULE_CreditCard; + else if(bean.getTrxType().equalsIgnoreCase(Constants.PAYMENT_RULE_CHEQUE)) + paymentRule=MOrder.PAYMENTRULE_Check; + else if(bean.getTrxType().equalsIgnoreCase(Constants.PAYMENT_RULE_MIXED)) + { + paymentRule=UdiConstants.PAYMENTRULE_MIXED; + validateMixedPaymentAmount(bean); + } + else if(bean.getTrxType().equalsIgnoreCase(MOrder.PAYMENTRULE_OnCredit)) + paymentRule=MOrder.PAYMENTRULE_OnCredit; + + else + throw new OperationException("Invalid Payment Rule"); + + //reusing existing order + MOrder order = null; + + Integer orderId = bean.getOrderId(); + if( orderId == null ) + { + //creating new order + order = OrderManager.createOrder(ctx, bean.getBpartnerId().intValue(), true, + priceListId, orderType.getOrderType(), warehouseId, paymentRule, trxName); + } + else + { + //updating existing order + MBPartner partner = new MBPartner(ctx, bean.getBpartnerId().intValue(), trxName); + order = new MOrder(ctx, orderId.intValue(), trxName); + + //deleting existing orderlines + OrderManager.deleteOrderlines(ctx, order, trxName); + + + order.setBPartner(partner); + order.setPaymentRule(paymentRule); + order.setDateOrdered(new Timestamp(System.currentTimeMillis())); + } + + //order.setC_POS_ID(terminalId);TODO - Trifon; order.setU_POSTerminal_ID(terminalId); + if(bean.getPaymentTermId()!=null) + { + order.setC_PaymentTerm_ID(bean.getPaymentTermId()); + } + PoManager.save(order); + + Iterator iter = cartBeanItems.iterator(); + ItemBean itemBean; + BigDecimal qtyTotal= BigDecimal.ZERO; + int i=0; + while(iter.hasNext()) + { + double actualPrice=0.0; + double discount=0.0; + itemBean =(ItemBean)iter.next(); + + if(bean.getDiscountPercent()!=null) + { + String discountEntered = bean.getDiscountPercent()[i]; + if( discountEntered == null || discountEntered.equals("")) + discount=0; + else + { + discount = Double.parseDouble(bean.getDiscountPercent()[i]); + actualPrice=Double.parseDouble(bean.getActualPrice()[i]); + } + } + + if(discount > 0.0) + { + MUser user = new MUser(ctx,Env.getAD_User_ID(ctx),null); + + MUserRoles[] userRole = MUserRoles.getOfUser(ctx,user.get_ID()); + + if (userRole.length == 0) + throw new OperationException("Role not found for user " + user.getName()); + + MRole role = new MRole(ctx,userRole[0].getAD_Role_ID(),null); + + MPriceList priceList = MPriceList.get(ctx, order.getM_PriceList_ID(), order.get_TrxName()); + int priceListVersionId = PriceListManager.getPriceListVersionID(ctx, order.getM_PriceList_ID(), order.get_TrxName()); + BigDecimal limitPrice=ProductManager.getLimitPrice(ctx, priceListVersionId, itemBean.getProductId(), priceList.isSOPriceList(), order.get_TrxName()); + + MProduct product = new MProduct(ctx,itemBean.getProductId().intValue(),null); + MTax tax = TaxManager.getTaxFromCategory(ctx, product.getC_TaxCategory_ID(), order.get_TrxName()); + BigDecimal limitPriceWithTax = TaxManager.getPriceWithTax(ctx,limitPrice,tax.getRate()); + + if(role.isOverwritePriceLimit()==false && actualPrice/itemBean.getQty().doubleValue() < limitPriceWithTax.doubleValue()) + { + throw new LimitPriceViolatedException("Discount Exceeds Limit price, limit price is= "+limitPriceWithTax.doubleValue()); + } + else + { + itemBean.setDiscountPercent(new BigDecimal(discount)); + itemBean.setActualPrice(new BigDecimal(actualPrice)); + } + } + qtyTotal=qtyTotal.add(itemBean.getQty()); + itemBean.setQtyTotal(qtyTotal); + OrderManager.createOrderLine(ctx,order,itemBean.getProductId().intValue(),itemBean.getQty(),itemBean.getDiscountPercent(),itemBean.getActualPrice()) ; + i++; + } + + if(order.isSOTrx()==true) + { + CreditCheckBean crBean = OrderManager.checkBPartnerCreditLimit(ctx,order.getC_BPartner_ID(),order.get_ID(),order.get_TrxName()); + if(crBean.getValid()==false) + throw new BPartnerOverCreditLimitException(crBean.getMsg()); + } + + return order; + } + + private static void validateMixedPaymentAmount(OrderLineBean bean) throws InvalidTenderedAmountException + { + if(bean.getTrxType().equalsIgnoreCase(Constants.PAYMENT_RULE_MIXED)) + { + double cashAmt=0.0; + double chequeAmt=0.0; + double cardAmt =0.0; + + if(bean.getPaymentByCash()!=null) + cashAmt = bean.getPaymentByCash(); + if(bean.getPaymentByChq()!=null) + chequeAmt=bean.getPaymentByChq(); + if(bean.getPaymentByCard()!=null) + cardAmt = bean.getPaymentByCard(); + + BigDecimal total = FormatBigDecimal.currency(cashAmt+chequeAmt+cardAmt); + + double lineDiscount=0.0; + double sumActualAmt=0.0; + int count=0; + if(bean.getDiscountPercent()!=null && bean.getDiscountPercent().length>0) + { + for(int i=0;i0.0) + { + sumActualAmt= bean.getTotalActualPrice()-(bean.getTotalActualPrice()*(lineDiscount/100)); + } + + else + { + sumActualAmt=bean.getTotalActualPrice(); + } + + + if(total.doubleValue() !=sumActualAmt) + throw new InvalidTenderedAmountException("The Tendered Amount should be equal to the total amount"); + } + } + + + public static MInvoice createDocuments(Properties ctx, MOrder order) throws OperationException + { + MInvoice customerInvoice = createCustomerInvoice(ctx, order); + PoManager.processIt(customerInvoice, DocumentEngine.ACTION_Complete); + if (!customerInvoice.getPaymentRule().equalsIgnoreCase(MInvoice.PAYMENTRULE_Cash) && !customerInvoice.getPaymentRule().equals(MInvoice.PAYMENTRULE_OnCredit)) + { + MPayment paymentReceived = PaymentManager.createARReceipt(ctx, customerInvoice, customerInvoice.get_TrxName()); + PaymentManager.completePayment(ctx, paymentReceived); + } + + MInOut shipment = MinOutManager.createMInOut(ctx, customerInvoice, order.getM_Warehouse_ID()); + + if (customerInvoice.isCreditMemo()) + { + MInOutConfirm confirm=MinOutManager.createConfirmation(ctx,shipment); + MinOutManager.completeConfirmation(ctx, confirm); + } + MinOutManager.completeShipment(ctx, shipment); + order.setIsDelivered(true); + PoManager.save(order); + + if (firstCashInvoice(ctx, customerInvoice)) + { + CashManager.updateBeginningBalance(ctx, order.getC_POS_ID(), order.get_TrxName()); + } + + return customerInvoice; + + } + + public static MOrder completePOSOrder(Properties ctx,int orderId,OrderLineBean bean,String trxName) throws InvalidTenderedAmountException,BPartnerOverCreditLimitException,NoOrderLineFoundException,OperationException + { + MOrder order = new MOrder(ctx,orderId,trxName); + + if(order.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + if(bean.getAmountGiven()==null || bean.getAmountGiven().doubleValue()< order.getGrandTotal().doubleValue()) + { + throw new InvalidTenderedAmountException("The Amount given is Invalid"); + } + } + + if(order.getPaymentRule().equalsIgnoreCase(UdiConstants.PAYMENTRULE_MIXED) && (bean.getPaymentByCash() == null || bean.getPaymentByCash() <= 0)) + { + if(bean.getAmountGiven()==null || bean.getAmountGiven().doubleValue() < bean.getPaymentByCash()) + { + throw new InvalidTenderedAmountException("The Amount given is Invalid"); + } + } + + order.setAmountTendered(bean.getAmountGiven()); + order.setAmountRefunded(bean.getAmountRefunded()); + PoManager.save(order); + + if(order.getLines().length==0) + { + throw new NoOrderLineFoundException("POS Order does not have any orderlines!"); + } + + PoManager.processIt(order, DocumentEngine.ACTION_Complete); + + Double cashAmt = bean.getPaymentByCash(); + if(cashAmt == null) + cashAmt = 0.0; + + Double chequeAmt=bean.getPaymentByChq(); + if(chequeAmt == null) + chequeAmt = 0.0; + + Double cardAmt = bean.getPaymentByCard(); + if(cardAmt == null) + cardAmt = 0.0; + + BigDecimal writeOffAmount = Env.ZERO; + + if (order.getAmountTendered() != null && order.getAmountRefunded() != null) + { + writeOffAmount = (order.getAmountTendered().subtract(order.getAmountRefunded())).subtract(order.getGrandTotal()); + } + + CheckoutBean checkoutBean = new CheckoutBean(); + checkoutBean.setAmountRefunded(order.getAmountRefunded()); + checkoutBean.setAmountTendered(order.getAmountTendered()); + checkoutBean.setBpartnerId(order.getC_BPartner_ID()); + checkoutBean.setCardAmt(new BigDecimal(cardAmt)); + checkoutBean.setCardNo(bean.getCreditCardNumber()); + checkoutBean.setCardType(bean.getCreditCardType()); + checkoutBean.setCashAmt(new BigDecimal(cashAmt)); + checkoutBean.setChequeAmt(new BigDecimal(chequeAmt)); + checkoutBean.setChequeNo(bean.getChequeNo()); + checkoutBean.setWriteOffAmt(writeOffAmount); + checkoutBean.setDiscountAmt(Env.ZERO); + + createAndCompleteDocuments(ctx, order, checkoutBean, trxName); + + return order; + } + + public static MOrder completePOSOrder(Properties ctx,int orderId, String trxName) throws OperationException + { + MOrder order = new MOrder(ctx, orderId, trxName); + + return completePOSOrder(ctx, order); + } + + public static MOrder completePOSOrder(Properties ctx,MOrder order) throws OperationException + { + MOrder completedOrder = OrderManager.completeOrder(ctx,order); + //if(completedOrder.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType())) + OrderManager.printOrder(ctx,completedOrder); + + createDocuments(ctx,completedOrder); + return completedOrder; + } + + public static MOrder completePOSOrderPrintInvoice(Properties ctx,MOrder order) throws OperationException + { + MOrder completedOrder = OrderManager.completeOrder(ctx,order); + MInvoice invoice = createDocuments(ctx,completedOrder); + InvoiceManager.printInvoice(ctx,invoice); + + return completedOrder; + } + + public static void createAndCompleteDocuments(Properties ctx, MOrder order, CheckoutBean bean, String trxName) throws OperationException + { + MInvoice invoice = createARInvoice(ctx,order.get_ID(), trxName); + createInvoiceLines(ctx, invoice, order, trxName); + PoManager.processIt(invoice, DocumentEngine.ACTION_Complete); + + if(order.getPaymentRule().equals(MOrder.PAYMENTRULE_OnCredit)) + { + //No payment for credit order + return; + } + + BigDecimal cashAmt = (bean.getCashAmt() == null ? Env.ZERO : bean.getCashAmt()); + BigDecimal cardAmt = (bean.getCardAmt() == null ? Env.ZERO : bean.getCardAmt()); + BigDecimal chequeAmt = (bean.getChequeAmt() == null ? Env.ZERO : bean.getChequeAmt()); + BigDecimal writeOffAmount = (bean.getWriteOffAmt() == null ? Env.ZERO : bean.getWriteOffAmt()); + BigDecimal discountAmt = (bean.getDiscountAmt() == null ? Env.ZERO : bean.getDiscountAmt()); + + boolean paymentCreated = false; + boolean discountApplied = false; + + /* + // Cash invoices creates automatically Cash Line entry upon completion of the invoice + // @see MInvoice.completeIt + // Reload cashLine to set writeOff Amt in case of cash payment + // because for each new cashline created, writeOff is set to zero by default + if (invoice.getPaymentRule().equals(MInvoice.PAYMENTRULE_Cash)) + { + paymentCreated = true; + + MCashLine cashLine = new MCashLine(ctx, invoice.getC_CashLine_ID(), trxName); + + if(cashLine != null) + { + cashLine.setWriteOffAmt(writeOffAmount); + cashLine.setDiscountAmt(discountAmt); + + if(!(discountAmt.equals(Env.ZERO))) + { + cashLine.setAmount(invoice.getGrandTotal().subtract(discountAmt).subtract(writeOffAmount)); + } + else + { + cashLine.setAmount(invoice.getGrandTotal().subtract(writeOffAmount)); + } + + PoManager.save(cashLine); + } + else + { + throw new OperationException("Could not load CashLine"); + } + } + // For mixed payment with Cash being part + else if (cashAmt.compareTo(Env.ZERO) > 0 && invoice.getPaymentRule().equals(MInvoice.PAYMENTRULE_Mixed)) + { + int cashBookId = POSTerminalManager.getCashBookId(ctx); + MCash cash = MCash.get(ctx, cashBookId, invoice.getDateInvoiced(), trxName); + + if (cash == null) + { + throw new OperationException("Could not load Cash Journal to do cash entry"); + } + + //No WriteOff in case of Mixed Payment + MCashLine cashLine = CashManager.createCashLine(ctx, cash.get_ID(), + invoice.get_ID(), cashAmt, Env.ZERO, discountAmt, trxName); + invoice.setC_CashLine_ID(cashLine.get_ID()); + PoManager.save(cashLine); + + paymentCreated = true; + discountApplied = true; + } + */ + + //Modifications for cash payment + if (invoice.getPaymentRule().equals(MInvoice.PAYMENTRULE_Cash)) + { + paymentCreated = true; + BigDecimal amt = null; + + if(!(discountAmt.equals(Env.ZERO))) + { + amt = invoice.getGrandTotal().subtract(discountAmt).subtract(writeOffAmount); + } + else + { + amt = invoice.getGrandTotal().subtract(writeOffAmount); + } + + MPayment paymentReceivedCash = PaymentManager.createARReceipt(ctx, invoice, + MPayment.TENDERTYPE_Cash, amt, invoice.get_TrxName()); + + paymentReceivedCash.setWriteOffAmt(writeOffAmount); + paymentReceivedCash.setDiscountAmt(discountAmt); + + PoManager.save(paymentReceivedCash); + PaymentManager.completePayment(ctx,paymentReceivedCash); + } + // For mixed payment with Cash being part + else if (cashAmt.compareTo(Env.ZERO) > 0 && invoice.getPaymentRule().equals(MInvoice.PAYMENTRULE_Mixed)) + { + //No WriteOff in case of Mixed Payment + MPayment paymentReceivedCash = PaymentManager.createARReceipt(ctx, invoice, + MPayment.TENDERTYPE_Cash, cashAmt, invoice.get_TrxName()); + + PoManager.save(paymentReceivedCash); + PaymentManager.completePayment(ctx,paymentReceivedCash); + + paymentCreated = true; + discountApplied = true; + } + //End of modifications + + + + // Enforce that check payment should be created only if Payment rule is check or mixed + if(chequeAmt.compareTo(Env.ZERO) > 0 + && (MInvoice.PAYMENTRULE_Check.equals(invoice.getPaymentRule()) || MInvoice.PAYMENTRULE_Mixed.equals(invoice.getPaymentRule()))) + { + MPayment paymentReceivedCheque = PaymentManager.createARReceipt(ctx, invoice, + MPayment.TENDERTYPE_Check, chequeAmt, invoice.get_TrxName()); + + if (bean.getChequeNo() != null && bean.getChequeNo().trim().length() > 0) + { + paymentReceivedCheque.setCheckNo(bean.getChequeNo()); + } + + if (!discountApplied && discountAmt.compareTo(Env.ZERO) > 0) + { + paymentReceivedCheque.setDiscountAmt(discountAmt); + } + + PoManager.save(paymentReceivedCheque); + PaymentManager.completePayment(ctx,paymentReceivedCheque); + + paymentCreated = true; + discountApplied = true; + } + + // Enforce that card payment should be created only if Payment rule is credit card or mixed + if (cardAmt.compareTo(Env.ZERO) > 0 + && (MInvoice.PAYMENTRULE_CreditCard.equals(invoice.getPaymentRule()) || MInvoice.PAYMENTRULE_Mixed.equals(invoice.getPaymentRule()))) + { + MPayment paymentReceivedCard = PaymentManager.createARReceipt(ctx, invoice, + MPayment.TENDERTYPE_CreditCard, cardAmt, invoice.get_TrxName()); + + if (bean.getCardType() != null && bean.getCardType().trim().length() > 0) + { + paymentReceivedCard.setCreditCardType(bean.getCardType()); + } + + if (bean.getCardNo() != null && bean.getCardNo().trim().length() > 0) + { + paymentReceivedCard.setCreditCardNumber(bean.getCardNo()); + } + + if (!discountApplied && discountAmt.compareTo(Env.ZERO) > 0) + { + paymentReceivedCard.setDiscountAmt(discountAmt); + } + + PoManager.save(paymentReceivedCard); + PaymentManager.completePayment(ctx,paymentReceivedCard); + + paymentCreated = true; + discountApplied = true; + } + + if (!paymentCreated) + { + throw new OperationException("No payments have been created!!!"); + } + + if (firstCashInvoice(ctx, invoice)) + CashManager.updateBeginningBalance(ctx, order.getC_POS_ID(),order.get_TrxName()); + + //@TODO not allowed to use MOrderLine getallids here, must use a manager. + int [] orderLines=MOrderLine.getAllIDs(MOrderLine.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and AD_ORG_ID="+Env.getAD_Org_ID(ctx)+" and C_ORDER_ID="+order.get_ID(),trxName); + MInOut shipment= MinOutManager.createShipment(ctx, order.get_ID(), orderLines, trxName); + MinOutManager.completeShipment(ctx,shipment); + } + + + public static ArrayList populateOrderLines(Properties ctx,MOrder order) throws OperationException + { + return populateOrderLines(ctx,order,false); + } + + public static ArrayList populateOrderLines(Properties ctx, MOrder order,boolean abbr) throws OperationException + { + MOrderLine [] lines=order.getLines(); + MOrderLine line; + MProduct product; + // AttributeValuesPair attributeValuesPair; + WebOrderLineBean orderLineBean; + BigDecimal qty = Env.ZERO; + BigDecimal totalGrossProfit = Env.ZERO; + BigDecimal totalGrossProfitPercentage = Env.ZERO; + + int priceListId = order.getM_PriceList_ID(); + + MPriceList priceList = MPriceList.get(ctx, priceListId, null); + ArrayList orderLines = new ArrayList(); + for (int i = 0; i < lines.length; i++) + { + line = lines[i]; + + product = new MProduct(ctx, line.getM_Product_ID(), null); + + orderLineBean = new WebOrderLineBean(); + orderLineBean.setProductName(product.getName()); + orderLineBean.setLineNetAmt(line.getLineNetAmt()); + BigDecimal lineTaxAmount = getLineTaxAmt(line.getCtx(), line.getLineNetAmt(), line.getC_Tax_ID(), priceList.isTaxIncluded(), line.getQtyOrdered()); + orderLineBean.setTaxAmt(lineTaxAmount); + BigDecimal lineTotalAmount = Env.ZERO; + if (priceList.isTaxIncluded()) + { + lineTotalAmount = line.getLineNetAmt(); + } + else + { + lineTotalAmount = line.getLineNetAmt().add(orderLineBean.getTaxAmt()); + } + + orderLineBean.setLineTotalAmt(lineTotalAmount); + orderLineBean.setUnitPrice(line.getPriceList().setScale(2)); + orderLineBean.setPriceActual(line.getPriceActual()); + orderLineBean.setProductId(Integer.valueOf(line.getM_Product_ID())); + orderLineBean.setUom(product.getUOMSymbol()); + MTax tax = MTax.get(ctx, line.getC_Tax_ID()); + orderLineBean.setTaxRate(tax.getRate()); + BigDecimal multiplier = (tax.getRate().add(Env.ONEHUNDRED)).divide(Env.ONEHUNDRED); + + Integer purchasePriceListId = PriceListManager.getDefaultPriceListId(ctx, false); + Integer ppriceListVersionId = PriceListManager.getPriceListVersionID(ctx, purchasePriceListId, null); + MPriceList ppriceList = new MPriceList(ctx, purchasePriceListId, null); + MProductPrice pprice = MProductPrice.get(ctx, ppriceListVersionId, line.getM_Product_ID(), null); + + BigDecimal priceLimit = Env.ZERO; + + try + { + if(ppriceList.isTaxIncluded()) + { + priceLimit = pprice.getPriceLimit(); + } + else + { + priceLimit = pprice.getPriceLimit().multiply(multiplier); + } + } + catch(NullPointerException e) + { + priceLimit = Env.ZERO; + } + + orderLineBean.setPurchasePriceList(priceLimit.setScale(2, RoundingMode.HALF_DOWN)); + BigDecimal grossProfit = lineTotalAmount.subtract((priceLimit).multiply(line.getQtyOrdered())); + BigDecimal grossProfitPercentage = Env.ZERO; + + try + { + grossProfitPercentage = (grossProfit.divide(lineTotalAmount, 4, BigDecimal.ROUND_UP)).multiply(Env.ONEHUNDRED); + } + catch (ArithmeticException e) + { + grossProfitPercentage = Env.ZERO; + } + + totalGrossProfit = totalGrossProfit.add(grossProfit); + + orderLineBean.setGrossProfit(grossProfit.setScale(2, RoundingMode.HALF_DOWN)); + orderLineBean.setTotalGrossProfit(totalGrossProfit.setScale(2, RoundingMode.HALF_DOWN)); + orderLineBean.setGrossProfitPercentage(grossProfitPercentage.setScale(2, RoundingMode.HALF_DOWN)); + + if (line.getM_Product_ID() == 0) + { + if(line.getC_Charge_ID() != 0) + { + MCharge charge = ChargeManager.loadCharge(ctx, line.getC_Charge_ID(), null); + orderLineBean.setProductName(charge.getName()); + } + else + throw new OperationException("Unknown Order line type with id: " + line.get_ID()); + } + else + { + String description = product.getDescription(); + if(description == null) + { + description = product.getName(); + } + orderLineBean.setDescription(description); + } + + orderLineBean.setOrderLineId(Integer.valueOf(line.get_ID())); + orderLineBean.setIsinvoiced(Boolean.valueOf(false)); + orderLineBean.setIsQtyReserved(Boolean.valueOf(true)); + qty=qty.add(line.getQtyOrdered()); + orderLineBean.setQtyTotal(qty) ; + + orderLineBean.setQtyOrdered(line.getQtyOrdered()); + orderLineBean.setDiscountPercentage(line.getDiscount()); + BigDecimal discountAmt = Env.ZERO; + BigDecimal subTotal = Env.ZERO; + BigDecimal grandTotal = Env.ZERO; + + if (order.getPaymentRule().equals(MOrder.PAYMENTRULE_Cash) || order.getPaymentRule().equals(MOrder.PAYMENTRULE_Mixed)) + { + MInvoice invoice = MInvoice.get(ctx, order.getC_Invoice_ID()); + MCashLine cashLine = new MCashLine(ctx, invoice.getC_CashLine_ID(), null); + if (cashLine.getC_CashLine_ID() != 0) + { + discountAmt = cashLine.getDiscountAmt()==null? Env.ZERO: cashLine.getDiscountAmt(); + discountAmt = discountAmt.setScale(lineTotalAmount.scale(), RoundingMode.HALF_DOWN); + BigDecimal writeOffAmt = cashLine.getWriteOffAmt() == null? Env.ZERO: cashLine.getWriteOffAmt(); + writeOffAmt = writeOffAmt.setScale(lineTotalAmount.scale(), RoundingMode.HALF_DOWN); + + orderLineBean.setWriteOffAmt(writeOffAmt); + subTotal = order.getGrandTotal(); + grandTotal = cashLine.getAmount(); + } + } + + if (!order.getPaymentRule().equals(MOrder.PAYMENTRULE_Cash)) + { + int[] payIds = MPayment.getAllIDs(MPayment.Table_Name, "C_Invoice_ID = " + order.getC_Invoice_ID(), null); + for (int payId : payIds) + { + MPayment payment = new MPayment(ctx, payId, null); + + if (payment.get_ID() != 0) + { + if (payment.getDiscountAmt() != null) + { + discountAmt = discountAmt.add(payment.getDiscountAmt()); + } + subTotal = subTotal.add(payment.getPayAmt()); + grandTotal = grandTotal.add(payment.getPayAmt()); + } + } + } + + if(!subTotal.equals(Env.ZERO)) + { + try + { + totalGrossProfitPercentage = (totalGrossProfit.divide(subTotal, 4, BigDecimal.ROUND_UP)).multiply(Env.ONEHUNDRED); + } + catch (ArithmeticException e) + { + totalGrossProfitPercentage = Env.ZERO; + } + orderLineBean.setTotalGrossProfitPercentage(totalGrossProfitPercentage.setScale(2)); + } + + orderLineBean.setDiscountAmt(discountAmt); + orderLineBean.setSubTotal(subTotal); + orderLineBean.setGrandTotal(grandTotal); + orderLines.add(orderLineBean); + } + + return orderLines; + } + + private static I_C_CashLine getCashLine(Properties ctx, MOrder order) throws OperationException + { + int invoiceId = order.getC_Invoice_ID(); + MInvoice invoice = new MInvoice(ctx, invoiceId, null); + I_C_CashLine cashLine = null; + try + { + cashLine = invoice.getC_CashLine(); + } + catch (Exception e) + { + throw new OperationException("No cash line generated for invoice: " + invoiceId); + } + return cashLine; + } + + public static WebDocumentBean calculateOrderTotals(ArrayList webOrderLineList) + { + Iterator iter = webOrderLineList.iterator(); + + WebOrderLineBean bean; + WebDocumentBean webDocumentBean=new WebDocumentBean(); + BigDecimal totalLines = Env.ZERO; + BigDecimal totalTax = Env.ZERO; + BigDecimal totalQty= Env.ZERO; + BigDecimal discountAmt = Env.ZERO; + BigDecimal writeOffAmt = Env.ZERO; + BigDecimal subTotal = Env.ZERO; + BigDecimal grandTotal = Env.ZERO; + + while(iter.hasNext()) + { + bean = (WebOrderLineBean) iter.next(); + totalLines = totalLines.add(bean.getLineNetAmt()); + totalTax = totalTax.add(bean.getTaxAmt()); + totalQty=totalQty.add(bean.getQtyTotal()); + if (bean.getDiscountAmt()!=null && !bean.getDiscountAmt().equals(Env.ZERO)) + { + discountAmt = bean.getDiscountAmt(); + } + if (bean.getWriteOffAmt()!=null && !bean.getWriteOffAmt().equals(Env.ZERO)) + { + writeOffAmt = bean.getWriteOffAmt(); + } + } + + subTotal = totalLines.add(totalTax); + grandTotal = subTotal.subtract(discountAmt).subtract(writeOffAmt); + + webDocumentBean.setTotalLines(totalLines); + webDocumentBean.setTotalTax(totalTax); + webDocumentBean.setSubTotal(subTotal); + webDocumentBean.setGrandTotal(grandTotal); + webDocumentBean.setTotalQty(totalQty); + return webDocumentBean; + } + + + public static String deleteOrderLines(Properties ctx,Integer[]orderlineIds,String trxName) throws OperationException + { + if((orderlineIds == null)||(orderlineIds.length == 0)) + { + throw new NoOrderLineSelectedException("Cannot delete orderlines. No orderlines supplied!"); + } + + MOrderLine orderLine = new MOrderLine(ctx,orderlineIds[0].intValue(),trxName); + MOrder order = new MOrder(ctx,orderLine.getC_Order_ID(),trxName); + + String orderType = order.getOrderType(); + + for(int i=0;i getPOSInfoReportData(Properties ctx, Timestamp fromDate, Timestamp todate, String trxName) throws OperationException + { + ArrayList list = getPOSInfo(ctx, fromDate, todate, trxName); + ArrayList reportData = new ArrayList(); + + Object[] headers = new Object[]{"POS Name","Organisation","Cash Total","Card Total","Cheque Total","Amount"}; + reportData.add(headers); + + NumberFormat formatter = new DecimalFormat("###,###,##0.00"); + + Object[] data = null; + String grandTotal = null; + + for (POSInfoBean bean : list) + { + data = new Object[6]; + + data[0] = bean.getPosName(); + data[1] = bean.getOrgName(); + data[2] = formatter.format(bean.getCashTotal().doubleValue()); + data[3] = formatter.format(bean.getCardTotal().doubleValue()); + data[4] = formatter.format(bean.getChequeTotal().doubleValue()); + + //format the currency + grandTotal = formatter.format(bean.getOrderGrandTotal().doubleValue()); + + data[5] = grandTotal; + + reportData.add(data); + } + + return reportData; + } + + protected static boolean firstCashInvoice(Properties ctx, MInvoice invoice) throws OperationException + { + boolean firstCashInvoice = false; + if (invoice != null && invoice.getC_CashLine_ID() > 0) + { + StringBuffer whereClause = new StringBuffer(); + whereClause.append("C_Cash_ID=(SELECT C_Cash_ID FROM C_CashLine WHERE C_CashLine_ID=") + .append(invoice.getC_CashLine_ID()) + .append(")"); + whereClause.append(" AND CashType='").append(MCashLine.CASHTYPE_Invoice).append("'"); + + int ids[] = MCashLine.getAllIDs(MCashLine.Table_Name, whereClause.toString(), invoice.get_TrxName()); + + firstCashInvoice = (ids.length == 1); + } + return firstCashInvoice; + } + + + public static BigDecimal getSumOfChequeAndCard(Properties ctx,Timestamp toDate,String paymentRule) throws OperationException + { + int terminalId = POSTerminalManager.getTerminalId(ctx); + BigDecimal grandTotal =null; + + String sql="select sum(pay.payAmt) " + + " from C_order ord,c_payment pay right outer join C_invoice inv on inv.c_Invoice_id=pay.c_Invoice_id" + + " where pay.created>="+ DB.TO_DATE(toDate, false) + + " and inv.c_order_id=ord.c_order_id"+ + " and ord.C_POS_ID="+terminalId+ + " and ord.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and ord.AD_ORG_ID="+Env.getAD_Org_ID(ctx)+ + " and inv.isSotrx='Y'"+ + " and ord.orderType in ('"+UDIOrderTypes.POS_ORDER.getOrderType()+"',"+ + "'"+UDIOrderTypes.CREDIT_ORDER.getOrderType()+"')"+ + " and pay.tenderType='"+paymentRule+"'"; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + if(rs.getString(1)==null) + grandTotal=new BigDecimal(0); + else + grandTotal=new BigDecimal(rs.getString(1)); + + grandTotal=grandTotal.add(paymentAmtWithOutInvoice(ctx,toDate,null,paymentRule,terminalId)); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) {} + + pstmt = null; + + } + + return grandTotal; + + } + + /** + * @ashley TODO Should look further into this workaround solution + * @param ctx + * @param fromDate + * @param toDate + * @param paymentRule + * @param terminalId + * @return + * @throws OperationException + */ + private static BigDecimal paymentAmtWithOutInvoice(Properties ctx, Timestamp fromDate, Timestamp toDate, + String paymentRule,int terminalId) throws OperationException + { + BigDecimal grandTotal =null; + String sql="select sum(pay.payAmt) " + + "from C_PAYMENT pay " ; + if(toDate==null) + { + sql=sql+ "where pay.created>= " + DB.TO_DATE(fromDate, false); + } + else + { + sql=sql+ " where pay.created between " + DB.TO_DATE(fromDate, false) + " AND " + DB.TO_DATE(toDate, false); + } + + + sql=sql+" and not exists(select * from c_invoice inv where pay.C_invoice_id=inv.c_invoice_id)" + + " and pay.tenderType='"+paymentRule+"'"; + + sql=sql+" and pay.description='"+terminalId+"'"; //pos id was saved into descriptuon while creating the payment for multiple invoice + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + if(rs.getString(1)==null) + grandTotal=new BigDecimal(0); + else + grandTotal=new BigDecimal(rs.getString(1)); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) {} + + pstmt = null; + + } + + return grandTotal; + } + + + public static BigDecimal getSumOfChequeAndCardPaymentsForInfo(Properties ctx, Timestamp fromDate,Timestamp toDate,String paymentRule,int posId) throws OperationException + { + BigDecimal grandTotal =null; + + String sql="select sum(pay.payAmt) " + + " from C_INVOICE inv,C_order ord,c_payment pay " + + " where inv.c_order_id=ord.c_order_id"+ + " and inv.c_Invoice_id=pay.c_Invoice_id"+ + " and ord.C_POS_ID="+posId+ + " and ord.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and ord.AD_ORG_ID="+Env.getAD_Org_ID(ctx)+ + " and inv.isSotrx='Y'"+ + " and ord.orderType in ('"+UDIOrderTypes.POS_ORDER.getOrderType()+"',"+ + "'"+UDIOrderTypes.CREDIT_ORDER.getOrderType()+"')"+ + " and pay.tenderType='"+paymentRule+"'"+ + " and pay.created between " + DB.TO_DATE(fromDate, false) + + " and " + DB.TO_DATE(toDate, false) ; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + if(rs.getString(1)==null) + grandTotal=new BigDecimal(0); + else + grandTotal=new BigDecimal(rs.getString(1)); + + grandTotal=grandTotal.add(paymentAmtWithOutInvoice(ctx,fromDate,toDate,paymentRule,posId)); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) {} + + pstmt = null; + + } + + return grandTotal; + + } + + /** + * It returns the date-time of last completed cash journal + * @param ctx + * @param cashBookId + * @return + * @throws OperationException + */ + public static Timestamp getTimeOfLastCompletedJournal(Properties ctx, int cashBookId, String trxName) throws OperationException + { + Timestamp lastDateTime = TimestampConvertor.getCurrentDateTimestamp(); + + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append("SELECT MAX(cl.Created) FROM C_Cash c "); + sqlStmt.append("INNER JOIN C_CashLine cl ON cl.C_Cash_ID = c.C_Cash_ID "); + sqlStmt.append("WHERE c.C_CashBook_ID=? "); + sqlStmt.append("AND c.DocStatus IN ('CO', 'CL')"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sqlStmt.toString(), trxName); + pstmt.setInt(1, cashBookId); + + rs = pstmt.executeQuery(); + + if (rs.next() && rs.getTimestamp(1) != null) + { + lastDateTime = rs.getTimestamp(1); + } + } + catch (Exception exception) + { + throw new OperationException("Could not get last completed journal date and time", exception); + } + + return lastDateTime; + } + + private static CurrentTillAmountBean getCurrentTillForInfo(Properties ctx, int terminalId, Timestamp fromDate, Timestamp toDate) throws OperationException + { + BigDecimal cardSum = BigDecimal.valueOf(0.0); + BigDecimal chequeSum = BigDecimal.valueOf(0.0); + BigDecimal cashSum=new BigDecimal(0); + BigDecimal grandTotal; + BigDecimal beginingBalance=null; + BigDecimal statementDifference=null; + int cashBookId = POSTerminalManager.getCashBookId(ctx, terminalId); + cardSum = getSumOfChequeAndCardPaymentsForInfo(ctx,fromDate,toDate,MPayment.TENDERTYPE_CreditCard,terminalId); + chequeSum = getSumOfChequeAndCardPaymentsForInfo(ctx,fromDate,toDate,MPayment.TENDERTYPE_Check,terminalId); + ArrayList list = CashManager.getCashBookDetailsForTill(ctx, cashBookId,fromDate,toDate); + Iterator iter = list.iterator(); + + CashBookDetailBean cashDetBean; + while(iter.hasNext()) + { + cashDetBean = (CashBookDetailBean)iter.next(); + beginingBalance=cashDetBean.getBeginingBalance(); + statementDifference=cashDetBean.getStatementDifference(); + cashSum=cashDetBean.getStatementDifference(); + + } + + grandTotal = new BigDecimal(cardSum.doubleValue()+chequeSum.doubleValue()+cashSum.doubleValue()); + + CurrentTillAmountBean bean = new CurrentTillAmountBean(); + bean.setBeginingBalance(beginingBalance); + bean.setStatementDifference(statementDifference); + bean.setCardTotal(cardSum); + bean.setCashTotal(cashSum); + bean.setChequeTotal(chequeSum); + bean.setTillGrandTotal(grandTotal); + bean.setPosName(POSTerminalManager.getTerminalName(ctx, terminalId)); + + return bean; + } + + public static CurrentTillAmountBean getCurrentTillAmount(Properties ctx) throws OperationException + { + BigDecimal cardSum ; + BigDecimal chequeSum; + BigDecimal cashSum=new BigDecimal(0); + BigDecimal grandTotal; + BigDecimal beginingBalance=null; + BigDecimal statementDifference=null; + + int cashBookId = POSTerminalManager.getCashBookId(ctx); + Timestamp toDate = getTimeOfLastCompletedJournal(ctx, cashBookId, null); + cardSum = getSumOfChequeAndCard(ctx,toDate,MPayment.TENDERTYPE_CreditCard); + chequeSum = getSumOfChequeAndCard(ctx,toDate,MPayment.TENDERTYPE_Check); + CashBookDetailBean cashDetBean = CashManager.getCashBookDetails(ctx, null); + + // Recently completed journal and not new cash transaction performed + // Thus the Till beginning balance should be the ending balance + // as the new cash journal will have + if (DocumentEngine.STATUS_Completed.equals(cashDetBean.getDocStatus())) + { + beginingBalance = cashDetBean.getEndingBalance(); + statementDifference = Env.ZERO; + cashSum = beginingBalance; + } + else + { + beginingBalance=cashDetBean.getBeginingBalance(); + statementDifference=cashDetBean.getStatementDifference(); + cashSum=cashDetBean.getStatementDifference().add(cashDetBean.getBeginingBalance()); + } + + grandTotal = new BigDecimal(cardSum.doubleValue()+chequeSum.doubleValue()+cashSum.doubleValue()); + + CurrentTillAmountBean bean = new CurrentTillAmountBean(); + bean.setBeginingBalance(beginingBalance); + bean.setStatementDifference(statementDifference); + bean.setCardTotal(cardSum); + bean.setCashTotal(cashSum); + bean.setChequeTotal(chequeSum); + bean.setTillGrandTotal(grandTotal); + bean.setPosName(POSTerminalManager.getTerminalName(ctx)); + + return bean; + + } + + public static MInvoice createCustomerInvoice(Properties ctx, MOrder salesOrder) throws OperationException + { + MInvoice invoice = null; + + boolean isSOTrx = salesOrder.isSOTrx(); + + if (!isSOTrx) + throw new OperationException("Customer Invoice should be created from sales Order"); + + MDocType [] docType; + boolean isSotrx=true; + + if (salesOrder.getOrderType().equals(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())) + docType = MDocType.getOfDocBaseType(ctx,MDocType.DOCBASETYPE_ARCreditMemo); + + else if (salesOrder.getOrderType().equals(UDIOrderTypes.CREDIT_MEMO.getOrderType())) + docType = MDocType.getOfDocBaseType(ctx,MDocType.DOCBASETYPE_ARCreditMemo); + + else if (salesOrder.getOrderType().equals(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType())) + { + docType = MDocType.getOfDocBaseType(ctx,MDocType.DOCBASETYPE_APCreditMemo); + isSotrx=false; + } + else + docType = MDocType.getOfDocBaseType(ctx,MDocType.DOCBASETYPE_ARInvoice); + invoice = new MInvoice(salesOrder,docType[0].get_ID(),new Timestamp(System.currentTimeMillis())); + invoice.setIsSOTrx(isSotrx); + invoice.setC_Order_ID(salesOrder.get_ID()); + invoice.setPaymentRule(salesOrder.getPaymentRule()); + invoice.setC_DocTypeTarget_ID(docType[0].get_ID()); + invoice.setC_DocType_ID(docType[0].get_ID()); + invoice.setC_BPartner_ID(salesOrder.getC_BPartner_ID()); + invoice.setC_Currency_ID(salesOrder.getC_Currency_ID()); + invoice.setIsTaxIncluded(false); + invoice.setIsDiscountPrinted(true); + invoice.setTotalLines(salesOrder.getTotalLines()); + invoice.setGrandTotal(salesOrder.getGrandTotal()); + invoice.setC_PaymentTerm_ID(salesOrder.getC_PaymentTerm_ID()); + + PoManager.save(invoice); + + + MOrderLine [] orderLines=salesOrder.getLines(); + MInvoiceLine invoiceLine; + MTax tax; + + for( int i=0;i < orderLines.length;i++) + { + + invoiceLine = new MInvoiceLine(invoice); + invoiceLine.setOrderLine(orderLines[i]); + invoiceLine.setC_OrderLine_ID(orderLines[i].get_ID()); + invoiceLine.setQtyEntered(orderLines[i].getQtyEntered()); + invoiceLine.setM_AttributeSetInstance_ID(orderLines[i].getM_AttributeSetInstance_ID()); + + + tax = new MTax(ctx,orderLines[i].getC_Tax_ID(),null); + invoiceLine.setQty(orderLines[i].getQtyEntered()); + invoiceLine.setQtyEntered(orderLines[i].getQtyEntered()); + invoiceLine.setQtyInvoiced(orderLines[i].getQtyEntered()); + invoiceLine.setTaxAmt(tax.calculateTax(orderLines[i].getLineNetAmt(),false,3)); + invoiceLine.setLineNetAmt(orderLines[i].getLineNetAmt()); + invoiceLine.setLineTotalAmt(new BigDecimal(orderLines[i].getLineNetAmt().intValue()+tax.calculateTax(orderLines[i].getLineNetAmt(),false,3).intValue())); + + + PoManager.save(invoiceLine); + } + + return invoice; + } + + + /** + * Creates an Invoice for a sales order + * @param ctx Context + * @param salesOrderId Sales Order + * @param trxType Payment Rule + * @param trxName Transaction + * @return Invoice + * @throws OperationException if could not save invoice + */ + protected static MInvoice createARInvoice(Properties ctx, int salesOrderId, String trxName) throws OperationException + { + MOrder salesOrder = new MOrder(ctx,salesOrderId,trxName); + MInvoice invoice = null; + + boolean isSOTrx = salesOrder.isSOTrx(); + if (!isSOTrx) + { + throw new OperationException("AR Invoice should be created from sales Order"); + } + + if (!DocumentEngine.STATUS_Completed.equals(salesOrder.getDocStatus())) + { + throw new OperationException("Order not in completed status, Status: " + salesOrder.getDocStatus()); + } + + invoice = new MInvoice(salesOrder, 0, salesOrder.getDateOrdered()); + PoManager.save(invoice); + + return invoice; + } + + /** + * Create Invoice lines from OrderLines + * @param ctx + * @param invoice + * @param salesOrder + * @param trxName + * @throws OperationException if Line cannot be created + */ + protected static void createInvoiceLines(Properties ctx, MInvoice invoice, MOrder order, String trxName) throws OperationException + { + MOrderLine [] orderLines = order.getLines(); + MInvoiceLine invoiceLine; + + for( int i=0;i < orderLines.length;i++) + { + invoiceLine = new MInvoiceLine(invoice); + invoiceLine.setOrderLine(orderLines[i]); + invoiceLine.setQty(orderLines[i].getQtyEntered()); + PoManager.save(invoiceLine); + } + } + + public static boolean getCashDrawerStatusFromCookie(HttpServletRequest request) + { + String status = getDataFromCookie(request, "preference.cashdrawer"); + return "true".equalsIgnoreCase(status); + } + + public static String getPrintingTypeFromCookie(HttpServletRequest request) + { + return getDataFromCookie(request, "preference.printerType"); + } + + public static String getDataFromCookie(HttpServletRequest request, String key) + { + Cookie[] cookies = request.getCookies(); + String value = null; + + if(cookies != null) + { + for(int i=0;i cartItems = new ArrayList(); + + MOrderLine[] orderlines = order.getLines(); + MOrderLine orderline = null; + ItemBean item = null; + BigDecimal orderTotal = Env.ZERO; + BigDecimal orderTaxTotal = Env.ZERO; + BigDecimal orderQtyTotal = Env.ZERO; + + + for (int i = 0; i < orderlines.length; i++) + { + int c_tax_id = orderlines[i].getC_Tax_ID(); + MTax tax = new MTax(ctx, c_tax_id, null); + + orderline = orderlines[i]; + item = new ItemBean(); + item.setTaxRate(tax.getRate()); + + MProduct product = orderline.getProduct(); + + String description = product.getName(); + int productId = product.get_ID(); + BigDecimal qty = orderline.getQtyOrdered(); + String uom = product.getUOMSymbol(); + + //Prices + BigDecimal actualPrice = orderline.getPriceActual(); + BigDecimal lineNetAmt = actualPrice.multiply(qty); + + BigDecimal lineNetTaxAmt = tax.calculateTax(lineNetAmt, priceList.isTaxIncluded(), 2); + BigDecimal lineUnitTaxAmt = tax.calculateTax(actualPrice, priceList.isTaxIncluded(), 2); + + if (!priceList.isTaxIncluded()) + { + lineNetAmt = lineNetAmt.add(lineNetTaxAmt); + item.setUnitPrice(actualPrice); + item.setInclPrice(actualPrice.add(lineUnitTaxAmt)); + } + else + { + item.setInclPrice(actualPrice); + item.setUnitPrice(actualPrice.subtract(lineUnitTaxAmt)); + } + + item.setIsTaxIncluded(priceList.isTaxIncluded()); + item.setListPrice(orderline.getPriceList()); + item.setPriceLimit(orderline.getPriceLimit()); + item.setProductId(Integer.valueOf(productId)); + item.setDescription(description); + item.setQty(qty); + item.setUom(uom); + item.setProductName(product.getName()); + + item.setTaxAmt(lineNetTaxAmt); + item.setPrice(lineNetAmt); + item.setDiscountPercent(orderline.getDiscount()); + + //calculating totals + orderQtyTotal = orderQtyTotal.add(qty); + orderTaxTotal = orderTaxTotal.add(lineNetTaxAmt); + orderTotal = orderTotal.add(lineNetAmt); + + cartItems.add(item); + } + + cart.setTotalPrice(orderTotal); + cart.setItems(cartItems); + return cart; + } + + + public static ShoppingCartBean getShoppingCartForOrderInEdit(Properties ctx, int orderId, String trxName) throws OperationException + { + MOrder order = new MOrder(ctx, orderId, trxName); + + if(order==null) + throw new InvalidOrderIDException("Order is not present"); + + ShoppingCartBean cart = new ShoppingCartBean(); + + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + String currency = PriceListManager.getCurrency(ctx, priceListId); + + /* if (currency.equals("EUR")) + cart.setCurrency(Constants.EURO_SIGN); + else */ + cart.setCurrency(currency); + + ArrayList cartItems = new ArrayList(); + + MOrderLine[] orderlines = order.getLines(); + MOrderLine orderline = null; + ItemBean item = null; + double total=0; + double taxTotal=0; + double priceTotal=0; + double qtyTotal=0; + + for (int i = 0; i < orderlines.length; i++) + { + orderline = orderlines[i]; + item = new ItemBean(); + + MProduct product = orderline.getProduct(); + + String description = product.getName(); + int productId = product.get_ID(); + BigDecimal qty = orderline.getQtyOrdered(); + + item.setProductId(Integer.valueOf(productId)); + item.setDescription(description); + item.setQty(qty); + + int [] taxIds = MTax.getAllIDs(MTax.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_TAXCATEGORY_ID="+product.getC_TaxCategory_ID() + " and isActive='Y'",null); + if(taxIds.length==0) + throw new OperationException("no tax Category for the product"); + MTax tax = new MTax(ctx,taxIds[0],null); + BigDecimal priceTax= tax.calculateTax(orderline.getLineNetAmt(),false,2); + + + + item.setUnitPrice(orderline.getPriceEntered()); + item.setStandardPrice(orderline.getLineNetAmt()); + item.setTaxAmt(priceTax); + item.setPrice(orderline.getLineNetAmt().add(priceTax)); + item.setActualPrice(orderline.getLineNetAmt().add(priceTax)); //initially price and the actual price are same + + priceTotal=priceTotal+orderline.getLineNetAmt().doubleValue(); + taxTotal=taxTotal+priceTax.doubleValue(); + total=total+orderline.getLineNetAmt().add(priceTax).doubleValue(); + qtyTotal=qtyTotal+qty.doubleValue(); + + item.setPriceTotal(new BigDecimal(priceTotal)); + item.setTaxTotal(new BigDecimal(taxTotal)); + item.setgrandTotal(new BigDecimal(total)); + item.setQtyTotal(new BigDecimal(qtyTotal)); + item.setDiscountPercent(orderline.getDiscount()); + + cartItems.add(item); + } + + //setting prices + // StockManager.setPOSItemPrices(ctx,cartItems,true); + + BigDecimal totalPrice = new BigDecimal(0.0d); + for(ItemBean bean:cartItems) + { + if(bean.getPriceTotal()!=null) + { + totalPrice = totalPrice.add(bean.getPriceTotal()); + } + } + + cart.setTotalPrice(totalPrice); + cart.setItems(cartItems); + + return cart; + } + + + + public static OrderBean getPOSOrderDetail(Properties ctx,String documentNo) throws InvalidOrderIDException,OperationException + { +// checking whether order exixts + int ids[] = MOrder.getAllIDs(MOrder.Table_Name,"ISACTIVE='Y' AND DOCUMENTNO = '" + documentNo + "' and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx),null); + + if((ids == null)||(ids.length == 0)) + { + throw new InvalidOrderIDException("Could not found order!"); + } + + if(ids.length>1) + throw new OperationException("two orders with same document number"); + + MOrder order= OrderManager.loadOrder(ctx, ids[0], null); + OrderBean bean=new OrderBean(); + bean.setOrderId(order.get_ID()); + bean.setBpartnerId(order.getC_BPartner_ID()); + bean.setDocStatus(order.getDocStatus()); + bean.setOrderType(order.getOrderType()); + bean.setPaymentTermId(order.getC_PaymentTerm_ID()); + + return bean; + + } + + public static MOrder createAndCompletePOSOrder(Properties ctx,OrderLineBean bean,ArrayList cartBeanItems) throws BPartnerOverCreditLimitException,OperationException, DiscountLimitException + { + + MOrder order = null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + order = createPOSOrder(ctx, bean, cartBeanItems,null/*trx.getTrxName()*/); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + throw (e); + } + finally + { + trx.close(); + } + + + OrderLineBean orderLineBean = new OrderLineBean(); + + if(order.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + MOrder newOrder = new MOrder(ctx,order.get_ID(),null);//has to load again as it is not getting the grand total + orderLineBean.setAmountGiven(newOrder.getGrandTotal()); + orderLineBean.setAmountRefunded(new BigDecimal(0)); + } + + order = completePOSOrder(ctx, order.get_ID(), orderLineBean, null); + + return order; + } + + public static BigDecimal getPayment(Properties ctx, int orderId, String tenderType, String trxName) throws OperationException + { + MOrder order = OrderManager.loadOrder(ctx,orderId,trxName); + + if(! UDIOrderTypes.POS_ORDER.getOrderType().equalsIgnoreCase(order.getOrderType())) + { + throw new OperationException("Only POS Orders are supported!"); + } + + if(! MOrder.DOCSTATUS_Completed.equalsIgnoreCase(order.getDocStatus())) + { + throw new OperationException("Document is not yet completed!"); + } + + boolean isCheck = MPayment.TENDERTYPE_Check.equalsIgnoreCase(tenderType); + boolean isCard = MPayment.TENDERTYPE_CreditCard.equalsIgnoreCase(tenderType); + boolean isCash = "S".equalsIgnoreCase(tenderType); + + if(isCash) + { + return order.getAmountTendered(); + } + + if(isCheck || isCard) + { + String whereClause = " C_ORDER_ID = " + orderId + + " AND TENDERTYPE = '" + tenderType + "'"; + + int[] ids = MPayment.getAllIDs(MPayment.Table_Name,whereClause,trxName); + + if(ids == null || ids.length == 0) + { + return new BigDecimal(0.0d); + } + + MPayment payment = new MPayment(ctx,ids[0],trxName); + + return payment.getPayAmt(); + } + + throw new OperationException("Invalid tender type :" + tenderType); + + } + + public static String getForward(Properties ctx,String orderType) + { + + if(orderType.equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType())) + { + return "/CreatePOSOrder.do"; + } + if(orderType.equalsIgnoreCase(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())) + { + return "/CustomerReturnOrder.do"; + } + + if(orderType.equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + return "/InitCreateCreditOrderAction.do?action=initCreateCreditOrder"; + } + + if(orderType.equalsIgnoreCase(UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType())) + { + return "/GetAllPOSVendor.do?action=getAllVendors&isSales=true"; + } + if(orderType.equalsIgnoreCase(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType())) + { + return "/GetAllPOSVendor.do?action=getAllVendors&isSales=false"; + } + + else return "/CreatePartialPOSOrder.do"; + + } + + public static ArrayList getItemBean(ArrayList itemBean) + { + ArrayList list = new ArrayList(); + for(ItemBean bean : itemBean) + { + if(bean.getUnitPrice().compareTo(bean.getStandardPrice())==0 && bean.getDiscountPercent().doubleValue() > 0) + { + double disPer = bean.getDiscountPercent().doubleValue(); + double stanPrice = bean.getStandardPrice().doubleValue(); + double newStanPrice = stanPrice -( (stanPrice*disPer)/100); + bean.setStandardPrice(new BigDecimal(newStanPrice)); + + } + + list.add(bean); + } + + return list; + } + + //---------------------------------------------------------------------------------------------- + + public static int checkoutOrder(Properties ctx, CheckoutBean checkoutBean, ArrayList items, String trxName) throws Exception + { + boolean isSoTrx = true; + String orderType = checkoutBean.getOrderType(); + + int m_pricelist_id = POSTerminalManager.getSOPriceListId(ctx); + int m_warehouse_id = POSTerminalManager.getWarehouseId(ctx); + int cashBookId = POSTerminalManager.getCashBookId(ctx); + + //close previous cash journals + if(firstOrderOfTheDay(ctx)) + { + CashManager.closePreviousDraftedCashjournals(ctx, cashBookId, trxName); + } + + Integer c_bpartner_id = checkoutBean.getBpartnerId(); + + //takes bp pricelist + if(c_bpartner_id != null) + { + MBPartner bpartner = MBPartner.get(ctx, c_bpartner_id); + if(bpartner != null && bpartner.getM_PriceList_ID() > 0) + { + m_pricelist_id = bpartner.getM_PriceList_ID(); + } + } + else + { + //set standard customer + c_bpartner_id = POSTerminalManager.getCashBPartnerId(ctx); + } + + String tenderType = checkoutBean.getTenderType(); + String paymentRule = checkoutBean.getPaymentRuleFromTenderType(); + + //create order + MOrder order = OrderManager.createOrder(ctx, c_bpartner_id, isSoTrx, m_pricelist_id, orderType, + m_warehouse_id, paymentRule, trxName); + + + BigDecimal[] discounts = checkoutBean.getDiscount(); + BigDecimal grandTotal = Env.ZERO; + + for(int i=0; i items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + ArrayList newItems = new ArrayList(); + + if (items == null || items.isEmpty()) + { + return; + } + + BigDecimal grandTotal = Env.ZERO; + BigDecimal grandTotalWithoutDiscount = Env.ZERO; + + int roleId = Env.getAD_Role_ID(ctx); + MRole role = MRole.get(ctx, roleId); + BigDecimal userDiscount = role.getUserDiscount(); + BigDecimal discountLimit = userDiscount; + + BigDecimal newOrderTotal = checkoutBean.getDiscountedTotal(); + BigDecimal newOrderDiscount = checkoutBean.getTotalDiscount(); + + if (newOrderDiscount.compareTo(discountLimit) == 1) // fraud! + { + throw new DiscountLimitException("user discount limit exceeded on total, " + + "discount percentage of " + newOrderDiscount +" was tried to be given"); + } + + Iterator itemBeanIter = items.iterator(); + BigDecimal priceLimitTotal = Env.ZERO; + + while (itemBeanIter.hasNext()) + { + ItemBean item = itemBeanIter.next(); + BigDecimal priceLimit = item.getPriceLimit(); + if (priceLimit == null) + { + throw new OperationException("Product "+ item.getProductName()+" has no price limit"); + } + priceLimitTotal = priceLimitTotal.add(priceLimit); + } + + if (priceLimitTotal.compareTo(newOrderTotal) == 1) //fraud! + { + throw new DiscountLimitException("user discount limit exceeded on total, " + + "total of " + newOrderTotal + "was tried to be given"); + } + + for(int i=0; i< prices.length; i++) + { + BigDecimal price = prices[i]; + Boolean isDiscOnInclUnitPrice = false; + BigDecimal discountedInclUnitPrice = Env.ZERO; + Boolean isDiscOnPerc = false; + Boolean isDiscOnTotal = false; + + if (isDiscOnInclUnitPrices != null) + { + isDiscOnInclUnitPrice = isDiscOnInclUnitPrices[i]; + } + if (discountedInclUnitPrices!= null) + { + discountedInclUnitPrice = discountedInclUnitPrices[i]; + } + if(isDiscountsOnPerc != null) + { + isDiscOnPerc = isDiscountsOnPerc[i]; + } + if(isDiscountsOnTotal != null) + { + isDiscOnTotal = isDiscountsOnTotal[i]; + } + ItemBean bean = items.get(i); + + BigDecimal unitPrice = bean.getUnitPrice(); + BigDecimal inclUnitPrice = bean.getInclPrice(); + BigDecimal listPrice = bean.getListPrice(); + BigDecimal qty = bean.getQty(); + BigDecimal total = Env.ZERO; + BigDecimal tax = bean.getTaxAmt(); + BigDecimal taxRate = bean.getTaxRate() == null? Env.ZERO: bean.getTaxRate(); + BigDecimal taxMulFactor = (taxRate.divide(Env.ONEHUNDRED, 2, RoundingMode.HALF_UP)).add(Env.ONE); + + BigDecimal discount = Env.ZERO; + BigDecimal actualPrice = Env.ZERO; + + if (priceList.isTaxIncluded()) + { + actualPrice = inclUnitPrice; + } + else + { + actualPrice = unitPrice; + } + + total = actualPrice.multiply(qty); + + // verify fraud + + if (!isDiscOnInclUnitPrice && !actualPrice.equals(discountedInclUnitPrice)) + { + if (discountedInclUnitPrice.compareTo(bean.getPriceLimit()) == -1) + { + throw new OperationException("incl unit price less than limit price, a value of " + + discountedInclUnitPrice + "was tried to be given"); + } + if (discountedInclUnitPrice.compareTo(bean.getListPrice()) == 1) + { + throw new OperationException("incl unit price less greater list price, a value of " + + discountedInclUnitPrice + "was tried to be given"); + } + } + if (!isDiscOnPerc && !discountPerc[i].equals(bean.getDiscountPercent())) + { + if (discountPerc[i].compareTo(Env.ZERO) == -1) + { + throw new OperationException("user discount less than zero on product " + + "" + bean.getProductName() +", discount percentage given is "+ discountPerc[i]); + } + if (discountPerc[i].compareTo(discountLimit) == 1) + { + throw new OperationException("user discount exceeds discount limit on product " + + "" + bean.getProductName() +", discount percentage given is "+ discountPerc[i]); + } + } + if (!isDiscOnTotal && !total.equals(price)) + { + if (price.compareTo(bean.getPriceLimit().multiply(bean.getQty())) == -1) + { + throw new OperationException("line total less than price limit total, a value of " + + price+" was tried to be given"); + } + + if (price.compareTo(bean.getListPrice().multiply(bean.getQty())) == 1) + { + throw new OperationException("line total greater than price list total, a value of " + + price+" was tried to be given"); + } + } + + if (isDiscOnInclUnitPrice) + { + discount = (listPrice.subtract(discountedInclUnitPrice)).divide(listPrice, 12, RoundingMode.HALF_UP).multiply(Env.ONEHUNDRED); + actualPrice = discountedInclUnitPrice; + } + else if (isDiscOnPerc) + { + discount = discountPerc[i]; + actualPrice = price.divide(qty, 2, RoundingMode.HALF_UP); + } + else if (isDiscOnTotal) + { + discount = ((total.subtract(price)).divide(total, 4, RoundingMode.HALF_UP)).multiply(Env.ONEHUNDRED); + actualPrice = price.divide(qty, 2, RoundingMode.HALF_UP); + bean.setIsDiscountOnTotal(false); // reset + } + + if (discount.compareTo(discountLimit) == 1) + { + throw new DiscountLimitException("user discount limit exceeded on product " + bean.getProductName() +", discount percentage given is "+ discount); + } + + // fraud verified + + bean.setActualPrice(actualPrice); + + if (priceList.isTaxIncluded()) + { + BigDecimal exclActualPrice = actualPrice.divide(taxMulFactor, 2, RoundingMode.HALF_UP); + tax = actualPrice.subtract(exclActualPrice); + unitPrice = actualPrice.divide(taxMulFactor, 2, RoundingMode.HALF_UP); + bean.setInclPrice(actualPrice); + } + else + { + tax = actualPrice.divide(taxMulFactor, 4).setScale(2, RoundingMode.HALF_UP); + bean.setInclPrice(actualPrice); + } + + bean.setTaxAmt(tax.multiply(qty)); + bean.setUnitPrice(unitPrice); + bean.setDiscountPercent(discount); + bean.setPrice(price); + bean.setIsDiscountOnInclUnitPrice(isDiscOnInclUnitPrice); + bean.setIsDiscountOnPercentage(isDiscOnPerc); + bean.setIsDiscountOnTotal(isDiscOnTotal); + + if (isDiscOnInclUnitPrice!=null && isDiscOnInclUnitPrice) + { + bean.setDiscountedInclUnitPrice(discountedInclUnitPrice); + bean.setDiscountedLinePrice(discountedInclUnitPrice); + } + // todo - remove that grand total hack + grandTotal = grandTotal.add(price); + bean.setgrandTotal(grandTotal); + grandTotalWithoutDiscount = grandTotalWithoutDiscount.add(total); + + newItems.add(bean); + } + + //Check for discount on total + request.getSession().setAttribute(Constants.DISCOUNT_ON_ORDER_TOTAL, checkoutBean.getDiscountOnTotal()); + request.getSession().setAttribute(Constants.DISCOUNT_ON_ORDER_TOTAL_PERCENT, checkoutBean.getDiscountOnTotalPercent()); + request.getSession().setAttribute(Constants.SHOPPING_CART_DISCOUNT_PERCENTAGE, newOrderDiscount); + request.getSession().setAttribute(Constants.SHOPPING_CART_DISCOUNTED_TOTAL, newOrderTotal); + request.getSession().setAttribute(Constants.SHOPPING_CART_TOTAL, grandTotal); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART_ITEMS, newItems); + request.getSession().setAttribute(Constants.CHECKOUT_BEAN, checkoutBean); + + } + + + public static void setQuickDiscount(Properties ctx, CheckoutBean checkoutBean, HttpServletRequest request, String trxName) throws OperationException, DiscountLimitException + { + BigDecimal[] prices = checkoutBean.getDiscountedPrice(); + Boolean[] isDiscOnInclUnitPrices = checkoutBean.getIsDiscOnInclUnitPrice(); + BigDecimal[] discountPerc = checkoutBean.getDiscount(); + Boolean[] isDiscountsOnPerc = checkoutBean.getIsDiscOnPerc(); + Boolean[] isDiscountsOnTotal = checkoutBean.getIsDiscOnTotal(); + Integer priceListId = checkoutBean.getPriceListId(); + Integer productId = checkoutBean.getM_productId(); + BigDecimal totalLinesIncDisc = checkoutBean.getGrandTotal(); + MPriceList priceList = MPriceList.get(ctx, priceListId, trxName); + int priceListVersionId = 0; + + String currency = (String) request.getSession().getAttribute(Constants.CURRENCY_SYMBOLE); + + int roleId = checkoutBean.getRoleId(); + MRole role = MRole.get(ctx, roleId); + BigDecimal userDiscount = role.getUserDiscount(); + BigDecimal discountLimit = userDiscount; + boolean isDiscountAllowedOnTotal = role.isDiscountAllowedOnTotal(); + boolean isDiscountUptoLimitPrice = role.isDiscountUptoLimitPrice(); + boolean isOverideLimitPrice = role.isOverwritePriceLimit(); + + if (priceListId != null) + { + MPriceListVersion plv = PriceListManager.getPriceListVersion(ctx, priceListId, null, trxName); + priceListVersionId = plv.get_ID(); + } + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + if (items == null || items.isEmpty()) + { + return; + } + + Iterator iter = items.iterator(); + ItemBean bean; + + if(isDiscountAllowedOnTotal && isDiscountsOnTotal[0]) + { + BigDecimal totalListPrice = Env.ZERO; + BigDecimal totalLimitPrice = Env.ZERO; + BigDecimal taxPerc = Env.ZERO; + BigDecimal grandTotal = Env.ZERO; + + for (ItemBean itemBean : items) + { + MPriceList sprice = new MPriceList(ctx, itemBean.getPriceListId(), null); + ProductBean details = POSProductManager.viewPOSProduct(ctx, itemBean.getProductId(), priceListId, null); + taxPerc = (details.getTaxRate().add(Env.ONEHUNDRED)).divide(Env.ONEHUNDRED, 4, BigDecimal.ROUND_HALF_UP); + + + if(sprice.isTaxIncluded()) + { + totalLimitPrice = totalLimitPrice.add(details.getPriceLimit()); + totalListPrice = totalListPrice.add(details.getPriceList()); + } + else + { + totalLimitPrice = totalLimitPrice.add(details.getPriceLimit().multiply(taxPerc)); + totalListPrice = totalListPrice.add(details.getPriceList().multiply(taxPerc)); + } + + grandTotal = itemBean.getGrandTotal(); + + } + + if(isDiscountUptoLimitPrice && !isOverideLimitPrice) + { + if(totalLinesIncDisc.compareTo(totalListPrice) == 1) + { + throw new OperationException("DISCOUNTED TOTAL EXCEEDS TOTAL LINES!!! A discount to price " + currency + totalLinesIncDisc +" was tried to be given"); + } + + if(totalLinesIncDisc.compareTo(totalLimitPrice) == 1) + { + throw new OperationException("TOTAL DISCOUNT EXCEEDED!!! A discount to price " + currency + totalLinesIncDisc +" was tried to be given"); + } + } + + if(!isDiscountUptoLimitPrice && isOverideLimitPrice) + { + if(userDiscount.compareTo(Env.ZERO) == 1) + { + BigDecimal discount = totalListPrice.subtract(totalLinesIncDisc) ; + BigDecimal discPerc = discount.divide(totalListPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(Env.ONEHUNDRED); + + if(discPerc.compareTo(userDiscount) == 1) + { + throw new OperationException("DISCOUNT LIMIT EXCEEDED!!!"); + } + + discount = totalLinesIncDisc.subtract(grandTotal); + + if(discount.compareTo(Env.ZERO) == 1) + { + throw new OperationException("DISCOUNT CANNOT BE NAGATIVE!!!"); + } + } + + if(userDiscount.compareTo(Env.ZERO) == 0) + { + throw new OperationException("CANNOT APPLY DISCOUNT!!!
    NO DISCOUNT PERCENTAGE SET"); + } + } + + if(isDiscountUptoLimitPrice && !isOverideLimitPrice) + { + if(userDiscount.compareTo(Env.ZERO) == 1) + { + if(totalLinesIncDisc.compareTo(totalLimitPrice) == -1) + { + throw new OperationException("CANNOT OVERRIDE LIMIT PRICE!!!"); + } + + if(totalLinesIncDisc.compareTo(totalListPrice) == 1) + { + throw new OperationException("DISCOUNTED TOTAL EXCEEDS TOTAL LINES!!!"); + } + } + + if(userDiscount.compareTo(Env.ZERO) == 0) + { + throw new OperationException("CANNOT APPLY DISCOUNT!!!
    NO DISCOUNT PERCENTAGE SET"); + } + } + + if(isDiscountUptoLimitPrice && isOverideLimitPrice) + { + throw new OperationException("DISCOUNT ERROR!! CANNOT PROCESS YOUR REQUEST!!!"); + } + + BigDecimal discountAmt = totalListPrice.subtract(totalLinesIncDisc); + checkoutBean.setDiscountOnTotal(isDiscountsOnTotal[0]); + checkoutBean.setDiscountAmt(discountAmt); + checkoutBean.setDiscountedTotal(totalLinesIncDisc); + checkoutBean.setGrandTotal(totalLinesIncDisc); + + request.getSession().setAttribute(Constants.SHOPPING_CART_DISCOUNTED_TOTAL, totalLinesIncDisc); + } + else + { + + while (iter.hasNext()) + { + bean = (ItemBean) iter.next(); + if(bean.getProductId().equals(productId)) + { + BigDecimal price = prices[0]; + BigDecimal listPrice = bean.getListPrice(); + BigDecimal limitPrice = bean.getPriceLimit(); + BigDecimal qty = bean.getQty(); + BigDecimal total = Env.ZERO; + BigDecimal grandTotal = Env.ZERO; + BigDecimal grandTotalWithoutDiscount = Env.ZERO; + BigDecimal tax = bean.getTaxAmt(); + + MProduct product = new MProduct(ctx,productId, trxName); + MTax mtax = TaxManager.getTaxFromCategory(ctx, product.getC_TaxCategory_ID(), trxName); + + BigDecimal taxRate = mtax.getRate(); + BigDecimal taxMulFactor = (taxRate.divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP)).add(Env.ONE); + BigDecimal newTaxAmt = mtax.calculateTax(price.multiply(qty), true, 12).setScale(2, BigDecimal.ROUND_HALF_DOWN); + + if(!priceList.isTaxIncluded()) + { + listPrice = listPrice.multiply(taxMulFactor); + } + + if(isDiscountUptoLimitPrice) + { + if(price.compareTo(limitPrice) == -1) + { + throw new OperationException("You cannot exceed the limit price!! A discount to price " + currency + prices[0] +" was tried to be given"); + } + + if(price.compareTo(listPrice) == 1) + { + throw new OperationException("You cannot exceed the list price!! A discount to price " + currency + prices[0] +" was tried to be given"); + } + } + + if(isDiscountUptoLimitPrice && !isOverideLimitPrice) + { + if(price.compareTo(limitPrice) == -1) + { + throw new OperationException("You cannot exceed the limit price!! A discount to price " + currency + prices[0] +" was tried to be given"); + } + + if(price.compareTo(listPrice) == 1) + { + throw new OperationException("You cannot exceed the list price!! A discount to price " + currency + prices[0] +" was tried to be given"); + } + } + + if(!isDiscountUptoLimitPrice && isOverideLimitPrice) + { + if(userDiscount.compareTo(Env.ZERO) == 1) + { + if(discountPerc[0].compareTo(userDiscount) == 1) + { + throw new OperationException("DISCOUNT LIMIT EXCEEDED!!!"); + } + } + + if(userDiscount.compareTo(Env.ZERO) == 0) + { + throw new OperationException("CANNOT APPLY DISCOUNT!!!
    NO DISCOUNT PERCENTAGE SET"); + } + } + + if(!isDiscountUptoLimitPrice && !isOverideLimitPrice) + { + if(userDiscount.compareTo(Env.ZERO) == 1) + { + if(discountPerc[0].compareTo(userDiscount) == 1) + { + throw new OperationException("DISCOUNT LIMIT EXCEEDED!!!"); + } + + if(discountPerc[0].compareTo(Env.ZERO) == -1) + { + throw new OperationException("DISCOUNT CANNOT BE NEGATIVE!!!"); + } + + if(price.compareTo(limitPrice) == -1) + { + throw new OperationException("CANNOT OVER RIDE LIMIT PRICE!!!"); + } + } + + if(userDiscount.compareTo(Env.ZERO) == 0) + { + throw new OperationException("CANNOT APPLY DISCOUNT!!!
    NO DISCOUNT PERCENTAGE SET"); + } + + } + + if(isDiscountUptoLimitPrice && isOverideLimitPrice) + { + throw new OperationException("DISCOUNT ERROR!! CANNOT PROCESS YOUR REQUEST!!!"); + } + + bean.setInclPrice(price.setScale(2)); + + BigDecimal incPriceExcVat = ((price.multiply(qty)).subtract(newTaxAmt)).divide(qty, 2, BigDecimal.ROUND_HALF_UP); + bean.setDiscountedLinePrice(incPriceExcVat.setScale(2)); + bean.setDiscountedInclUnitPrice(incPriceExcVat); + bean.setUnitPrice(incPriceExcVat.setScale(2)); + + bean.setTaxAmt(newTaxAmt.setScale(2)); + bean.setIsDiscountOnInclUnitPrice(isDiscOnInclUnitPrices[0]); + bean.setIsDiscountOnPercentage(isDiscountsOnPerc[0]); + bean.setIsDiscountOnTotal(isDiscountsOnTotal[0]); + + bean.setPrice(price.multiply(qty)); + grandTotal = grandTotal.add(price); + bean.setgrandTotal(grandTotal); + grandTotalWithoutDiscount = grandTotalWithoutDiscount.add(total); + + } + } + } + //Check for discount on total + request.getSession().setAttribute(Constants.DISCOUNT_ON_ORDER_TOTAL, checkoutBean.getDiscountOnTotal()); + request.getSession().setAttribute(Constants.DISCOUNT_ON_ORDER_TOTAL_PERCENT, checkoutBean.getDiscountOnTotalPercent()); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART_ITEMS, items); + request.getSession().setAttribute(Constants.CHECKOUT_BEAN, checkoutBean); + + } + + /*private static void validateUserInput(ItemBean itemBean, CheckoutBean checkoutBean) + { + BigDecimal discountLimit = checkoutBean.getDiscountLimit(); + BigDecimal[] prices = checkoutBean.getDiscountedPrice(); + Boolean[] isDiscOnInclUnitPrices = checkoutBean.getIsDiscOnInclUnitPrice(); + BigDecimal[] discountedInclUnitPrices = checkoutBean.getDiscInclUnitPrice(); + BigDecimal[] discountPerc = checkoutBean.getDiscount(); + Boolean[] isDiscountsOnPerc = checkoutBean.getIsDiscOnPerc(); + Boolean[] isDiscountsOnTotal = checkoutBean.getIsDiscOnTotal(); + + if (!isDiscOnInclUnitPrice && actualPrice.compareTo(discountedInclUnitPrice) == 1) + { + throw new OperationException("incl unit price not valid, a value of " + + discountedInclUnitPrice + "was tried to be given"); + } + if (!isDiscOnPerc && discountPerc[i].compareTo(bean.getDiscountPercent()) == 1) + { + throw new OperationException("user discount limit exceeded on product " + + "" + bean.getProductName() +", discount percentage given is "+ discountPerc[i]); + } + if (!isDiscOnTotal && !total.equals(price)) + { + if ((price.compareTo(bean.getPriceLimit().multiply(bean.getQty())) == -1) || total.compareTo(price)==-1) + throw new OperationException("line total not valid, a value of " + + price+" was tried to be given"); + } + + }*/ + + public static int createGoodsReceiveNote(Properties ctx, CheckoutBean checkoutBean, HttpServletRequest request, String trxName) throws OperationException + { + MOrder order = null; + + MWarehouse warehouse = POSTerminalManager.getWarehouse(ctx); + int priceListId = 0; + Integer bpartnerId = checkoutBean.getBpartnerId(); + + if (bpartnerId == null) + { + throw new MandatoryException("Vendor is mandatory"); + } + priceListId = checkoutBean.getPriceListId(); + + if(checkoutBean.getPriceListId() == null) + { + priceListId = Env.getContextAsInt(ctx,UdiConstants.POS_PURCHASE_PL); + } + + order = OrderManager.createOrder(ctx,bpartnerId,false,priceListId,UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType(), + warehouse.get_ID(),checkoutBean.getPaymentRuleFromTenderType(),trxName); + + + PoManager.save(order); + + + //create orderlines + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + for(int i=0; i items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + MOrder order = POSGoodsManager.createCustomerReturn(ctx,orderBean,items,bpartnerId,reason,trxName); + POSGoodsManager.completeCustomerReturnOrder(ctx,order.get_ID(),trxName); + + return order.get_ID(); + } + + public static int createGoodsReturnNote(Properties ctx, CheckoutBean checkoutBean, HttpServletRequest request, String trxName) throws OperationException + { + MOrder order = null; + + MWarehouse warehouse = POSTerminalManager.getWarehouse(ctx); + int priceListId = 0; + Integer bpartnerId = checkoutBean.getBpartnerId(); + + if (bpartnerId == null) + { + throw new MandatoryException("Vendor is mandatory"); + } + priceListId = checkoutBean.getPriceListId(); + + if(checkoutBean.getPriceListId() == null) + { + priceListId = Env.getContextAsInt(ctx,UdiConstants.POS_PURCHASE_PL); + } + + order = OrderManager.createOrder(ctx,bpartnerId,false,priceListId,UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType(), + warehouse.get_ID(),checkoutBean.getPaymentRuleFromTenderType(),trxName); + + + PoManager.save(order); + + + //create orderlines + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + for(int i=0; i0) + { + ProductImageManager.clearImages(ctx, product.get_ID(), null); + ProductImageUploader.uploadImage(ctx, product.get_ID(), attachment, attachment.getFileName(), null); + } + return product; + } + + public static ProductBean viewPOSProduct(Properties ctx,int productId, int priceListId, String trxName) throws OperationException + { + ProductBean bean = viewPOSProduct(ctx, productId, trxName); + int priceListversionId = PriceListManager.getPriceListVersionID(ctx, priceListId, trxName); + + MProductPrice productPrice = MProductPrice.get(ctx, priceListversionId, productId, trxName); + if(productPrice != null) + { + bean.setPriceList(productPrice.getPriceList()); + bean.setPriceStandard(productPrice.getPriceStd()); + bean.setPriceLimit(productPrice.getPriceLimit()); + bean.setPriceListId(priceListId); + } + + return bean; + } + + public static ProductBean viewPOSProductForInventory(Properties ctx,int productId, int priceListId, String trxName) throws OperationException + { + ProductBean bean = viewPOSProduct(ctx, productId, trxName); + int priceListversionId = PriceListManager.getPriceListVersionID(ctx, priceListId, trxName); + + MProductPrice productPrice = MProductPrice.get(ctx, priceListversionId, productId, trxName); + if(productPrice != null) + { + bean.setPriceList(productPrice.getPriceList()); + bean.setPriceStandard(productPrice.getPriceStd()); + bean.setPriceLimit(productPrice.getPriceLimit()); + bean.setPriceListId(priceListId); + + MPOS pos = MPOS.get(ctx,Env.getContextAsInt(ctx,UdiConstants.TERMINAL_ID)); + BigDecimal QtyBook = MStorage.getQtyAvailable(pos.getM_Warehouse_ID(), productId,0, null); + bean.setQtyOnHand(QtyBook); + } + + return bean; + } + + // SENDYFIXME refactor handling of price list + public static ProductBean viewPOSProduct(Properties ctx,int productId, String trxName) throws OperationException + { + if (productId == 0) + { + ProductBean productBean = new ProductBean(); + productBean.setOrgId(0); + return productBean; + } + int warehouseId = WarehouseManager.getDefaultWarehouse(ctx).getM_Warehouse_ID(); + MLocator locator = MLocator.get(ctx, warehouseId, "", "0", "0", "0"); + BigDecimal qtyAvailable = MStorage.getQtyAvailable(warehouseId, locator.get_ID(), productId, 0, trxName); + + MProduct product = new MProduct(ctx,productId,trxName); + MProductPrice purchasePrice=null; + ProductBean bean= new ProductBean(); + + bean.setProductName(product.getName()); + bean.setOrgId(product.getAD_Org_ID()); + bean.setBarCode(product.getUPC()); + int revenueRecognitionId = product.getC_RevenueRecognition_ID(); + bean.setDescription(product.getDescription()); + bean.setProductCategoryId(product.getM_Product_Category_ID()); + bean.setProductId(productId); + bean.setIsActive(product.isActive()); + bean.setRevenueRecoId(revenueRecognitionId); + int taxCategoryId = product.getC_TaxCategory_ID(); + bean.setTaxCategoryId(taxCategoryId); + bean.setProductType(product.getProductType()); + bean.setGroup1(product.getGroup1()); + bean.setGroup2(product.getGroup2()); + bean.setUnitsPerPack(product.getUnitsPerPack()); + int uomId = product.getC_UOM_ID(); + MUOM uom = MUOM.get(ctx, uomId); + bean.setUom(uom.getName()); + bean.setUomId(uomId); + bean.setQtyOnHand(qtyAvailable); + bean.setOrgId(product.getAD_Org_ID()); + bean.setIsEditable(RoleManager.isEditable(ctx, product.getAD_Org_ID())); + + MProductCategory productCategory = new MProductCategory(ctx, product.getM_Product_Category_ID(), trxName); + bean.setProductCategoryName(productCategory.getName()); + + ProductImageInfo imageInfo = new ProductImageInfo(); + boolean isImagePresent = ProductManager.isProductImagePresent(ctx, productId, trxName); + imageInfo.setHasAttachment(isImagePresent); + + bean.setImageInfo(imageInfo); + + // FIXME bad handling of tax - need refactoring + MTaxCategory taxCategory = new MTaxCategory(ctx,product.getC_TaxCategory_ID(),trxName); + MTax tax = TaxManager.getTaxFromCategory(ctx, taxCategory.getC_TaxCategory_ID(), trxName); + bean.setTaxRate(tax.getRate()); + bean.setTaxCategoryName(taxCategory.getName()); + + MRevenueRecognition reco=new MRevenueRecognition(ctx,product.getC_RevenueRecognition_ID(),trxName); + bean.setRevenueRecognition(reco.getName()); + + int priceListId = POSTerminalManager.getSOPriceListId(ctx); + int salesPriceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, trxName); + bean.setPriceListId(priceListId); + + MPriceList m_priceList = MPriceList.get(ctx, priceListId, trxName); + bean.setIsTaxIncluded(m_priceList.isTaxIncluded()); + + MProductPrice productPrice = MProductPrice.get(ctx,salesPriceListVersionId, productId, null); + + if(productPrice!=null) + { + if(productPrice.getPriceList()==null) + bean.setSalesPriceList(0+""); + else + bean.setSalesPriceList(productPrice.getPriceList().toString()); + + if(productPrice.getPriceStd()==null) + bean.setSalesPriceStandard(0+""); + else + bean.setSalesPriceStandard(productPrice.getPriceStd().toString()); + + if(productPrice.getPriceLimit()==null) + bean.setSalesPriceLimit(0+""); + else + bean.setSalesPriceLimit(productPrice.getPriceLimit().toString()); + } + else + { + bean.setSalesPriceStandard(0+""); + } + + int purchasePriceListVersionId = StoreManager.getPriceListId(ctx); + purchasePrice = MProductPrice.get(ctx, purchasePriceListVersionId, productId, null); + if(purchasePrice==null) + bean.setPurchasePriceStandard(0+""); + else + bean.setPurchasePriceStandard(purchasePrice.getPriceList().toString()); + + return bean; + } + + + /*public static void editProduct(Properties ctx,ProductBean bean,String existingBarCode,String trxName) throws BarcodeAlreadyExistsException,CannotInactivateProductException, OperationException + { + MProductPrice purchasePrice ; + MProductPrice salesPrice; + + FormFile attachment = bean.getFile(); + + if(attachment != null && attachment.getFileName() != null && attachment.getFileName().length()>0 && !attachment.getFileName().equals("")) + { + ProductImageManager.clearImages(ctx, bean.getProductId(), trxName); + ProductImageUploader.uploadImage(ctx, bean.getProductId(), attachment, attachment.getFileName(), trxName); + } + + MProduct product = ProductManager.loadProduct(ctx, bean.getProductId(), trxName); + + product.setName(bean.getProductName()); + product.setDescription(bean.getDescription()); + product.setGroup1(bean.getGroup1()); + product.setGroup2(bean.getGroup2()); + if(bean.getTaxCategoryId()!=null) + product.setC_TaxCategory_ID(bean.getTaxCategoryId()); + product.setUPC(bean.getBarCode()); + product.setC_UOM_ID(bean.getUomId()); + + if(bean.getRevenueRecognition()!=null) + product.setC_RevenueRecognition_ID(getOrCreateRevenueRecognition(ctx,bean.getRevenueRecognition(),trxName).get_ID()); + + if(bean.getIsActive().equals(false)) + { + String errorMsg=checkQty(ctx,product.get_ID(),trxName); + if(errorMsg!=null) + throw new CannotInactivateProductException(errorMsg); + product.setIsActive(bean.getIsActive()); + } + + else + product.setIsActive(bean.getIsActive()); + + if(bean.getProductType()!=null) + { + if( bean.getProductType().equals(MProduct.PRODUCTTYPE_Service)) + { + String errorMsg=checkQty(ctx,product.get_ID(),trxName); + if(errorMsg!=null) + throw new CannotInactivateProductException(errorMsg); + product.setIsStocked(false); + + } + else + { + product.setIsStocked(true); + } + + if(bean.getProductType()!=null) + product.setProductType(bean.getProductType()); + } + + if(bean.getSalesPriceList()==null) + bean.setSalesPriceList("0"); + if(bean.getSalesPriceStandard()==null) + bean.setSalesPriceStandard(bean.getSalesPriceList()); + if(bean.getSalesPriceLimit()==null) + bean.setSalesPriceLimit(bean.getSalesPriceStandard()); + if(bean.getPurchasePriceStandard()==null) + bean.setPurchasePriceStandard("0"); + + double salesPriceL= Double.parseDouble(bean.getSalesPriceList())); + double salesPriceS=OrderManager.round(Double.parseDouble(bean.getSalesPriceStandard())); + double salesPriceLmt=OrderManager.round(Double.parseDouble(bean.getSalesPriceLimit())); + double purchasePriceSt=OrderManager.round(Double.parseDouble(bean.getPurchasePriceStandard())); + + + + + BigDecimal salesPriceList=FormatBigDecimal.currency(salesPriceL); + BigDecimal salesPriceStand= FormatBigDecimal.currency(salesPriceS); + BigDecimal salesPriceLimit=FormatBigDecimal.currency(salesPriceLmt); + BigDecimal purchasePriceStand=FormatBigDecimal.currency(purchasePriceSt); + + + int priceListId = POSTerminalManager.getSOPriceListId(ctx); + int salesPriceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, trxName); + + salesPrice = MProductPrice.get(ctx,salesPriceListVersionId,bean.getProductId(),trxName); + if(salesPrice==null) + salesPrice= new MProductPrice(ctx,salesPriceListVersionId,bean.getProductId(),trxName); + salesPrice.setPrices(salesPriceList,salesPriceStand,salesPriceLimit); + PoManager.save(salesPrice); + + int purchasePriceListVersionId = Env.getContextAsInt(ctx,UdiConstants.POS_PURCHASE_PL_VERSION); + purchasePrice = MProductPrice.get(ctx,purchasePriceListVersionId,bean.getProductId(),trxName); + if(purchasePrice==null) + purchasePrice = new MProductPrice(ctx,purchasePriceListVersionId,bean.getProductId(),trxName); + purchasePrice.setPrices(purchasePriceStand,purchasePriceStand,purchasePriceStand); + PoManager.save(purchasePrice); + PoManager.save(product); + + createCosting(ctx,product,new BigDecimal(bean.getPurchasePriceStandard()),null, trxName); //null for not updating stock + }*/ + + + public static String checkQty(Properties ctx,int productId,String trxName) throws OperationException + { + MStorage[] storages = MStorage.getOfProduct(ctx, productId, trxName); + BigDecimal OnHand = Env.ZERO; + BigDecimal Ordered = Env.ZERO; + BigDecimal Reserved = Env.ZERO; + for (int i = 0; i < storages.length; i++) + { + OnHand = OnHand.add(storages[i].getQtyOnHand()); + Ordered = Ordered.add(storages[i].getQtyOrdered()); + Reserved = Reserved.add(storages[i].getQtyReserved()); + } + String errMsg = null; + if (OnHand.signum() != 0) + errMsg = "QtyOnHand = " + OnHand; + if (Ordered.signum() != 0) + errMsg += " , QtyOrdered = " + Ordered; + if (Reserved.signum() != 0) + errMsg += " , QtyReserved=" + Reserved; + if (errMsg != null) + { + return errMsg; + + } + + return errMsg; + } + + + private static MRevenueRecognition getOrCreateRevenueRecognition(Properties ctx,String name,String trxName) throws OperationException + { + MRevenueRecognition revenueRecognition; + int [] revenueRecIds = MRevenueRecognition.getAllIDs(MRevenueRecognition.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and AD_ORG_ID="+Env.getAD_Org_ID(ctx)+" and name='"+name+"'",trxName); + if(revenueRecIds.length>0) + { + revenueRecognition = new MRevenueRecognition(ctx,revenueRecIds[0],trxName); + return revenueRecognition; + } + + else + revenueRecognition = new MRevenueRecognition(ctx,0,trxName); + + revenueRecognition.setIsTimeBased(false); + revenueRecognition.setName(name); + revenueRecognition.setDescription(name); + + PoManager.save(revenueRecognition); + return revenueRecognition; + } + + public static ArrayList getArrayOfPriceList(Properties ctx, int productId) + { + ArrayList reportData = new ArrayList(); + + return reportData; + } + + + public static ArrayList viewAllProducts(Properties ctx,String name,String barCode,String description) throws ProductNotFoundException,OperationException + { + String sql="select m_product_id,name from m_product where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + if(name != null) + sql = sql+" and upper(name) like upper('%"+name+"%')"; + + if(barCode != null) + sql = sql+" and upc ='"+barCode+"'"; + + if(description != null && description.length() > 0) + { + sql = sql + " and upper(description) like upper('%" +description + "%')"; + } + + sql=sql+" order by name"; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + ResultSet rs; + ProductBean bean=null; + ArrayList list=new ArrayList(); + + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean=viewPOSProduct(ctx,rs.getInt(1), null); + list.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + } + + private static void createCosting(Properties ctx, MProduct product, BigDecimal costPrice, BigDecimal stock, String trxName) throws OperationException + { + MClient client = new MClient(ctx, Env.getAD_Client_ID(ctx), null); + + MCostElement costElements[] = MCostElement.getCostingMethods(client); + + for(int i = 0; i < costElements.length; i++) + { + MCost cost = MCost.get(product, 0, client.getAcctSchema(), 0, costElements[i].get_ID()); + cost.set_TrxName(trxName); + cost.setCurrentCostPrice(costPrice); + if(stock!=null) + cost.setCurrentQty(stock); + PoManager.save(cost); + } + } + + + public static String getProductCartAsCSV( Properties ctx, ProductCart cart ) throws OperationException + { + ArrayList productList = cart.getProducts(); + + ArrayList data = new ArrayList(); + Object[] headers = new Object[]{"Product ID","Name","Barcode","Qty"}; + + data.add( headers ); + Object[] row = null; + + for(ProductDetailsBean bean : productList) + { + row = new Object[4]; + + row[0] = bean.getProductId(); + row[1] = bean.getProductName(); + row[2] = bean.getBarCode(); + row[3] = bean.getQuantity(); + + data.add( row ); + } + + return CSVReportManager.generateCSVReport(ctx, data); + + } + + public static String getPrintBarcodeData( Properties ctx, ProductCart cart, String trxName ) throws OperationException + { + ArrayList productList = cart.getProducts(); + StringBuffer printData = new StringBuffer(); + BarcodeFormatter formatter = new BarcodeFormatter(); + ProductBean pBean = null; + PrintBarcodeBean barcodeBean = null; + + formatter.setShowSubtitle( false); + + for(ProductDetailsBean bean : productList) + { + Integer productId = bean.getProductId(); + BigDecimal quantity = bean.getQuantity(); + String barcode = bean.getBarCode(); + String productName = bean.getProductName(); + String salesPrice = null; + + pBean = viewPOSProduct(ctx, productId.intValue(), trxName); + salesPrice = pBean.getSalesPriceStandard(); + + if( barcode == null ) + { + barcode = ProductManager.getBarcodeForSimilarProducts( ctx, productId, trxName); + } + + barcodeBean = new PrintBarcodeBean(); + + productName = productName.replaceAll(ProductManager.PRODUCT_ATTRIBUTES_DELIMETER, " "); + + barcodeBean.setBarcode( barcode ); + barcodeBean.setTitle( productName ); + barcodeBean.setPrice( salesPrice ); + barcodeBean.setQty( quantity.intValue() ); + + String s = (String) formatter.format( barcodeBean ); + + printData.append(s); + + } + + //TODO send data to barcode printer + System.out.println( "---> Printing Barcode" ); + System.out.println( printData.toString() ); + + return printData.toString(); + } + + public static ProductSalesSummaryBean getProductSalesInfoSummary( Properties ctx, int product_id, String period, String trxName) throws OperationException + { + Date startDate = ReportDateManager.getStartDateForPeriod(period); + Date endDate = ReportDateManager.getEndDateForPeriod(period); + + SimpleDateFormat f = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + String fromDate = f.format(startDate); + String toDate = f.format(endDate); + + String sql = "select " + + "(qtyordered - qtyreturned) as NetQtySold," + //1.net qty sold + "(orderAmt - returnAmt) as NetAmount " + //2.net amount + + "from " + + "( select nvl(sum(ordline.QTYORDERED),0) as qtyordered, nvl(sum(ordline.LINENETAMT),0) as orderAmt " + + " from C_ORDERLINE ordline, C_ORDER ord, C_BPARTNER bp " + + " where ordline.M_PRODUCT_ID = ? " + //<----------1.productID + " and ord.C_ORDER_ID = ordline.C_ORDER_ID " + + " and bp.C_BPARTNER_ID = ord.C_BPARTNER_ID " + + " and bp.ISCUSTOMER = 'Y' " + + " and ORDERTYPE in ('POS Order','Credit Order') " + + " and ord.DATEORDERED between " + + " to_date( ? , 'DD-MM-YYYY HH24:MI:SS' )" + //<----------2.startDate + " and to_date( ? , 'DD-MM-YYYY HH24:MI:SS' )" + //<----------3.endDate + ") QTYORDERED, " + + + "( select nvl(sum(ordline.QTYORDERED),0) as qtyreturned, nvl(sum(ordline.LINENETAMT),0) as returnAmt " + + " from C_ORDERLINE ordline, C_ORDER ord, C_BPARTNER bp " + + " where ordline.M_PRODUCT_ID = ? " + //<----------4.productID + " and ord.C_ORDER_ID = ordline.C_ORDER_ID " + + " and bp.C_BPARTNER_ID = ord.C_BPARTNER_ID " + + " and bp.ISCUSTOMER = 'Y' " + + " and ORDERTYPE = 'Customer Return Order' " + + " and ord.DATEORDERED between " + + " to_date( ? , 'DD-MM-YYYY HH24:MI:SS' )" + //<----------5.startDate + " and to_date( ? , 'DD-MM-YYYY HH24:MI:SS' )" + //<----------6.endDate + ") QtyReturned " ; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + ProductSalesSummaryBean bean = new ProductSalesSummaryBean(); + + try + { + pstmt = DB.prepareStatement( sql, trxName ); + pstmt.setInt( 1, product_id ); + pstmt.setInt( 4, product_id ); + + pstmt.setString(2, fromDate); + pstmt.setString(3, toDate); + pstmt.setString(5, fromDate); + pstmt.setString(6, toDate); + + + + rs = pstmt.executeQuery(); + + if( rs.next() ) + { + bean.setQtySold( rs.getBigDecimal(1) ); + bean.setTotalAmount( rs.getBigDecimal(2) ); + } + + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + rs = null; + pstmt = null; + } + + return bean; + +} + + public static ProductSalesSummaryBean getProductSalesInfoSummary( Properties ctx, int product_id, String trxName ) throws OperationException + { + String sql = "select " + + "prod.name, " + //1.product name + "(qtyordered - qtyreturned) as NetQtySold," + //2.net qty sold + "(orderAmt - returnAmt) as NetAmount, " + //3.net amount + "qtyonhand from " + //4.qty on hand + + "( select nvl(sum(ordline.QTYORDERED),0) as qtyordered, nvl(sum(ordline.LINENETAMT),0) as orderAmt " + + " from C_ORDERLINE ordline, C_ORDER ord, C_BPARTNER bp " + + " where ordline.M_PRODUCT_ID = ? " + + " and ord.C_ORDER_ID = ordline.C_ORDER_ID " + + " and bp.C_BPARTNER_ID = ord.C_BPARTNER_ID " + + " and bp.ISCUSTOMER = 'Y' " + + " and ORDERTYPE in ('POS Order','Credit Order') " + + ") QtyOrdered, " + + + "( select nvl(sum(ordline.QTYORDERED),0) as qtyreturned, nvl(sum(ordline.LINENETAMT),0) as returnAmt " + + " from C_ORDERLINE ordline, C_ORDER ord, C_BPARTNER bp " + + " where ordline.M_PRODUCT_ID = ? " + + " and ord.C_ORDER_ID = ordline.C_ORDER_ID " + + " and bp.C_BPARTNER_ID = ord.C_BPARTNER_ID " + + " and bp.ISCUSTOMER = 'Y' " + + " and ORDERTYPE = 'Customer Return Order'" + + ") QtyReturned, " + + + " ( select nvl(sum(qtyonhand),0) as qtyonhand from M_STORAGE where M_PRODUCT_ID = ? ) QtyOnHand , " + + + "M_Product prod where M_PRODUCT_ID = ?"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + ProductSalesSummaryBean bean = new ProductSalesSummaryBean(); + + try + { + pstmt = DB.prepareStatement( sql, trxName ); + pstmt.setInt( 1, product_id ); + pstmt.setInt( 2, product_id ); + pstmt.setInt( 3, product_id ); + pstmt.setInt( 4, product_id ); + + rs = pstmt.executeQuery(); + + if( rs.next() ) + { + bean.setProductName( rs.getString(1) ); + bean.setQtySold( rs.getBigDecimal(2) ); + bean.setTotalAmount( rs.getBigDecimal(3) ); + bean.setQtyOnHand( rs.getBigDecimal(4) ); + bean.setProductId( Integer.valueOf(product_id) ); + } + + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + rs = null; + pstmt = null; + } + + return bean; + + } + + public static ArrayList getProductSalesInfoDetails( Properties ctx, int product_id, String trxName ) throws OperationException + { + String sql = "" + + "select * from (" + + "select " + + "ord.DOCUMENTNO, " + //1.document No + "ord.DATEORDERED, " + //2.date ordered + "bp.name || ' ' || bp.name2, " + //3.customer name + "ord.ORDERTYPE, " + //4.order type + "ordline.QTYORDERED, " + //5.qty ordered + "ord.C_ORDER_ID, " + //6.order id + "ordline.linenetamt " + //7.line amount + + "from C_ORDERLINE ordline, C_ORDER ord, C_BPARTNER bp " + + "where ordline.M_PRODUCT_ID = ? " + + "and ord.C_ORDER_ID = ordline.C_ORDER_ID " + + "and bp.C_BPARTNER_ID = ord.C_BPARTNER_ID " + + "and bp.ISCUSTOMER = 'Y' " + + "order by ord.DATEORDERED desc" + + ") DocNum "; +// "where rownum <= ?"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + ArrayList list = new ArrayList(); + ProductSalesInfoBean bean = null; + + try + { + pstmt = DB.prepareStatement( sql, trxName ); + pstmt.setInt( 1, product_id ); + //pstmt.setInt( 2, maxNoOfRecords ); // limits the number of records returned + + rs = pstmt.executeQuery(); + + while( rs.next() ) + { + bean = new ProductSalesInfoBean(); + + bean.setDocumentNo( rs.getString(1)); + bean.setDateOrdered(rs.getDate(2)); + bean.setBpartnerName(rs.getString(3)); + bean.setOrderType(rs.getString(4)); + bean.setQtyOrderded(rs.getBigDecimal(5)); + bean.setOrderId(Integer.valueOf(rs.getInt(6))); + bean.setLineAmount(rs.getBigDecimal(7)); + + list.add( bean ); + } + + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + rs = null; + pstmt = null; + } + + return list; + + } + + public static ProductSalesSummaryBean[] getSalesBucket(Properties ctx, int productId, String trxName) throws OperationException + { + String[] periods = new String[]{ + ReportDateManager.CURRENT_YEAR, + ReportDateManager.LAST_6MONTHS, + ReportDateManager.LAST_3MONTHS, + ReportDateManager.LAST_2MONTHS, + ReportDateManager.CURRENT_MONTH, + ReportDateManager.CURRENT_WEEK, + ReportDateManager.TODAY + }; + + ProductSalesSummaryBean[] beans = new ProductSalesSummaryBean[periods.length]; + + for(int i = 0; i < periods.length; i++) + { + beans[i] = getProductSalesInfoSummary(ctx,productId,periods[i],trxName); + } + + return beans; + + } + + public static void editBulkProduct(Properties ctx, Integer[] productIds, ProductBean bean, String trxName) throws InvalidContentTypeException, OperationException + { + MProductPrice purchasePrice ; + MProductPrice salesPrice; + FormFile attachment = bean.getFile(); + boolean hasAttachment; + Integer productId; + MProduct product; + + hasAttachment = (attachment != null && !attachment.getFileName().equals("")); + + for(int i=0; i getUoms(Properties ctx, String trxName) + { + String orgs = RoleManager.getRoleViewableOrgAccess(ctx); + String whereClause = "ISACTIVE = 'Y' AND AD_CLIENT_ID IN (0," + Env.getAD_Client_ID(ctx) + ") AND AD_Org_ID IN (" + orgs + ")"; + int ids[] = MUOM.getAllIDs(MUOM.Table_Name, whereClause, trxName); + + ArrayList list = new ArrayList(); + for(int id : ids) + { + MUOM uom = MUOM.get(ctx, id); + KeyNamePair pair = uom.getKeyNamePair(); + list.add(pair); + } + + return list; + } + + public static ProductBean getProductBean(Properties ctx, + ArrayList list, Integer productId, Boolean isNext) throws OperationException + { + int index = -1; + + if (productId == 0) + { + ProductBean productBean = new ProductBean(); + productBean.setProductId(0); + productBean.setOrgId(0); + return productBean; + } + else + { + if (list != null) + { + Iterator iter = list.iterator(); + + while (iter.hasNext()) + { + ProductBean currBean = iter.next(); + if (currBean.getProductId().equals(productId)) + { + index = list.indexOf(currBean); + } + } + if (index != -1) + { + if (isNext!=null) + { + if (isNext) + { + int nextIndex = (index + 1)%list.size(); + index = nextIndex; + } + else + { + int previousIndex = (index-1)%list.size(); + if (previousIndex < 0) + { + previousIndex += list.size(); + } + index = previousIndex; + } + } + return viewPOSProduct(ctx, list.get(index).getProductId(), null); + } + else + { + throw new OperationException("product not found in search list"); + } + } + else + { + return viewPOSProduct(ctx, productId, null); + } + } + } + + public static ArrayList getProductBeans(Properties ctx, Integer priceListVersionId, String trxName) throws OperationException + { + PreparedStatement pstmt = null; + ResultSet rs = null; + ArrayList list = new ArrayList(); + StringBuffer query = new StringBuffer(); + + String orgs = RoleManager.getRoleViewableOrgAccess(ctx); + + query.append("SELECT M_Product_Id FROM M_ProductPrice where AD_CLIENT_ID = " + Env.getAD_Client_ID(ctx)); + + if(priceListVersionId != null) + { + query.append(" AND M_PriceList_Version_Id = " + priceListVersionId); + } + + query.append(" ORDER BY M_Product_Id"); + + try + { + pstmt = DB.prepareStatement(query.toString(), trxName); + rs = pstmt.executeQuery(); + + while(rs.next()) + { + ProductBean productBean = new ProductBean(); + productBean = viewPOSProduct(ctx, rs.getInt(1), trxName); + list.add(productBean); + } + } + + catch(SQLException e) + { + throw new OperationException(e); + } + + finally + { + if(pstmt != null) + { + try + { + pstmt.close(); + } + catch(SQLException e) + { + throw new OperationException(e); + } + } + + if(rs != null) + { + try + { + rs.close(); + } + catch(SQLException e) + { + throw new OperationException(e); + } + } + } + + return list; + } + + public static HashMap getOrderQtyInfoPerProduct(Properties ctx, Boolean isSOTrx, + Integer productId, String orgIds, Timestamp date1, Timestamp date2, String trxName) throws OperationException + { + DateFormatSymbols dfs = new DateFormatSymbols(Locale.ENGLISH); + String[] monthName = dfs.getMonths(); + + + HashMap dateQtymap = new HashMap(); + + String[] orgs = orgIds.split(","); + StringBuffer locatorIds = new StringBuffer(); + int i = 0; + for (String org:orgs ) + { + try + { + int orgId = Integer.parseInt(org); + locatorIds = locatorIds.append(WarehouseManager.getLocatorIds(ctx, orgId)); + if (orgId == 0) + { + break; + } + else + { + if (i < orgs.length -1) + { + locatorIds.append(","); + } + } + } + catch (NumberFormatException e) + {} + + i++; + } + + StringBuffer sql = new StringBuffer("SELECT SUM(trx.movementQty), trx.movementDate") + .append(" FROM M_Transaction trx") + .append(" WHERE trx.M_Product_ID = ? AND trx.M_Locator_ID IN (" + locatorIds+")") + .append(" AND trx.movementDate BETWEEN " + DB.TO_DATE(date1, true) +" AND " + DB.TO_DATE(date2, true)) + .append(" AND trx.movementType = ?") + .append(" GROUP BY trx.movementDate"); + + PreparedStatement pstmt =null; + ResultSet rs = null; + ArrayList list = new ArrayList(); + try + { + pstmt = DB.prepareStatement(sql.toString(), trxName); + pstmt.setInt(1, productId); + if (isSOTrx) + { + pstmt.setString(2, MTransaction.MOVEMENTTYPE_CustomerShipment); + } + else + { + pstmt.setString(2, MTransaction.MOVEMENTTYPE_VendorReceipts); + } + rs = pstmt.executeQuery(); + + while (rs.next()) + { + BigDecimal qty = rs.getBigDecimal(1); + Date date = rs.getDate(2); + list.add(date); + dateQtymap.put(date, qty); + } + } + catch (SQLException e) + { + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + Collections.sort(list); + + Iterator iter= list.iterator(); + StringBuffer monthYearList = new StringBuffer(); + + HashMap monthQtyMap = new HashMap(); + while (iter.hasNext()) + { + Date date = iter.next(); + + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + + int month= cal.get(Calendar.MONTH); + int year = cal.get(Calendar.YEAR); + + String monthYear = monthName[month] + " " + year; + monthYearList.append(monthYear).append(","); + + BigDecimal qty = dateQtymap.get(date); + + if (monthQtyMap.containsKey(monthYear)) + { + qty = qty.add(monthQtyMap.get(monthYear)); + } + + monthQtyMap.put(monthYear, qty); + + } + + return monthQtyMap; + } + + public static ArrayList getExportData(Properties ctx, ArrayList list) throws IOException + { + ArrayList exportData = new ArrayList(); + String[] header = null; + + File importTemplate = new File(PathInfo.PROJECT_HOME + "/import/importTemplate.csv"); + BufferedReader bufReader = new BufferedReader(new FileReader(importTemplate)); + String line = bufReader.readLine(); + int i = 0; + int size = 0; + //read the template file header + if (line != null) + { + StringTokenizer st = new StringTokenizer(line,","); + size = st.countTokens(); + header = new String[size]; + while (st.hasMoreTokens()) + { + + header[i] = st.nextToken().replaceAll("\"","");; + i++; + } + } + //close the file + bufReader.close(); + exportData.add(header); + + if (list!=null && !list.isEmpty()) + { + Iterator productIter = list.iterator(); + + HashMap map = new HashMap(); + + while (productIter.hasNext()) + { + ProductBean productBean = productIter.next(); + map.put("Revenue Recognition", productBean.getRevenueRecognition()); + map.put("Barcode", productBean.getBarCode()); + map.put("Name", productBean.getProductName()); + map.put("Description", productBean.getDescription()); + map.put("UOM", productBean.getUom()); + map.put("Purchase Price", productBean.getPurchasePriceStandard()); + map.put("Marked Price", productBean.getSalesPriceList()); + map.put("Discounted Price", productBean.getSalesPriceStandard()); + map.put("Limit Price", productBean.getSalesPriceLimit()); + map.put("VAT %", productBean.getTaxRate()); + map.put("Stock in Hand", productBean.getQtyOnHand()); + + Object[] productLine = new Object[size]; + int count = 0; + for (String value : header) + { + if (map.containsKey(value)) + { + productLine[count] = map.get(value); + } + count++; + } + exportData.add(productLine); + map.clear(); + } + } + return exportData; + } + + public static ArrayList searchPOSGarmentAttributes(HttpServletRequest request) throws OperationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + String attrName = null; + String attrValue = null; + + int ad_client_id = Env.getAD_Client_ID(ctx); + + ArrayList attributeValueList = new ArrayList(); + + String[] attributes = {"brand","colour","design","model","revenue_recognition"}; + + for(int i=0;i getAllAttributeSet(Properties ctx) throws OperationException + { + String sql = " select M_ATTRIBUTESET_ID,NAME from M_ATTRIBUTESET where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + AttributeBean bean =null; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + ArrayList list = new ArrayList(); + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { bean= new AttributeBean(); + bean.setAttributeSetId(Integer.valueOf(rs.getInt(1))); + bean.setAttributeSetName(rs.getString(2)); + list.add(bean); + } + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + } + + + public static ArrayList getAllAttributeFromAttributeSet(Properties ctx,AttributeBean aBean) throws OperationException + { + + + String sql = "select att.M_ATTRIBUTE_ID," + + "att.name" + + " from M_ATTRIBUTEUSE u,M_ATTRIBUTE att" + + " where u.M_ATTRIBUTE_ID=att.M_ATTRIBUTE_ID"+ + " and M_ATTRIBUTESET_ID="+aBean.getAttributeSetId(); + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ArrayList list = new ArrayList(); + AttributeBean bean =null; + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean= new AttributeBean(); + bean.setAttributeId(Integer.valueOf(rs.getInt(1))); + bean.setAttributeName(rs.getString(2)); + if(aBean.getAttributeValueIds()==null) + { + bean.setAttributeValueList(getAttributeValues(ctx,bean.getAttributeId())); + } + else + { + bean.setAttributeValueList(getFilteredAttributeValues(ctx,aBean,bean.getAttributeId().intValue())); + } + + list.add(bean); + } + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + return list; + + } + + private static ArrayList getAttributeValues(Properties ctx,int attributeId) throws OperationException + { + + String sql = "select distinct M_ATTRIBUTEVALUE_ID,VALUE from M_ATTRIBUTEINSTANCE where M_ATTRIBUTE_ID= "+attributeId+" order by VALUE"; + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ArrayList list = new ArrayList(); + AttributeBean bean =null; + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + bean= new AttributeBean(); + bean.setAttributeValueId(Integer.valueOf(rs.getInt(1))); + bean.setAttributeValue(rs.getString(2)); + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + } + + + public static ArrayList getAllProducts(Properties ctx, Integer attributeSetId) throws OperationException + { + MWarehouse warehouse = POSTerminalManager.getWarehouse(ctx); + BigDecimal totalCost = BigDecimal.valueOf(0.0); +// int purchasePriceListVersionId = Env.getContextAsInt(ctx,UdiConstants.POS_PURCHASE_PL_VERSION); + + int poPriceListId = POSTerminalManager.getPOPriceListId(ctx); + int purchasePriceListVersionId = PriceListManager.getPriceListVersionID(ctx, poPriceListId, null); + + String sql = "select pr.name," + + " SUM(st.QTYONHAND)," + + " st.M_PRODUCT_ID,"+ + " pr.M_ATTRIBUTESETINSTANCE_ID," + + " pr.UPC,"+ + " pp.PRICESTD"+ + " from M_STORAGE st,M_PRODUCT pr left outer join M_PRODUCTPRICE pp on pr.M_PRODUCT_ID = pp.M_PRODUCT_ID" + + " where st.M_PRODUCT_ID=pr.M_PRODUCT_ID" + + " and st.ad_client_id=" +Env.getAD_Client_ID(ctx)+ + " and st.AD_ORG_ID=" +Env.getAD_Org_ID(ctx)+ + " and st.M_LOCATOR_ID="+warehouse.getDefaultLocator().get_ID()+ + " and pp.M_PRICELIST_VERSION_ID="+purchasePriceListVersionId; + if (attributeSetId != null) + { + sql += " and pr.m_attributeset_id = " + attributeSetId; + } + sql += " group by pr.name,st.M_PRODUCT_ID, pr.M_ATTRIBUTESETINSTANCE_ID,pr.UPC,pp.PRICESTD"+ + " order by pr.name "; + + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + AttributeBean bean =null; + ArrayList productsInStock =new ArrayList(); + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + bean= new AttributeBean(); + bean.setProductName(rs.getString(1)); + bean.setQuantity(rs.getBigDecimal(2)); + bean.setProductId(Integer.valueOf(rs.getInt(3))); + bean.setAttributeSetInstanceId(Integer.valueOf(rs.getInt(4))); + bean.setBarCode(rs.getString(5)); + totalCost = new BigDecimal(rs.getInt(2)).multiply(rs.getBigDecimal(6)); + bean.setPrice(totalCost); + productsInStock.add(bean); + } + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return productsInStock; + } + + public static ArrayList getProducts(Properties ctx, AttributeBean aBean) throws OperationException + { + + + MWarehouse warehouse = POSTerminalManager.getWarehouse(ctx); + + ArrayList attributeIdList = new ArrayList(); + + + for(int i=0;i productsInStock =new ArrayList(); + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + bean= new AttributeBean(); + bean.setProductName(rs.getString(1)); + bean.setQuantity(rs.getBigDecimal(2)); + bean.setProductId(Integer.valueOf(rs.getInt(3))); + bean.setAttributeSetInstanceId(Integer.valueOf(rs.getInt(4))); + bean.setBarCode(rs.getString(5)); + productsInStock.add(bean); + } + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + + return productsInStock; + + } + + public static ArrayList getFilteredAttributeValues(Properties ctx,AttributeBean aBean,int attributeId) throws OperationException + { + ArrayList attributeIdList = new ArrayList(); + for(int i=0;i list = new ArrayList(); + AttributeBean bean =null; + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + bean= new AttributeBean(); + bean.setAttributeValueId(Integer.valueOf(rs.getInt(1))); + bean.setAttributeValue(rs.getString(2)); + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + } + + + + + public static ArrayList getStockFromSearch(Properties ctx, String searchString,String barCode,String qtyFilter) throws OperationException + { + + searchString = (searchString==null)? "" : searchString; + StringTokenizer st = new StringTokenizer(searchString,"+"); + + BigDecimal totalCost = BigDecimal.valueOf(0.0); + int purchasePLId = POSTerminalManager.getPOPriceListId(ctx); + int purchasePriceListVersionId = PriceListManager.getPriceListVersionID(ctx, purchasePLId, null); + + + String sql="select pr.name as name, sum(st.qtyonhand) as qty ,pr.UPC,pr.m_product_id,pp.PRICESTD" + + " from M_STORAGE st,M_PRODUCT pr left outer join M_PRODUCTPRICE pp on pr.M_PRODUCT_ID = pp.M_PRODUCT_ID" + + " and pp.M_PRICELIST_VERSION_ID="+purchasePriceListVersionId + + " where st.M_PRODUCT_ID=pr.M_PRODUCT_ID"; + + String token = null; + + while(st.hasMoreTokens()) + { + token = st.nextToken().trim(); + sql = sql + " and upper(pr.name) like upper('%"+token+"%' )"; + } + + if(barCode!=null && !barCode.equals("")) + sql=sql+" and pr.upc='"+barCode+"'"; + + sql=sql+" and pr.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and st.AD_ORG_ID="+Env.getAD_Org_ID(ctx); + + sql=sql+ " and st.M_LOCATOR_ID="+POSTerminalManager.getWarehouse(ctx).getDefaultLocator().get_ID(); + + sql=sql+" group by pr.name,pr.UPC,pr.m_product_id,pp.PRICESTD"; + + if(qtyFilter!=null && qtyFilter.length()!=0) + { + sql = "select * from (" + sql + ") stDetails where stDetails.qty" + qtyFilter; + } + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + AttributeBean bean =null; + ArrayList productsInStock =new ArrayList(); + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + BigDecimal quantity = rs.getBigDecimal(2); + BigDecimal price = rs.getBigDecimal(5); + + if (quantity == null) + { + quantity = BigDecimal.ZERO; + } + if (price == null) + { + price = BigDecimal.ZERO; + } + MProduct product = MProduct.get(ctx, rs.getInt(4)); + int uomPrecision = MUOM.getPrecision(ctx, product.getC_UOM_ID()); + String uom = product.getUOMSymbol(); + bean= new AttributeBean(); + bean.setProductName(rs.getString(1)); + bean.setQuantity(quantity.setScale(uomPrecision)); + bean.setBarCode(rs.getString(3)); + + totalCost = quantity.multiply(price); + bean.setUnitPrice(price); + bean.setDescription(product.getDescription()); + bean.setPrice(totalCost.setScale(price.scale(),RoundingMode.HALF_UP)); + bean.setUom(uom); + + productsInStock.add(bean); + } + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return productsInStock; + + } + + + public static HashMap getStockByOrg(Properties ctx, Integer productId, Timestamp asOfDate, Integer orgId, String trxName) throws OperationException, SQLException + { + if (productId == null) + { + throw new OperationException("productId is null, cannot search stock qty by org"); + } + + String locatorIds = WarehouseManager.getLocatorIds(ctx, orgId); + + BigDecimal qty = Env.ZERO; + + int precision = ProductManager.getUOMPrecision(ctx, productId); + + StringBuffer movementTypes = new StringBuffer("'"+MTransaction.MOVEMENTTYPE_CustomerShipment +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_CustomerReturns +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_VendorReceipts +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_VendorReturns +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_InventoryOut +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_InventoryIn +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_MovementFrom +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_MovementTo +"'") ; + + StringBuffer sql = new StringBuffer("SELECT SUM(trx.movementQty), loc.AD_Org_ID FROM M_Transaction trx") + .append(" INNER JOIN M_Locator loc ON trx.M_Locator_ID = loc.M_Locator_ID WHERE") + .append(" trx.M_Product_ID="+productId+ " AND trx.M_Locator_ID IN ("+ locatorIds + ")") + .append(" AND trx.movementDate <= "+ DB.TO_DATE(asOfDate, false)) + .append(" AND trx.movementType in ("+movementTypes+")") + .append(" GROUP BY loc.AD_Org_ID"); + + + + PreparedStatement pstmt = null; + ResultSet rs = null; + + HashMap orgStock = new HashMap(); + try + { + pstmt = DB.prepareStatement (sql.toString(), trxName); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + qty = rs.getBigDecimal(1); + Integer org_Id = rs.getInt(2); + + qty = qty.setScale(precision, RoundingMode.HALF_UP); + + orgStock.put(org_Id, qty); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException("could not get stock enquiry data",e); + } + finally + { + close(pstmt, rs); + } + + String[] orgs = null; + + if (orgId == 0) + { + String orgIdList = Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM).toString(); + orgs = orgIdList.split(","); + } + else + { + orgs = new String[]{orgId + ""}; + } + + if (orgStock.isEmpty()) + { + for (String org : orgs) + { + Integer org_ID = Integer.parseInt(org); + orgStock.put(org_ID, Env.ZERO); + } + } + + return orgStock; + } + + public static HashMap getMonthlyStockAdjustments( + Properties ctx, int productId, String orgIds, Timestamp date1, Timestamp date2, + String trxName) throws OperationException + { + int precision = ProductManager.getUOMPrecision(ctx, productId); + int ad_client_id = Env.getAD_Client_ID(ctx); + + DateFormatSymbols dfs = new DateFormatSymbols(Locale.ENGLISH); + String[] monthName = dfs.getMonths(); + + HashMap monthQtyMap = new HashMap(); + HashMap dateQtymap = new HashMap(); + + StringBuffer movementTypes = new StringBuffer("'"+MTransaction. MOVEMENTTYPE_InventoryOut +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_InventoryIn +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_MovementFrom +"', ") + .append("'"+MTransaction. MOVEMENTTYPE_MovementTo +"'") ; + + StringBuffer sql = new StringBuffer(); + + sql.append(" SELECT SUM(movementQty), trx.movementDate FROM M_Transaction trx INNER JOIN") + .append(" M_Locator ml ON trx.M_Locator_ID = ml.M_Locator_ID") + .append(" WHERE trx.M_Product_ID = ?") + .append(" AND trx.movementType IN ("+movementTypes+")") + .append(" AND trx.AD_Client_ID = "+ad_client_id) + .append(" AND ml.AD_Org_ID IN ("+orgIds+")") + .append(" AND trx.movementDate BETWEEN "+DB.TO_DATE(date1, true) + " AND " + DB.TO_DATE(date2, true)) + .append(" GROUP BY trx.movementDate"); + + PreparedStatement pstmt =null; + ResultSet rs = null; + ArrayList list = new ArrayList(); + try + { + pstmt = DB.prepareStatement(sql.toString(), trxName); + pstmt.setInt(1, productId); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + BigDecimal qty = rs.getBigDecimal(1); + Date date = rs.getDate(2); + + list.add(date); + + if (dateQtymap.containsKey(date)) + { + qty = qty.add(dateQtymap.get(date)); + } + dateQtymap.put(date, qty); + + } + } + catch (SQLException e) + { + throw new OperationException("could not retrieve montly stock adjustments with sql"+ sql, e); + } + finally + { + close(pstmt, rs); + } + + if (!list.isEmpty()) + { + Collections.sort(list); + + Iterator iter= list.iterator(); + StringBuffer monthYearList = new StringBuffer(); + /*String list_monthYears = POSReportManager.getListMonthYears(date1, date2);*/ + + + while (iter.hasNext()) + { + Date date = iter.next(); + + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + + int month= cal.get(Calendar.MONTH); + int year = cal.get(Calendar.YEAR); + + String monthYear = monthName[month] + " " + year; + monthYearList.append(monthYear).append(","); + + BigDecimal qty = dateQtymap.get(date); + + if (monthQtyMap.containsKey(monthYear)) + { + qty = qty.add(monthQtyMap.get(monthYear)); + } + + monthQtyMap.put(monthYear, qty); + } + } + return monthQtyMap; + } + + + private static void close(PreparedStatement pstmt, ResultSet rs) throws OperationException + { + if (pstmt!=null) + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + throw new OperationException("Could not close prepared statement" , ex); + } + finally + { + pstmt = null; + } + } + if (rs != null) + { + try + { + rs.close(); + } + catch (Exception ex) + { + throw new OperationException("Could not close result set", ex); + } + finally + { + rs = null; + } + } + } + + + public static ArrayList getStockAdjustments(Properties ctx, ArrayList reportData, + int productId, String orgIds, Timestamp date1, Timestamp date2, + String trxName) throws OperationException + { + + + String[] orgs = orgIds.split(","); + + + ArrayList orgIdList = new ArrayList(); + ArrayList orgNameList = new ArrayList(); + for (int i = 0; i map = new HashMap(); + map.put("I-", "Inventory Out"); + map.put("I+", "Inventory In"); + map.put("M-", "Movement Out"); + map.put("M+", "Movement In"); + + sql.append(" SELECT movementType, SUM(movementQty), ml.AD_Org_ID FROM M_Transaction trx INNER JOIN") + .append(" M_Locator ml ON trx.M_Locator_ID = ml.M_Locator_ID") + .append(" WHERE trx.M_Product_ID = " + productId) + .append(" AND movementType IN ('I+','I-','M+','M-')") + .append(" AND trx.AD_Client_ID = "+ad_client_id) + .append(" AND ml.AD_Org_ID IN ("+orgIds+")") + .append(" AND movementDate BETWEEN "+ DB.TO_DATE(date1, false)) + .append(" AND " + DB.TO_DATE(date2, false)) + .append(" GROUP BY movementType, ml.AD_Org_ID"); + + + PreparedStatement pstmt = null; + ResultSet rs = null; + + HashMap> moveTypeOrgMap = new HashMap>(); + + try + { + pstmt = DB.prepareStatement(sql.toString(), trxName); + rs = pstmt.executeQuery(); + HashMap orgList = null; + + while (rs.next()) + { + String movementType = rs.getString(1); + BigDecimal movementQty = rs.getBigDecimal(2); + Integer orgId = rs.getInt(3); + + if (movementQty == null) + { + movementQty = Env.ZERO; + } + + String moveType = map.get(movementType); + if (orgList == null) + { + orgList = new HashMap(); + orgList.put(orgId, movementQty); + } + + if (moveTypeOrgMap.isEmpty()) + { + moveTypeOrgMap.put(moveType, orgList); + } + else + { + if (moveTypeOrgMap.containsKey(moveType)) + { + HashMap newOrgList = moveTypeOrgMap.get(moveType); + BigDecimal qty = movementQty; + if (newOrgList.containsKey(orgId)) + { + qty = newOrgList.get(orgId); + if (qty!=null) + { + qty = qty.add(movementQty); + } + } + newOrgList.put(orgId, qty); + moveTypeOrgMap.put(moveType, newOrgList); + } + else + { + orgList = new HashMap(); + orgList.put(orgId, movementQty); + moveTypeOrgMap.put(moveType, orgList); + } + } + } + } + catch (SQLException e) + { + throw new OperationException("could not get stock adjustments",e); + } + finally + { + close(pstmt, rs); + } + + String[] moveTypeList = new String[map.size()]; + map.values().toArray(moveTypeList); + Object[] data = null; + + for (String movementType: moveTypeList) + { + HashMap orgQtyList = null; + + if (moveTypeOrgMap.containsKey(movementType)) + { + orgQtyList = moveTypeOrgMap.get(movementType); + } + + data = new Object[header.length]; + + data[0] = movementType; + for (int i=1; i< data.length; i++) + { + data[i] = Env.ZERO; + if (orgQtyList != null) + { + if (i <= orgIdList.size()) + { + int orgId = orgIdList.get(i-1); + if (orgQtyList.containsKey(orgId)) + { + BigDecimal qty = orgQtyList.get(orgId); + data[i] = qty; + } + } + } + } + reportData.add(data); + } + + return reportData; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/POSTerminalManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/POSTerminalManager.java new file mode 100644 index 0000000000..1d302fb942 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/POSTerminalManager.java @@ -0,0 +1,1165 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 8, 2006 by alok + */ + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.compiere.model.MBPartner; +import org.compiere.model.MCash; +import org.compiere.model.MCashBook; +import org.compiere.model.MCurrency; +import org.compiere.model.MPOS; +import org.compiere.model.MPOSTerminal; +import org.compiere.model.MPayment; +import org.compiere.model.MPriceList; +import org.compiere.model.MStore; +import org.compiere.model.MWarehouse; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.TerminalBean; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.InvalidTerminalCashBookException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.TerminalInactivateException; +import org.posterita.exceptions.TerminalLockedException; +import org.posterita.exceptions.TerminalNotFoundException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class POSTerminalManager +{ + public static final CLogger logger = CLogger.getCLogger(POSTerminalManager.class); + + /** + * Creates a new POS Terminal + * @param ctx Context + * @param orgId Organisation + * @param name Name of the terminal + * @param cashbookId Cash Book + * @param bankAccountId Bank Account + * @param poPriceListId Purchase Price list + * @param soPriceListid Sales Price list + * @param warehouseId Warehouse + * @param cashBPartnerId BPartner to be used for Cash Transactions + * @param salesRepId Sales Representative + * @param trxName Transaction + * @return POS Terminal + * @throws OperationException If the terminal cannot be created + */ + public static MPOSTerminal createPOSTerminal(Properties ctx, int orgId, String name, + int cashbookId, int bankAccountId, int poPriceListId, int soPriceListid, int warehouseId,int cashBPartnerId, + int salesRepId, String trxName) throws OperationException + { + MPOSTerminal terminal = new MPOSTerminal(ctx, 0, trxName); + terminal.setAD_Org_ID(orgId); + terminal.setName(name); + terminal.setC_CashBook_ID(cashbookId); + terminal.setM_Warehouse_ID(warehouseId); + terminal.setPO_PriceList_ID(poPriceListId); + terminal.setSO_PriceList_ID(soPriceListid); + terminal.setCard_BankAccount_ID(bankAccountId); + terminal.setCheck_BankAccount_ID(bankAccountId); + terminal.setC_CashBPartner_ID(cashBPartnerId); + terminal.setCashBookTransferType(MPOSTerminal.CASHBOOKTRANSFERTYPE_BankAccount); + terminal.setCashTransferBankAccount_ID(bankAccountId); + PoManager.save(terminal); + return terminal; + } + + + /** + * Migrates old POS Terminal structure to the new one + * @param ctx Context + * @throws OperationException If new terminal cannot be created + */ + public static void migrateOldPOSTerminal(Properties ctx) throws OperationException + { + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + String whereClause = "IsActive='Y' AND AD_Client_ID=" + Env.getAD_Client_ID(ctx); + + int oldPosIds[] = MPOS.getAllIDs(MPOS.Table_Name, whereClause, trx.getTrxName()); + + for (int i = 0; i < oldPosIds.length; i++) + { + MPOS oldPOS = new MPOS(ctx, oldPosIds[i], trx.getTrxName()); + + String posName = oldPOS.getName(); + int warehouseId = oldPOS.getM_Warehouse_ID(); + int soPriceListId = oldPOS.getM_PriceList_ID(); + int cashBookId = oldPOS.getC_CashBook_ID(); + int cashBPartnerId = oldPOS.getC_BPartnerCashTrx_ID(); + int adOrgId = oldPOS.getAD_Org_ID(); + int bankAccountId = BankManager.getDefaultBankAccountId(ctx, adOrgId, trx.getTrxName()); + int salesRepId = oldPOS.getSalesRep_ID(); + MStore store = StoreManager.getStore(ctx); + if (store.get_ID() == 0) + { + throw new OperationException("Store could not be loaded"); + } + + int poPriceListId = store.getM_PriceList_ID(); + + MPOSTerminal terminal = createPOSTerminal(ctx, adOrgId, posName, cashBookId, bankAccountId, poPriceListId, soPriceListId, warehouseId, cashBPartnerId, salesRepId, trx.getTrxName()); + StringBuffer updateStmt = new StringBuffer(); + updateStmt.append("UPDATE C_Order SET C_POS_ID=").append(terminal.get_ID()); + updateStmt.append(" WHERE C_POS_ID=").append(oldPOS.get_ID()); + + DB.executeUpdate(updateStmt.toString(), trx.getTrxName()); + + oldPOS.setIsActive(false); + PoManager.save(oldPOS); + trx.commit(); + } + } + catch (Exception ex) + { + logger.log(Level.SEVERE, "Could not migrate old pos terminal", ex); + } + finally + { + trx.rollback(); + trx.close(); + } + } + + + /** + * Checks whether a check book can be set on a terminal + * @param ctx Context + * @param terminalId Terminal + * @param cashBookId Cash Book + * @param trxName Transaction + * @return Whether the cash book can be set on the terminal + * @throws OperationException If data cannot be retrieved + */ + public static boolean isCashBookAssignedValid(Properties ctx, int terminalId, int cashBookId, String trxName) throws OperationException + { + boolean valid = false; + + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append("SELECT COUNT(*) FROM U_POSTerminal "); + sqlStmt.append("WHERE AD_Client_ID=? AND U_POSTerminal_ID<>? AND C_CashBook_ID=? "); + sqlStmt.append("AND U_POSTerminal.IsActive='Y' "); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sqlStmt.toString(), trxName); + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + pstmt.setInt(2, terminalId); + pstmt.setInt(3, cashBookId); + + rs = pstmt.executeQuery(); + + if (rs.next()) + { + valid = (rs.getInt(1) == 0); + } + } + catch (Exception ex) + { + throw new OperationException("Could not check validity of Cash Book", ex); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + return valid; + } + + /** + * Checks whether a cash book has been assigned on a terminal + * @param ctx Context + * @param cashBookId Context + * @param trxName Transaction + * @return True if cash book is present on a terminal + */ + public static boolean isCashbookPresentOnTerminal(Properties ctx, int cashBookId, String trxName) + { + String sqlStmt = "SELECT U_POSTerminal_ID FROM U_POSTerminal WHERE AD_Client_ID=? AND C_CashBook_ID=? AND IsActive='Y'"; + + int terminalId = DB.getSQLValue(trxName, sqlStmt, Env.getAD_Client_ID(ctx), cashBookId); + + return (terminalId != -1); + } + + /** + * Creates or updates a terminal based on Data provided + * @param ctx Context + * @param bean Terminal data + * @param trxName Transaction + * @return POS Terminal PO + * @throws OperationException If data could not be updated + */ + public static MPOSTerminal createUpdatePOSTerminal(Properties ctx, TerminalBean bean, String trxName) throws OperationException + { + MPOSTerminal terminal = getPO(ctx, bean, trxName); + + if (bean.getIsActive() && !isCashBookAssignedValid(ctx, bean.getTerminalId(), bean.getCashBookId(), trxName)) + { + throw new InvalidTerminalCashBookException("The cash book assigned is already present on another terminal"); + } + else if (!bean.getIsActive() && !canInactivateTerminal(ctx, terminal.getAD_Org_ID(), terminal.get_ID(), trxName)) + { + throw new TerminalInactivateException("This terminal cannot be inactivated as no other active terminal available"); + } + + PoManager.save(terminal); + bean.setTerminalId(terminal.get_ID()); + return terminal; + } + + /** + * Returns the Persistent Object from the model used for the Terminal + * @param ctx Context + * @param bean Data model used + * @param trxName Transaction + * @return Terminal PO + * @throws OperationException If data in the model is not valid to construct the PO + */ + public static MPOSTerminal getPO(Properties ctx, TerminalBean bean, String trxName) throws OperationException + { + MPOSTerminal terminal = new MPOSTerminal(ctx, bean.getTerminalId(), trxName); + if (terminal.get_ID() != bean.getTerminalId()) + { + // Happens only when trying to load a terminal that is not present + // and the PO model resets the Id to 0 + throw new OperationException("Could not load terminal"); + } + terminal.setAD_Org_ID(bean.getOrgId()); + terminal.setName(bean.getName()); + terminal.setDescription(bean.getDescription()); + terminal.setC_CashBook_ID(bean.getCashBookId()); + terminal.setC_CashBPartner_ID(bean.getBpartnerId()); + terminal.setC_TemplateBPartner_ID(bean.getTemplateBPartnerId()); + terminal.setCheck_BankAccount_ID(bean.getCheckBankAccountId()); + terminal.setCard_BankAccount_ID(bean.getCardBankAccountId()); + terminal.setIsActive(bean.getIsActive()); + terminal.setLocked(bean.getLocked()); + terminal.setM_Warehouse_ID(bean.getWarehouseId()); + terminal.setPO_PriceList_ID(bean.getPurchasePriceListId()); + terminal.setSO_PriceList_ID(bean.getSalesPriceListId()); + + terminal.setAutoLock(bean.getAutoLock()); + + if (bean.getAutoLock()) + { + terminal.setLockTime(bean.getLockingTime()); + } + else + { + terminal.setLockTime(0); + } + + terminal.setCashBookTransferType(bean.getCashbookTransferType()); + if ( MPOSTerminal.CASHBOOKTRANSFERTYPE_CashBook.equals(bean.getCashbookTransferType())) + { + if (bean.getCashbookTransferCashbookId() == 0) + { + throw new OperationException("No cash book defined to transfer cash transactions"); + } + terminal.setCashTransferCashBook_ID(bean.getCashbookTransferCashbookId()); + terminal.setCashTransferBankAccount_ID(0); + } + else if (MPOSTerminal.CASHBOOKTRANSFERTYPE_BankAccount.equals(bean.getCashbookTransferType())) + { + if (bean.getCashbookTransferBankAccountId() == 0) + { + throw new OperationException("No bank account defined to transfer cash transactions"); + } + terminal.setCashTransferCashBook_ID(0); + terminal.setCashTransferBankAccount_ID(bean.getCashbookTransferBankAccountId()); + } + + + terminal.setCheckTransferType(bean.getCheckTransferType()); + if (MPOSTerminal.CHECKTRANSFERTYPE_CashBook.equals(bean.getCheckTransferType())) + { + if (bean.getCheckTransferCashbookId() == 0) + { + throw new OperationException("No cash book defined to transfer check transactions"); + } + terminal.setCheckTransferCashBook_ID(bean.getCheckTransferCashbookId()); + terminal.setCheckTransferBankAccount_ID(0); + } + else if (MPOSTerminal.CHECKTRANSFERTYPE_BankAccount.equals(bean.getCheckTransferType())) + { + if (bean.getCheckTransferBankAccountId() == 0) + { + throw new OperationException("No bank account defined to transfer check transactions"); + } + terminal.setCheckTransferCashBook_ID(0); + terminal.setCheckTransferBankAccount_ID(bean.getCheckTransferBankAccountId()); + } + + terminal.setCardTransferType(bean.getCardTransferType()); + if (MPOSTerminal.CARDTRANSFERTYPE_CashBook.equals(bean.getCardTransferType())) + { + if (bean.getCardTransferCashbookId() == 0) + { + throw new OperationException("No cash book defined to transfer credit card transactions"); + } + terminal.setCardTransferCashBook_ID(bean.getCardTransferCashbookId()); + terminal.setCardTransferBankAccount_ID(0); + } + else if (MPOSTerminal.CARDTRANSFERTYPE_BankAccount.equals(bean.getCardBankAccountId())) + { + if (bean.getCardBankAccountId() == 0) + { + throw new OperationException("No bank account defined to transfer credit card transactions"); + } + terminal.setCardTransferCashBook_ID(0); + terminal.setCardTransferBankAccount_ID(bean.getCardTransferBankAccountId()); + } + return terminal; + } + + + /** + * Retrieves the terminal id from the cookie stored in the client's browser + * @param request Server Request + * @return Terminal ID present in the cookie or null if not present + */ + public static String getTerminalFromCookie(HttpServletRequest request) + { + return POSManager.getDataFromCookie(request, Constants.POSTERMINAL); + } + + /** + * Retrieves the terminal id from the cookie stored in the client's browser + * @param request Server Request + * @return Terminal ID present in the cookie + * @throws OperationException If the Terminal Id is not valid + */ + public static int getTerminalIdFromCookie(HttpServletRequest request) throws OperationException + { + String strTerminalId = getTerminalFromCookie(request); + + int terminalId = -1; + + try + { + terminalId = Integer.parseInt(strTerminalId); + Properties ctx = TmkJSPEnv.getCtx(request); + loadTerminal(ctx, terminalId, null); + } + catch (Exception ex) + { + throw new OperationException("Could not retrieve terminal Id"); + } + return terminalId; + } + + /** + * Set the terminal id in the cookie that is stored in the client's browser + * @param response Response to be sent to the client + * @param terminalId Terminal Id + */ + public static void setTerminalInCookie(HttpServletResponse response, int terminalId) + { + Cookie cookie = new Cookie(Constants.POSTERMINAL, String.valueOf(terminalId)); + cookie.setMaxAge(365*24*60*60); + response.addCookie(cookie); + } + + /** + * Reset the terminal id in the cookie that is stored in the client's browser + * @param response Response to be sent to client + */ + public static void resetTerminalInCookie(HttpServletResponse response) + { + Cookie cookie = new Cookie(Constants.POSTERMINAL, ""); + response.addCookie(cookie); + } + + /** + * Checks whether a POS Terminal is present with the id provided + * and the context organisation + * @param ctx Context + * @param posId POS Terminal + * @return + */ + public static boolean isPOSTerminalAccessible(Properties ctx, int terminalId) + { + String whereClause = "AD_Client_ID=" + Env.getAD_Client_ID(ctx) + + " AND AD_Org_ID=" + Env.getAD_Org_ID(ctx) + " AND U_PosTerminal_ID=" + terminalId + + " AND IsActive='Y'"; + + int posIds[] = MPOSTerminal.getAllIDs(MPOSTerminal.Table_Name, whereClause, null); + + if(posIds.length == 0) + { + return false; + } + return true; + } + + + /** + * Returns the terminal data model from the Terminal persistent object + * @param terminal Terminal PO + * @return Data model + */ + public static TerminalBean getBean(MPOSTerminal terminal) + { + int currentTerminalId = getTerminalId(terminal.getCtx()); + TerminalBean bean = new TerminalBean(); + bean.setTerminalId(terminal.getU_POSTerminal_ID()); + bean.setOrgId(terminal.getAD_Org_ID()); + bean.setName(terminal.getName()); + bean.setDescription(terminal.getDescription()); + bean.setAutoLock(terminal.isAutoLock()); + bean.setBpartnerId(terminal.getC_CashBPartner_ID()); + bean.setCashBookId(terminal.getC_CashBook_ID()); + bean.setCashbookTransferType(terminal.getCashBookTransferType()); + bean.setCashbookTransferBankAccountId(terminal.getCashTransferBankAccount_ID()); + bean.setCashbookTransferCashbookId(terminal.getCashTransferCashBook_ID()); + bean.setCheckBankAccountId(terminal.getCheck_BankAccount_ID()); + bean.setCheckTransferBankAccountId(terminal.getCheckTransferBankAccount_ID()); + bean.setCheckTransferCashbookId(terminal.getCheckTransferCashBook_ID()); + bean.setCheckTransferType(terminal.getCheckTransferType()); + bean.setCardBankAccountId(terminal.getCard_BankAccount_ID()); + bean.setCardTransferBankAccountId(terminal.getCardTransferBankAccount_ID()); + bean.setCardTransferCashbookId(terminal.getCardTransferCashBook_ID()); + bean.setCardTransferType(terminal.getCardTransferType()); + bean.setIsActive(terminal.isActive()); + bean.setLocked(terminal.isLocked()); + bean.setLockingTime(terminal.getLockTime()); + bean.setPurchasePriceListId(terminal.getPO_PriceList_ID()); + bean.setSalesPriceListId(terminal.getSO_PriceList_ID()); + bean.setTemplateBPartnerId(terminal.getC_TemplateBPartner_ID()); + bean.setWarehouseId(terminal.getM_Warehouse_ID()); + + if (currentTerminalId == terminal.get_ID()) + { + bean.setIsCurrentTerminal(true); + } + + return bean; + } + + + /** + * Retrieves POS Terminal + * @param ctx Context + * @param terminalId Terminal ID + * @param trxName Transaction + * @return Terminal + * @throws TerminalNotFoundException If the terminal does not exist or could not be loaded + */ + public static TerminalBean getTerminalBean(Properties ctx, int terminalId, String trxName) throws TerminalNotFoundException + { + MPOSTerminal posTerminal = new MPOSTerminal(ctx, terminalId, trxName); + if (posTerminal.get_ID() == 0) + { + throw new TerminalNotFoundException("Could not load terminal with id: " + terminalId); + } + + return getBean(posTerminal); + } + + /** + * Checks whether can activate + * @param ctx + * @param adOrgId + * @param trxName + * @return + */ + private static boolean canInactivateTerminal(Properties ctx, int adOrgId, int terminalId, String trxName) + { + String sqlStmt = "SELECT COUNT(*) FROM U_POSTerminal WHERE IsActive='Y' AND AD_Org_ID=? AND U_POSTerminal_ID<>?"; + + int count = DB.getSQLValue(trxName, sqlStmt, adOrgId, terminalId); + return (count >= 1); + } + + /** + * Updates the Terminal active state + * @param ctx Context + * @param terminalId Terminal ID + * @param active State of the terminal + * @param trxName Transaction + * @return Terminal Data model + * @throws OperationException If Terminal could not be updated + */ + public static TerminalBean updateTerminalStatus(Properties ctx, int terminalId, boolean active, String trxName) throws OperationException + { + MPOSTerminal terminal = loadTerminal(ctx, terminalId, trxName); + if (active && !isCashBookAssignedValid(ctx, terminalId, terminal.getC_CashBook_ID(), trxName)) + { + throw new InvalidTerminalCashBookException("Terminal cannot be reactivated as the cash book assigned to it is already being used"); + } + if (!active && !canInactivateTerminal(ctx, terminal.getAD_Org_ID(), terminalId, trxName)) + { + throw new TerminalInactivateException("Cannot inactivate this terminal as no active terminals present"); + } + terminal.setIsActive(active); + PoManager.save(terminal); + return getBean(terminal); + } + + /** + * Retrieves the Terminal ID from the applica + * @param ctx + * @return + */ + public static int getTerminalId(Properties ctx) + { + int terminalId = Env.getContextAsInt(ctx, UdiConstants.TERMINAL_ID); + return terminalId; + } + + /** + * Retrieves POS Terminal + * @param ctx Context + * @param terminalId Terminal ID + * @param trxName Transaction + * @return Terminal + * @throws TerminalNotFoundException If the terminal does not exist or could not be loaded + */ + public static MPOSTerminal loadTerminal(Properties ctx, int terminalId, String trxName) throws TerminalNotFoundException + { + MPOSTerminal posTerminal = new MPOSTerminal(ctx, terminalId, trxName); + if (posTerminal.get_ID() == 0) + { + throw new TerminalNotFoundException("Could not load terminal with id: " + terminalId); + } + + return posTerminal; + } + + /** + * Loads the PO of the terminal present in the application context + * @param ctx Context + * @return Terminal PO + * @throws TerminalNotFoundException If no terminal ID is present in the application context + * or the terminal ID is invalid + */ + public static MPOSTerminal loadTerminal(Properties ctx) throws TerminalNotFoundException + { + return loadTerminal(ctx, getTerminalId(ctx), null); + } + + /** + * Returns the Terminal PO from the terminal ID present in the application context + * @param ctx Context + * @return Terminal PO + * @throws TerminalNotFoundException If the terminal cannot be loaded + */ + public static MPOSTerminal getTerminal(Properties ctx) throws TerminalNotFoundException + { + int terminalId = getTerminalId(ctx); + return getTerminal(ctx, terminalId); + } + + /** + * Returns the Terminal PO from the terminal ID provided + * @param ctx Context + * @param terminalId + * @return + * @throws TerminalNotFoundException If the terminal cannot be loaded + */ + private static MPOSTerminal getTerminal(Properties ctx, int terminalId) throws TerminalNotFoundException + { + MPOSTerminal terminal = MPOSTerminal.get(ctx, terminalId); + if (terminal == null) + { + throw new TerminalNotFoundException("Terminal cannot be loaded"); + } + return terminal; + } + + /** + * Get all terminals from a search based on the name of the terminals + * @param ctx Context + * @param searchText Name search term + * @param trxName Transaction + * @return List of Terminals + * @throws OperationException If data cannot be retrieved + */ + public static ArrayList getTerminals(Properties ctx, String searchText, String trxName) throws OperationException + { + ArrayList terminalList = new ArrayList(); + StringBuffer sqlStmt = new StringBuffer(); + + sqlStmt.append("SELECT pos.*, o.Name as orgName, p1.Name as poPriceList, p2.Name as soPriceList "); + sqlStmt.append("FROM U_POSTerminal pos "); + sqlStmt.append("LEFT JOIN AD_Org o ON pos.AD_Org_ID=o.AD_Org_ID "); + sqlStmt.append("LEFT JOIN M_PriceList p1 ON pos.PO_PriceList_ID=p1.M_PriceList_ID "); + sqlStmt.append("LEFT JOIN M_PriceList p2 ON pos.SO_PriceList_ID=p2.M_PriceList_ID "); + sqlStmt.append("WHERE UPPER(pos.Name) LIKE UPPER(?) AND pos.AD_Client_ID=? "); + sqlStmt.append("AND pos.AD_Org_ID IN (").append(Env.getContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)).append(") "); + sqlStmt.append("ORDER BY pos.Name"); + PreparedStatement pstmt = null; + ResultSet rs = null; + + if (searchText == null) + { + searchText = ""; + } + + searchText = "%" + searchText.trim() + "%"; + + int currentTerminalId = getTerminalId(ctx); + + try + { + pstmt = DB.prepareStatement(sqlStmt.toString(), trxName); + pstmt.setString(1, searchText); + pstmt.setInt(2, Env.getAD_Client_ID(ctx)); + + rs = pstmt.executeQuery(); + while (rs.next()) + { + MPOSTerminal terminal = new MPOSTerminal(ctx, rs, trxName); + TerminalBean terminalBean = getBean(terminal); + terminalBean.setOrgName(rs.getString("orgName")); + terminalBean.setPoPriceList(rs.getString("poPriceList")); + terminalBean.setSoPriceList(rs.getString("soPriceList")); + terminalBean.setIsCurrentTerminal(false); + + if (terminal.get_ID() == currentTerminalId) + { + terminalBean.setIsCurrentTerminal(true); + } + + terminalList.add(terminalBean); + } + } + catch (Exception ex) + { + logger.log(Level.SEVERE, "Could not retrieve terminals", ex); + throw new OperationException("Could not retrieve terminals, cause: " + ex.getMessage()); + } + finally + { + DB.close(rs, pstmt); + } + + return terminalList; + } + + + /** + * Retrieves list of active terminals + * @param ctx Context + * @param adOrgId Organisation + * @param trxName Transaction + * @return List of Active Terminals + * @throws OperationException If data cannot be retrieved + */ + public static ArrayList getAllActiveTerminals(Properties ctx, int adOrgId, String trxName) throws OperationException + { + ArrayList terminalList = new ArrayList(); + + String sqlStmt = "SELECT * FROM U_POSTerminal WHERE AD_Client_ID=? " + + "AND AD_Org_ID=? AND IsActive='Y' ORDER BY Name"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sqlStmt, trxName); + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + pstmt.setInt(2, adOrgId); + + rs = pstmt.executeQuery(); + + while (rs.next()) + { + MPOSTerminal terminal = new MPOSTerminal(ctx, rs, trxName); + TerminalBean terminalBean = getBean(terminal); + terminalList.add(terminalBean); + } + } + catch (Exception ex) + { + logger.log(Level.SEVERE, "Could not retrieve terminals", ex); + throw new OperationException("Could not retrieve terminals, cause: " + ex.getMessage()); + } + finally + { + DB.close(rs, pstmt); + } + + return terminalList; + } + + + /** + * Retrieves the currency for the Sales Price List for the POS Terminal + * @param ctx Context + * @return Currency of Sales PriceList + * @throws TerminalNotFoundException + */ + public static MCurrency getDefaultSalesCurrency(Properties ctx) throws TerminalNotFoundException + { + int salesPriceListId = POSTerminalManager.getSOPriceListId(ctx); + MPriceList priceList = new MPriceList(ctx, salesPriceListId, null); + MCurrency currency = new MCurrency(ctx, priceList.getC_Currency_ID(), null); + return currency; + } + + /** + * Retrieves the currency for the Sales Price List for the POS Terminal + * @param ctx Context + * @return Currency of Sales PriceList + * @throws OperationException + */ + public static MCurrency getDefaultPurchaseCurrency(Properties ctx) throws OperationException + { + int poPriceListId = getPOPriceListId(ctx); + MPriceList priceList = new MPriceList(ctx, poPriceListId, null); + MCurrency currency = new MCurrency(ctx,priceList.getC_Currency_ID(),null); + return currency; + } + + /** + * Retrieves the BPartner to be used for Cash Transactions for the the terminal present in + * the application context + * @param ctx Context + * @return BPartner + * @throws OperationException If the BPartner cannot be loaded + */ + public static MBPartner getCashBPartner(Properties ctx) throws OperationException + { + MPOSTerminal terminal = getTerminal(ctx); + int cashBPartnerId = terminal.getC_CashBPartner_ID(); + return BPartnerManager.loadBPartner(ctx, cashBPartnerId, null); + } + + /** + * Retrieves the ID of the BPartner defined on the Terminal present in application context + * that is to be used for Cash Transactions + * @param ctx Context + * @return ID of BPartner for cash transactions + * @throws TerminalNotFoundException If the terminal cannot be loaded + */ + public static int getCashBPartnerId(Properties ctx) throws TerminalNotFoundException + { + MPOSTerminal terminal = getTerminal(ctx); + int cashBPartnerId = terminal.getC_CashBPartner_ID(); + return cashBPartnerId; + } + + /** + * Returns the name of the printer to be used for server printing + * @param ctx Context + * @return Name of printer to be used for server printing + * @throws TerminalNotFoundException If the terminal cannot be loaded + */ + public static String getPOSPrinter(Properties ctx) throws TerminalNotFoundException + { + MPOSTerminal terminal = getTerminal(ctx); + return terminal.getPrinterName(); + } + + /** + * Returns the Cash Book associated with the terminal defined in the application context + * @param ctx Context + * @return Cash Book + * @throws OperationException If the cash book cannot be + */ + public static MCashBook getCashBook(Properties ctx) throws OperationException + { + int terminalId = Env.getContextAsInt(ctx,UdiConstants.TERMINAL_ID); + return getCashBook(ctx, terminalId); + } + + /** + * Returns the Cash Book ID of the Cash Book associated with the terminal defined in the + * application context + * @param ctx Context + * @return Cash Book ID + * @throws OperationException If the terminal cannot be loaded + */ + public static int getCashBookId(Properties ctx) throws OperationException + { + return getTerminal(ctx).getC_CashBook_ID(); + } + + /** + * Returns the Cash Book associated with the terminal provided + * @param ctx Context + * @param terminalId Terminal + * @return Cash Book + * @throws OperationException If the terminal/cash book cannot be loaded + */ + public static MCashBook getCashBook(Properties ctx, int terminalId) throws OperationException + { + MPOSTerminal terminal = getTerminal(ctx, terminalId); + int cashBookId = terminal.getC_CashBook_ID(); + MCashBook cashBook = CashManager.loadCashBook(ctx, cashBookId, null); + return cashBook; + } + + /** + * Retrieves the cash book ID associated with the terminal provided + * @param ctx Context + * @param terminalId Terminal ID + * @return Cash Book ID + * @throws OperationException If the terminal cannot be loaded + */ + public static int getCashBookId(Properties ctx, int terminalId) throws OperationException + { + MPOSTerminal terminal = getTerminal(ctx, terminalId); + return terminal.getC_CashBook_ID(); + } + + /** + * Retrieves the Warehouse associated with the terminal present in the application context + * @param ctx Context + * @return Warehouse + * @throws TerminalNotFoundException If the terminal cannot be loaded + */ + public static MWarehouse getWarehouse(Properties ctx) throws TerminalNotFoundException + { + int terminalId = Env.getContextAsInt(ctx,UdiConstants.TERMINAL_ID); + return getWarehouse(ctx, terminalId); + } + + /** + * Retrieves the Warehouse associated with the terminal provided + * @param ctx Context + * @param terminalId Terminal + * @return Warehouse + * @throws TerminalNotFoundException If terminal cannot be loaded + */ + public static MWarehouse getWarehouse(Properties ctx, int terminalId) throws TerminalNotFoundException + { + MPOSTerminal terminal = loadTerminal(ctx, terminalId, null); + int warehouseId = terminal.getM_Warehouse_ID(); + MWarehouse warehouse = new MWarehouse(ctx,warehouseId,null); + return warehouse; + } + + /** + * Retrieves the currency of the Cash Book associated with terminal in the application context + * @param ctx Context + * @return Currency of Cash Book + * @throws OperationException If terminal/cash book cannot be loaded + */ + public static MCurrency getCurrencyOfTerminalCashBook(Properties ctx) throws OperationException + { + int terminalId = Env.getContextAsInt(ctx,UdiConstants.TERMINAL_ID); + return getCurrencyOfTerminalCashBook(ctx, terminalId); + } + + /** + * Retrieves the currency of the Cash Book associated with the terminal provided + * @param ctx Context + * @param terminalId Terminal + * @return Currency of Cash Book + * @throws OperationException If Terminal/Cash Book cannot be loaded + */ + public static MCurrency getCurrencyOfTerminalCashBook(Properties ctx, int terminalId) throws OperationException + { + MCashBook cashBook = getCashBook(ctx, terminalId); + MCurrency currency = new MCurrency(ctx, cashBook.getC_Currency_ID(), null); + return currency; + } + + + /** + * Retrieves the name of the POS Terminal in context + * @param ctx Context + * @return Terminal Name + * @throws TerminalNotFoundException If the terminal cannot be loaded + */ + public static String getTerminalName(Properties ctx) throws TerminalNotFoundException + { + MPOSTerminal terminal = getTerminal(ctx); + return terminal.getName(); + } + + /** + * Retrieves the name of the POS Terminal + * @param ctx Context + * @param terminalId Terminal + * @return Terminal Name + * @throws TerminalNotFoundException If the terminal cannot be loaded + */ + public static String getTerminalName(Properties ctx, int terminalId) throws TerminalNotFoundException + { + MPOSTerminal terminal = getTerminal(ctx, terminalId); + return terminal.getName(); + } + + /** + * Retrieves the id of the sales price list associated with the POS Terminal in context. + * @param ctx context + * @return price list id + * @throws TerminalNotFoundException + */ + public static int getSOPriceListId(Properties ctx) throws TerminalNotFoundException + { + return getPriceListId(ctx, true); + } + + /** + * Retrieves the id of the purchase price list associated with the POS Terminal in context. + * @param ctx context + * @return price list id + * @throws TerminalNotFoundException + */ + public static int getPOPriceListId(Properties ctx) throws TerminalNotFoundException + { + return getPriceListId(ctx, false); + } + + /** + * Retrieves price list associated with the POS Terminal in context + * @param ctx Context + * @param isSOTrx Sales Pricelist + * @return Price List ID (Sales or Purchase) + * @throws TerminalNotFoundException + */ + public static int getPriceListId(Properties ctx, boolean isSOTrx) throws TerminalNotFoundException + { + MPOSTerminal terminal = getTerminal(ctx); + + if (isSOTrx) + { + return terminal.getSO_PriceList_ID(); + } + else + { + return terminal.getPO_PriceList_ID(); + } + } + + /** + * Updates the price list associated with the POS Terminal in context. + * @param ctx context + * @param priceListId price list id + * @param isSOTrx True for sales price list and false for purchase price list + * @throws OperationException + */ + public static void setTerminalPriceListId(Properties ctx, int priceListId, + boolean isSOTrx, String trxName) throws OperationException + { + MPOSTerminal terminal = loadTerminal(ctx); + terminal.set_TrxName(trxName); + + if (isSOTrx) + { + terminal.setSO_PriceList_ID(priceListId); + } + else + { + terminal.setPO_PriceList_ID(priceListId); + } + PoManager.save(terminal); + } + + /** + * Retrieves the organisation associated with the POS Terminal in context. + * @param ctx context + * @return Organisation Id (AD_Org_ID) + * @throws TerminalNotFoundException + */ + public static int getOrgId(Properties ctx) throws TerminalNotFoundException + { + MPOSTerminal terminal = getTerminal(ctx); + return terminal.getAD_Org_ID(); + } + + /** + * Retrieves the Warehouse associated with the POS Terminal in context. + * @param ctx context + * @return Warehouse Id (M_Warehouse_ID) + * @throws TerminalNotFoundException + */ + public static int getWarehouseId(Properties ctx) throws TerminalNotFoundException + { + MPOSTerminal terminal = getTerminal(ctx); + return terminal.getM_Warehouse_ID(); + } + + /** + * Return the Bank Account specified for a tender type on the terminal + * @param ctx Context + * @param tenderType Payment Tender Type + * @return Bank Account Id + * @throws OperationException If no Bank Account is defined for tender type + */ + public static int getBankAccountId(Properties ctx, String tenderType) throws OperationException + { + MPOSTerminal terminal = getTerminal(ctx); + int bankAccountId = 0; + + if (MPayment.TENDERTYPE_Check.equals(tenderType)) + { + bankAccountId = terminal.getCheck_BankAccount_ID(); + } + else if (MPayment.TENDERTYPE_CreditCard.equals(tenderType)) + { + bankAccountId = terminal.getCheck_BankAccount_ID(); + } + + if (bankAccountId <= 0) + { + throw new OperationException("No bank account defined on the terminal for the tender type: " + tenderType); + } + + return bankAccountId; + } + + /** + * Retrieves the lock status of the terminal present in the application context is locked + * @param ctx Context + * @return Lock status of the terminal + * @throws TerminalNotFoundException If terminal cannot be loaded + */ + public static boolean isTerminalLocked(Properties ctx) throws TerminalNotFoundException + { + int terminalId = getTerminalId(ctx); + return isTerminalLocked(ctx, terminalId); + } + + /** + * Retrieves the locked status of the terminal provided + * @param ctx Context + * @param terminalId Terminal + * @return Lock status of the terminal + * @throws TerminalNotFoundException If the terminal cannot be loaded + */ + public static boolean isTerminalLocked(Properties ctx, int terminalId) throws TerminalNotFoundException + { + MPOSTerminal terminal = getTerminal(ctx, terminalId); + return terminal.isLocked(); + } + + /** + * Update the lock status of the terminal in context + * @param ctx Context + * @param terminalId Terminal + * @param trxName Transaction + * @throws OperationException If terminal cannot be loaded/cannot update terminal status + */ + public static void setTerminalLockStatus(Properties ctx, int terminalId, boolean locked, String trxName) throws OperationException + { + MPOSTerminal terminal = loadTerminal(ctx); + terminal.setLocked(locked); + PoManager.save(terminal); + } + + + /** + * Closes the till (Terminal). Does all the transfer of money that has been defined on the terminal + * @param ctx Context + * @param terminalId Terminal + * @param cashJournal Cash Journal being used from the cash book + * @param cashAmount Cash amount that need to be transfered + * @param checkAmount Check amount that need to be transfered + * @param cardAmount Card amount that need to be transfered + * @param trxName Transaction + * @throws OperationException If terminal is locked or transfers cannot be done + */ + public static void closeTerminal(Properties ctx, int terminalId, MCash cashJournal, BigDecimal cashAmount, + BigDecimal checkAmount, BigDecimal cardAmount, String trxName) throws OperationException + { + if (isTerminalLocked(ctx, terminalId)) + { + throw new TerminalLockedException("Terminal is locked"); + } + + MPOSTerminal terminal = loadTerminal(ctx, terminalId, trxName); + int cashBookId = cashJournal.getC_CashBook_ID(); + MCashBook cashBook = new MCashBook(ctx, cashBookId, trxName); + int currencyId = cashBook.getC_Currency_ID(); + Timestamp dateAcct = cashJournal.getStatementDate(); + + if (MPOSTerminal.CASHBOOKTRANSFERTYPE_BankAccount.equals(terminal.getCashBookTransferType())) + { + int bankAccountId = terminal.getCashTransferBankAccount_ID(); + CashManager.createBankTransferCashEntry(ctx, cashJournal, cashAmount, bankAccountId, trxName); + } + else if (MPOSTerminal.CASHBOOKTRANSFERTYPE_CashBook.equals(terminal.getCashBookTransferType())) + { + int toCashBookId = terminal.getCashTransferCashBook_ID(); + CashTransferManager.transferFromJournalToCashBook(ctx, cashJournal, toCashBookId, currencyId, cashAmount, dateAcct, trxName); + } + + if (MPOSTerminal.CHECKTRANSFERTYPE_BankAccount.equals(terminal.getCheckTransferType())) + { + int fromBankAccountId = terminal.getCheck_BankAccount_ID(); + int toBankAccountId = terminal.getCheckTransferBankAccount_ID(); + CashTransferManager.transferBankToBank(ctx, fromBankAccountId, toBankAccountId, currencyId, checkAmount, dateAcct, trxName); + } + else if (MPOSTerminal.CHECKTRANSFERTYPE_CashBook.equals(terminal.getCheckTransferType())) + { + int fromBankAccountId = terminal.getCheck_BankAccount_ID(); + int toCashBookId = terminal.getCheckTransferCashBook_ID(); + MCash toCashJournal = CashManager.getCashJournal(ctx, toCashBookId, trxName); + CashManager.createBankTransferCashEntry(ctx, toCashJournal, checkAmount.negate(), fromBankAccountId, trxName); + } + + + if (MPOSTerminal.CARDTRANSFERTYPE_BankAccount.equals(terminal.getCardTransferType())) + { + int fromBankAccountId = terminal.getCard_BankAccount_ID(); + int toBankAccountId = terminal.getCard_BankAccount_ID(); + CashTransferManager.transferBankToBank(ctx, fromBankAccountId, toBankAccountId, currencyId, cardAmount, dateAcct, trxName); + } + else if (MPOSTerminal.CARDTRANSFERTYPE_CashBook.equals(terminal.getCardTransferType())) + { + int fromBankAccountId = terminal.getCard_BankAccount_ID(); + int toCashBookId = terminal.getCardTransferCashBook_ID(); + MCash toCashJournal = CashManager.getCashJournal(ctx, toCashBookId, trxName); + CashManager.createBankTransferCashEntry(ctx, toCashJournal, cardAmount.negate(), fromBankAccountId, trxName); + } + + if (terminal.isAutoLock()) + { + // Lock the terminal + terminal.setLocked(true); + } + + PoManager.save(terminal); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/PartialPOSManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/PartialPOSManager.java new file mode 100644 index 0000000000..e5d74e02c4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/PartialPOSManager.java @@ -0,0 +1,299 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 14-Mar-2006 + */ + + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MInOut; +import org.compiere.model.MInvoice; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.compiere.model.MPayment; +import org.compiere.process.DocAction; +import org.compiere.process.DocumentEngine; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.ItemBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.core.DocStatusMap; +import org.posterita.exceptions.InvalidInvokeOrderStatusException; +import org.posterita.exceptions.InvalidOrderIDException; +import org.posterita.exceptions.InvalidOrderTypeException; +import org.posterita.exceptions.InvalidTenderedAmountException; +import org.posterita.exceptions.NoOrderLineFoundException; +import org.posterita.exceptions.NoOrderLineSelectedException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; +import org.posterita.util.PoManager; + + +public class PartialPOSManager extends POSManager +{ + public static void validateMixedPaymentAmount(OrderLineBean bean) throws InvalidTenderedAmountException + { + if(bean.getTrxType().equalsIgnoreCase("Mixed")) + { + double cashAmt = 0.0; + double chequeAmt = 0.0; + double cardAmt = 0.0; + + cashAmt = (bean.getPaymentByCash()!=null) ? bean.getPaymentByCash() : cashAmt; + chequeAmt = (bean.getPaymentByChq()!=null) ? bean.getPaymentByChq() : chequeAmt; + cardAmt = (bean.getPaymentByCard()!=null) ? bean.getPaymentByCard() : cardAmt; + + double sumActualAmt=bean.getTotalActualPrice(); + + + if( + (cashAmt+chequeAmt+cardAmt !=sumActualAmt)|| + (cashAmt<0.0)|| + (chequeAmt<0.0)|| + (cardAmt<0.0) + ) + { + throw new InvalidTenderedAmountException("The Tendered Amount should be equal to the total amount"); + } + } + } + + //FIXME + public static String deleteOrderLines(Properties ctx,Integer[]orderlineIds,String trxName) throws OperationException + { + if((orderlineIds == null)||(orderlineIds.length == 0)) + { + throw new NoOrderLineSelectedException("Cannot delete orderlines. No orderlines supplied!"); + } + + for(int i=0;i cartBeanItems, String trxName) throws OperationException + { + + MOrder order = new MOrder(ctx,orderId,trxName); + validateMixedPaymentAmount(bean); + + String paymentRule = getPaymentRule(ctx,bean.getTrxType()); + + order.setPaymentRule(paymentRule); + + PoManager.save(order); + + int i=0; + for(ItemBean itemBean : cartBeanItems) + { + double actualPrice = 0.0; + double discount = 0.0; + + if(bean.getDiscountPercent()!=null) + { + String discountEntered = bean.getDiscountPercent()[i]; + + if( discountEntered == null || discountEntered.equals("")) + { + discount = 0; + } + else + { + discount = Double.parseDouble(bean.getDiscountPercent()[i]); + + //double d = 100.0 - discount; + double priceWithDiscount = Double.parseDouble(bean.getActualPrice()[i]); + + // newPrice = (actualPrice + VAT) - discount + + actualPrice = (100.0 / 115.0) * priceWithDiscount; + } + } + + itemBean.setDiscountPercent(new BigDecimal(discount)); + itemBean.setActualPrice(new BigDecimal(actualPrice)); + + updateOrderLine(ctx,order,itemBean.getProductId().intValue(),itemBean.getDiscountPercent(),itemBean.getActualPrice()) ; + + i++; + } + + + return order; + } + + private static void updateOrderLine(Properties ctx,MOrder order,int productID,BigDecimal discount,BigDecimal actualPrice) throws OperationException + { + //load orderLine + int orderId = order.get_ID(); + + int id[] = MOrderLine.getAllIDs(MOrderLine.Table_Name,"C_ORDER_ID = "+orderId+" AND M_PRODUCT_ID = "+productID,order.get_TrxName()); + if((id==null)||(id.length==0)) + { + throw new OperationException("OrderLine not found."); + } + + String trxName = order.get_TrxName(); + + MOrderLine orderLine = new MOrderLine(ctx,id[0],trxName); + + //calculating new price + BigDecimal newActualPrice = OrderManager.calculateActualPrice(ctx,orderLine.getPriceActual(),discount); + orderLine.setPrice (newActualPrice); + + PoManager.save(orderLine); + + } + + public static MOrder invokePartialOrder(Properties ctx,int orderId,String trxName) throws InvalidOrderIDException,NoOrderLineFoundException,InvalidInvokeOrderStatusException + { + //checking whether order exixts + int ids[] = MOrder.getAllIDs(MOrder.Table_Name,"ISACTIVE='Y' AND C_ORDER_ID = " + orderId,null); + + if((ids == null)||(ids.length == 0)) + { + throw new InvalidOrderIDException("Could not found order!"); + } + + //loading order + MOrder order = new MOrder(ctx,ids[0],trxName); + + //checking order status + String status = order.getDocStatus(); + if((status.equals(DocAction.STATUS_Drafted))||(status.equals(DocAction.STATUS_InProgress))) + { + //looking for orderlines + if(OrderManager.isOrderEmpty(ctx,orderId,trxName)) + { + throw new NoOrderLineFoundException("Order does contain any orderlines!"); + } + } + else + { + //display err msg + String s = DocStatusMap.getDocStatusMap().get(status); + throw new InvalidInvokeOrderStatusException("Cannot invoke with status: " + s,s); + } + + return order; + } + + public static MOrder invokePartialOrder (Properties ctx, String documentNo, String trxName) throws InvalidOrderIDException,NoOrderLineFoundException,InvalidInvokeOrderStatusException, InvalidOrderTypeException + { + int orderId=getOrderIdFromDocumentNo(ctx,documentNo); + //loading order + MOrder order = new MOrder(ctx,orderId,trxName); + + //check order type + //only drafted pos orders can be invoked + String orderType = order.getOrderType(); + if(! orderType.equalsIgnoreCase( UDIOrderTypes.POS_ORDER.getOrderType() ) ) + { + throw new InvalidOrderTypeException("Can only POS orders "); + } + + //checking order status + String status = order.getDocStatus(); + if((status.equals(DocAction.STATUS_Drafted))||(status.equals(DocAction.STATUS_InProgress))) + { + //looking for orderlines + if(OrderManager.isOrderEmpty(ctx,orderId,trxName)) + { + throw new NoOrderLineFoundException("Order does contain any orderlines!"); + } + } + else + { + //display err msg + String s = DocStatusMap.getDocStatusMap().get(status); + throw new InvalidInvokeOrderStatusException("Cannot invoke with status: " + s,s); + } + + return order; + } + + public static int getOrderIdFromDocumentNo(Properties ctx,String documentNo) throws InvalidOrderIDException + { +// checking whether order exixts + int ids[] = MOrder.getAllIDs(MOrder.Table_Name,"ISACTIVE='Y' AND AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and DOCUMENTNO = '" + documentNo + "'",null); + + if((ids == null)||(ids.length == 0)) + { + throw new InvalidOrderIDException("Could not found order!"); + } + + return ids[0]; + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/PaymentAllocationManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/PaymentAllocationManager.java new file mode 100644 index 0000000000..038eed7589 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/PaymentAllocationManager.java @@ -0,0 +1,372 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 7, 2006 by alok + */ + + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MAllocationHdr; +import org.compiere.model.MAllocationLine; +import org.compiere.model.MInvoice; +import org.compiere.model.MPayment; +import org.compiere.process.DocumentEngine; +import org.compiere.util.DB; +import org.compiere.util.Env; + +import org.posterita.beans.OpenItemBean; +import org.posterita.exceptions.AllocatedAmtMoreThanOpenAmtException; +import org.posterita.exceptions.CanNotCreatePaymentAllocationException; +import org.posterita.exceptions.NoAllocateeInvoiceException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.PayAmtNotEqualToAllocateAmtException; +import org.posterita.exceptions.TooManyAllocateInvoiceException; +import org.posterita.util.PoManager; + + +public class PaymentAllocationManager +{ + + + public static void allocate(Properties ctx, Integer[] invoiceIds, Integer[] paymentIds, String trxName) throws TooManyAllocateInvoiceException,CanNotCreatePaymentAllocationException,OperationException + { + + BigDecimal discountAmt = new BigDecimal(0); + BigDecimal writeOffAmt = new BigDecimal(0); + BigDecimal overUnderAmt = new BigDecimal(0); + int paymentId = 0; + int cashLineId=0; + int creditInvoiceId=0; + MInvoice invoice = null; + BigDecimal appliedAmt=new BigDecimal(0); + int count=0; + + if(invoiceIds==null || invoiceIds.length<1) + { + throw new NoAllocateeInvoiceException("Please select an Invoice to allocate"); + } + + if(invoiceIds.length<2 && (paymentIds==null || paymentIds.length<1)) + { + throw new NoAllocateeInvoiceException("Please select an Invoice to allocate"); + } + + + for(int i=0;i1) + throw new TooManyAllocateInvoiceException("can match only one credit Invoice"); + creditInvoiceId=invoice.get_ID(); + } + + } + if(count==0) + { + throw new NoAllocateeInvoiceException("Please select an Invoice to allocate"); + } + + MInvoice creditInvoice = new MInvoice(ctx,creditInvoiceId,null); + if(appliedAmt.doubleValue()>0) + { + if((appliedAmt.doubleValue())>creditInvoice.getOpenAmt().doubleValue()) + { + throw new CanNotCreatePaymentAllocationException("the allocation amt is more than open amt"); + } + } + + MAllocationHdr alloc = new MAllocationHdr (ctx, true, // manual + new Timestamp(System.currentTimeMillis()), creditInvoice.getC_Currency_ID(), Env.getContext(Env.getCtx(), "#AD_User_Name"), trxName); + alloc.setAD_Org_ID(Env.getAD_Org_ID(ctx)); + alloc.save(); + + if(invoiceIds.length>1) + { + for(int j=0;j0) + { + MPayment payment=null; + BigDecimal overUnderPaymentAmt = null; + for(int k=0;kcreditInvoice.getOpenAmt().doubleValue()) + { + overUnderPayment=availableAmt.subtract(creditInvoice.getOpenAmt()); + } + else + { + overUnderPayment=payment.getOverUnderAmt(); + } + */ + + MAllocationLine aLine = new MAllocationLine (alloc, allocationAmt, + payment.getDiscountAmt(), payment.getWriteOffAmt(),overUnderPaymentAmt ); + aLine.setDocInfo(creditInvoice.getC_BPartner_ID(),creditInvoice.getC_Order_ID(), creditInvoice.get_ID()); + aLine.setPaymentInfo(payment.get_ID(), cashLineId); + aLine.save(); + } + } + + + String sql = "SELECT invoiceOpen("+creditInvoiceId+", 0) FROM C_Invoice WHERE C_Invoice_ID = ?"; + BigDecimal open = DB.getSQLValueBD(null, sql, creditInvoiceId); + if (open != null && open.signum() == 0) + { + sql = "UPDATE C_Invoice SET IsPaid='Y' WHERE C_Invoice_ID=" + creditInvoiceId; + DB.executeUpdate(sql,null); + + } + + alloc.processIt(DocumentEngine.ACTION_Complete); + PoManager.save(alloc); + } + + private static BigDecimal getAvailableAmt(Properties ctx, int paymentId) throws OperationException + { + String sql = "select availableAmt from RV_payment where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and C_Payment_id="+paymentId; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + BigDecimal availableAmt=new BigDecimal(0.0); + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + availableAmt=rs.getBigDecimal(1); + } + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch (SQLException e) + { + + } + + } + + return availableAmt; + } + + + + public static ArrayList getInvoiceToAllocate(Properties ctx,Integer [] invoiceIds,String trxName) throws TooManyAllocateInvoiceException,CanNotCreatePaymentAllocationException,OperationException + { + if(invoiceIds==null) + { + throw new NoAllocateeInvoiceException("Please select an Invoice to allocate"); + } + ArrayList list=new ArrayList(); + for (int i=0;i0) + { + for(int k=0;k0) + { + + for(int k=0;k list = new ArrayList(); + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean= new PaymentHistoryBean(); + bean.setPaymentId(Integer.valueOf(rs.getInt(1))); + bean.setPartnerName(rs.getString(2)); + bean.setDocumentNo(rs.getString(3)); + bean.setDateTrx(rs.getTimestamp(4)); + bean.setIsReceipt(rs.getString(5)); + bean.setInvoiceId(Integer.valueOf(rs.getInt(6))); + bean.setCheckNo(rs.getString(7)); + bean.setPayAmt(Integer.valueOf(rs.getInt(8))); + bean.setDocStatus(UDIMap.docStatusMap.get(rs.getString(9))); + bean.setDocStatusCode(rs.getString(9)); + bean.setOrderId(Integer.valueOf(rs.getInt(10))); + bean.setPartnerId(Integer.valueOf(rs.getInt(11))); + list.add(bean); + } + + rs.close(); + + } + catch (SQLException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + + } + + return list; + } + + public static MPayment generatePayments(Properties ctx, MInvoice invoice) throws OperationException + { + //the normal flow for payment should be that + //first customer creates an AP Payment + //completes it + //this generates a counter(AR payment) document on HSAF side + + //however we assume that the customer has paid for the goods + //and generate his AP payment ourselves + + //get counter(vendor invoice) from customer Invoice + + MInvoice vendorInvoice = InvoiceManager.getCounterInvoice(ctx, invoice); + Properties newCtx = (Properties) ctx.clone(); + newCtx.setProperty(UdiConstants.ORG_ID_CTX_PARAM, "" + vendorInvoice.getAD_Org_ID()); + + //appayment is linked to vendor invoice + MPayment apPayment = createAPPayment(newCtx, vendorInvoice, vendorInvoice.get_TrxName()); + + //ar receipt is linked to customer invoice + MPayment completedAPPayment = completeAPPayment(newCtx, apPayment); + + //get generated AR receipt + int arReceiptIds[] = MPayment.getAllIDs(MPayment.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ref_payment_id=" + completedAPPayment.get_ID(),invoice.get_TrxName()); + + if (arReceiptIds.length == 0) + throw new RuntimeException("Expected an AR Receipt for AP Payment---" + apPayment.get_ID()); + + PaymentManager.completePayment(ctx, new MPayment(ctx,arReceiptIds[0],invoice.get_TrxName())); + return completedAPPayment; + } + + //retrieve AR receipt + public static MPayment getCounterPayment(Properties ctx, MPayment apPayment) + { + if (!apPayment.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + throw new RuntimeException("Cannot get counter document of payment which has not been completed"); + + int arReceipts[] = MPayment.getAllIDs(MPayment.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ref_payment_id=" + apPayment.get_ID(), apPayment.get_TrxName()); + + if (arReceipts.length == 0) + throw new RuntimeException("counter payment document not found for payment--" + apPayment.get_ID()); + + MPayment receipt = new MPayment(ctx, arReceipts[0], apPayment.get_TrxName()); + + return receipt; + } + public static WebDocumentBean getWebPaymentBean(Properties ctx, MPayment payment) throws OperationException, DataException + { + if (payment == null) + throw new OperationException("Invalid operation payment is null"); + + if (payment.get_ID() == 0) + throw new OperationException("You have deleted this payment. You cannot view this payment."); + + WebDocumentBean bean = new WebDocumentBean(); + + bean.setPaymentId(Integer.valueOf(payment.get_ID())); + + int currencyId = payment.getC_Currency_ID(); + MCurrency currency = new MCurrency(ctx,currencyId,null); + bean.setCurrencySymbole(currency.getCurSymbol()); + + MOrg myOrg = OrganisationManager.getMyOrg(ctx); + MBPartner me = new MBPartner(ctx, myOrg.getLinkedC_BPartner_ID(null), null); + bean.setMe(me); + //MOrg orderOrg = new MOrg(ctx, payment.getAD_Org_ID(), null); + /* + if (orderOrg.getLinkedC_BPartner_ID() != myOrg.getLinkedC_BPartner_ID()) + throw new DocumentDoesNotBelongToYouException("This payment does not belong to you. You do not have access to it."); + */ + + MBPartnerLocation meLocation[] = MBPartnerLocation.getForBPartner(ctx,me.get_ID()); + if (meLocation.length ==0) + throw new OperationException("No location has been set for your organisation. Please ask your administrator to set one for you"); + + MLocation location = new MLocation(ctx, meLocation[0].getC_Location_ID(), null); + + if (location.get_ID() == 0) + throw new OperationException("You must have a location set for your business partner, Please ask your administrator to set one for you"); + + bean.setMeLocation(location); + + MBPartner you = new MBPartner(ctx, payment.getC_BPartner_ID(), null); + + MBPartnerLocation youBPLocation[] = MBPartnerLocation.getForBPartner(ctx, you.get_ID()); + + if (youBPLocation.length ==0) + throw new OperationException("No location has been set for the dealer organisation. Please ask your administrator to set one for you"); + + MLocation youLocation = new MLocation(ctx, youBPLocation[0].getC_Location_ID(), null); + + bean.setYou(you); + bean.setYoubpLocation(youBPLocation[0]); + bean.setYouLocation(youLocation); + + WebDocumentHeaderBean headerBean = createWebDocumentHeader(ctx, payment.getAD_Org_ID(),payment.getC_BPartner_ID(), payment.getDocStatus(), payment.isReceipt(),payment.getTenderType()); + headerBean.setDocumentHeader(getDocumentHeader(payment)); + + String tenderTypeName = MRefList.getListName(ctx, MPayment.TENDERTYPE_AD_Reference_ID,payment.getTenderType()); + + if(payment.getCheckNo()!=null) + { + tenderTypeName=tenderTypeName+" "+payment.getCheckNo(); + } + headerBean.setPaymentType(tenderTypeName); + + bean.setHeaderBean(headerBean); + + bean.setPayment(payment); + + MInvoice invoice = new MInvoice(ctx, payment.getC_Invoice_ID(), null); + + //order linked to invoice + MOrder order = new MOrder(ctx, invoice.getC_Order_ID(), null); + + bean.setOrder(order); + bean.setInvoice(invoice); + + CommandBean cmdBean = getCustomerPaymentWebCommands(payment); + bean.setSimpleCommand(cmdBean.getSimpleCommand()); + bean.setComplexCommand(cmdBean.getComplexCommand()); + + return bean; + } + + public static String getDocumentHeader(MPayment payment) + { + if (payment.isReceipt()) + return PAYMENT_RECEIVED; + + return PAYMENT_MADE; + } + + + +// public static void paidAndShip(Properties ctx, MInvoice invoice) throws OperationException +// { +// MPayment apPayment = generatePayments(ctx, invoice); +// MessageManager.sendPaymentMessage(apPayment,UDIDocActionValues.CONFIRM); +// MinOutManager.generateMinOut(ctx, invoice); +// +// } + + + + private static CommandBean getCustomerPaymentWebCommands(MPayment payment) throws OperationException, DataException + { + + //if (!payment.isReceipt()) + // throw new OperationException("Invoice should be a AR Receipt"); + + + String[] simpleCommands = null; + String[] complexCommands = null; + + CommandBean bean = new CommandBean(); + + if (payment.getDocStatus().equals(DocumentEngine.STATUS_Drafted)) + { + simpleCommands = new String[]{Constants.PAYMENT_ACTION_COMPLETE}; + complexCommands = new String[]{Constants.PAYMENT_ACTION_CANCEL}; + } + + if (payment.getDocStatus().equals(DocumentEngine.STATUS_Voided)) + { + complexCommands = new String[]{Constants.INVOICE_ACTION_DELETE}; + } + + if (payment.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + { + + simpleCommands = new String[]{Constants.MINOUT_ACTION_SHIP}; + } + + + bean.setSimpleCommand(simpleCommands); + bean.setComplexCommand(complexCommands); + return bean; + } + + + public static MPayment loadPayment(Properties ctx, int paymentId, String trxName) throws OperationException + { + MPayment payment = new MPayment(ctx, paymentId, trxName); + if(payment.get_ID() == 0) + throw new OperationException("Could not load payment with id: " + paymentId); + + return payment; + } + + public static void printInvoice(Properties ctx,MPayment payment) throws OperationException + { + PrintManager.print(ctx,ReportEngine.REMITTANCE,payment.get_ID()); + } + + + public static MPayment createPayment(Properties ctx,PaymentBean bean,String trxName) throws OperationException + { + if(bean.getBpartnerId()==null) + { + throw new BPartnerNotFoundException("customer not found"); + } + + String docBaseType = MDocType.DOCBASETYPE_APPayment; + boolean isReceipt = false; + + if(bean.getIsSoTrx()) + { + docBaseType = MDocType.DOCBASETYPE_ARReceipt; + isReceipt = true; + } + + MDocType[] docTypes = MDocType.getOfDocBaseType(ctx, docBaseType); + if (docTypes.length == 0) + { + throw new OperationException("not document type found for payment"); + } + + MPayment payment = new MPayment(ctx,0,trxName); + payment.setC_DocType_ID(docTypes[0].get_ID()); + payment.setC_Currency_ID(POSTerminalManager.getCurrencyOfTerminalCashBook(ctx).get_ID()); + payment.setC_BPartner_ID(bean.getBpartnerId()); + + // @ashley TODO Fix inconsistent Transaction type in the codes + if(bean.getTrxType().equalsIgnoreCase("Card")) + { + payment.setTenderType(MPayment.TENDERTYPE_CreditCard); + } + else if(bean.getTrxType().equalsIgnoreCase("Cheque")) + { + payment.setTenderType(MPayment.TENDERTYPE_Check); + } + else if(bean.getTrxType().equalsIgnoreCase("Cash")) + { + payment.setTenderType(MPayment.TENDERTYPE_Cash); + } + else + { + throw new OperationException("invalid tender type"); + } + + + if(MPayment.TENDERTYPE_Cash.equals(payment.getTenderType())) + { + int cashbookId = POSTerminalManager.getCashBookId(ctx); + payment.setC_CashBook_ID(cashbookId); + } + else + { + int bankAccountId = POSTerminalManager.getBankAccountId(ctx, payment.getTenderType()); + payment.setC_BankAccount_ID(bankAccountId); + } + + + payment.setIsPrepayment(false); + + payment.setPayAmt(bean.getAmount()); + if(bean.getCreditCardNumber()!=null) + payment.setCreditCardNumber(bean.getCreditCardNumber()); + if(bean.getChequeNo()!=null) + payment.setCheckNo(bean.getChequeNo()); + + payment.setIsReceipt(isReceipt); + + if(isReceipt) + payment.setDescription("(AR Receipt) Payment Received"); + else + payment.setDescription("(AP Payment) Payment Made"); + + int posId = POSTerminalManager.getTerminalId(ctx); + payment.setDescription(""+posId); //To get the proper pos info posId is saved into description + + PoManager.save(payment); + + PoManager.processIt(payment, DocumentEngine.ACTION_Complete); + + return payment; + } + + /** + * Returns the tender type for a payment rule + * @param paymentRule Order/Invoice Payment Rule + * @return Tender Type + */ + public static String getTenderType(String paymentRule) + { + if(MInvoice.PAYMENTRULE_CreditCard.equals(paymentRule)) + { + return MPayment.TENDERTYPE_CreditCard; + } + else if(MInvoice.PAYMENTRULE_DirectDebit.equals(paymentRule)) + { + return MPayment.TENDERTYPE_DirectDebit; + } + else if(MInvoice.PAYMENTRULE_DirectDeposit.equals(paymentRule)) + { + return MPayment.TENDERTYPE_DirectDeposit; + } + else if (MInvoice.PAYMENTRULE_Check.equals(paymentRule)) + { + return MPayment.TENDERTYPE_Check; + } + else if (MInvoice.PAYMENTRULE_OnCredit.equals(paymentRule) + || MInvoice.PAYMENTRULE_Mixed.equals(paymentRule)) + { + // Returns Check by default for Credit and Mixed payment rules. + return MPayment.TENDERTYPE_Check; + } + else + { + throw new IllegalArgumentException("No tender type is defined for the payment rule: " + paymentRule); + } + } + + /** + * @param ctx Context + * @param currencyId CurrencyId whose roundOff Factor is required + * @param total Total price + * @param trxName Transaction Name + * @return writeOff Amount + */ + public static BigDecimal computeWriteOff(Properties ctx, Integer currencyId, BigDecimal total, String trxName) + { + BigDecimal writeoffAmt = Env.ZERO; + BigDecimal roundOffFactor; + + MCurrency currency = new MCurrency(ctx, currencyId, trxName); + roundOffFactor = currency.getRoundOffFactor(); + + //Calculate write off amount + if(roundOffFactor != null && roundOffFactor.doubleValue() != 0.0) + { + writeoffAmt = total.remainder(roundOffFactor); + } + + return writeoffAmt; + } + + public static PaymentDetailsBean getPaymentDetails(Properties ctx, int c_order_id, String trxName) throws OperationException + { + PaymentDetailsBean bean = new PaymentDetailsBean(); + + MOrder order = new MOrder(ctx, c_order_id, trxName); + + bean.setTenderedAmt(order.getAmountTendered()); + bean.setRefundedAmt(order.getAmountRefunded()); + + String sql = " SELECT SUM(AMOUNT) AS AMOUNT, SUM(WRITEOFF) AS WRITEOFF, SUM(DISCOUNT) AS DISCOUNT FROM (" + + " SELECT SUM(AMOUNT) AS AMOUNT, SUM(WRITEOFFAMT) AS WRITEOFF, SUM(DISCOUNTAMT) AS DISCOUNT FROM C_CASHLINE,C_INVOICE " + + " WHERE C_INVOICE.C_INVOICE_ID = C_CASHLINE.C_INVOICE_ID " + + " AND C_INVOICE.C_ORDER_ID = ? " + + " UNION " + + " SELECT SUM(PAYAMT) AS AMOUNT, SUM(WRITEOFFAMT) AS WRITEOFF, SUM(DISCOUNTAMT) AS DISCOUNT FROM C_PAYMENT,C_INVOICE " + + " WHERE C_INVOICE.C_INVOICE_ID = C_PAYMENT.C_INVOICE_ID " + + " AND C_INVOICE.C_ORDER_ID = ? " + + " ) PAYMENT"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sql, trxName); + pstmt.setInt(1, c_order_id); + pstmt.setInt(2, c_order_id); + + rs = pstmt.executeQuery(); + + if(rs.next()) + { + BigDecimal amount = rs.getBigDecimal(1); + BigDecimal writeOff = rs.getBigDecimal(2); + BigDecimal discount = rs.getBigDecimal(3); + + amount = amount == null? Env.ZERO : amount; + writeOff = writeOff == null? Env.ZERO : writeOff; + discount = discount == null? Env.ZERO : discount; + + bean.setWriteOffAmt(writeOff); + bean.setDiscountAmt(discount); + bean.setPayAmt(amount.setScale(2, BigDecimal.ROUND_UP)); + + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + DB.close(rs, pstmt); + } + return bean; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/PaymentTermManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/PaymentTermManager.java new file mode 100644 index 0000000000..0d42a2eb6b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/PaymentTermManager.java @@ -0,0 +1,316 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 31, 2006 by alok + */ + + +package org.posterita.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MPaymentTerm; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.PaymentTermBean; +import org.posterita.exceptions.CannotDeactivatePaymentTermException; +import org.posterita.exceptions.InvalidNetDaysException; +import org.posterita.exceptions.MandatoryNameException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.PaymentTermAlreadyExistsException; +import org.posterita.util.PoManager; + + +public class PaymentTermManager +{ + + public static ArrayList getAllActivePaymentTerm(Properties ctx) throws OperationException + { + return getAllPaymentTerm(ctx,true); + } + public static ArrayList getAllPaymentTerm(Properties ctx,boolean isActive) throws OperationException + { + String sql = "select " + + " C_PAYMENTTERM_ID," +//1 + " NAME," +//2 + " NETDAYS,"+//3 + " CASE WHEN isActive = 'Y' THEN 'true' ELSE 'false' END AS active ," + + //" DECODE(isActive,'Y','true','false') active,"+//4 + " CASE WHEN AFTERDELIVERY = 'Y' THEN 'true' ELSE 'false' END AS delivery," + + //" DECODE(AFTERDELIVERY,'Y','true','false') delivery,"+//5 + " CASE WHEN ISDUEFIXED = 'Y' THEN 'true' ELSE 'false' END AS dueFixed," + + //" DECODE(ISDUEFIXED,'Y','true','false') dueFixed,"+// + " FIXMONTHCUTOFF,"+//7 + " FIXMONTHDAY,"+//8 + " FIXMONTHOFFSET"+//9 + " from C_PAYMENTTERM " + + " where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + if(isActive==true) + sql=sql+"and isActive = 'Y'"; + + + ArrayList list = new ArrayList(); + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + + + PaymentTermBean bean=null; + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + + bean=new PaymentTermBean(); + bean.setPaymentTermId(rs.getInt(1)); + bean.setPaymentTermName(rs.getString(2)); + bean.setNetDays(rs.getInt(3)); + bean.setIsActive(Boolean.parseBoolean(rs.getString(4))); + bean.setAfterDelivery(Boolean.parseBoolean(rs.getString(5))); + bean.setFixedDueDate(Boolean.parseBoolean(rs.getString(6))); + bean.setFiedMonthCutoff(rs.getInt(7)); + bean.setFixedMonthDay(rs.getInt(8)); + bean.setFixedMonthOffset(rs.getInt(9)); + + list.add(bean); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + if(rs!=null) + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + + } + } + + return list; + } + + public static MPaymentTerm createEditPaymentTerm(Properties ctx,PaymentTermBean bean,String trxName ) throws OperationException + { + if(bean.getPaymentTermName()==null) + { + throw new MandatoryNameException(" name is mandatory"); + } + + + MPaymentTerm paymentTerm=null; + String whereClause="AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and name='"+bean.getPaymentTermName()+"'"; + int [] paymentTermIds=MPaymentTerm.getAllIDs(MPaymentTerm.Table_Name,whereClause,null); + + if(bean.getPaymentTermId()==null) + { + paymentTerm = new MPaymentTerm(ctx,0,trxName); + if(paymentTermIds.length>0) + throw new PaymentTermAlreadyExistsException("The Payment Term Name already exists"); + } + else + { + paymentTerm = new MPaymentTerm(ctx,bean.getPaymentTermId(),trxName); + if(paymentTermIds.length>0 && !paymentTerm.getName().equalsIgnoreCase(bean.getPaymentTermName())) + throw new PaymentTermAlreadyExistsException("The Payment Term Name already exists"); + + } + paymentTerm.setName(bean.getPaymentTermName()); + paymentTerm.setValue(bean.getPaymentTermName()); + + if(bean.getIsActive()==false) + { + String whereClause1="AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_PAYMENTTERM_ID="+bean.getPaymentTermId(); + + int [] bPids = MBPartner.getAllIDs(MBPartner.Table_Name,whereClause1,null); + if(bPids!=null && bPids.length>0) + { + throw new CannotDeactivatePaymentTermException("cannot deActivate payment term,have associated bPartner"); + + } + } + + paymentTerm.setIsActive(bean.getIsActive()); + paymentTerm.setAfterDelivery(bean.getAfterDelivery().booleanValue()); + if(bean.getFixedDueDate().booleanValue()==true) + { + paymentTerm.setIsDueFixed(true); + + /**The Fix Month Cutoff indicates the last + * day invoices can have to be included in the current + * due date. This field only displays when the fixed due date checkbox has been + * selected.*/ + paymentTerm.setFixMonthCutoff(bean.getFiedMonthCutoff().intValue()); + + /**The Fix Month Day indicates the day of the month that invoices are due. + This field only displays if the fixed due date checkbox is selected.*/ + paymentTerm.setFixMonthDay(bean.getFixedMonthDay()); + + /**The Fixed Month Offset indicates the number of + * months from the current month to indicate an invoice is due. + * A 0 indicates the same month, a 1 the following month. + * This field will only display if the fixed due date checkbox is selected.*/ + + if(bean.getFixedMonthOffset()==null) + bean.setFixedMonthOffset(0); + paymentTerm.setFixMonthOffset(bean.getFixedMonthOffset()); + + } + else + { + paymentTerm.setIsDueFixed(false); + if(bean.getNetDays()==null || bean.getNetDays().intValue()<0) + { + throw new InvalidNetDaysException(" net days cannot be negative"); + } + paymentTerm.setNetDays(bean.getNetDays()); + } + + if(bean.getDiscountDay1()!=null) + { + paymentTerm.setDiscountDays(bean.getDiscountDay1()); + } + if(bean.getDiscountAmt1()!=null) + { + paymentTerm.setDiscount(bean.getDiscountAmt1()); + } + if(bean.getDiscountDay2()!=null) + { + paymentTerm.setDiscountDays2(bean.getDiscountDay2()); + } + if(bean.getDiscountAmt2()!=null) + { + paymentTerm.setDiscount2(bean.getDiscountAmt2()); + } + PoManager.save(paymentTerm); + return paymentTerm; + } + + + public static PaymentTermBean getPaymentTerm(Properties ctx,int paymentTermId) throws OperationException + { + String sql = "select " + + " C_PAYMENTTERM_ID," +//1 + " NAME," +//2 + " NETDAYS,"+//3 + //" DECODE(isActive,'Y','true','false') active,"+//4 + " CASE WHEN isActive='Y' THEN 'true' ELSE 'false' END AS active,"+//4 + //" DECODE(AFTERDELIVERY,'Y','true','false') delivery,"+//5 + " CASE WHEN AFTERDELIVERY = 'Y' THEN 'true' ELSE 'false' END AS delivery,"+//5 + //" DECODE(ISDUEFIXED,'Y','true','false') dueFixed,"+//6 + " CASE WHEN ISDUEFIXED = 'Y' THEN 'true' ELSE 'false' END AS dueFixed,"+//6 + " FIXMONTHCUTOFF,"+//7 + " FIXMONTHDAY,"+//8 + " FIXMONTHOFFSET,"+//9 + " DISCOUNTDAYS,"+//10 + " DISCOUNT,"+//11 + " DISCOUNTDAYS2,"+//12 + " DISCOUNT2"+//13 + " from C_PAYMENTTERM " + + " where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and C_PAYMENTTERM_ID ="+paymentTermId; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + + PaymentTermBean bean=null; + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + + bean=new PaymentTermBean(); + bean.setPaymentTermId(rs.getInt(1)); + bean.setPaymentTermName(rs.getString(2)); + bean.setNetDays(rs.getInt(3)); + bean.setIsActive(Boolean.parseBoolean(rs.getString(4))); + bean.setAfterDelivery(Boolean.parseBoolean(rs.getString(5))); + bean.setFixedDueDate(Boolean.parseBoolean(rs.getString(6))); + bean.setFiedMonthCutoff(rs.getInt(7)); + bean.setFixedMonthDay(rs.getInt(8)); + bean.setFixedMonthOffset(rs.getInt(9)); + bean.setDiscountDay1(rs.getInt(10)); + bean.setDiscountAmt1(rs.getBigDecimal(11)); + bean.setDiscountDay2(rs.getInt(12)); + bean.setDiscountAmt2(rs.getBigDecimal(13)); + + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + if(rs!=null) + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + + } + } + + return bean; + } + + + public static MPaymentTerm activatePaymentTerm(Properties ctx,int paymentTermId, boolean activate) throws OperationException + { + + + MPaymentTerm paymentTerm = new MPaymentTerm(ctx,paymentTermId,null); + + if(activate==true) + { + paymentTerm.setIsActive(true); + } + + else + { + String whereClause="AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_PAYMENTTERM_ID="+paymentTermId; + int [] bPids = MBPartner.getAllIDs(MBPartner.Table_Name,whereClause,null); + if(bPids!=null && bPids.length>0) + { + throw new CannotDeactivatePaymentTermException("cannot deActivate payment term,have associated bPartner"); + } + paymentTerm.setIsActive(false); + } + + + PoManager.save(paymentTerm); + return paymentTerm; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/PostingManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/PostingManager.java new file mode 100644 index 0000000000..412d12fb9f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/PostingManager.java @@ -0,0 +1,78 @@ +/** + * + * Copyright (c) 2007 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 21 Dec 2007 17:34:13 by shameem + * + */ + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.model.MInvoice; +import org.compiere.model.MPInstance; +import org.compiere.process.FactAcctReset; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.CLogger; +import org.compiere.util.Env; + +public class PostingManager +{ + + static private CLogger cLog = CLogger.getCLogger(FactAcctReset.class); + + public static void resubmitPostingForInvoice(Properties ctx) + { + // TODO Auto-generated method stub + + BigDecimal clientId = new BigDecimal(Env.getAD_Client_ID(ctx)); + + BigDecimal invoiceIdTableId = new BigDecimal(MInvoice.Table_ID); + + ProcessInfoParameter param[] = + { + new ProcessInfoParameter("AD_Client_ID", clientId, null, null, null), + new ProcessInfoParameter("AD_Table_ID", invoiceIdTableId, null, null, null), + new ProcessInfoParameter("DeletePosting", "N", null, null, null), + }; + + + MPInstance instance = new MPInstance(ctx, 175, Env.getAD_Client_ID(ctx)); + + instance.save(); + + ProcessInfo poInfo = new ProcessInfo("Resubmit Posting", 175); + poInfo.setParameter(param); + poInfo.setAD_Process_ID(175); + poInfo.setAD_PInstance_ID(instance.get_ID()); + + + FactAcctReset factAcct = new FactAcctReset(); + boolean success = factAcct.startProcess(ctx,poInfo, null); + + + + if(success==false) + { + cLog.log(Level.FINE,"Error occurred while running process for resubmit posting for Invoice"); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/PrintManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/PrintManager.java new file mode 100644 index 0000000000..2f8ef39cf7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/PrintManager.java @@ -0,0 +1,398 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 23, 2006 + */ + + +package org.posterita.businesslogic; + +import java.io.FileOutputStream; +import java.lang.reflect.Constructor; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Properties; +import java.util.logging.Level; + +import javax.print.DocFlavor; +import javax.print.DocPrintJob; +import javax.print.PrintException; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.SimpleDoc; + +import org.compiere.model.MCashLine; +import org.compiere.model.MUser; +import org.compiere.print.MPrintFormat; +import org.compiere.print.ReportEngine; +import org.compiere.util.CLogger; +import org.compiere.util.Env; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.UDIBean; +import org.posterita.exceptions.OperationException; +import org.posterita.util.IPrintFormatter; +import org.posterita.util.TmkPrinterConstants; + + +public class PrintManager +{ + private static final CLogger logger = CLogger.getCLogger(PrintManager.class); + + final static String SINGLE_LINE = "-----------------------------"; + final static String DOUBLE_LINE = "============================="; + final static String EMPTY_STRING = ""; + + public static void printAdjustCashbookReport(Properties ctx, MCashLine cashLine) throws OperationException + { + int ad_user_id = Env.getAD_User_ID(ctx); + + if (cashLine.get_ID() <= 0) + { + throw new OperationException("Could not load Cash Line"); + } + + BigDecimal adjustmentAmount = cashLine.getAmount(); + String transferType = cashLine.getCashType(); + String title = "Adjust Cashbook"; + + if(MCashLine.CASHTYPE_GeneralExpense.equals(transferType)) + { + transferType = "Expense"; + } + else if(MCashLine.CASHTYPE_BankAccountTransfer.equals(transferType)) + { + transferType = "Account Transfer"; + adjustmentAmount = adjustmentAmount.negate(); + } + else if(MCashLine.CASHTYPE_GeneralReceipts.equals(transferType)) + { + transferType = "Receipt"; + } + else + { + throw new OperationException("Transfer type cannot be processed"); + } + + //writing the report + StringBuffer reportData = new StringBuffer(); + + //adding report header + reportData.append(TmkPrinterConstants.LOGO1); + + //adding title + reportData.append(TmkPrinterConstants.BIG_FONT) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(title) + .append(TmkPrinterConstants.LINE_FEED); + + //setting small font + reportData.append(TmkPrinterConstants.SMALL_FONT); + + //adding customer name + MUser user = new MUser(ctx,ad_user_id,null); + String username = user.getName(); + + username = String.format("%1$-60s",username); + reportData.append(username).append(TmkPrinterConstants.LINE_FEED); + + //adding date + Calendar c = Calendar.getInstance(); + String date = String.format("%1$te %1$tb,%1$tY %1$tH:%1$tM:%1$tS",c); + date = String.format("%1$-60s",date); + reportData.append(date) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.LINE_FEED); + + //1.header + reportData.append(TmkPrinterConstants.H_FULL_LINE_TOP) + .append(TmkPrinterConstants.LINE_FEED); + + String header = String.format("%1$-30s%2$-30s","Transfer Type","Amount"); + + reportData.append(header) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(TmkPrinterConstants.H_FULL_LINE_BOTTOM) + .append(TmkPrinterConstants.LINE_FEED); + + //2.body + + String body = String.format("%1$-30s%2$-30s", transferType, adjustmentAmount); + + reportData.append(body) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(TmkPrinterConstants.H_FULL_LINE_BOTTOM) + .append(TmkPrinterConstants.LINE_FEED); + + //3.footer + + String footer = "Sig: ..................................."; + footer = String.format("%1$60s",footer); + + reportData.append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.LINE_FEED) + .append(footer) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.PAPER_CUT); + + print(ctx,reportData.toString()); + openCashDrawer(ctx); + + } + + /** + * Return Postscript file for document + * @param ctx Context + * @param type Type of document (Order, Invoice, ..) + * @param recordId The document id for which to generate a PS + * @return Postscript data + * @throws OperationException + * + * @author Ashley + */ + public static byte[] getPDFData(Properties ctx, int type, int recordId) throws OperationException + { + ReportEngine re = ReportEngine.get(ctx, type, recordId); + return re.createPDFData(); + } + + public static void openCashDrawer(Properties ctx) throws OperationException + { + byte [] printData= {10,27,112,48,55,1}; + print(ctx, new String(printData)); + } + + public static void print(Properties ctx, int type,int recordId) throws OperationException + { + ReportEngine re = ReportEngine.get(ctx,type, recordId); + MPrintFormat printFormatter = re.getPrintFormat(); + + String classname = printFormatter.getClassName(); + + if (classname != null) + { + String args = printFormatter.getArgs(); + try + { + Class clazz = Class.forName(classname); + IPrintFormatter formatter = null; + + Class[] parameterTypes = new Class[]{ String.class}; + Object[] parameters = new Object[]{ args}; + + Constructor constructor = clazz.getConstructor(parameterTypes); + formatter = (IPrintFormatter) constructor.newInstance(parameters); + + String str = formatter.format(ctx, recordId); + int docCopies = re.getPrintInfo().getCopies(); + System.out.println(str); + + for (int i=0; i 1) + throw new OperationException(processIds.length + " Processes found with class name: " + cl.getName()); + else + return processIds[0]; + } + + public static int getProcessIdByValue(String processValue) throws OperationException + { + if(processValue == null) + throw new OperationException("Process Value cannot be null"); + + String whereClause = "value='" + processValue + "'"; + + int processIds[] = MProcess.getAllIDs(MProcess.Table_Name, whereClause, null); + + if(processIds.length == 0) + throw new OperationException("No process found with value: " + processValue); + + else if(processIds.length > 1) + throw new OperationException(processIds.length + " Processes found with value: " + processValue); + else + return processIds[0]; + } + + public static void startProcess(Properties ctx, String className, ProcessInfo pi, Trx trx) + throws InstantiationException, IllegalAccessException, ClassNotFoundException + { + if (className == null) + { + return; + } + Class cl = Class.forName(className); + + if (cl == ReportStarter.class) + { + ReportStarter reportStarter = (ReportStarter)cl.newInstance(); + reportStarter.startProcess(ctx, pi, trx); + return; + } + SvrProcess server = (SvrProcess)cl.newInstance(); + server.startProcess(ctx, pi, trx); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/ProductAttributeSetManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/ProductAttributeSetManager.java new file mode 100644 index 0000000000..3019011fe9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/ProductAttributeSetManager.java @@ -0,0 +1,44 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * */ +package org.posterita.businesslogic; + +import java.util.Properties; + +import org.compiere.model.MAttributeSet; +import org.posterita.exceptions.OperationException; +import org.posterita.util.PoManager; + + +public class ProductAttributeSetManager +{ + public static MAttributeSet createAttributeSet(Properties ctx, String name) throws OperationException + { + MAttributeSet attributeSet = new MAttributeSet(ctx, 0, null); + attributeSet.setMandatoryType(MAttributeSet.MANDATORYTYPE_NotMandatary); + attributeSet.setIsSerNo(false); + attributeSet.setIsSerNoMandatory(false); + attributeSet.setIsInstanceAttribute(false); + attributeSet.setName(name); + + PoManager.save(attributeSet); + + return attributeSet; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/ProductCart.java b/posterita/posterita/src/main/org/posterita/businesslogic/ProductCart.java new file mode 100644 index 0000000000..fb5ddf7f18 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/ProductCart.java @@ -0,0 +1,164 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 29-Sep-2006 16:23:25 by praveen + * + */ + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.compiere.util.Env; +import org.posterita.beans.ProductDetailsBean; +import org.posterita.beans.StockMovementBean; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.stock.MMovementManager; +import org.posterita.exceptions.OperationException; + +public class ProductCart +{ + private HashMap products = null; + private BigDecimal noOfProducts = Env.ZERO; + private Properties ctx = null; + + public ProductCart(Properties ctx) + { + this.ctx = ctx; + products = new HashMap(); + } + + public void addProduct(int product_id, BigDecimal qty) + { + noOfProducts = noOfProducts.add(Env.ONE); + + BigDecimal previousQty = products.get(Integer.valueOf(product_id)); + + if(previousQty == null) + { + products.put(Integer.valueOf(product_id),qty); + } + else + { + BigDecimal newQty = previousQty.add(qty); + products.put(Integer.valueOf(product_id), newQty); + } + } + + public void addProduct(int product_id) + { + addProduct(product_id, Env.ONE); + } + + public void removeProduct(int product_id, BigDecimal qty) + { + BigDecimal oldQty = products.get(Integer.valueOf(product_id)); + + if( oldQty == null ) + { + return; + } + else + { + if( oldQty.doubleValue() <= qty.doubleValue() ) + { + removeProduct( product_id ); + noOfProducts = noOfProducts.subtract(oldQty); + } + else + { + BigDecimal newQty = oldQty.subtract(qty); + products.put(Integer.valueOf(product_id),newQty); + noOfProducts = noOfProducts.subtract(qty); + } + } + } + + public void removeProduct(int product_id) + { + BigDecimal qty = products.remove(Integer.valueOf(product_id)); + + if( qty == null ) + { + return; + } + + noOfProducts = noOfProducts.subtract(qty); + } + + public void clear() + { + products.clear(); + noOfProducts = Env.ZERO; + } + + public BigDecimal getNoOfProducts() + { + return noOfProducts; + } + + public ArrayList getProducts() throws OperationException + { + ArrayList productList = new ArrayList(); + ProductDetailsBean bean = null; + Integer productId = null; + BigDecimal qty = null; + + Set> entrySet = products.entrySet(); + + for (Map.Entry entry : entrySet) + { + productId = entry.getKey(); + qty = entry.getValue(); + + bean = ProductManager.getProductDetailInfo(ctx, productId.intValue(), null); + bean.setQuantity(qty); + + productList.add(bean); + } + + return productList; + } + + + public Integer[] getProductIDs() + { + Set set = products.keySet(); + + if( set.isEmpty() ) + { + return new Integer[]{}; + } + + Integer[] ids = new Integer[]{}; + ids = set.toArray( ids ); + + return ids; + } + + public boolean hasProduct( int productId ) + { + return products.containsKey( Integer.valueOf(productId) ); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/ProductImageUploader.java b/posterita/posterita/src/main/org/posterita/businesslogic/ProductImageUploader.java new file mode 100644 index 0000000000..ecc906ee97 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/ProductImageUploader.java @@ -0,0 +1,241 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 14, 2006 by praveen + * + */ +package org.posterita.businesslogic; + +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Properties; + +import org.apache.struts.upload.FormFile; +import org.compiere.model.MAttachment; +import org.compiere.model.MAttachmentEntry; +import org.posterita.businesslogic.administration.ProductImageManager; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.core.AttachmentManager; +import org.posterita.core.ThumbnailGenerator; +import org.posterita.exceptions.AttachmentNotFoundException; +import org.posterita.exceptions.InvalidContentTypeException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class ProductImageUploader +{ + public static void uploadImage(Properties ctx, Integer productIds[], FormFile file, String imageName, String trxName) throws OperationException,InvalidContentTypeException + { + for(int i = 0; i < productIds.length; i++) + { + uploadImage(ctx, productIds[i].intValue(), file, imageName, trxName); + } + } + + public static void uploadImage(Properties ctx, int product_id, FormFile file, String imageName, String trxName) throws OperationException,InvalidContentTypeException + { + if((file.getContentType() == null)||(!file.getContentType().startsWith("image/"))) + throw new InvalidContentTypeException("Invalid Content type! Expecting image"); + + try + { + uploadImage(ctx, product_id, file.getFileData(), imageName, trxName); + } + catch(IOException ex) + { + throw new OperationException("Could not read form file", ex); + } + + } + + public static void uploadDefaultImage(Properties ctx, int productId, File file, String trxName) throws OperationException + { + uploadImage(ctx, productId, file, UdiConstants.DEFAULT_IMAGE, trxName); + } + + public static void uploadImage(Properties ctx, int productId, File file, String imageName, String trxName) throws OperationException + { + if(file == null) + throw new OperationException("Image file cannot be null"); + + if(!file.exists()) + throw new OperationException("Image file does not exist"); + + if(file.isDirectory()) + throw new OperationException("File cannot be a directory"); + + try + { + FileInputStream fileInStream = new FileInputStream(file); + ByteArrayOutputStream byteArrStream = new ByteArrayOutputStream(); + BufferedInputStream bufferedInStream = new BufferedInputStream(fileInStream); + byte data[] = new byte[1024]; + int read = 0; + while((read = bufferedInStream.read(data)) != -1) + { + byteArrStream.write(data, 0, read); + } + byteArrStream.flush(); + byte fileData[] = byteArrStream.toByteArray(); + bufferedInStream.close(); + byteArrStream.close(); + fileInStream.close(); + + uploadImage(ctx, productId, fileData, imageName, trxName); + } + catch(IOException ex) + { + throw new OperationException("Could not read file: " + file.getAbsolutePath(), ex); + } + } + + + public static void uploadDefaultImage(Properties ctx, int productId, byte[] imageData, String trxName) throws OperationException + { + uploadImage(ctx, productId, imageData, UdiConstants.DEFAULT_IMAGE, trxName); + } + + public static void uploadImage(Properties ctx, int productId, byte[] imageData, String imageName, String trxName) throws OperationException + { + MAttachmentEntry attEntry = new MAttachmentEntry(imageName + ".jpg", imageData); +// MAttachmentEntry entries[] = new MAttachmentEntry[] {attEntry}; + + ProductManager.addUpdateAttachment(ctx, productId, attEntry, trxName); + + try + { + generateSubImages(ctx, productId, imageName, trxName); + } + catch(AttachmentNotFoundException ex) + { + throw new OperationException("Could not generate sub images for product with ID: " + productId, ex); + } + } + + + public static void generateAllSubImages(Properties ctx, int productId, String trxName) throws AttachmentNotFoundException, OperationException + { + MAttachment attachment = ProductManager.getAttachment(ctx, productId, trxName); + + if(attachment == null) + throw new AttachmentNotFoundException("No attachment found for product with id: " + productId); + + //deleteOldImages(ctx, attachment); + + MAttachmentEntry attachmentEntries[] = attachment.getEntries(); + + for(int i = 0; i < attachmentEntries.length; i++) + { + if(attachmentEntries[i].getContentType().startsWith("image/")) + { + String imageFileName = attachmentEntries[i].getName(); + if(!(imageFileName.startsWith(UdiConstants.FULL_IMAGE_PREFIX) + || imageFileName.startsWith(UdiConstants.THUMBNAIL_IMAGE_PREFIX) + || imageFileName.equalsIgnoreCase(UdiConstants.FULL_IMAGE + UdiConstants.IMAGE_EXTENSION) + || imageFileName.equalsIgnoreCase(UdiConstants.THUMBNAIL + UdiConstants.IMAGE_EXTENSION))) + { + String imageName = imageFileName.replaceAll(UdiConstants.IMAGE_EXTENSION, ""); + generateSubImages(ctx, productId, imageName, trxName); + } + } + } + } + +// private static void deleteOldImages(Properties ctx, MAttachment attachment) throws OperationException +// { +// String oldFullImageName = UdiConstants.FULL_IMAGE + UdiConstants.IMAGE_EXTENSION; +// int oldFullImageEntryId = FileAttachmentManager.getAttachmentEntryIndex(ctx, attachment, oldFullImageName); +// if(oldFullImageEntryId != -1) +// attachment.deleteEntry(oldFullImageEntryId); +// +// String oldThumbImageName = UdiConstants.THUMBNAIL + UdiConstants.IMAGE_EXTENSION; +// int oldThumbImageEntryId = FileAttachmentManager.getAttachmentEntryIndex(ctx, attachment, oldThumbImageName); +// if(oldThumbImageEntryId != -1) +// attachment.deleteEntry(oldThumbImageEntryId); +// +// UDIMAttachment udiAttachment = new UDIMAttachment(attachment); +// udiAttachment.save(); +// } + + public static void generateSubImages(Properties ctx, int productId, String imageName, String trxName) throws OperationException, AttachmentNotFoundException + { + String originalImageName = imageName + UdiConstants.IMAGE_EXTENSION; + + MAttachment attachment = ProductManager.getAttachment(ctx, productId, trxName); + + byte originalImageData[] = ProductManager.getAttachmentData(attachment, originalImageName); + + byte[] scaledImageData = ThumbnailGenerator.getSquareThumbnail(originalImageData, 380); + byte[] framedImageData = ProductImageManager.addImageSquareBorder(ctx,scaledImageData,7.0, trxName); + byte[] thumbImageData = ThumbnailGenerator.getSquareThumbnail(framedImageData, 180); + + String fullImageName = UdiConstants.FULL_IMAGE_PREFIX + imageName + UdiConstants.IMAGE_EXTENSION; + String thumbnailImageName = UdiConstants.THUMBNAIL_IMAGE_PREFIX + imageName + UdiConstants.IMAGE_EXTENSION; + + int fullImageEntryInd = AttachmentManager.getAttachmentEntryIndex(ctx, attachment, fullImageName); + if(fullImageEntryInd != -1) + attachment.deleteEntry(fullImageEntryInd); + + int thumbnailEntryInd = AttachmentManager.getAttachmentEntryIndex(ctx, attachment, thumbnailImageName); + if(thumbnailEntryInd != -1) + attachment.deleteEntry(thumbnailEntryInd); + + MAttachmentEntry attFullImageEntry = new MAttachmentEntry(fullImageName, framedImageData); + MAttachmentEntry attThumbImageEntry = new MAttachmentEntry(thumbnailImageName, thumbImageData); + + AttachmentManager.addAttachmentEntry(attachment, attFullImageEntry); + AttachmentManager.addAttachmentEntry(attachment, attThumbImageEntry); + + PoManager.save(attachment); + } + + public static ArrayList getRelatedProductImageNames(Properties ctx, int productId, String trxName) throws OperationException + { + MAttachment attachment = ProductManager.getAttachment(ctx, productId, trxName); + + MAttachmentEntry entries[] = attachment.getEntries(); + + ArrayList productImageNameList = new ArrayList(); + + for(int i = 0; i < entries.length; i++) + { + String productImageName = entries[i].getName(); + + if(!(productImageName.startsWith(UdiConstants.THUMBNAIL_IMAGE_PREFIX) + || productImageName.startsWith(UdiConstants.FULL_IMAGE_PREFIX))) + { + productImageName = productImageName.replaceAll(UdiConstants.IMAGE_EXTENSION, ""); + productImageNameList.add(productImageName); + } + } + Collections.sort(productImageNameList); + return productImageNameList; + } + + public static String getImageAttachmentName(String imageName) + { + return imageName + UdiConstants.IMAGE_EXTENSION; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/RegionManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/RegionManager.java new file mode 100644 index 0000000000..206d9380d8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/RegionManager.java @@ -0,0 +1,112 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 19-Jul-2005 by alok + * + */ +package org.posterita.businesslogic; + +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MRegion; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + + +public class RegionManager +{ + + public static MRegion createRegion(Properties ctx,String name, String trxName) throws OperationException + { + try + { + Properties newCtx = (Properties) ctx.clone(); + Env.setContext(newCtx, "#AD_Client_ID", 0); + Env.setContext(newCtx, "#AD_Org_ID", 0); + + + MRegion region = null; + int[] allRegion=MRegion.getAllIDs(MRegion.Table_Name,"upper(NAME) = upper('" + name + "')",trxName); + + if (allRegion.length > 0) + { + region = new MRegion(newCtx, allRegion[0], trxName); + return region; + } + + //create region only if it does not exist yet + // region does not belong client or org + //it belongs to the system + else if (allRegion.length == 0) + { + region = new MRegion(newCtx, 0, trxName); + region.setC_Country_ID(UdiConstants.COUNTRY_MAURITIUS); + region.setName(name); + + return region; + } + + + PoManager.save(region); + + return region; + + } + catch(OperationException e) + { + throw e; + } + + } + + public static MRegion getOrCreateRegion(Properties ctx, String name, String trxName) throws OperationException + { + Properties nCtx = (Properties)ctx.clone(); + Env.setContext(nCtx, "#AD_CLIENT_ID", 0); + Env.setContext(nCtx, "#AD_ORG_ID", 0); + int allRegion[] = MRegion.getAllIDs(MRegion.Table_Name," AD_Client_ID= " + Env.getAD_Client_ID(ctx) + " and upper(NAME) = upper('" + name + "')",trxName); + MRegion region; + if(allRegion.length != 0) + region = new MRegion(nCtx, allRegion[0], trxName); + else + region = createRegion(nCtx, name, trxName); + + return region; + } + + + public static ArrayList getCountryRegions(Properties ctx, int countryId) + { + ArrayList list = new ArrayList(); + MRegion[] regions = MRegion.getRegions(ctx, countryId); + + for (int i = 0; i < regions.length; i++) + { + MRegion region = regions[i]; + + KeyNamePair pair = new KeyNamePair(region.get_ID(), region.getName()); + list.add(pair); + } + + return list; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/RoleMenuManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/RoleMenuManager.java new file mode 100644 index 0000000000..88cfa380ba --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/RoleMenuManager.java @@ -0,0 +1,79 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 27-Jul-2005 by alok + * + */ +package org.posterita.businesslogic; + +import java.util.Properties; + +import org.compiere.model.MRoleMenu; +import org.posterita.exceptions.OperationException; +import org.posterita.model.MWebMenu; +import org.posterita.util.PoManager; + + +public class RoleMenuManager +{ + + public static MRoleMenu createRoleMenu(Properties ctx,int roleId,int menuId, String trxName) throws OperationException + { + MRoleMenu roleMenu; + + MWebMenu menu = new MWebMenu(ctx, menuId, null); + + int parentMenuId = menu.getParentMenu_ID(); + + if(parentMenuId != 0) + { + int[] parentRoleMenuIds = MRoleMenu.getAllIDs(MRoleMenu.Table_Name, " ad_role_id = " + roleId + " and u_webmenu_id = " + parentMenuId, trxName); + + if (parentRoleMenuIds.length == 0) + roleMenu = createRoleMenu(ctx,roleId,parentMenuId, trxName); + } + + roleMenu = new MRoleMenu(ctx, 0, trxName); + roleMenu.setAD_Role_ID(roleId); + roleMenu.setU_WebMenu_ID(menuId); + + PoManager.save(roleMenu); + + return roleMenu; + } + + public static void createRoleMenus(Properties ctx, int roleId, int menuIds[], String trxName) throws OperationException + { + for(int i = 0; i < menuIds.length; i++) + { + RoleMenuManager.createRoleMenu(ctx, roleId, menuIds[i], trxName); + } + } + + public static boolean isRoleMenuPresent(Properties ctx, int roleId, int menuId, String trxName) + { + String whereClause = "AD_Role_ID=" + roleId + " and U_WebMenu_ID=" + menuId; + + int roleMenuIds[] = MRoleMenu.getAllIDs(MRoleMenu.Table_Name, whereClause, trxName); + + if(roleMenuIds == null || roleMenuIds.length == 0) + return false; + return true; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/SearchManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/SearchManager.java new file mode 100644 index 0000000000..9fead40434 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/SearchManager.java @@ -0,0 +1,140 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 15, 2006 by ashley +* +*/ + +package org.posterita.businesslogic; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.posterita.beans.SearchBean; +import org.posterita.exceptions.OperationException; + +public class SearchManager +{ + + public static SearchBean getSearchParams(String searchText) throws OperationException + { + if(searchText == null) + throw new OperationException("Search text cannot be null"); + + + SearchBean searchBean = new SearchBean(searchText); + searchBean = parseExactSearch(searchBean); + searchBean = parseAndSearch(searchBean); + searchBean = parseOrSearch(searchBean); + + searchBean.setSearchText(searchText); + + return searchBean; + } + + private static SearchBean parseExactSearch(SearchBean searchBean) + { + String searchText = searchBean.getSearchText().trim(); + + int ind11 = searchText.indexOf("\""); + + if(ind11 == -1) + return searchBean; + + String lText1 = searchText.substring(0, ind11).trim(); + String rText1 = searchText.substring(ind11 + 1).trim(); + + int ind12 = rText1.indexOf("\""); + + if(ind12 == -1) + { + searchText = searchText.replaceAll("\"", ""); + searchBean.setSearchText(searchText); + return searchBean; + } + + String lText2 = rText1.substring(0, ind12); + String rText2 = rText1.substring(ind12 + 1); + + String exactSearchText = lText2; + String remSearchText = lText1.trim() + " " + rText2.trim(); + + searchBean.setSearchText(remSearchText); + searchBean.getAndCriteriasList().add(exactSearchText); + + return parseExactSearch(searchBean); + } + + private static SearchBean parseAndSearch(SearchBean searchBean) + { + String searchText = searchBean.getSearchText(); + if(searchText == null || searchText.length() == 0) + return searchBean; + + String regexStr = "\\+[\\w]+"; + + Pattern regex = Pattern.compile(regexStr); + Matcher regexMatcher = regex.matcher(searchText); + + if(regexMatcher.find()) + { + int startInd = regexMatcher.start(); + int endInd = regexMatcher.end(); + + String subStr = searchText.substring(startInd, endInd); + subStr = subStr.replaceAll("\\+", ""); + searchBean.getAndCriteriasList().add(subStr); + + searchText = searchText.substring(0, startInd) + searchText.substring(endInd); + searchBean.setSearchText(searchText); + + parseAndSearch(searchBean); + } + + return searchBean; + } + + private static SearchBean parseOrSearch(SearchBean searchBean) + { + String searchText = searchBean.getSearchText(); + if(searchText == null || searchText.length() == 0) + return searchBean; + + String regexStr = "[\\w]+"; + + Pattern regex = Pattern.compile(regexStr); + Matcher regexMatcher = regex.matcher(searchText); + + if(regexMatcher.find()) + { + int startInd = regexMatcher.start(); + int endInd = regexMatcher.end(); + + String subStr = searchText.substring(startInd, endInd); + subStr = subStr.replaceAll("\\+", ""); + searchBean.getOrCriteriasList().add(subStr); + + searchText = searchText.substring(0, startInd) + searchText.substring(endInd); + searchBean.setSearchText(searchText); + + parseOrSearch(searchBean); + } + + return searchBean; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/ShoppingcartManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/ShoppingcartManager.java new file mode 100644 index 0000000000..d8f2e90828 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/ShoppingcartManager.java @@ -0,0 +1,501 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Mar 25, 2008 11:20:20 AM by praveen + * + */ + +package org.posterita.businesslogic; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.swing.text.NumberFormatter; + +import org.apache.ecs.xhtml.div; +import org.apache.ecs.xhtml.table; +import org.apache.ecs.xhtml.td; +import org.apache.ecs.xhtml.th; +import org.apache.ecs.xhtml.tr; +import org.compiere.model.MOrder; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.TangoColors; +import org.posterita.beans.ItemBean; +import org.posterita.beans.PaymentDetailsBean; +import org.posterita.beans.ProductDetailsBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; + +public class ShoppingcartManager +{ + + private static String getShoppingcartAsHTML(ArrayList itemList, String currency, BigDecimal discountedTotal, BigDecimal percentageDiscount, String orderType) throws ParseException + { + NumberFormatter formatter = new NumberFormatter(new DecimalFormat("0.00")); + + BigDecimal totalQty = Env.ZERO; + BigDecimal grandTotal = Env.ZERO; + BigDecimal grandTotalWithoutDiscount = Env.ZERO; + BigDecimal totalWithoutDiscount = Env.ZERO; + BigDecimal discount = Env.ZERO; + BigDecimal totalDiscount = Env.ZERO; + String currencySymbol = currency; + + String[] headers = {"Name","Description","Qty","Uom","Unit Price","VAT","Incl Price","Total"}; + table tbl = new table("0", "0", "0", "100%", ""); + + + tr headerRow = new tr(); + headerRow.setClass("itemTitleList"); + + for(String header : headers) + { + th h = new th(header); + headerRow.addElement(h); + } + + tbl.addElement(headerRow); + + //add body + int count = 0; + + if(itemList != null) + for(ItemBean bean : itemList) + { + count ++; + + tr dataRow = new tr(); + + if(orderType != null) + { + if(count % 2 == 0) + { + if(orderType.equalsIgnoreCase("POS Order")) + { + dataRow.setClass("evenRow"); + //dataRow.setOnMouseOut("this.className='evenRow'"); + //dataRow.setOnMouseOver("this.className='highlight'"); + } + else if(orderType.equalsIgnoreCase("POS Goods Receive Note")) + { + //Keep same style for purchase sceen for time being + dataRow.setClass("evenRow"); + //dataRow.setOnMouseOut("this.className='evenRow'"); + //dataRow.setOnMouseOver("this.className='highlight'"); + } + } + else + { + dataRow.setClass("oddRow"); + //dataRow.setOnMouseOut("this.className='oddRow'"); + //dataRow.setOnMouseOver("this.className='highlight'"); + } + } + + dataRow.setID("row" + count); + dataRow.addAttribute("productId", bean.getProductId().toString()); + dataRow.addAttribute("qty", bean.getQty().toString()); + dataRow.addAttribute("priceLimit", bean.getPriceLimit().toString()); + dataRow.addAttribute("priceList", bean.getListPrice().toString()); + + + totalQty = totalQty.add(bean.getQty()); + grandTotal = grandTotal.add(bean.getPrice()); + BigDecimal unitPrice = bean.getUnitPrice()==null?Env.ZERO:bean.getUnitPrice(); + BigDecimal taxAmt = bean.getTaxAmt()==null?Env.ZERO:bean.getTaxAmt(); + dataRow.addAttribute("taxRate", bean.getTaxRate().toString()); + dataRow.addAttribute("isTaxIncluded", bean.getIsTaxIncluded().toString()); + BigDecimal inclPrice = bean.getInclPrice(); + BigDecimal listPrice = bean.getListPrice(); + + if(bean.getIsTaxIncluded()) + { + + totalWithoutDiscount = bean.getQty().multiply(listPrice); + grandTotalWithoutDiscount = grandTotalWithoutDiscount.add(totalWithoutDiscount); + } + else + { + totalWithoutDiscount = bean.getQty().multiply(listPrice.add(taxAmt)); + grandTotalWithoutDiscount = grandTotalWithoutDiscount.add(totalWithoutDiscount); + } + + String[] columnData = { + bean.getProductName(), + bean.getDescription(), + bean.getQty().toString(), + bean.getUom(), + formatter.valueToString(bean.getUnitPrice()), + formatter.valueToString(bean.getTaxAmt()), + formatter.valueToString(inclPrice), + formatter.valueToString(bean.getPrice()) + }; + + for(int i=0; i itemList = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + String currency = (String) request.getSession().getAttribute(Constants.CURRENCY_SYMBOLE); + BigDecimal discountOnTotal = (BigDecimal)request.getSession().getAttribute(Constants.SHOPPING_CART_DISCOUNTED_TOTAL); + BigDecimal discountOnTotalPer = (BigDecimal)request.getSession().getAttribute(Constants.SHOPPING_CART_DISCOUNT_PERCENTAGE); + BigDecimal cartTotal = (BigDecimal) request.getSession().getAttribute(Constants.SHOPPING_CART_TOTAL); + + //When giving discount on total, recompute total discount if quantity is changed + if(cartTotal != null && discountOnTotal != null) + { + if(discountOnTotal.doubleValue() > 0) + { + cartTotal = cartTotal.multiply(((Env.ONEHUNDRED.subtract(discountOnTotal))).divide(Env.ONEHUNDRED, RoundingMode.HALF_EVEN)); + } + } + + return getShoppingcartAsHTML(itemList, currency, cartTotal, discountOnTotalPer, null); + } + + public static String getShoppingcartAsHTML(HttpServletRequest request, String orderType) throws ParseException + { + //add body + ArrayList itemList = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + String currency = (String) request.getSession().getAttribute(Constants.CURRENCY_SYMBOLE); + Boolean isDiscOnTotal = (Boolean)request.getSession().getAttribute(Constants.DISCOUNT_ON_ORDER_TOTAL); + Boolean isDiscOnTotalPer = (Boolean)request.getSession().getAttribute(Constants.DISCOUNT_ON_ORDER_TOTAL_PERCENT); + //BigDecimal cartTotal = (BigDecimal) request.getSession().getAttribute(Constants.SHOPPING_CART_DISCOUNTED_TOTAL); + BigDecimal discountPercentOnOrderTotal = null; + BigDecimal discountedOrderTotal = null; + if (isDiscOnTotal != null && isDiscOnTotal) + { + discountedOrderTotal =(BigDecimal)request.getSession().getAttribute(Constants.SHOPPING_CART_DISCOUNTED_TOTAL); + } + else if (isDiscOnTotalPer != null && isDiscOnTotalPer) + { + discountPercentOnOrderTotal = (BigDecimal) request.getSession().getAttribute(Constants.SHOPPING_CART_DISCOUNT_PERCENTAGE); + } + //When giving discount on total, recompute total discount if quantity is changed + if (discountedOrderTotal != null && discountPercentOnOrderTotal != null) + { + if (discountPercentOnOrderTotal.compareTo(Env.ZERO) == 1) + { + discountedOrderTotal = discountedOrderTotal.multiply(((Env.ONEHUNDRED.subtract(discountedOrderTotal))).divide(Env.ONEHUNDRED, RoundingMode.HALF_EVEN)); + } + } + + String shoppingCart = getShoppingcartAsHTML(itemList, currency, discountedOrderTotal, discountPercentOnOrderTotal, orderType); + return shoppingCart; + } + + public static void clearShoppingcart(HttpServletRequest request) + { + //bug fix + request.setAttribute("qtyTotal", null); + request.setAttribute("grandTotal", null); + + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + request.getSession().removeAttribute(Constants.SHOPPING_CART_TOTAL); + request.getSession().removeAttribute(Constants.SHOPPING_CART_DISCOUNTED_TOTAL); + request.getSession().removeAttribute(Constants.SHOPPING_CART_DISCOUNT_PERCENTAGE); + } + + public static String getShoppingCartFromOrder(Properties ctx, int c_order_id, String trxName) throws OperationException, ParseException + { + ShoppingCartBean shoppingcart = POSManager.getShoppingCartForOrder(ctx, c_order_id, trxName); + + MOrder order = new MOrder(ctx, c_order_id, trxName); + String orderType = order.getOrderType(); + + PaymentDetailsBean bean = PaymentManager.getPaymentDetails(ctx, c_order_id, trxName); + + if(MOrder.PAYMENTRULE_OnCredit.equals(order.getPaymentRule())) + { + bean.setPayAmt(order.getGrandTotal()); + } + + //weird logic! + + BigDecimal discountedTotal = bean.getPayAmt(); + /*if(bean.getDiscountAmt()!=null && bean.getDiscountAmt().equals(Env.ZERO)) + { + discountedTotal = null; + } */ + return getShoppingcartAsHTML(shoppingcart.getItems(), shoppingcart.getCurrency(), discountedTotal, Env.ZERO, orderType); + } + + //-----------------------------------------------------------------------// + // BARCODE INTEGRATION + + private static String getBarcodecartAsHTML(ArrayList itemList, Properties ctx) throws ParseException, OperationException + { + NumberFormatter formatter = new NumberFormatter(new DecimalFormat("0.00")); + + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + String currSymbol = PriceListManager.getCurrency(ctx, priceListId); + + BigDecimal totalQty = Env.ZERO; + + String[] headers = {"Barcode","Description","Sale Price (Inc VAT)","No Of Labels"}; + table tbl = new table("0", "0", "0", "100%", ""); + tbl.setID("cart"); + tbl.setBgColor(TangoColors.ALUMINIUM_2); + + BigDecimal qty = Env.ZERO; + + tr headerRow = new tr(); + headerRow.setClass("itemTitleList"); + + + for(String header : headers) + { + th h = new th(header); + headerRow.addElement(h); + } + + tbl.addElement(headerRow); + + //add body + int count = 0; + + if(itemList != null) + for(ItemBean bean : itemList) + { + count ++; + + tr dataRow = new tr(); + + if(count % 2 == 0) + { + dataRow.setClass("evenRow"); + } + else + { + dataRow.setClass("oddRow"); + } + dataRow.setID("row" + count); + dataRow.addAttribute("productId", bean.getProductId().toString()); + dataRow.addAttribute("qty", bean.getQty().toString()); + qty = bean.getQty(); + + BigDecimal stdPrice = bean.getUnitPrice()==null?Env.ZERO:bean.getUnitPrice(); + BigDecimal taxRate = bean.getTaxRate()==null?Env.ZERO:bean.getTaxRate(); + BigDecimal priceIncVat = stdPrice.multiply((taxRate.add(new BigDecimal(100))).divide(new BigDecimal(100))); + + totalQty = totalQty.add(bean.getQty()); + String[] columnData = { + bean.getBarCode(), + bean.getDescription(), + currSymbol + formatter.valueToString(priceIncVat), + bean.getQty().toString() + }; + + for(int i=0; iTotal labels to be printed ").setColSpan("3")); + footerRow.addElement(new td(new div(totalQty.toString()).setID("cartTotal"))); + + tbl.addElement(footerRow); + + + return tbl.toString(); + } + + public static String getBarcodecartAsHTML(HttpServletRequest request) throws ParseException, OperationException + { + //add body + ArrayList itemList = (ArrayList) request.getSession().getAttribute(Constants.BARCODE_CART_ITEMS); + Properties ctx = TmkJSPEnv.getCtx(request); + return getBarcodecartAsHTML(itemList, ctx); + } + + public static String copyShoppingCartAsHTML(Properties ctx, ProductCart cart) throws ParseException, OperationException + { + + NumberFormatter formatter = new NumberFormatter(new DecimalFormat("0.00")); + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + String currSymbol = PriceListManager.getCurrency(ctx, priceListId); + ArrayList productList = cart.getProducts(); + + + BigDecimal totalQty = Env.ZERO; + + String[] headers = {"Barcode","Description","Sale Price (Inc VAT)","No Of Labels"}; + table tbl = new table("1", "0", "0", "100%", ""); + tbl.setID("cart"); + + BigDecimal qty = Env.ZERO; + + tr headerRow = new tr(); + for(String header : headers) + { + th h = new th(header); + headerRow.addElement(h); + } + + tbl.addElement(headerRow); + + //add body + int count = 0; + + if(productList != null) + for(ProductDetailsBean bean : productList) + { + count ++; + + String styleClass = "label"; + if ((count%2) != 0) + styleClass = "contentname"; + + tr dataRow = new tr(); + dataRow.setID("row" + count); + dataRow.addAttribute("productId", bean.getProductId().toString()); + dataRow.addAttribute("qty", bean.getQuantity().toString()); + qty = bean.getQuantity(); + totalQty = totalQty.add(bean.getQuantity()); + String[] columnData = { + bean.getBarCode(), + bean.getProductName(), + currSymbol + formatter.valueToString(bean.getStdSalesPrice()), + bean.getQuantity().toString() + }; + + for(int i=0; iTotal labels to be printed ").setAlign("right").setColSpan("3")); + footerRow.addElement(new td(new div(totalQty.toString()).setID("cartTotal")).setAlign("right")); + + tbl.addElement(footerRow); + + + return tbl.toString(); + } + + public static int getPriceList(HttpServletRequest request) + { + int priceListId = -1; + + ShoppingCartBean cart = (ShoppingCartBean)request.getSession().getAttribute(Constants.SHOPPING_CART); + if(cart != null) + { + priceListId = cart.getPricelistId(); + } + + return priceListId; + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/StockInquiryManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/StockInquiryManager.java new file mode 100644 index 0000000000..2b79ceb442 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/StockInquiryManager.java @@ -0,0 +1,117 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Aug 19, 2005 by alok +* +*/ + +package org.posterita.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.util.DB; +import org.compiere.util.Env; + +import org.posterita.beans.ProductBean; +import org.posterita.beans.ProductQuery; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.exceptions.OperationException; + +public class StockInquiryManager +{ + + + + public static ArrayList getAvailableTShirts(Properties ctx, ProductQuery query) throws OperationException + { + String sql = " SELECT " + + " s.AD_Org_ID," + + " s.M_LOCATOR_ID," + + " s.M_Product_ID," + + " p.name," + + " p.m_attributesetinstance_id," + + " s.QtyOnHand," + + " s.QtyReserved," + + " s.QtyOrdered," + + " p.m_product_category_id," + + " p.description" + + " FROM M_Storage s,m_product p,m_locator loc" + + " where s.M_PRODUCT_ID = p.M_PRODUCT_ID" + + " and s.m_locator_id = loc.m_locator_id" + + " and p.m_product_category_id=" + query.getProductCategoryId() + + " and p.isWebstoreFeatured='Y'" + + " AND s.AD_Client_ID = " + Env.getAD_Client_ID(ctx) + + " @ATTRIBUTE_SEARCH_SQL@" + + " and s.ad_org_id=" + Env.getAD_Org_ID(ctx); + + String attributeSearchSQL = ProductManager.getAttributeSearchSQL(ctx, query); + + + sql = sql.replaceAll("@ATTRIBUTE_SEARCH_SQL@",attributeSearchSQL); + sql = StockManager.setBackOrderFilter(ctx, sql, query.getBackOrder()); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = null; + + ProductBean bean; + ArrayList productList = new ArrayList(); + try + { + rs = pstmt.executeQuery(); + while (rs.next()) + { + bean = new ProductBean(); + bean.setOrgId(Integer.valueOf(rs.getInt(1))); + bean.setLocatorId(Integer.valueOf(rs.getInt(2))); + bean.setProductId(Integer.valueOf(rs.getInt(3))); + bean.setProductName(rs.getString(4)); + bean.setAttributeSetInstanceId(Integer.valueOf(rs.getInt(5))); + bean.setQtyOnHand(rs.getBigDecimal(6)); + bean.setQtyReserved(rs.getBigDecimal(7)); + bean.setQtyOrdered(rs.getBigDecimal(8)); + bean.setProductCategoryId(Integer.valueOf(rs.getInt(9))); + bean.setDescription(rs.getString(10)); + productList.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return productList; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/StoreManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/StoreManager.java new file mode 100644 index 0000000000..d7241e7d96 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/StoreManager.java @@ -0,0 +1,139 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * + * + */ + +/** + @author ashley + */ + +package org.posterita.businesslogic; + +import java.util.Properties; + +import org.compiere.model.MStore; +import org.compiere.util.Env; +import org.posterita.exceptions.DefaultStoreException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.StoreException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class StoreManager +{ + + public static int getStoreIdByName(Properties ctx, String storeName, String trxName) throws StoreException + { + int adClientId = Env.getAD_Client_ID(ctx); + int adOrgId = Env.getAD_Org_ID(ctx); + + String whereClause = "AD_Client_ID=" + adClientId + " and AD_Org_ID=" + adOrgId + " and Name='" + storeName + "'"; + + int storeIds[] = MStore.getAllIDs(MStore.Table_Name, whereClause, trxName); + + if(storeIds.length == 0) + throw new StoreException("Could not find Store with name: " + storeName); + + else if(storeIds.length > 1) + throw new StoreException(storeIds.length + " Stores found with name: " + storeName); + + else + return storeIds[0]; + } + + public static MStore createStore(Properties ctx, String storeName, String webContext, int orgId, + int priceListId, int salesRepId, int warehouseId, String webParam6, String hostUrl, String trxName) throws OperationException + { + if(storeName == null || storeName.length() == 0) + throw new OperationException("Store name cannot be null"); + if(webContext == null || webContext.length() == 0) + throw new OperationException("Web context cannot be null"); + + MStore store = new MStore(ctx, 0, trxName); + store.setAD_Org_ID(orgId); + store.setName(storeName); + store.setWebContext(webContext); + store.setM_PriceList_ID(priceListId); + store.setSalesRep_ID(salesRepId); + store.setM_Warehouse_ID(warehouseId); + store.setWebParam6(webParam6); + store.setURL(hostUrl); + PoManager.save(store); + + return store; + } + + public static boolean isStorePresent(String webContext) + { + String whereClause = "WebContext='" + webContext + "'"; + int storeIds[] = MStore.getAllIDs(MStore.Table_Name, whereClause, null); + + return (storeIds.length > 0); + } + + public static MStore getDefaultStore(Properties ctx) throws DefaultStoreException + { + String whereClause = "IsDefault='Y'"; + int storeIds[] = MStore.getAllIDs(MStore.Table_Name, whereClause, null); + + if(storeIds.length == 0) + throw new DefaultStoreException("No Default store defined!!!"); + else if(storeIds.length > 1) + throw new DefaultStoreException("More than 1 default store defined!!!"); + else + return new MStore(ctx, storeIds[0], null); + } + + /** + * Retrieves the web store as per the context. + * @param ctx context + * @return web store + */ + public static MStore getStore(Properties ctx) + { + MStore store = MStore.get(ctx, Env.getContextAsInt(ctx, UdiConstants.WSTORE_CTX_PARAM)); + return store; + } + + /** + * Retrieves the price list id associated with the web store in context. + * This price list is a purchase price list. + * @param ctx context + * @return price list id + */ + public static int getPriceListId(Properties ctx) + { + MStore store = getStore(ctx); + return store.getM_PriceList_ID(); + } + + /** + * Updates the price list associated with the web store in context. + * @param ctx context + * @param priceListId id of the price list to set in the web store + */ + public static void setPriceListId(Properties ctx, int priceListId,String trxName) + { + MStore store = getStore(ctx); + store.setM_PriceList_ID(priceListId); + store.save(trxName); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/UDIMessageManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/UDIMessageManager.java new file mode 100644 index 0000000000..fe028e8a1f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/UDIMessageManager.java @@ -0,0 +1,204 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 1, 2005 by din + */ + +package org.posterita.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MMessage; +import org.compiere.model.MOrg; +import org.compiere.util.DB; +import org.compiere.util.Env; + +import org.posterita.Constants; +import org.posterita.beans.MessageBean; +import org.posterita.beans.UDIPair; +import org.posterita.exceptions.OperationException; + + +public class UDIMessageManager +{ + public static ArrayList getAllOrgMessagesReceived(Properties ctx) + { + String strOrgID = ctx.getProperty("#AD_Org_ID"); + + String sql; + + sql = "select U_Message_ID," + //1 + " subject," + //2 + " message," + //3 + " msg.created," + //4 + " org.name, " + //5 + " msg.AD_ORG_ID," + //6 + //" decode(msg.U_READ,'Y','true','false')" + //7 + " CASE WHEN msg.U_READ='Y' THEN 'true' ELSE 'false' END" + //7 + " from U_MESSAGE msg " + + " join AD_ORG org ON org.AD_ORG_ID = msg.AD_ORG_ID " + + " where msg.C_AD_ORG_ID =" + strOrgID + + " and MESSAGE_TYPE=" + "'" + Constants.RECEIVED_MESSAGE + "'" + + " and msg.IsActive=" + "'Y'" + + " order by msg.created desc"; + + PreparedStatement pstmt =null; + + System.out.println(sql); + + MessageBean message = null; + ArrayList messages = new ArrayList(); + try + { + pstmt = DB.prepareStatement(sql, null); + ResultSet rs = pstmt.executeQuery(); + + + while (rs.next()) + { + + message = new MessageBean(); + message.setMessageID(Integer.valueOf(rs.getInt(1))); + message.setSubject(rs.getString(2)); + message.setMessage(rs.getString(3)); + message.setDateCreated(rs.getTimestamp(4)); + message.setCounterOrgName(rs.getString(5)); + message.setOrgID(Integer.valueOf(rs.getInt(6))); + message.setRead(rs.getString(7)); + messages.add(message); + + } + + rs.close(); + + } + catch (SQLException e) + { + + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + } + pstmt = null; + } + + + return messages; + } + + public static ArrayList getOrgs(Properties ctx) + { + int[] orgIDs = MOrg.getAllIDs(MOrg.Table_Name,"AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " and AD_Org_ID<>" + ctx.getProperty("#AD_Org_ID"),null); + ArrayList orgs = new ArrayList (); + for ( int i=0 ; i < orgIDs.length ; i++ ) + { + MOrg org = new MOrg(ctx, orgIDs[i],null); + UDIPair pair = new UDIPair(Integer.valueOf(orgIDs[i]), org.getName()); + orgs.add(pair); + + } + + return orgs; + } + + public static Integer getUnreadMessageCount(Properties ctx) + { + int[] ids = MMessage.getAllIDs("U_MESSAGE", "U_READ='N' and C_AD_ORG_ID=" + ctx.getProperty("#AD_Org_ID") + " and MESSAGE_TYPE=" + "'" + Constants.RECEIVED_MESSAGE + "'" + " and IsActive=" + "'Y'",null); + + return Integer.valueOf(ids.length); + } + + public static ArrayList getMySentMessages(Properties ctx) throws OperationException + { + String strOrgID = ctx.getProperty("#AD_Org_ID"); + + String sql; + + sql = "select U_Message_ID," + //1 + " subject," + //2 + " message," + //3 + " msg.created," + //4 + " org.name, " + //5 + " msg.AD_ORG_ID," + //6 + //" decode(msg.U_READ,'Y','true','false')" + //7 + " CASE WHEN msg.U_READ='Y' THEN 'true' ELSE 'false' END" + //7 + " from U_MESSAGE msg " + + " join AD_ORG org ON org.AD_ORG_ID = msg.C_AD_ORG_ID " + + " where msg.AD_ORG_ID =" + strOrgID + + " and msg.MESSAGE_TYPE=" + "'" + Constants.SENT_MESSAGE + "'" + + " and msg.IsActive=" + "'Y'" + + " order by msg.created desc"; + + + PreparedStatement pstmt =null; + + MessageBean message = null; + ArrayList messages = new ArrayList(); + try + { + pstmt = DB.prepareStatement(sql, null); + ResultSet rs = pstmt.executeQuery(); + + + while (rs.next()) + { + message = new MessageBean(); + message.setMessageID(Integer.valueOf(rs.getInt(1))); + message.setSubject(rs.getString(2)); + message.setMessage(rs.getString(3)); + message.setDateCreated(rs.getTimestamp(4)); + message.setCounterOrgName(rs.getString(5)); + message.setOrgID(Integer.valueOf(rs.getInt(6))); + message.setRead(rs.getString(7)); + messages.add(message); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + } + pstmt = null; + } + + + return messages; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/BPartnerManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/BPartnerManager.java new file mode 100644 index 0000000000..9274ac1e2c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/BPartnerManager.java @@ -0,0 +1,1127 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import org.compiere.acct.Fact.Balance; +import org.compiere.model.MBPBankAccount; +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MCountry; +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MRegion; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.utils.DBUtils; +import org.posterita.beans.AddressBean; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.StatementOfAccountBean; +import org.posterita.businesslogic.LocationManager; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + + +public class BPartnerManager +{ + + + public static MBPartner activateBPartner(Properties ctx, int bpartnerId, boolean isActive,String trxName) throws OperationException + { + + MBPartner bpartner = new MBPartner(ctx,bpartnerId,trxName); + + if(bpartner == null) + throw new OperationException("Business Partner does not exist!"); + if(isActive == true) + { + bpartner.setIsActive(false); + } + else + { + bpartner.setIsActive(true); + } + + PoManager.save(bpartner); + + return bpartner; + + } + + public static MBPartner createBPartner(Properties ctx,int orgId, int parentBpId, String bPName, String name2, boolean isCustomer,boolean isVendor,boolean isEmployee,boolean isSalesRep,String address1, String address2, String postalAddress1, Integer regionId, String city,String bpPhone, String fax,int countryId, boolean isShipTo, boolean isBillTo, String trxName) throws OperationException + { + return saveBPartner(ctx, orgId, 0, parentBpId, bPName, name2, isCustomer, isVendor, isEmployee, isSalesRep, address1, address2, postalAddress1, regionId, city, bpPhone, "", fax, countryId, isShipTo, isBillTo, trxName); + } + + + public static MBPartner createBPartner(Properties ctx,int orgId, int parentBpId, String bPName, String name2, boolean isCustomer,boolean isVendor,boolean isEmployee,boolean isSalesRep,String address1,String postalAddress1,String city,String bpPhone,int countryId, String trxName) throws OperationException + { + return saveBPartner( ctx, orgId, 0, parentBpId, bPName, name2, isCustomer, isVendor, isEmployee, isSalesRep, address1, "", postalAddress1, null, city, bpPhone, "", "", countryId, true, true, trxName); + } + + public static MBPBankAccount createBPBankAcc(Properties ctx,int bPartnerId,String aName,String city,String street, String trxName) throws OperationException + { + MBPBankAccount bankAcc = new MBPBankAccount(ctx,0,trxName); + + try + { + bankAcc.setC_BPartner_ID(bPartnerId); + bankAcc.setA_Name(aName);//Name of Account holder + bankAcc.setA_Street(street); + bankAcc.setA_City(city);//city of bank account + + PoManager.save(bankAcc); + } + catch(OperationException e) + { + throw new OperationException("Cannot create BP Bank Account!"); + } + + + return bankAcc; + } + + public static MBPartner createLinkedBPartner(Properties ctx,int orgId, int parentBpId, String bPName, String name2, boolean isCustomer,boolean isVendor,boolean isEmployee,boolean isSalesRep,String address1,String postalAddress1,String city,String bpPhone,int countryId, String trxName) throws OperationException + { + MBPartner bpartner = saveBPartner( ctx, orgId, 0, parentBpId, bPName, name2, isCustomer, isVendor, isEmployee, isSalesRep, address1, "", postalAddress1, null, city, bpPhone, "", "",countryId, true, true, trxName); + + bpartner.setAD_OrgBP_ID(orgId); + + PoManager.save(bpartner); + return bpartner; + } + + + + public static MBPartner createShippingBPartner(Properties ctx,int orgId, int parentBpId, String bPName, String name2, boolean isCustomer,boolean isVendor,boolean isEmployee,boolean isSalesRep,String address1,String postalAddress1,String city,String bpPhone,int countryId, boolean isShipTo, boolean isBillTo, String trxName) throws OperationException + { + return saveBPartner( ctx, orgId, 0, parentBpId, bPName, name2, isCustomer, isVendor, isEmployee, isSalesRep, address1, "", postalAddress1, null, city, bpPhone, "", "", countryId, isShipTo, isBillTo, trxName); + + } + + public static MBPartner deactivateBPartner(Properties ctx, int bpartnerId, String trxName) throws OperationException + { + + MBPartner bpartner = new MBPartner(ctx,bpartnerId,trxName); + + if(bpartner == null)throw new OperationException("Business Partner does not exist!"); + + bpartner.setIsActive(false); + + PoManager.save(bpartner); + + return bpartner; + + } + + + public static ArrayList getAllBpartners(Properties ctx, String trxName) throws OperationException + { + + int adClientID = Env.getAD_Client_ID(ctx); + + + String sql; + + sql = " select bp.c_bpartner_id, " + //1 + " bp.name," + //2 + " bp.name2," + //3 + " bp.isactive,"+//4 + " bp.iscustomer," + //5 + " bp.isemployee," + //6 + " bp.isvendor, " + //7 + " bp.issalesrep," + //8 + " cl.address1," + //9 + " cl.address2," + //10 + " cl.city," + //11 + " cl.postal_add," + //12 + " bpl.c_bpartner_id," + //13 + " cl.c_location_id," + //14 + " bpl.phone," + //15 + " bpl.fax," + //16 + " cl.REGIONNAME " + //17 + " from C_BPARTNER bp left outer join (c_bpartner_location bpl left outer join c_location cl on cl.c_location_id=bpl.c_location_id) on bpl.c_bpartner_id = bp.c_bpartner_id, AD_ORG org " + + " where bp.ad_org_id = org.ad_org_id and " + + " bp.AD_CLIENT_ID = " + adClientID + + " order by bp.name"; + + PreparedStatement pstmt =null; + + System.out.println(sql); + + BPartnerBean bpartner = null; + ResultSet rs = null; + + ArrayList bpartners = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sql,trxName); + rs = pstmt.executeQuery(); + + + while (rs.next()) + { + + bpartner = new BPartnerBean(); + bpartner.setBpartnerId(Integer.valueOf(rs.getInt(1))); + bpartner.setPartnerName(rs.getString(2)); + bpartner.setName2(rs.getString(3)); + + if(rs.getString(4).equals("Y")) + { + bpartner.setIsActive(Boolean.valueOf(true)); + } + else + bpartner.setIsActive(Boolean.valueOf(false)); + + if(rs.getString(5).equals("Y")) + { + bpartner.setIsCustomer(Boolean.valueOf(true)); + } + else + bpartner.setIsCustomer(Boolean.valueOf(false)); + + if(rs.getString(6).equals("Y")) + { + bpartner.setIsEmployee(Boolean.valueOf(true)); + } + else + bpartner.setIsEmployee(Boolean.valueOf(false)); + + if(rs.getString(7).equals("Y")) + { + bpartner.setIsVendor(Boolean.valueOf(true)); + } + else + bpartner.setIsVendor(Boolean.valueOf(false)); + + if(rs.getString(8).equals("Y")) + { + bpartner.setIsSalesRep(Boolean.valueOf(true)); + } + else + bpartner.setIsSalesRep(Boolean.valueOf(false)); + + + + bpartner.setAddress1(rs.getString(9)); + bpartner.setAddress2(rs.getString(10)); + bpartner.setCity(rs.getString(11)); + bpartner.setPostalAddress(rs.getString(12)); + bpartner.setPhone(rs.getString(15)); + bpartner.setFax(rs.getString(16)); + + String regionName = rs.getString(17); + + int regionId = 0; + + int id[] = MRegion.getAllIDs(MRegion.Table_Name," name= '"+ regionName +"'",trxName); + + if(id.length != 0) + { + regionId = id[0]; + } + + bpartner.setRegionId(Integer.valueOf(regionId)); + + + bpartners.add(bpartner); + } + + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + if(pstmt != null) + pstmt.close(); + } + catch(Exception ex) + {} + + pstmt = null; + } + + return bpartners; + + + } + + + public static BPartnerBean getBpartner(Properties ctx, int bPartnerId, String trxName) throws OperationException + { + MBPartner bpartner = loadBPartner(ctx, bPartnerId, trxName); + + MBPartnerLocation bplocations[] = bpartner.getLocations(false); + + BPartnerBean bpBean = new BPartnerBean(); + bpBean.setBpartnerId(bpartner.get_ID()); + bpBean.setPartnerName(bpartner.getName()); + bpBean.setName2(bpartner.getName2()); + bpBean.setIsActive(bpartner.isActive()); + bpBean.setIsCustomer(bpartner.isCustomer()); + bpBean.setIsEmployee(bpartner.isEmployee()); + bpBean.setIsVendor(bpartner.isVendor()); + bpBean.setIsSalesRep(bpartner.isSalesRep()); + bpBean.setOrgId(bpartner.getAD_Org_ID()); + if (bplocations.length == 0) + { + throw new OperationException("No location defined for BPartner"); + } + + MBPartnerLocation bplocation = bplocations[0]; + MLocation location = bplocation.getLocation(false); + + bpBean.setAddress1(location.getAddress1()); + bpBean.setAddress2(location.getAddress2()); + bpBean.setCity(location.getCity()); + bpBean.setPostalAddress(location.getPostal_Add()); + bpBean.setPhone(bplocation.getPhone()); + bpBean.setFax(bplocation.getFax()); + bpBean.setPostalCode(location.getPostal()); + MRegion region = location.getRegion(); + + if (region != null && region.get_ID() > 0) + { + bpBean.setRegionId(region.get_ID()); + } + + return bpBean; + } + + public static MBPartnerLocation getBPartnerSingleLocation(Properties ctx, int bpartnerId) throws OperationException + { + MBPartnerLocation bpartnerLocations[] = MBPartnerLocation.getForBPartner(ctx, bpartnerId); + + if(bpartnerLocations.length == 0) + throw new OperationException("No location found business partner with id: " + bpartnerId); + else if(bpartnerLocations.length > 1) + throw new OperationException("More than 1 location found for business partner with id: " + bpartnerId); + else + return bpartnerLocations[0]; + } + + + public static MBPartner getCreateLinkedBPartner(Properties ctx, MOrg org, String trxName) throws OperationException + { + MBPartner linkedBPartner; + if(org == null) + throw new OperationException("Organisation cannot be null"); + + int linkedBPId = org.getLinkedC_BPartner_ID(trxName); + if(linkedBPId != 0) + { + linkedBPartner = loadBPartner(ctx, linkedBPId, trxName); + return linkedBPartner; + } + else + { + + linkedBPartner = BPartnerManager.saveBPartner(ctx, org.get_ID(), 0, 0, org.getName(), "", false, false, false, false, " ", " ", " ", null, "", "", "", "", MCountry.getDefault(ctx).get_ID(), true, true, trxName); + + //saveBPartner(ctx, partnerId, parentBpId, name, name2, isCustomer, isVendor, isEmployee,isSalesRep, address1, address2, postalAddress1, regionId, city,bpPhone, String phone2, String fax,int countryId, boolean isShipTo, boolean isBillTo, String trxName) throws OperationException + + linkedBPartner.setAD_OrgBP_ID(org.get_ID()); + + PoManager.save(linkedBPartner, trxName); + + return linkedBPartner; + } + } + + + public static ArrayList getMyBPartners(Properties ctx, int partnerId, String trxName) throws OperationException + { + + ArrayList bpartnerList = new ArrayList (); + + if (partnerId == 0) + throw new OperationException("Parent business partner not present!"); + + MBPartner me = new MBPartner(ctx, partnerId, trxName); + AddressBean myAddressBean = populateAddressBean(ctx, me); + bpartnerList.add(myAddressBean); + + int[] partnerIds = MBPartner.getAllIDs(MBPartner.Table_Name, "BPARTNER_PARENT_ID=" + partnerId, null); + + for (int i = 0; i < partnerIds.length; i++) + { + MBPartner partner = new MBPartner(ctx, partnerIds[i], trxName); + + AddressBean bean = populateAddressBean(ctx, partner); + + bpartnerList.add(bean); + + } + + return bpartnerList; + } + + public static MBPartner getOrCreateBPartner(Properties ctx,int orgId, int parentBpId, String bPName, String name2, boolean isCustomer,boolean isVendor,boolean isEmployee,boolean isSalesRep,String address1,String postalAddress1,String city,String bpPhone,int countryId, String trxName) throws OperationException + { + return getOrCreateBPartner( ctx, orgId, parentBpId, bPName, name2, isCustomer, isVendor, isEmployee, isSalesRep, address1, "", postalAddress1, city, bpPhone, "",countryId, trxName); + } + + + public static MBPartner getOrCreateBPartner(Properties ctx, int orgId, int bPartnerParentId, String bPName, String name2, boolean isCustomer,boolean isVendor,boolean isEmployee,boolean isSalesRep,String address1,String address2, String postalAddress1,String city,String bpPhone, String fax, int countryId, String trxName) throws OperationException + { + String sqlQuery = " upper(Name)=upper('" + bPName + "') and AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " and AD_ORG_ID=" + Env.getAD_Org_ID(ctx); + + int partners[] = MBPartner.getAllIDs(MBPartner.Table_Name, sqlQuery, trxName); + MBPartner partner; + if(partners.length != 0) + partner = new MBPartner(ctx, partners[0], trxName); + else + partner = saveBPartner(ctx, orgId, 0, bPartnerParentId, bPName, name2, isCustomer, isVendor, isEmployee, isSalesRep, address1, address2, postalAddress1, null, city, bpPhone,"", fax,countryId, true, true, trxName); + + return partner; + } + +/* public static int getOrgBPId(Properties ctx) throws OperationException + { + MOrg org = new MOrg(ctx, Env.getAD_Org_ID(ctx), null); + + int bpartnerId = org.getLinkedC_BPartner_ID(); + + if (bpartnerId == 0) + throw new OperationException("Organisation does not have Linked Business Partner"); + + return bpartnerId; + }*/ + + public static AddressBean getShipmentAddressBPartner(Properties ctx, int partnerId) throws OperationException + { + if (partnerId == 0) + throw new OperationException("Business partner not present!"); + + MBPartner partner = new MBPartner(ctx, partnerId, null); + + AddressBean bean = populateAddressBean(ctx, partner); + + return bean; + + } + +/* public static String getVehicleTypeWhereStatement(Properties ctx, String trxName) throws OperationException + { + MOrg org = OrganisationManager.getMyOrg(ctx, trxName); + + if (org.isAutomobile()) + { + return (" and o.isautomobile='Y' "); + } + else if(org.isMotorcycle()) + { + return (" and o.ismotorcycle='Y' "); + } + else if (org.isMotorcycle() && org.isAutomobile()) + { + return (" and (o.ismotorcycle='Y' or o.isautomobile='Y' "); + } + + return ""; + }*/ + + public static boolean isBPartnerPresent(Properties ctx, int c_bpartner_id, String trxName) + { + boolean isPresent = false; + + String sql = "SELECT C_BPARTNER_ID FROM C_BPARTNER WHERE ISACTIVE = 'Y' AND C_BPARTNER_ID = ?"; + int value = DB.getSQLValue(trxName, sql, c_bpartner_id); + if(value != -1) + { + isPresent = true; + } + + return isPresent; + } + + public static MBPartner loadBPartner(Properties ctx, int bpartnerID, String trxName) throws OperationException + { + MBPartner bPartner = new MBPartner(ctx, bpartnerID, trxName); + + if(bPartner.get_ID() == 0) + throw new OperationException("Cannot load Business Partner with id: " + bpartnerID); + + return bPartner; + } + + private static AddressBean populateAddressBean(Properties ctx, MBPartner partner) throws OperationException + { + MBPartnerLocation[] partnerLocations = MBPartnerLocation.getForBPartner(ctx, partner.get_ID()); + + if (partnerLocations.length == 0) + throw new OperationException("Partner " + partner.getName() + " " + partner.getName2() + " (" + partner.get_ID() + ") " + "does not have any location!"); + + MBPartnerLocation partnerLocation = partnerLocations[0];//We assume there is only 1 location for this partner + MLocation location = new MLocation(ctx, partnerLocation.getC_Location_ID(), partner.get_TrxName()); + + AddressBean bean = new AddressBean(); + bean.setBpartnerId(partner.get_ID()); + bean.setUsername(partner.getName()); + bean.setUserSurname(partner.getName2()); + bean.setAddress1(location.getAddress1()); + bean.setAddress2(location.getAddress2()); + bean.setPostalAddress(location.getPostal_Add()); + bean.setCity(location.getCity()); + bean.setCountryId(location.getC_Country_ID()); + bean.setCountryName(location.getCountryName()); + + return bean; + } + + public static ArrayList searchBpartners(Properties ctx, String name, String trxName) throws OperationException + { + int adClientID = Env.getAD_Client_ID(ctx); + + String sql; + + sql = " select bp.c_bpartner_id, " + //1 + " bp.name," + //2 + " bp.name2," + //3 + " bp.isactive,"+//4 + " bp.iscustomer," + //5 + " bp.isemployee," + //6 + " bp.isvendor, " + //7 + " bp.issalesrep," + //8 + " cl.address1," + //9 + " cl.address2," + //10 + " cl.city," + //11 + " cl.postal_add," + //12 + " bpl.c_bpartner_id," + //13 + " cl.c_location_id," + //14 + " bpl.phone," + //15 + " bpl.fax," + //16 + " cl.REGIONNAME " + //17 + " from C_BPARTNER bp left outer join (c_bpartner_location bpl left outer join c_location cl on cl.c_location_id=bpl.c_location_id) on bpl.c_bpartner_id = bp.c_bpartner_id " + + " where bp.ad_org_id in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+")"+ + " and bp.AD_CLIENT_ID = " + adClientID + + " and (upper(bp.name) like upper('%" + name + "%')" + + " or upper(bp.name2) like upper('%" + name + "%'))" + + " order by bp.name"; + + PreparedStatement pstmt =null; + + BPartnerBean bpartner = null; + ResultSet rs = null; + + ArrayList bpartners = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sql,trxName); + rs = pstmt.executeQuery(); + + + while (rs.next()) + { + + bpartner = new BPartnerBean(); + bpartner.setBpartnerId(Integer.valueOf(rs.getInt(1))); + bpartner.setPartnerName(rs.getString(2)); + bpartner.setName2(rs.getString(3)); + + if(rs.getString(4).equals("Y")) + { + bpartner.setIsActive(Boolean.valueOf(true)); + } + else + bpartner.setIsActive(Boolean.valueOf(false)); + + if(rs.getString(5).equals("Y")) + { + bpartner.setIsCustomer(Boolean.valueOf(true)); + } + else + bpartner.setIsCustomer(Boolean.valueOf(false)); + + if(rs.getString(6).equals("Y")) + { + bpartner.setIsEmployee(Boolean.valueOf(true)); + } + else + bpartner.setIsEmployee(Boolean.valueOf(false)); + + if(rs.getString(7).equals("Y")) + { + bpartner.setIsVendor(Boolean.valueOf(true)); + } + else + bpartner.setIsVendor(Boolean.valueOf(false)); + + if(rs.getString(8).equals("Y")) + { + bpartner.setIsSalesRep(Boolean.valueOf(true)); + } + else + bpartner.setIsSalesRep(Boolean.valueOf(false)); + + + + bpartner.setAddress1(rs.getString(9)); + bpartner.setAddress2(rs.getString(10)); + bpartner.setCity(rs.getString(11)); + bpartner.setPostalAddress(rs.getString(12)); + bpartner.setPhone(rs.getString(15)); + bpartner.setFax(rs.getString(16)); + + String regionName = rs.getString(17); + + int regionId = 0; + + int id[] = MRegion.getAllIDs(MRegion.Table_Name," name= '"+ regionName +"'",trxName); + + if(id.length != 0) + { + regionId = id[0]; + } + + bpartner.setRegionId(Integer.valueOf(regionId)); + + + bpartners.add(bpartner); + } + + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + if(pstmt != null) + pstmt.close(); + } + catch(Exception ex) + {} + + pstmt = null; + } + + return bpartners; + } + + public static MBPartner saveBPartner(Properties ctx, int orgId, int partnerId,int parentBpId, String name, String name2, + boolean isCustomer,boolean isVendor,boolean isEmployee,boolean isSalesRep,String address1, + String address2, String postalAddress1, Integer regionId, String city,String bpPhone, String phone2, + String fax,int countryId, boolean isShipTo, boolean isBillTo, String trxName) throws OperationException, NoAccessToEditObjectException + { + MBPartner bPartner; + int locationId; + + if (partnerId == 0) + { + bPartner = new MBPartner(ctx, -1, trxName); // Using Template BPartner + locationId = 0; + } + else + { + bPartner = loadBPartner(ctx, partnerId, trxName); + + Boolean isEditable = RoleManager.isEditable(ctx, bPartner.getAD_Org_ID()); + + if (!isEditable) + throw new NoAccessToEditObjectException("You do not have the right organisational access for editing"); + + MBPartnerLocation[] bplocations = MBPartnerLocation.getForBPartner(ctx, partnerId); + + if (bplocations.length > 1) + throw new OperationException("Error: Business Partner has more than 1 location!"); + else if (bplocations.length == 0) + locationId = 0; + else + { + MBPartnerLocation bpLocation = bplocations[0]; + locationId = bpLocation.getC_Location_ID(); + } + } + + + bPartner.setValue(name + "_" + name2 + "_" + TrxPrefix.getPrefix() ); + bPartner.setName(name); + + bPartner.setName2(name2); + bPartner.setIsCustomer(isCustomer); + bPartner.setIsVendor(isVendor); + bPartner.setIsEmployee(isEmployee); + bPartner.setIsSalesRep(isSalesRep); + bPartner.setBPartner_Parent_ID(parentBpId); +// bPartner.setDescription(Constants.WEBSTORE_CUSTOMER); + bPartner.setAD_Org_ID(orgId); + bPartner.setSalesRep_ID(Env.getAD_User_ID(ctx));//required for dunning possible bug in Compiere + + PoManager.save(bPartner); + + MLocation location = LocationManager.saveLocation(ctx, orgId, locationId, address1, address2, postalAddress1,regionId, city,countryId, trxName); + + //We need to make the link of the billing address to the business partner + MBPartnerLocation bplocation = null; + + if (bPartner.getPrimaryC_BPartner_Location_ID() == 0) + bplocation = new MBPartnerLocation(bPartner); + else + bplocation = new MBPartnerLocation(ctx, bPartner.getPrimaryC_BPartner_Location_ID(), trxName); + + bplocation.setPhone(bpPhone); + bplocation.setPhone2(phone2); + bplocation.setFax(fax); + bplocation.setC_Location_ID(location.get_ID()); + bplocation.setIsShipTo(isShipTo); + bplocation.setIsBillTo(isBillTo); + bplocation.setAD_Org_ID(orgId); + + //UDIMBPartnerLocation udiBpLocation = new UDIMBPartnerLocation(bplocation); + //udiBpLocation.save(); + + PoManager.save(bplocation); + + + //Set the default location for the business partner + bPartner.setPrimaryC_BPartner_Location_ID(bplocation.get_ID()); + + //UDIMBPartner udiBPartner_defaultLocation = new UDIMBPartner(bPartner); + //udiBPartner_defaultLocation.save(); + PoManager.save(bPartner); + + return bPartner; + + } + public static MBPartner editBPartner(Properties ctx, int orgId, int bpartnerId, String name, String name2, boolean isCustomer, boolean isVendor, boolean isEmployee, boolean isSalesRep, + String address1, String address2, String postalAddress, String city, String phoneNo,String phone2, String fax, int regionId,String trxName) throws OperationException + { + + MBPartner bPartner = new MBPartner(ctx,bpartnerId,trxName); + + bPartner.setName(name); + bPartner.setName2(name2); + bPartner.setIsVendor(isVendor); + bPartner.setIsCustomer(isCustomer); + bPartner.setIsEmployee(isEmployee); + bPartner.setIsSalesRep(isSalesRep); + bPartner.setAD_Org_ID(orgId); + + if(bPartner.getSalesRep_ID()==0) + { + bPartner.setSalesRep_ID(Env.getAD_User_ID(ctx)); + } + + + MBPartnerLocation bpLocation = editPhoneAndFax(ctx,bpartnerId,phoneNo,phone2,fax, trxName); + + LocationManager.editLocation(ctx, bpLocation.getC_Location_ID(), address1, postalAddress, regionId, city, trxName); + + PoManager.save(bpLocation); + + PoManager.save(bPartner); + + return bPartner; + + } + + public static MBPartnerLocation editPhoneAndFax(Properties ctx, int bpId, String phone,String phone2, String fax, String trxName) throws OperationException + { + + if(bpId<=0) + throw new OperationException("BPartner does not exist"); + + MBPartner bp = new MBPartner(ctx, bpId, trxName); + MBPartnerLocation bpLocation; + + try + { + bpLocation = new MBPartnerLocation(ctx, bp.getPrimaryC_BPartner_Location_ID(),trxName); + + if(bpLocation==null) + throw new OperationException("BPartner Location does not exist"); + + bpLocation.setPhone(phone); + bpLocation.setPhone2(phone2); + bpLocation.setFax(fax); + bpLocation.setAD_Org_ID(bp.getAD_Org_ID()); + + PoManager.save(bpLocation); + + + } + catch(OperationException e) + { + throw new OperationException("Error: Could not edit phone and fax!!"); + + } + + + return bpLocation; + + } + + + public static ArrayList getCreditorsDebtors(Properties ctx, boolean queryCreditors, String trxName) throws OperationException + { + ArrayList bpList = new ArrayList(); + + StringBuffer sql = new StringBuffer("SELECT C_BPARTNER_ID,NAME,NAME2,ISCUSTOMER,ISVENDOR,TOTALOPENBALANCE,ACTUALLIFETIMEVALUE,so_creditlimit,so_creditused " + + " FROM C_BPARTNER WHERE ISACTIVE = 'Y' AND AD_CLIENT_ID = ?"); + + if(queryCreditors) + sql.append(" AND ISVENDOR = 'Y' " ); + else + sql.append(" AND ISCUSTOMER = 'Y' "); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sql.toString(), trxName); + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + + rs = pstmt.executeQuery(); + + while(rs.next()) + { + BPartnerBean bean = new BPartnerBean(); + bean.setBpartnerId(rs.getInt(1)); + bean.setPartnerName(rs.getString(2)); + bean.setName2(rs.getString(3)); + bean.setIsCustomer("Y".equals(rs.getString(4))); + bean.setIsVendor("Y".equals(rs.getString(5))); + bean.setActualLifetimeValue(rs.getBigDecimal(7)); + bean.setCreditLimit(rs.getBigDecimal(8)); + bean.setCreditUsed(rs.getBigDecimal(9)); + + BigDecimal openBalance = rs.getBigDecimal(6); + if(openBalance == null) + { + openBalance = Env.ZERO; + } + + if(queryCreditors) + { + openBalance = openBalance.negate(); + } + + bean.setOpenBalance(openBalance); + + bpList.add(bean); + } + + } + catch (Exception e) + { + throw new OperationException(e); + } + finally + { + DBUtils.close(rs); + DBUtils.close(pstmt); + } + + return bpList; + + } + + public static ArrayList getCreditorsHistory(Properties ctx, int c_bpartner_id, Timestamp startDate, Timestamp endDate, String trxName) + { + StringBuffer sb = new StringBuffer( + " SELECT * FROM ( " + + " SELECT C_INVOICE.CREATED AS DATETRX,C_INVOICE.DOCUMENTNO AS REFERENCE,C_DOCTYPE.NAME AS DETAILS,C_INVOICE.GRANDTOTAL AS AMT, C_INVOICE.C_ORDER_ID AS ID " + + " FROM C_INVOICE " + + " INNER JOIN C_DOCTYPE ON C_INVOICE.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID " + + " WHERE C_INVOICE.C_BPARTNER_ID = ? " + + " AND C_INVOICE.DOCSTATUS IN ('CO','CL') " + + " AND C_DOCTYPE.NAME = 'AP Invoice' " + + " UNION " + + " SELECT C_INVOICE.CREATED AS DATETRX,C_INVOICE.DOCUMENTNO AS REFERENCE,C_DOCTYPE.NAME AS DETAILS,C_INVOICE.GRANDTOTAL AS AMT, C_INVOICE.C_ORDER_ID AS ID " + + " FROM C_INVOICE " + + " INNER JOIN C_DOCTYPE ON C_INVOICE.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID " + + " WHERE C_INVOICE.C_BPARTNER_ID = ? " + + " AND C_INVOICE.DOCSTATUS IN ('CO','CL') " + + " AND C_DOCTYPE.NAME = 'AP CreditMemo' " + + " UNION " + + " SELECT C_PAYMENT.CREATED,C_PAYMENT.C_PAYMENT_ID || '' AS REFERENCE ,C_DOCTYPE.NAME AS DETAILS,C_PAYMENT.PAYAMT + C_PAYMENT.DISCOUNTAMT + C_PAYMENT.WRITEOFFAMT AS AMT,C_PAYMENT.C_PAYMENT_ID AS ID " + + " FROM C_PAYMENT " + + " INNER JOIN C_DOCTYPE ON C_PAYMENT.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID " + + " WHERE C_PAYMENT.C_BPARTNER_ID = ? " + + " AND C_PAYMENT.DOCSTATUS IN ('CO','CL') " + + " AND C_DOCTYPE.NAME = 'AP Payment' " + + " UNION " + + " SELECT C_INVOICE.CREATED AS DATETRX,C_CASHLINE.C_CASHLINE_ID || '' AS REFERENCE,'AP Payment - Cash' AS DETAILS,0 - (C_CASHLINE.AMOUNT + C_CASHLINE.DISCOUNTAMT + C_CASHLINE.WRITEOFFAMT) AS AMT,C_CASHLINE.C_CASHLINE_ID AS ID " + + " FROM C_INVOICE " + + " INNER JOIN C_CASHLINE ON (C_CASHLINE.C_INVOICE_ID = C_INVOICE.C_INVOICE_ID) " + + " INNER JOIN C_CASH ON (C_CASH.C_CASH_ID = C_CASHLINE.C_CASH_ID AND C_CASH.DOCSTATUS IN ('CO','CL')) " + + " INNER JOIN C_DOCTYPE ON C_INVOICE.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID " + + " WHERE C_INVOICE.C_BPARTNER_ID = ? " + + " AND C_INVOICE.DOCSTATUS IN ('CO','CL') " + + " AND C_DOCTYPE.NAME = 'AP Invoice' " + + " ) AS HISTORY ORDER BY DATETRX ASC, DETAILS ASC"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + BigDecimal balance = Env.ZERO; + ArrayList reportData = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sb.toString(), trxName); + pstmt.setInt(1, c_bpartner_id); + pstmt.setInt(2, c_bpartner_id); + pstmt.setInt(3, c_bpartner_id); + pstmt.setInt(4, c_bpartner_id); + + rs = pstmt.executeQuery(); + + //int previousMonth = -2; // + + while(rs.next()) + { + Timestamp date = rs.getTimestamp(1); + String reference = rs.getString(2); + String docType = rs.getString(3); + BigDecimal amount = rs.getBigDecimal(4); + BigDecimal credit = Env.ZERO; + BigDecimal debit = Env.ZERO; + int docId = rs.getInt(5); + + + if(docType.startsWith("AP Payment") || docType.equalsIgnoreCase("AP CreditMemo")) + { + credit = amount; + balance = balance.subtract(amount); + } + else + { + debit = amount; + balance = balance.add(amount); + } + + String details = ""; + String table = "Order"; + + if(docType.equalsIgnoreCase("AP Payment")) + { + details = "PAYMENT"; + table = "Payment"; + } + else if(docType.equalsIgnoreCase("AP Payment - Cash")) + { + details = "PAYMENT"; + table = "CashLine"; + } + else if(docType.equalsIgnoreCase("AP CreditMemo")) + { + details = "Account Returns"; + } + else if(docType.equalsIgnoreCase("AP Invoice")) + { + details = "Account Purchases"; + } + else + { + details = docType; + } + + StatementOfAccountBean bean = new StatementOfAccountBean(); + bean.setDate(date); + bean.setReference(reference); + bean.setDocType(table); + bean.setDetails(details); + bean.setDebit(debit); + bean.setCredit(credit); + bean.setBalance(balance); + bean.setDocId(docId); + + reportData.add(bean); + } + + } + catch (SQLException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + finally + { + DB.close(rs, pstmt); + } + + return reportData; + } + + public static ArrayList getDebtorsHistory(Properties ctx, int c_bpartner_id, Timestamp startDate, Timestamp endDate, String trxName) + { + StringBuffer sb = new StringBuffer( + " SELECT * FROM ( " + + " SELECT C_INVOICE.CREATED AS DATETRX,C_INVOICE.DOCUMENTNO AS REFERENCE,C_DOCTYPE.NAME AS DETAILS,C_INVOICE.GRANDTOTAL AS AMT, C_INVOICE.C_ORDER_ID AS ID " + + " FROM C_INVOICE " + + " INNER JOIN C_DOCTYPE ON C_INVOICE.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID " + + " WHERE C_INVOICE.C_BPARTNER_ID = ? " + + " AND C_INVOICE.DOCSTATUS IN ('CO','CL') " + + " AND C_DOCTYPE.NAME = 'AR Invoice' " + + " UNION " + + " SELECT C_INVOICE.CREATED AS DATETRX,C_INVOICE.DOCUMENTNO AS REFERENCE,C_DOCTYPE.NAME AS DETAILS,C_INVOICE.GRANDTOTAL AS AMT, C_INVOICE.C_ORDER_ID AS ID " + + " FROM C_INVOICE " + + " INNER JOIN C_DOCTYPE ON C_INVOICE.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID " + + " WHERE C_INVOICE.C_BPARTNER_ID = ? " + + " AND C_INVOICE.DOCSTATUS IN ('CO','CL') " + + " AND C_DOCTYPE.NAME = 'AR Credit Memo' " + + " UNION " + + " SELECT C_PAYMENT.CREATED,C_PAYMENT.C_PAYMENT_ID || '' AS REFERENCE ,C_DOCTYPE.NAME AS DETAILS,C_PAYMENT.PAYAMT + C_PAYMENT.DISCOUNTAMT + C_PAYMENT.WRITEOFFAMT AS AMT,C_PAYMENT.C_PAYMENT_ID AS ID " + + " FROM C_PAYMENT " + + " INNER JOIN C_DOCTYPE ON C_PAYMENT.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID " + + " WHERE C_PAYMENT.C_BPARTNER_ID = ? " + + " AND C_PAYMENT.DOCSTATUS IN ('CO','CL') " + + " AND C_DOCTYPE.NAME = 'AR Receipt' " + + " UNION " + + " SELECT C_INVOICE.CREATED AS DATETRX,C_CASHLINE.C_CASHLINE_ID || '' AS REFERENCE,'AR Receipt - Cash' AS DETAILS,C_CASHLINE.AMOUNT + C_CASHLINE.DISCOUNTAMT + C_CASHLINE.WRITEOFFAMT AS AMT,C_CASHLINE.C_CASHLINE_ID AS ID " + + " FROM C_INVOICE " + + " INNER JOIN C_CASHLINE ON (C_CASHLINE.C_INVOICE_ID = C_INVOICE.C_INVOICE_ID) " + + " INNER JOIN C_CASH ON (C_CASH.C_CASH_ID = C_CASHLINE.C_CASH_ID AND C_CASH.DOCSTATUS IN ('CO','CL')) " + + " INNER JOIN C_DOCTYPE ON C_INVOICE.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID " + + " WHERE C_INVOICE.C_BPARTNER_ID = ? " + + " AND C_INVOICE.DOCSTATUS IN ('CO','CL') " + + " AND C_DOCTYPE.NAME = 'AR Invoice' " + + " ) AS HISTORY ORDER BY DATETRX ASC, DETAILS ASC"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + BigDecimal balance = Env.ZERO; + ArrayList reportData = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sb.toString(), trxName); + pstmt.setInt(1, c_bpartner_id); + pstmt.setInt(2, c_bpartner_id); + pstmt.setInt(3, c_bpartner_id); + pstmt.setInt(4, c_bpartner_id); + + rs = pstmt.executeQuery(); + + //int previousMonth = -2; // + + while(rs.next()) + { + Timestamp date = rs.getTimestamp(1); + String reference = rs.getString(2); + String docType = rs.getString(3); + BigDecimal amount = rs.getBigDecimal(4); + BigDecimal credit = Env.ZERO; + BigDecimal debit = Env.ZERO; + int docId = rs.getInt(5); + + + if(docType.startsWith("AR Receipt") || docType.equalsIgnoreCase("AR Credit Memo")) + { + debit = amount; + balance = balance.subtract(amount); + } + else + { + credit = amount; + balance = balance.add(amount); + } + + String details = ""; + String table = "Order"; + + if(docType.equalsIgnoreCase("AR Receipt")) + { + details = "PAYMENT"; + table = "Payment"; + } + else if(docType.equalsIgnoreCase("AR Receipt - Cash")) + { + details = "PAYMENT"; + table = "CashLine"; + } + else if(docType.equalsIgnoreCase("AR Credit Memo")) + { + details = "Account Returns"; + } + else if(docType.equalsIgnoreCase("AR Invoice")) + { + details = "Account Sales"; + } + else + { + details = docType; + } + + StatementOfAccountBean bean = new StatementOfAccountBean(); + bean.setDate(date); + bean.setReference(reference); + bean.setDocType(table); + bean.setDetails(details); + bean.setDebit(debit); + bean.setCredit(credit); + bean.setBalance(balance); + bean.setDocId(docId); + + reportData.add(bean); + } + + } + catch (SQLException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + finally + { + DB.close(rs, pstmt); + } + + return reportData; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/BarcodeManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/BarcodeManager.java new file mode 100644 index 0000000000..644cb8729f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/BarcodeManager.java @@ -0,0 +1,477 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Praveen Beekoo + */ + +package org.posterita.businesslogic.administration; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import net.sourceforge.barbecue.formatter.BarcodeFormatter; + +import org.apache.ecs.xhtml.sub; +import org.compiere.model.MProduct; +import org.compiere.model.MSequence; +import org.compiere.util.Env; +import org.krysalis.barcode4j.impl.AbstractBarcodeBean; +import org.krysalis.barcode4j.impl.code128.Code128Bean; +import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider; +import org.krysalis.barcode4j.tools.UnitConv; + +import org.posterita.Constants; +import org.posterita.beans.CheckoutBean; +import org.posterita.beans.CustomerBean; +import org.posterita.beans.ItemBean; +import org.posterita.beans.PrintBarcodeBean; +import org.posterita.businesslogic.CustomerCart; +import org.posterita.businesslogic.OrderManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.RandomStringGenerator; +import org.posterita.exceptions.OperationException; + +public class BarcodeManager +{ + public static final String BARCODE_PREFIX = "609789"; + public static final String SEQUENCE_NAME = "Barcode Sequence"; + public static boolean showPrice = true; + public static boolean showTitle = true; + public static boolean showSubtitle = true; + + public static String saveBarcode(String barcode) throws OperationException + { + try + { + //Create the barcode bean + Code128Bean bean = new Code128Bean(); + + final int dpi = 400; + + //Configure the barcode generator + bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); //makes the narrow bar + //width exactly one pixel + bean.doQuietZone(false); + bean.setBarHeight(1.5d); + bean.setFontSize(1); + bean.setFontName("Helvetica"); + + //Open output file + String filename = RandomStringGenerator.randomstring() + ".png"; + String filepath = ReportManager.getReportPath(filename); + + File outputFile = new File(filepath); + OutputStream out = new FileOutputStream(outputFile); + + //Set up the canvas provider for monochrome JPEG output + BitmapCanvasProvider canvas = new BitmapCanvasProvider( + out, "image/x-png", dpi, BufferedImage.TYPE_BYTE_BINARY, false); + + //Generate the barcode + bean.generateBarcode(canvas, barcode); + + //Signal end of generation + canvas.finish(); + + out.close(); + + return filename; + } + catch (Exception e) + { + throw new OperationException(e); + } + + } + + public static void writeBarcode(String barcode,HttpServletResponse response) throws OperationException + { + try + { + //Create the barcode bean + AbstractBarcodeBean bean = new Code128Bean(); + + final int dpi = 400; + + //Configure the barcode generator + bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); //makes the narrow bar + //width exactly one pixel + bean.doQuietZone(false); + bean.setBarHeight(2.0d); + bean.setFontSize(1.0d); + bean.setFontName("Helvetica"); + + //writing the image to the response + OutputStream out = response.getOutputStream(); + response.setContentType("image/x-png"); + + //Set up the canvas provider for monochrome JPEG output + BitmapCanvasProvider canvas = new BitmapCanvasProvider( + out, "image/x-png", dpi, BufferedImage.TYPE_BYTE_BINARY, false); + + //Generate the barcode + bean.generateBarcode(canvas, barcode); + + //Signal end of generation + canvas.finish(); + + out.flush(); + out.close(); + } + catch (IOException e) + { + throw new OperationException(e); + } + + } + + public static byte[] getBarcodeAsByte(String barcode) throws OperationException + { + ByteArrayOutputStream baos= new ByteArrayOutputStream(); + + try + { + //Create the barcode bean + AbstractBarcodeBean bean = new Code128Bean(); + + final int dpi = 400; + + //Configure the barcode generator + bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); //makes the narrow bar + //width exactly one pixel + bean.doQuietZone(false); + bean.setBarHeight(1.5d); + bean.setFontSize(1); + bean.setFontName("Helvetica"); + + //writing the image to outputstream + + //Set up the canvas provider for monochrome JPEG output + BitmapCanvasProvider canvas = new BitmapCanvasProvider( + baos, "image/x-png", dpi, BufferedImage.TYPE_BYTE_BINARY, false); + + //Generate the barcode + bean.generateBarcode(canvas, barcode); + + //Signal end of generation + canvas.finish(); + + baos.flush(); + baos.close(); + } + catch (IOException e) + { + throw new OperationException(e); + } + + + return baos.toByteArray(); + } + + public static MSequence getBarcodeSequence(Properties ctx, String trxName) throws OperationException + { + MSequence sequence = null; + + String whereClause = " name = '" + SEQUENCE_NAME + "'" + + " and ad_client_id =" + Env.getAD_Client_ID(ctx) + + " and ad_org_id =" + Env.getAD_Org_ID(ctx); + + int[] ids = MSequence.getAllIDs(MSequence.Table_Name, whereClause, trxName); + + if( ( ids ==null ) || ( ids.length == 0 ) ) + { + sequence = new MSequence(ctx, 0, trxName); + + sequence.setName(SEQUENCE_NAME); + sequence.setPrefix(BARCODE_PREFIX); + sequence.setIsAutoSequence(true); + sequence.setIncrementNo(1); + sequence.setIsTableID(false); + sequence.setCurrentNext(1000000); + + boolean isSaved = sequence.save(); + + if( !isSaved) + { + throw new OperationException("Unable to create barcode sequence"); + } + } + else + { + sequence = new MSequence(ctx, ids[0], trxName); + } + + return sequence; + } + + /** + * Print Product Barcode + * @param ctx + * @param request + * @param trxName + * @return + * @throws OperationException + */ + public static String printProductBarcode(Properties ctx, HttpServletRequest request, boolean isPrintProductName, boolean isPrintProductDescription, boolean isPrintPrices, String trxName) throws OperationException + { + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.BARCODE_CART_ITEMS); + StringBuffer barcodeData = new StringBuffer(); + int m_product_id = 0; + String productName = ""; + BigDecimal qty = Env.ZERO; + BigDecimal price = Env.ZERO; + BigDecimal unitSalePrice = Env.ZERO; + + + for(int i=0; i= 23) + { + + for(int j=0; j= 23) + { + for(int n=0; n customerList =null; + CustomerCart customerCart = cart; + + if(customerCart != null) + { + customerList = cart.getCustomers(); + + } + else + { + customerList = new ArrayList(); + } + + StringBuffer barcodeData = new StringBuffer(); + int bpartnerId = 0; + + + for(int i=0; i getAllBlackListed(Properties ctx) throws OperationException + { + ArrayList list= new ArrayList(); + String sql=getBlackListedsql(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = null; + BlackListedBean bean= null; + try + { + rs=pstmt.executeQuery(); + + while(rs.next()) + { + bean=new BlackListedBean(); + bean.setBlackListedBankName(rs.getString(1)); + bean.setBlackListedChequeNo(rs.getString(2)); + bean.setBlackListedId(rs.getInt(3)); + + list.add(bean); + } + rs.close(); + } + catch(SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + { + } + pstmt=null; + } + return list; + } + private static String getBlackListedsql(Properties ctx) + { + int ad_client_id = Env.getAD_Client_ID(ctx); + + StringBuffer strBufSQL = new StringBuffer(); + + strBufSQL.append("select bl.bankName, bl.chequeNo, bl.U_BLACKLISTCHEQUE_ID"); + strBufSQL.append(" from U_BLACKLISTCHEQUE bl"); + strBufSQL.append(" where ad_client_id = " + ad_client_id ); + strBufSQL.append(" and ad_ORG_ID in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+")"); + + + return strBufSQL.toString(); + } + + public static ArrayList searchChequeNo(Properties ctx, String chequeNo) throws OperationException + { + ArrayList list = new ArrayList(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + + String sql = " select" + + " bl.bankName," + //1.BankName + " bl.chequeNo," +//2.ChequeNo + " bl.U_BLACKLISTCHEQUE_ID" +//3.ID + " from U_BLACKLISTCHEQUE bl" + + " where ad_client_id = " + ad_client_id + + "and bl.isActive = 'Y'"+ + " and ad_ORG_ID in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+") "; + + if(chequeNo != null && chequeNo.length() != 0) + sql += " and ( lower(bl.chequeNo) like lower('%" + chequeNo + "%')) "; + + sql += " order by bl.chequeNo" ; + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs = null; + + BlackListedBean bean = null; + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean = new BlackListedBean(); + + //set bean + bean.setBlackListedBankName(rs.getString(1)); + bean.setBlackListedChequeNo(rs.getString(2)); + bean.setBlackListedId(rs.getInt(3)); + + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + return list; + + } + + public static BlackListedBean getBlackListedDetails(Properties ctx, int blackListedId) throws OperationException,BPartnerNotFoundException + { +// if (blackListedId == 0) +// throw new OperationException("BlackListed details not found. Please contact your administrator."); + + + int id[] = MBlackListCheque.getAllIDs(MBlackListCheque.Table_Name,"U_BLACKLISTCHEQUE_ID="+blackListedId,null); + + if((id==null)||(id.length==0)) + { + throw new BPartnerNotFoundException("Could not find Cheque with id :"+blackListedId); + } + + MBlackListCheque blacklisted = new MBlackListCheque(ctx, blackListedId, null); + BlackListedBean bean = new BlackListedBean(); + bean.setBlackListedBankName(blacklisted.getBankName()); + bean.setBlackListedChequeNo(blacklisted.getChequeNo()); + bean.setBlackListedId(blackListedId); + + +// MUser user=null; +// int userIds [] =MUser.getAllIDs(MUser.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_BPARTNER_ID="+partner.getID(),null); +// if(userIds.length==0) +// { +// user = new MUser(ctx,0,null); +// user.setName(partner.getName()); +// +// } +// else +// { +// user = new MUser(ctx,userIds[0],null); +// } + return bean; + } + + public static void deactivateBListedCheque(Properties ctx, int blackListedId, String trxName) throws OperationException + { + + MBlackListCheque blackListed = new MBlackListCheque(ctx, blackListedId, trxName); + + if(blackListed == null)throw new OperationException("Business Partner does not exist!"); + + blackListed.setIsActive(false); + + blackListed.save(); + + } + + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/CheckSequenceManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/CheckSequenceManager.java new file mode 100644 index 0000000000..a9c462d0dc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/CheckSequenceManager.java @@ -0,0 +1,51 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic.administration; + +import java.util.Properties; + +import org.compiere.process.ProcessInfo; +import org.compiere.process.SequenceCheck; + +import org.posterita.exceptions.SequenceUpdateException; + + +public class CheckSequenceManager { + +// private static final int TABLE_ID=115; + private static final int PROCESS_ID=258; + + public static void runProcess(Properties ctx) throws SequenceUpdateException + { + ProcessInfo poInfo = new ProcessInfo("Sequencecheck",PROCESS_ID); + SequenceCheck seqCheck = new SequenceCheck(); + boolean success= seqCheck.startProcess(ctx, poInfo,null); + + if(success==false) + throw new SequenceUpdateException("Sequence not updated"); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/CommissionManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/CommissionManager.java new file mode 100644 index 0000000000..11a456ae70 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/CommissionManager.java @@ -0,0 +1,349 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MCharge; +import org.compiere.model.MCommission; +import org.compiere.model.MCommissionLine; +import org.compiere.model.MPInstance; +import org.compiere.process.CommissionCalc; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.CommissionBean; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.core.TimestampConvertor; +import org.posterita.exceptions.InvalidDateTimeException; +import org.posterita.exceptions.OperationException; +import org.posterita.factory.SystemObjectsFactory; +import org.posterita.util.PoManager; + + +public class CommissionManager +{ + private static final int GENERATE_COMMISSION_PROCESS_ID=123; + private static final String CHARGE_NAME="Commission Charge"; + + public static void getCreateCommission(Properties ctx,String name,int partnerId,String docBasisType,BigDecimal amtMultiplier,String frequency,BigDecimal subtractAmt,String trxName) throws OperationException + { + int [] commissionIds = MCommission.getAllIDs(MCommission.Table_Name," AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_BPARTNER_ID="+partnerId+" and isActive='Y'",null); + if(commissionIds!=null && commissionIds.length>1) + throw new OperationException("Sales rep has more than one commission"+ commissionIds.length); + + MCommission com; + MCommissionLine comLine; + if(commissionIds==null || commissionIds.length<1) + { + com = new MCommission(ctx,0,trxName); + comLine = new MCommissionLine(ctx,0,trxName); + } + else + { + com = new MCommission(ctx,commissionIds[0],trxName); + MCommissionLine [] line =com.getLines(); + if(line.length!=1) + throw new OperationException("either No commissionLine or more than One commission Line has bean defined for this bPartner"); + comLine = new MCommissionLine(ctx,line[0].get_ID(),trxName); + } + com.setC_Charge_ID(getCreateCommissionCharge(ctx)); + com.setName(name); + com.setC_BPartner_ID(partnerId); + com.setFrequencyType(frequency); + com.setC_Currency_ID(POSTerminalManager.getCurrencyOfTerminalCashBook(ctx).get_ID()); + com.setDocBasisType(docBasisType); + com.setListDetails(true); + PoManager.save(com); + + + + comLine.setC_Commission_ID(com.get_ID()); + comLine.setAmtMultiplier(amtMultiplier.divide(new BigDecimal(100))); + comLine.setDescription(name); + comLine.setCommissionOrders(true); + comLine.setIsPositiveOnly(true); + if(subtractAmt!=null) + comLine.setAmtSubtract(subtractAmt); + PoManager.save(comLine); + + } + + private static int getCreateCommissionCharge(Properties ctx) throws OperationException + { + int chargeIds [] = MCharge.getAllIDs(MCharge.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and name='"+CHARGE_NAME+"'",null); + + if(chargeIds.length<1) + { + MCharge charge = new MCharge(ctx,0,null); + charge.setName(CHARGE_NAME); + charge.setChargeAmt(new BigDecimal(0)); + charge.setC_TaxCategory_ID(SystemObjectsFactory.getFactoryInstance().get(ctx,SystemObjectsFactory.TAX_CATEGORY_DEFAULT_ID).get_ID()); + + PoManager.save(charge); + + return charge.get_ID(); + } + else + { + return chargeIds[0]; + } + } + + public static void generateCommission(Properties ctx, Timestamp date) throws OperationException, InvalidDateTimeException + { +// deleteComAmtTableData(ctx); + int commissionIds [] = MCommission.getAllIDs(MCommission.Table_Name," AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and isActive='Y'",null); + if(commissionIds!=null && commissionIds.length>0) + for(int i=0;i getCommissionAmt(Properties ctx) throws OperationException + { + + String sql="select camt.C_COMMISSIONAMT_ID," +//1 + " camt.C_COMMISSIONRUN_ID," +//2 + "camt.C_COMMISSIONLINE_ID," +//3 + "camt.CONVERTEDAMT," +//4 + "camt.ACTUALQTY," +//5 + "camt.COMMISSIONAMT," +//6 + "cline.DESCRIPTION," +//7 + //"DECODE(com.FREQUENCYTYPE,'"+MCommission.FREQUENCYTYPE_Monthly+"','Monthly','"+ + "CASE WHEN com.FREQUENCYTYPE='"+MCommission.FREQUENCYTYPE_Monthly+"' THEN 'Monthly' "+ + //MCommission.FREQUENCYTYPE_Quarterly+"','Quarterly','"+ + " WHEN com.FREQUENCYTYPE='"+MCommission.FREQUENCYTYPE_Quarterly+"' THEN 'Quarterly' "+ + //MCommission.FREQUENCYTYPE_Weekly+"','Weekly','"+ + " WHEN com.FREQUENCYTYPE='"+MCommission.FREQUENCYTYPE_Weekly+"' THEN 'Weekly' "+ + //MCommission.FREQUENCYTYPE_Yearly+"','Yearly',com.FREQUENCYTYPE) frequency," +//8 + " WHEN com.FREQUENCYTYPE='"+MCommission.FREQUENCYTYPE_Yearly+"' THEN 'Yearly' ELSE com.FREQUENCYTYPE END AS frequency," +//8 + //"DECODE(com.DOCBASISTYPE,'"+MCommission.DOCBASISTYPE_Invoice+"','Invoice','"+ + "CASE WHEN com.DOCBASISTYPE ='"+MCommission.DOCBASISTYPE_Invoice+"' THEN 'Invoice' "+ + //MCommission.DOCBASISTYPE_Order+"','Order','"+ + " WHEN com.DOCBASISTYPE ='"+MCommission.DOCBASISTYPE_Order+"' THEN 'Order' "+ + //MCommission.DOCBASISTYPE_Receipt+"','Payment Receipt',com.DOCBASISTYPE) docbasis," +//9 + " WHEN com.DOCBASISTYPE ='"+MCommission.DOCBASISTYPE_Receipt+"' THEN 'Payment Receipt' ELSE com.DOCBASISTYPE END AS docbasis," +//9 + "cline.AMTMULTIPLIER*100, "+//10 + "crun.DESCRIPTION,"+//11 + //"nvl(cline.AMTSUBTRACT,0)"+//12 + "COALESCE(cline.AMTSUBTRACT,0)"+//12 + " from C_COMMISSIONAMT camt, C_COMMISSIONLINE cline,C_COMMISSION com,C_COMMISSIONRUN crun " + + " where camt.C_COMMISSIONLINE_ID=cline.C_COMMISSIONLINE_ID"+ + " and cline.C_COMMISSION_ID=com.C_COMMISSION_ID"+ + " and camt.C_COMMISSIONRUN_ID=crun.C_COMMISSIONRUN_ID"+ + " and camt.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + CommissionBean bean=null; + ArrayList list = new ArrayList(); + + + + + try + { + + ResultSet rs= pstmt.executeQuery(); + + if(rs.next()) + { + bean=new CommissionBean(); + bean.setCommissionAmtId(rs.getInt(1)); + bean.setCommissionRunId(rs.getInt(2)); + bean.setCommissionLineId(rs.getInt(3)); + bean.setConvertedAmt(rs.getBigDecimal(4)); + bean.setActualQty(rs.getBigDecimal(5)); + bean.setCommissionAmt(rs.getBigDecimal(6)); + bean.setCommissionLineName(rs.getString(7)); + bean.setFrequencyType(rs.getString(8)); + bean.setDocBasisType(rs.getString(9)); + bean.setAmtMultiplier(rs.getBigDecimal(10)); + bean.setPeriodAndCurrencyDesc(rs.getString(11)); + bean.setSubtractAmt(rs.getBigDecimal(12)); + list.add(bean); + + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (SQLException e) + { + + + } + } + return list; + } + + + + public static ArrayList getCommissionDetails(Properties ctx, int commissionAmtId) throws OperationException + { + String sql=" select det.C_COMMISSIONDETAIL_ID," +//1 + "det.C_COMMISSIONAMT_ID," +//2 + " det.REFERENCE ," +//3 + " det.C_ORDERLINE_ID," +//4 + "det.C_INVOICELINE_ID," +//5 + " det.INFO," +//6 + "det.C_CURRENCY_ID," +//7 + "det.ACTUALAMT," +//8 + "det.CONVERTEDAMT," +//9 + " det.ACTUALQTY, " +//10 + "inv.C_INVOICE_ID,"+//11 + " ord.C_ORDER_ID"+//12 + " from c_invoiceLine inv left outer join (C_COMMISSIONDETAIL det left outer join c_orderLine ord on det.C_ORDERLINE_ID=ord.C_ORDERLINE_ID ) on det.C_INVOICELINE_ID=inv.C_INVOICELINE_ID "+ + " where det.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + //" and det.C_INVOICELINE_ID=inv.C_INVOICELINE_ID(+)"+ + //" and det.C_ORDERLINE_ID=ord.C_ORDERLINE_ID(+)"+ + " and det.C_COMMISSIONAMT_ID="+commissionAmtId; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + CommissionBean bean=null; + ArrayList list = new ArrayList(); + try + { + ResultSet rs= pstmt.executeQuery(); + + while(rs.next()) + { + bean=new CommissionBean(); + bean.setCommissionDetailId(rs.getInt(1)); + bean.setCommissionAmtId(rs.getInt(2)); + bean.setReference(rs.getString(3)); + bean.setOrderLineId(rs.getInt(4)); + bean.setInvoiceLineId(rs.getInt(5)); + bean.setInfo(rs.getString(6)); + bean.setCurrencyId(rs.getInt(7)); + bean.setActualAmt(rs.getBigDecimal(8)); + bean.setConvertedAmt(rs.getBigDecimal(9)); + bean.setActualQty(rs.getBigDecimal(10)); + bean.setInvoiceId(rs.getInt(11)); + bean.setOrderId(rs.getInt(12)); + + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (SQLException e) + { + + + } + } + return list; + } + + public static String getCommissionAmtAsCSV(Properties ctx, ArrayList commissionList) throws OperationException + { + ArrayList reportData = new ArrayList(); + + // adding column header + Object[] headers = new Object[]{ + "Name", + "Calculation Period And Curr.", + "Total Amount", + "Substract Amount", + "Commission Amount", + "Qty", + "Frequency Type", + "Doc Basis Type", + "Rate %"}; + + reportData.add(headers); + + //adding data records + Object[] data = null; + + for(CommissionBean bean : commissionList) + { + data = new Object[]{ + bean.getCommissionLineName(), + bean.getPeriodAndCurrencyDesc(), + bean.getConvertedAmt(), + bean.getSubtractAmt(), + bean.getCommissionAmt(), + bean.getActualQty(), + bean.getFrequencyType(), + bean.getDocBasisType(), + bean.getAmtMultiplier() + }; + + reportData.add(data); + } + + //generate CSV + String reportName = CSVReportManager.generateCSVReport(ctx,reportData); + + return reportName; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/CustomerManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/CustomerManager.java new file mode 100644 index 0000000000..db5556b4ba --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/CustomerManager.java @@ -0,0 +1,1270 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic.administration; + +import java.awt.Color; +import java.io.FileOutputStream; +import java.io.IOException; +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.compiere.model.MBPBankAccount; +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MBank; +import org.compiere.model.MCountry; +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MPaymentTerm; +import org.compiere.model.MRegion; +import org.compiere.model.MUser; +import org.compiere.model.X_I_BPartner; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.CustomerBean; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.RandomStringGenerator; +import org.posterita.core.TimestampConvertor; +import org.posterita.exceptions.BPartnerAlreadyExistException; +import org.posterita.exceptions.BPartnerNotFoundException; +import org.posterita.exceptions.InvalidDateTimeException; +import org.posterita.exceptions.NoCustomerFoundException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PathInfo; +import org.posterita.util.PoManager; + +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Phrase; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; + +public class CustomerManager +{ + + public static MBPartner saveCustomer(Properties ctx, Integer partnerId, CustomerBean bean, String trxName) throws OperationException, InvalidDateTimeException + { + + int countryId = 0; + + if (bean.getCountryId() == null) + { + MCountry country = MCountry.getDefault(ctx); + countryId = country.get_ID(); + } + else + countryId = bean.getCountryId().intValue(); + + MOrg parentOrg = OrganisationManager.getMyOrg(ctx); + + MBPartner bPartner = BPartnerManager.saveBPartner(ctx, bean.getOrgId(), partnerId, parentOrg.getLinkedC_BPartner_ID(trxName), bean.getPartnerName(), bean.getSurname(), true, false, false, false, bean.getAddress1(), bean + .getAddress2(), bean.getPostalAddress(), bean.getRegionId(), bean.getCity(), bean.getPhone(), bean.getPhone2(), bean.getFax(), countryId, true, true, trxName); + + int customerkey = DB.getNextID(ctx, X_I_BPartner.Table_Name, null); + bPartner.setValue(String.valueOf(customerkey)); + // bPartner.setC_Dunning_ID(bean.getDunningId()); + if(bean.getCreditLimit()!=null) + { + bPartner.setSO_CreditLimit(bean.getCreditLimit()); + } + + Integer priceListId = bean.getPriceListId(); + + if (priceListId!=null && priceListId!=0) + { + bPartner.setM_PriceList_ID(priceListId); + } + bPartner.setSOCreditStatus(bean.getCreditStatus()); + bPartner.setName2(bean.getSurname()); + if(bean.getPaymentTermId()!=null) + { + bPartner.setC_PaymentTerm_ID(bean.getPaymentTermId()); + } + if(bean.getPaymentTermId()==null) + { + bPartner.setC_PaymentTerm_ID(0); + } + PoManager.save(bPartner); + + MUser user = null; + + if (bean.getUserId() == null || bean.getUserId() == 0) + { + user = new MUser(bPartner); + } + else + { + user = new MUser(ctx, bean.getUserId(), trxName); + } + + user.setEMail(bean.getEmail()); + user.setPhone(bean.getPhone()); + user.setAD_Org_ID(bean.getOrgId()); + + if (bean.getBirthdate() !=null ) + { + Timestamp timestamp = TimestampConvertor.getTimestamp(bean.getBirthdate().toString(), TimestampConvertor.BIRTH_DATE); + + user.setBirthday(timestamp); + } + + PoManager.save(user); + + return bPartner; + } + + public static CustomerBean editCustomer(Properties ctx,CustomerBean bean,String trxName) throws OperationException, InvalidDateTimeException + { + Integer bpartnerId = bean.getBpartnerId(); + if(bpartnerId==null) + { + throw new OperationException("Cannot edit business partner details. Cause bpartnerId cannot be null!"); + } + + int[] bpartnerIds = MBPartner.getAllIDs(MBPartner.Table_Name," C_bpartner_Id = "+bpartnerId, trxName); + if(bpartnerIds==null || bpartnerIds.length==0) + { + throw new OperationException("Cannot edit business partner details. Cause bpartnerId could not be found!"); + } + + MBPartnerLocation partnerLocation[] = MBPartnerLocation.getForBPartner(ctx,bpartnerIds[0]); + int region_id = 333; + if (partnerLocation.length >0) + { + + MLocation location = new MLocation(ctx, partnerLocation[0].getC_Location_ID(), trxName); + MRegion region = location.getRegion(); + + + if(region!=null) + { + region_id = region.get_ID(); + } + } + else + { + + MBPartner partner = new MBPartner(ctx,bpartnerId,null); + + MLocation location = new MLocation(ctx, 0, null); + location.setAddress1(bean.getAddress1()); + location.setAddress2(bean.getAddress2()); + location.setPostal_Add(bean.getPostalAddress()); + location.setCity(bean.getCity()); + location.save(); + MBPartnerLocation bpLocation = new MBPartnerLocation(partner); + bpLocation.setC_Location_ID(location.get_ID()); + bpLocation.setPhone(bean.getPhone()); + bpLocation.setPhone2(bean.getPhone2()); + bpLocation.setFax(bean.getFax()); + PoManager.save(bpLocation); + } + + MBPartner bPartner=BPartnerManager.editBPartner(ctx,bean.getOrgId(), bean.getBpartnerId(),bean.getPartnerName(),bean.getSurname(),true, + false,false,false,bean.getAddress1(),bean.getAddress2(),bean.getPostalAddress(),bean.getCity(),bean.getPhone(),bean.getPhone2(),bean.getFax(),region_id,trxName); + if(bean.getCreditLimit()!=null) + { + bPartner.setSO_CreditLimit(bean.getCreditLimit()); + } + bPartner.setSOCreditStatus(bean.getCreditStatus()); + if(bean.getPaymentTermId()!=null) + { + bPartner.setC_PaymentTerm_ID(bean.getPaymentTermId()); + } + if(bean.getPaymentTermId()==null) + { + bPartner.setC_PaymentTerm_ID(0); + } + + + PoManager.save(bPartner); + + MUser user; + int userIds [] =MUser.getAllIDs(MUser.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_BPARTNER_ID="+bpartnerId,trxName); + if(userIds.length==0) + { + user = new MUser(bPartner); + PoManager.save(user); + + } + else + { + user = new MUser(ctx,userIds[0],trxName); + } + + PoManager.save(user); + return bean; + } + + @SuppressWarnings("unchecked") + public static ArrayList getAllCustomers(Properties ctx, boolean isPOS) throws OperationException + { + int adOrgID = Env.getAD_Org_ID(ctx); + int adClientID = Env.getAD_Client_ID(ctx); + String sql; + + sql = " select bp.c_bpartner_id," + //1 + " bp.name," + //2 + " bp.name2," + //3 + " bp.customer_id_no," + //4 + " bp.phone," + //5 + " bp.cellno," + //6 + " cl.address1," + //7 + " cl.address1," + //8 + " cl.city," + //9 + " cl.postal_add," + //10 + " cl.birthday" + //11 + " from C_BPARTNER bp, c_bpartner_location bpl, c_location cl" + + " where bpl.c_bpartner_id = bp.c_bpartner_id" + + " and cl.c_location_id=bpl.c_location_id" + + " and bp.AD_CLIENT_ID = " + adClientID + + " and bp.ad_org_id in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+")"+ + " and bp.isActive = 'Y' " ; + + if(!isPOS) + sql=sql+ " and bp.name not in (select name from ad_org where ad_org_id = " + adOrgID + ")" + + " and bp.name not in (select name from ad_user where ad_client_id = "+ adClientID +" and ad_org_id = " + adOrgID + ")" ; + + sql=sql+" order by bp.name,bp.name2"; + + PreparedStatement pstmt =null; + + CustomerBean customer = null; + ArrayList customers = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sql,null); + ResultSet rs = pstmt.executeQuery(); + + + while (rs.next()) + { + + customer = new CustomerBean(); + customer.setBpartnerId(Integer.valueOf(rs.getInt(1))); + customer.setPartnerName(rs.getString(2)); + customer.setSurname(rs.getString(3)); + customer.setCustIdNumber(rs.getString(4)); + customer.setPhone(rs.getString(5)); + customer.setMobile(rs.getString(6)); + customer.setAddress1(rs.getString(7)); + customer.setAddress1(rs.getString(8)); + customer.setCity(rs.getString(9)); + customer.setPostalAddress1(rs.getString(10)); + customer.setBirthdate(rs.getString(11)); + + customers.add(customer); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + Comparator c = new Comparator() + { + + public int compare(Object o1, Object o2) + { + CustomerBean bean1 = (CustomerBean) o1; + CustomerBean bean2 = (CustomerBean) o2; + + String customer1Name = bean1.getSurname() + "_" +bean1.getPartnerName(); + + + String customer2Name = bean2.getSurname() + "_" + bean2.getPartnerName(); + + return customer1Name.compareToIgnoreCase(customer2Name); + } + + }; + + Collections.sort(customers, c); + + return customers; + + } + + public static ArrayList getAllCustomersSortedByDateCreated(Properties ctx) throws OperationException + { + ArrayList allCustomers = getAllCustomers(ctx,false); + + Comparator c = new Comparator() + { + + public int compare(CustomerBean o1, CustomerBean o2) + { + CustomerBean bean1 = (CustomerBean) o1; + CustomerBean bean2 = (CustomerBean) o2; + return bean1.getBpartnerId().compareTo(bean2.getBpartnerId()); + + } + }; + + Collections.sort(allCustomers, c); + Collections.reverse(allCustomers); + + return allCustomers; + } + + + public static ArrayList getAllPosCustomer(Properties ctx) throws OperationException + { + + ArrayList list = new ArrayList(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + //int ad_org_id = Env.getAD_Org_ID(ctx); + + String sql = " select" + + " bp.name as firstname," + //1.firstname + " bp.name2 as lastname," +//2.lastname + " loc.address1," +//3.address1 + " loc.address2," +//4.address2 + " bploc.phone," +//5.phone + " bploc.fax," +//6.fax + " bp.isactive, " +//7.isactive + " bp.c_bpartner_id " + //8.partnerid + " from c_bpartner bp left outer join (c_bpartner_location bploc left outer join c_location loc on bploc.C_LOCATION_ID = loc.C_LOCATION_ID)on bp.c_bpartner_id = bploc.c_bpartner_id" + + " where bp.ad_client_id = " + ad_client_id + + " and bp.ad_org_id in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+")"+ + //" and bp.c_bpartner_id = bploc.c_bpartner_id (+)" + + //" and bploc.C_LOCATION_ID = loc.C_LOCATION_ID (+)" + + " and bp.ISCUSTOMER = 'Y'" + + //" and bp.name not in (select name from ad_org where ad_org_id = " + ad_org_id + ")" + + " order by bp.name" ; + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs = null; + + CustomerBean bean = null; + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean = new CustomerBean(); + + //set bean + bean.setPartnerName(rs.getString(1)); + bean.setSurname(rs.getString(2)); + bean.setAddress1(rs.getString(3)); + bean.setAddress2(rs.getString(4)); + bean.setPhone(rs.getString(5)); + bean.setFax(rs.getString(6)); + + if(rs.getString(7).equalsIgnoreCase("Y")) + { + bean.setIsActive(Boolean.valueOf("True")); + } + else + { + bean.setIsActive(Boolean.valueOf("False")); + } + + bean.setBpartnerId(Integer.valueOf(rs.getInt(8))); + + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + return list; + } + + + + public static CustomerBean getCustomerDetails(Properties ctx, int bpartnerId) throws OperationException,BPartnerNotFoundException, InvalidDateTimeException, Exception + { + if (bpartnerId == 0) + throw new OperationException("Customer details not found. Please contact your administrator."); + + int id[] = MBPartner.getAllIDs(MBPartner.Table_Name,"C_BPARTNER_ID="+bpartnerId,null); + + if((id==null)||(id.length==0)) + { + throw new BPartnerNotFoundException("Could not find customer with id :"+bpartnerId); + } + + MBPartner partner = new MBPartner(ctx, bpartnerId, null); + + + CustomerBean customer = new CustomerBean(); + customer.setBpartnerId(bpartnerId); + customer.setPartnerName(partner.getName()); + customer.setSurname(partner.getName2()); + customer.setPriceListId(partner.getM_PriceList_ID()); + customer.setCreditLimit(partner.getSO_CreditLimit()); + customer.setCreditStatus(partner.getSOCreditStatus()); + customer.setIsActive(partner.isActive()); + customer.setOrgId(partner.getAD_Org_ID()); + + if(partner.getC_PaymentTerm_ID()!=0) + { + customer.setPaymentTermId(partner.getC_PaymentTerm_ID()); + MPaymentTerm paymentTerm=new MPaymentTerm(ctx,partner.getC_PaymentTerm_ID(),null); + customer.setPaymentTermName(paymentTerm.getName()); + } + + MBPartnerLocation partnerLocation[] = MBPartnerLocation.getForBPartner(ctx,partner.get_ID()); + if (partnerLocation.length > 0) + { + MLocation location = new MLocation(ctx, partnerLocation[0].getC_Location_ID(), null); + customer.setAddress1(location.getAddress1()); + customer.setAddress2(location.getAddress2()); + customer.setCity(location.getCity()); + customer.setPostalAddress1(location.getPostal_Add()); + customer.setPostalCode(location.getPostal()); + customer.setPostalCity(location.getCityRegionPostal()); + customer.setPhone(partnerLocation[0].getPhone()); + customer.setPhone2(partnerLocation[0].getPhone2()); + customer.setFax(partnerLocation[0].getFax()); + + } + customer.setBpartnerId(bpartnerId); + + MUser user=null; + int userIds [] =MUser.getAllIDs(MUser.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_BPARTNER_ID="+partner.get_ID(),null); + if(userIds.length==0) + { + user = new MUser(ctx,0,null); + user.setName(partner.getName()); + + } + else + { + user = new MUser(ctx,userIds[0],null); // FIXME What about when having multiple users? + } + + customer.setUserId(user.get_ID()); + customer.setEmail(user.getEMail()); + customer.setMobile(user.getPhone()); + + Timestamp date = user.getBirthday(); + + if ((date != null)) + { + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + SimpleDateFormat sdfOutput = new SimpleDateFormat ("dd/MM/yyyy"); + String textDate = date.toString(); + + customer.setBirthdate(textDate); + } + + + return customer; + } + + @SuppressWarnings("unchecked") + public static ArrayList getCustomers(Properties ctx, boolean isPOS, String name) throws OperationException + { + int adOrgID = Env.getAD_Org_ID(ctx); + int adClientID = Env.getAD_Client_ID(ctx); + String sql; + + sql = " select bp.c_bpartner_id," + //1 + " bp.name," + //2 + " bp.name2," + //3 + " bp.customer_id_no," + //4 + " bp.phone," + //5 + " bp.cellno," + //6 + " bp.aa_card_no," + //7 + " cl.address1," + //8 + " cl.city," + //9 + " cl.postal_add," + //10 + " from C_BPARTNER bp, c_bpartner_location bpl, c_location cl" + + " where bpl.c_bpartner_id = bp.c_bpartner_id" + + " and cl.c_location_id=bpl.c_location_id" + + " and bp.AD_CLIENT_ID = " + adClientID + + " and bp.ad_org_id in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+")"+ + " and bp.isActive = 'Y' " + + " and (lower(bp.name) like lower('%"+ name +"%')" + + " or lower(bp.name2) like lower('%"+ name +"%')" ; + + if(!isPOS) + sql=sql+ " and bp.name not in (select name from ad_org where ad_org_id = " + adOrgID + ")" + + " and bp.name not in (select name from ad_user where ad_client_id = "+ adClientID +" and ad_org_id = " + adOrgID + ")" ; + + sql=sql+" order by bp.name,bp.name2"; + + PreparedStatement pstmt =null; + + CustomerBean customer = null; + ArrayList customers = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sql,null); + ResultSet rs = pstmt.executeQuery(); + + + while (rs.next()) + { + customer = new CustomerBean(); + customer.setBpartnerId(Integer.valueOf(rs.getInt(1))); + customer.setPartnerName(rs.getString(2)); + customer.setSurname(rs.getString(3)); + customer.setCustIdNumber(rs.getString(4)); + customer.setPhone(rs.getString(5)); + customer.setMobile(rs.getString(6)); + customer.setAaCardnumber(rs.getString(7)); + customer.setAddress1(rs.getString(8)); + customer.setCity(rs.getString(9)); + customer.setPostalAddress1(rs.getString(10)); + + customers.add(customer); + } + + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + Comparator c = new Comparator() + { + + public int compare(Object o1, Object o2) + { + CustomerBean bean1 = (CustomerBean) o1; + CustomerBean bean2 = (CustomerBean) o2; + + String customer1Name = bean1.getSurname() + "_" +bean1.getPartnerName(); + + + String customer2Name = bean2.getSurname() + "_" + bean2.getPartnerName(); + + return customer1Name.compareToIgnoreCase(customer2Name); + } + + }; + + Collections.sort(customers, c); + + return customers; + + } + + public static ArrayList searchCustomers(Properties ctx,String searchString, boolean isPOS) throws OperationException + { + searchString = (searchString==null)? "" : searchString; + + int adOrgID = Env.getAD_Org_ID(ctx); + int adClientID = Env.getAD_Client_ID(ctx); + String sql; + + StringTokenizer st = new StringTokenizer(searchString,"+ "); + String token = null; + + sql = " select bp.c_bpartner_id," + //1 + " bp.name," + //2 + " bp.name2," + //3 + " bp.m_pricelist_id," + //4 + " bp.so_creditlimit," + //5 + " bp.so_creditused," + //6 + " bp.totalopenbalance," + //7 + " bp.socreditstatus " + //8 + " from C_BPARTNER bp" + + " where bp.AD_CLIENT_ID = " + adClientID + + " and bp.ad_org_id in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+")"+ + " and bp.isActive = 'Y' "+ + " and bp.isCustomer='Y'"; + ArrayList params = new ArrayList(); + while(st.hasMoreTokens()) + { + token = st.nextToken().trim(); + token = "%" + token + "%"; + params.add(token); + params.add(token); + sql = sql + " and ( upper(bp.name) like upper(?) or upper(bp.name2) like upper(? ))"; + } + + if(!isPOS) + sql=sql+ " and bp.name not in (select name from ad_org where ad_org_id = " + adOrgID + ")" ; + + + sql=sql+" order by bp.name,bp.name2"; + + PreparedStatement pstmt =null; + + CustomerBean customer = null; + ArrayList customers = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sql,null); + int index = 1; + for (String s : params) + { + pstmt.setString(index, s); + index++; + } + ResultSet rs = pstmt.executeQuery(); + + + while (rs.next()) + { + customer = new CustomerBean(); + customer.setBpartnerId(Integer.valueOf(rs.getInt(1))); + customer.setPartnerName(rs.getString(2)); + customer.setSurname(rs.getString(3)); + customer.setPriceListId(rs.getInt(4)); + customer.setCreditStatus(rs.getString(8)); + + BigDecimal creditLimit = rs.getBigDecimal(5); + BigDecimal creditUsed = rs.getBigDecimal(6); + BigDecimal openBalance = rs.getBigDecimal(7); + + creditLimit = creditLimit == null ? Env.ZERO : creditLimit; + creditUsed = creditUsed == null ? Env.ZERO : creditUsed; + openBalance = openBalance == null ? Env.ZERO : openBalance; + + BigDecimal creditAvailable = Env.ZERO; + if(creditLimit.doubleValue() > 0.0d) + { + creditAvailable = creditLimit.subtract(creditUsed); + } + + customer.setTotalOpenBalance(openBalance); + customer.setCreditAvailable(creditAvailable); + customer.setCreditLimit(creditLimit); + customer.setCreditUsed(creditUsed); + + customers.add(customer); + } + + rs.close(); + + return customers; + + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + } + + public static ArrayList searchPOSCustomer(Properties ctx, String customerName, String day, String month, String year, String isActive) throws OperationException, Exception + { + + ArrayList list = new ArrayList(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + int ad_org_id = Env.getAD_Org_ID(ctx); + + StringBuffer sql = new StringBuffer(); + sql.append("select bp.c_bpartner_id,"); //1. bpartner id + sql.append(" bp.name as firstname,"); //2.firstname + sql.append(" bp.name2 as lastname,");//3.lastname + sql.append(" loc.address1,");//4.address1 + sql.append(" loc.address2,");//5.address2 + sql.append(" loc.city,");//6. City + sql.append(" bploc.phone,");//7.phone + sql.append(" bploc.fax,");//8.fax + sql.append(" bp.isactive,");//9.isactive + sql.append(" au.birthday, "); //10. birthday + sql.append(" bp.ad_org_id "); //11. organisation + sql.append(" FROM C_BPARTNER BP "); + sql.append(" LEFT OUTER JOIN AD_USER AU ON AU.C_BPARTNER_ID = BP.C_BPARTNER_ID "); + sql.append(" LEFT OUTER JOIN C_BPARTNER_LOCATION BPLOC ON BP.C_BPARTNER_ID = BPLOC.C_BPARTNER_ID "); + sql.append(" LEFT OUTER JOIN C_LOCATION LOC ON BPLOC.C_LOCATION_ID = LOC.C_LOCATION_ID "); + sql.append(" where bp.ad_client_id = ").append(ad_client_id); + sql.append(" and bp.ad_org_id in (" + Env.getContext(ctx,UdiConstants.ROLE_VIEWABLE_ORGS_CTX_PARAM)+")"); + sql.append(" and bp.ISCUSTOMER = 'Y'"); + + if( isActive.length() != 0) + { + sql.append("and bp.isActive='").append(isActive).append("'"); + } + + + sql.append(" and bp.name not in (select name from ad_org where ad_org_id = " + ad_org_id + ")" ); + sql.append(" and lower(bp.name||' ' ||"); + sql.append("bp.name2) like lower('%").append(customerName).append("%')"); + + if (day.length() != 0) + { + String dd = String.valueOf(day); + if (dd.length() == 1) + { + dd = "0" + dd; + } + + sql.append(" and to_char(bp.created, 'dd') = '").append(dd).append("'"); + } + + + if (month.length() != 0) + { + String mm = String.valueOf(month); + if (mm.length() == 1) + { + mm = "0" + mm; + } + + sql.append(" and to_char(bp.created, 'mm') = '").append(mm).append("'"); + } + + if (year.length() != 0) + { + sql.append(" and to_char(bp.created, 'yyyy') ='").append(year).append("'");; + } + + + sql.append(" order by bp.name"); + + + PreparedStatement pstmt = DB.prepareStatement(sql.toString(),null); + pstmt.execute(); + + ResultSet rs = null; + + CustomerBean bean = null; + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean = new CustomerBean(); + + //set bean + bean.setPartnerName(rs.getString(2)); + bean.setSurname(rs.getString(3)); + bean.setAddress1(rs.getString(4)); + bean.setAddress2(rs.getString(5)); + bean.setCity(rs.getString(6)); + bean.setPhone(rs.getString(7)); + bean.setFax(rs.getString(8)); + bean.setIsEditable(RoleManager.isEditable(ctx, rs.getInt(11))); + + if(rs.getString(9).equalsIgnoreCase("Y")) + { + bean.setIsActive(Boolean.valueOf("True")); + } + else + { + bean.setIsActive(Boolean.valueOf("False")); + } + + bean.setBpartnerId(Integer.valueOf(rs.getInt(1))); + + if (rs.getString(10) != null) + { + Date textDate = rs.getDate(10); + bean.setBirthdate(textDate.toString()); + } + + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + return list; + } + + /* + * + * param + * * return String name of the pdf file + */ + public static String fidelityCard (Properties ctx,ArrayList customerList) throws OperationException + { + String reportName =RandomStringGenerator.randomstring()+".pdf"; + String reportPath =ReportManager.getReportPath(reportName); + + boolean shouldPrintCard = false; + + for(CustomerBean b: customerList) + { + if(b.getIsActive()) + { + shouldPrintCard = true; + break; + } + } + + if(!shouldPrintCard) + { + throw new NoCustomerFoundException("Cannot print fidelity card. Cause no active customers were found."); + } + + Document document = new Document(PageSize.A4,3,3,2,4);//l,r,t,b + + try { +// step 2: + // we create a writer that listens to the document + // and directs a PDF-stream to a file + PdfWriter.getInstance(document, new FileOutputStream(reportPath)); + + // step 3: we open the document + document.open(); + + PdfPTable main = new PdfPTable(2); + main.setWidthPercentage(71.0f); + main.getDefaultCell().setBorderColor(Color.gray); + + PdfPCell cell = new PdfPCell(); + cell.setMinimumHeight(150.0f); + + Font smallFont = FontFactory.getFont(FontFactory.HELVETICA,7,Font.BOLD); + //Font spaceFont = FontFactory.getFont(FontFactory.HELVETICA,6,Font.BOLD); + //Font spaceFont2 = FontFactory.getFont(FontFactory.HELVETICA,15,Font.BOLD); + + //ResourceBundle rb = ResourceBundle.getBundle("MessageResources"); + + for(CustomerBean bean: customerList) + { + if(bean.getIsActive()) + { + String name =bean.getPartnerName(); + String name1=""; + String add2 =""; + String add1 =""; + String city =""; + + if (bean.getAddress1()!= null) + add1=bean.getAddress1(); + + if (bean.getAddress2()!= null) + add2=bean.getAddress2(); + + if (bean.getCity()!= null) + city =bean.getCity(); + + + String Address = " "+add1; + String Add2 = " " + add2; + String Add3 = " "+city; + + String BackPriv1Path = PathInfo.PROJECT_HOME + "/images/BackPriv1.jpg" ; + String backPriv2Path = PathInfo.PROJECT_HOME + "/images/backPriv2.jpg" ; + String frontImgPath = PathInfo.PROJECT_HOME + "/images/pc.png"; + + float WIDTH=205; + float HEIGHT= 135; + + + + Image Back1= Image.getInstance(BackPriv1Path); + Back1.scaleAbsolute(WIDTH-40,HEIGHT/3); + Image Back2=Image.getInstance(backPriv2Path); + Back2.scaleAbsolute(WIDTH,HEIGHT/3); + Image frontImg = Image.getInstance(frontImgPath); + frontImg.scaleAbsolute(WIDTH,HEIGHT); + + + + if(bean.getSurname() != null && bean.getSurname().trim().length() > 0) + name1 = " "+ name + " " + name1 + bean.getSurname(); + + byte[] barcode = BarcodeManager.getBarcodeAsByte(bean.getBpartnerId().toString()); + Image barcodeImg = Image.getInstance(barcode); + barcodeImg.setRotation(1.57f); + barcodeImg.scaleAbsolute(HEIGHT- 55f, WIDTH/5); + + //document.add(barcodeImg); + PdfPTable card = new PdfPTable(2); + card.getDefaultCell().setBorderWidth(0.0f); + + PdfPCell c =null; + card.setWidthPercentage(50.0f); + + PdfPTable t = new PdfPTable(1); + PdfPTable nametable = new PdfPTable(1); + + c = new PdfPCell(Back1); + c.setBorderWidth(0.0f); + nametable.addCell(c); + + + c = new PdfPCell(new Phrase(name1,smallFont)); + c.setHorizontalAlignment(Element.ALIGN_CENTER); + c.setVerticalAlignment(Element.ALIGN_CENTER); + c.setBorderWidth(0.0f); + nametable.addCell(c); + + c = new PdfPCell(new Phrase(Address,smallFont)); + c.setHorizontalAlignment(Element.ALIGN_CENTER); + c.setVerticalAlignment(Element.ALIGN_CENTER); + c.setBorderWidth(0.0f); + //c.setColspan(2); + nametable.addCell(c); + + c = new PdfPCell(new Phrase(Add2,smallFont)); + c.setHorizontalAlignment(Element.ALIGN_CENTER); + c.setVerticalAlignment(Element.ALIGN_CENTER); + c.setBorderWidth(0.0f); + //c.setColspan(2); + nametable.addCell(c); + + c = new PdfPCell(new Phrase(Add3,smallFont)); + c.setHorizontalAlignment(Element.ALIGN_CENTER); + c.setVerticalAlignment(Element.ALIGN_CENTER); + c.setBorderWidth(0.0f); + //c.setColspan(2); + nametable.addCell(c); + + //nametable.getDefaultCell(); + nametable.getDefaultCell().setBorderWidth(0.0f); + nametable.setHorizontalAlignment(Element.ALIGN_CENTER); + card.addCell(nametable); + + + c = new PdfPCell(barcodeImg); + c.setBorderWidth(0.0f); + //c.setColspan(2); + c.setHorizontalAlignment(Element.ALIGN_RIGHT); + c.setVerticalAlignment(Element.ALIGN_MIDDLE); + c.setPadding(5.0f); + card.addCell(c); + + + c = new PdfPCell(Back2); + c.setBorderWidth(0.0f); + c.setColspan(2); + card.addCell(c); + + + c = new PdfPCell(new Phrase(name1,smallFont)); + c.setBorderWidth(0.0f); + t.addCell(c); + + c = new PdfPCell(new Phrase(Address,smallFont)); + c.setBorderWidth(0.0f); + t.addCell(c); + + c = new PdfPCell(new Phrase(Add3,smallFont)); + c.setBorderWidth(0.0f); + t.addCell(c); + + + PdfPTable card1 = new PdfPTable(1); + card.getDefaultCell().setBorderWidth(0.0f); + + PdfPCell c1 =null; + card.setWidthPercentage(50.0f); + + c1 = new PdfPCell(frontImg); + c1.setBorderWidth(0.0f); + card1.addCell(c1); + + + + main.addCell(card); + main.addCell(card1); + } + + } + document.add(main); + + } + // TODO handle the following exception neatly + catch (DocumentException de) + { + System.err.println(de.getMessage()); + } + catch (IOException ioe) + { + System.err.println(ioe.getMessage()); + } + + // step 5: we close the document + document.close(); + return reportName; + } + + + public static CustomerBean createSingleCustomerForImport(Properties ctx, CustomerBean bean, String trxName) throws Exception, OperationException, InvalidDateTimeException + { + MBPartner customer = saveCustomer(ctx, 0, bean, trxName); + + /** SET ADDITIONAL DETAILS **/ + + customer.setReferenceNo(bean.getCustIdNumber()); + customer.setTaxID(bean.getTaxNo()); + PoManager.save(customer); + + + MBPartnerLocation[] partnerLocations = MBPartnerLocation.getForBPartner(ctx, customer.getC_BPartner_ID()); + + if(partnerLocations.length > 0) + { + partnerLocations[0].setPhone2(bean.getMobile()); + PoManager.save(partnerLocations[0]); + + //Set postal code and postal address for customer + MLocation location = new MLocation(ctx, partnerLocations[0].getC_Location_ID(), trxName); + + location.setPostal(bean.getPostalCode()); + location.setAddress3(bean.getPostalAddress()); + location.setAddress4(bean.getPostalAddress1()); + PoManager.save(location); + } + + + //Modify contact for new customer since contact name is same as customer name by default + if(bean.getUsername() != null && bean.getUsername().length() > 0) + { + MUser[] users = MUser.getOfBPartner(ctx, customer.getC_BPartner_ID()); + + if(users.length > 0) + { + users[0].setName(bean.getUsername()); + users[0].setFax(bean.getFax()); + users[0].setPhone2(bean.getMobile()); + PoManager.save(users[0]); + } + } + + //Set Bank account details for customer + + if(bean.getBankName() != null && bean.getBankName().length() > 0 + && bean.getAccountNo() != null && bean.getAccountNo().length() > 0) + { + MBPBankAccount bpBankAccount = new MBPBankAccount(ctx, 0, trxName); + bpBankAccount.setC_BPartner_ID(customer.getC_BPartner_ID()); + bpBankAccount.setAccountNo(bean.getAccountNo()); + bpBankAccount.setA_City(bean.getBranch()); // Set branch for bank + + String whereClause = " UPPER(name)='" + bean.getBankName().toUpperCase() + "' AND AD_Client_ID=" + Env.getAD_Client_ID(ctx) + + " AND AD_Org_ID=" + Env.getAD_Org_ID(ctx) + " AND isActive='Y'"; + + int[] bankIds = MBank.getAllIDs(MBank.Table_Name, whereClause, trxName); + MBank bank = null; + + if(bankIds.length == 0) + { + bank = new MBank(ctx, 0, trxName); + bank.setName(bean.getBankName()); + bank.setRoutingNo("123456789"); //Routing Number is mandatory + PoManager.save(bank); + } + else + { + bank = new MBank(ctx, bankIds[0], trxName); + } + + bpBankAccount.setC_Bank_ID(bank.getC_Bank_ID()); + bpBankAccount.setRoutingNo(bank.getRoutingNo()); + + PoManager.save(bpBankAccount); + + } + + CustomerBean customerBean= new CustomerBean(); + customerBean = CustomerManager.getCustomerDetails(ctx, customer.getC_BPartner_ID()); + return customerBean; + } + + public static void activateCustomer(Properties ctx, int bpartnerId, String trxName) throws OperationException + { + BPartnerManager.activateBPartner(ctx,bpartnerId, false,trxName); + + } + + public static void deactivateCustomer(Properties ctx, int bpartnerId, String trxName) throws OperationException + { + BPartnerManager.deactivateBPartner(ctx,bpartnerId, trxName); + + } + + + public static ArrayList updateCustomerListStatus(ArrayList list, Integer partnerId, Boolean status) + { + if (list == null) + return list; + + for (int i = 0; i < list.size(); i++) + { + CustomerBean bean = (CustomerBean) list.get(i); + + if (bean.getBpartnerId().equals(partnerId)) + { + bean.setIsActive(status); + + list.remove(i); + + list.add(i, bean); + + break; + } + } + + return list; + + } + + public static MBPartner getBPartner(Properties ctx, String name, String name2, boolean isCustomer, boolean isVendor, boolean isSalesRep, boolean isEmployee, String trxName) throws BPartnerAlreadyExistException, OperationException + { + MBPartner bpartner = null; + + if((name == null || name.length() == 0) && (name2 == null || name2.length() == 0)) + { + throw new OperationException("Name cannot be null or empty."); + } + + if(name != null && name.contains("'")) + { + name = name.replaceAll("'", "''"); + } + + if(name2 != null && name2.contains("'")) + { + name2 = name2.replaceAll("'", "''"); + } + + StringBuffer sql = new StringBuffer(); + + if(name != null || name.length() > 0) + { + name = name.toUpperCase(); + sql.append(" UPPER(name)='" + name + "'"); + } + + if(name2 != null && name2.length() > 0) + { + name2 = name2.toUpperCase(); + sql.append(" AND UPPER(name2)='" + name2 + "'"); + } + + if(isCustomer) + { + sql.append(" AND isCustomer='Y'"); + } + + if(isVendor) + { + sql.append(" AND isVendor='Y'"); + } + + if(isEmployee) + { + sql.append(" AND isEmployee='Y'"); + } + + if(isSalesRep) + { + sql.append(" AND isSalesRep='Y'"); + } + + sql.append(" AND AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " AND isActive='Y'"); + + int[] bpartnerIds = MBPartner.getAllIDs(MBPartner.Table_Name, sql.toString(), trxName); + + if(bpartnerIds.length != 0) + { + bpartner = new MBPartner(ctx, bpartnerIds[0], trxName); + } + + return bpartner; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/DunningManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/DunningManager.java new file mode 100644 index 0000000000..ab0736efd4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/DunningManager.java @@ -0,0 +1,251 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Properties; + +import org.compiere.model.MDunning; +import org.compiere.model.MDunningLevel; +import org.compiere.model.MDunningRun; +import org.compiere.model.MPInstance; +import org.compiere.print.MPrintFormat; +import org.compiere.process.DunningPrint; +import org.compiere.process.DunningRunCreate; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.DunningBean; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.exceptions.OperationException; +import org.posterita.util.PoManager; + + +public class DunningManager +{ + private static final int DUNNING_CREATE_PROCESS_ID=289; + private static final int DUNNING_PRINT_PROCESS_ID=312; + + + public static MDunning createDunningAndLevel(Properties ctx,String dunningName,String desc,String dunningLevelName,String printText,String printNote,int daysAfterDue) throws OperationException + { + + MDunning dunning = new MDunning(ctx,0,null); + dunning.setIsDefault(true); + dunning.setSendDunningLetter(true); + dunning.setName(dunningName); + dunning.setDescription(desc); + + PoManager.save(dunning); + + MDunningLevel dunningLevel = new MDunningLevel(ctx,0,null); + dunningLevel.setC_Dunning_ID(dunning.get_ID()); + dunningLevel.setName(dunningLevelName); + dunningLevel.setDaysAfterDue(new BigDecimal(daysAfterDue)); + dunningLevel.setDaysBetweenDunning(0); + dunningLevel.setPrintName(printText); + dunningLevel.setNote(printNote); + + int [] allIds = MPrintFormat.getAllIDs(MPrintFormat.Table_Name,"AD_CLIENT_ID=0 and name='Dunning_Header ** TEMPLATE **'",null); + if(allIds.length==0) + throw new OperationException("no dunning print format for system"); + if(allIds.length > 1) + throw new OperationException("more than one dunning print format for system"); + dunningLevel.setDunning_PrintFormat_ID(allIds[0]); + + PoManager.save(dunningLevel); + return dunning; + } + + + + + public static void printDunningLetters(Properties ctx, DunningBean bean) throws OperationException + { + if(bean.getBpartnerIds()!=null && bean.getBpartnerIds().length>0) + { + for(int i=0;i importCustomer(Properties ctx, FormFile formFile,String trxName) throws BPartnerAlreadyExistException, OperationException, InvalidDateTimeException, Exception + { + ArrayList list=new ArrayList(); + + InputStream is = null; + BufferedInputStream bis = null; + BufferedReader reader = null; + + try + { + is = formFile.getInputStream(); + + bis = new BufferedInputStream(is); + + reader = new BufferedReader(new InputStreamReader(bis)); + + String s = null; + CustomerBean bean = null; + String accountNo = null; + String name = null; + String address1 = null; + String address2 = null; + String address3 = null; + String postalCode = null; + String strAddress1 = null; + String strAddress2 = null; + String contactName = null; + String phone = null; + String fax = null; + String paymentTerm = null; + String creditLimit = null; + String broughtForwardBalance = null; + String totalOwing = null; + String salesRep = null; + String priceList = null; + String taxNo = null; + String bank = null; + String branch = null; + String bankAccountNo = null; + String email = null; + String cell = null; + + String name2 = " "; // since name2 is compulsory in posterita + + int count = 0; + StringBuffer importCustomerExMsg = new StringBuffer(); + StringBuffer csv = new StringBuffer(); + boolean isCustomerImported = true; + + csv.append(reader.readLine()).append("\n"); + + while((s=reader.readLine()) != null && s.trim().length() > 0) + { + count ++; + + // set empty string for blank fields such that when doing st.nextToken(), empty string is returned rather than + // the next token which belongs to another field. + + while(s.contains(",,")) + { + s = s.replace(",,", ",\"\","); + } + + StringTokenizer st = new StringTokenizer(s,","); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + try + { + trx.start(); + accountNo = getElement(st); + name = getElement(st); + address1 = getElement(st); + address2 = getElement(st); + address3 = getElement(st); + postalCode = getElement(st); + strAddress1 = getElement(st); + strAddress2 = getElement(st); + + if(address3 == null || address3.length() == 0) + { + address3 = getElement(st); + + } + else + { + st.nextToken(); // skip empty string so that st.nextToken() gives contact name + } + + contactName = getElement(st); + phone = getElement(st); + fax = getElement(st); + paymentTerm = getElement(st); + creditLimit = getElement(st); + broughtForwardBalance = getElement(st); + totalOwing = getElement(st); + salesRep = getElement(st); + priceList = getElement(st); + taxNo = getElement(st); + bank = getElement(st); + branch = getElement(st); + bankAccountNo = getElement(st); + email = getElement(st); + cell = getElement(st); + + try + { + MBPartner customer = CustomerManager.getBPartner(ctx, name, name2, true, false, false, false, trxName); + + if(customer != null) + { + throw new BPartnerAlreadyExistException("Customer already exists!"); + } + + bean = new CustomerBean(); + + if(paymentTerm != null && paymentTerm.length() > 0) + { + String whereClause = " UPPER(name)='" + paymentTerm.toUpperCase() + "' AND AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " AND AD_Org_ID=" + + Env.getAD_Org_ID(ctx) + " AND isActive='Y'"; + + int[] paymentTermIds = MPaymentTerm.getAllIDs(MPaymentTerm.Table_Name, whereClause, trxName); + + if(paymentTermIds.length == 0) + { + throw new OperationException("Payment term " + paymentTerm + " not found!"); + } + else if(paymentTermIds.length > 1) + { + throw new OperationException("Duplicate payment term " + paymentTerm + " found. Payment Term should be unique."); + } + else + { + PaymentTermBean paymentTermBean = new PaymentTermBean(); + paymentTermBean = PaymentTermManager.getPaymentTerm(ctx, paymentTermIds[0]); + + bean.setPaymentTermName(paymentTermBean.getPaymentTermName()); + bean.setPaymentTermId(paymentTermBean.getPaymentTermId()); + } + + } + + if(creditLimit != null && creditLimit.length() > 0) + { + BigDecimal creditLmt = new BigDecimal(creditLimit); + bean.setCreditLimit(creditLmt); + } + + if(totalOwing != null && totalOwing.length() > 0 && broughtForwardBalance != null && broughtForwardBalance.length() > 0) + { + BigDecimal totalOwe = new BigDecimal(totalOwing); + BigDecimal BFBal = new BigDecimal(broughtForwardBalance); + + if(totalOwe != null && BFBal != null) + { + bean.setTotalOpenBalance(BFBal.subtract(totalOwe)); + } + else + { + bean.setTotalOpenBalance(Env.ZERO); + } + + } + + if(priceList != null && priceList.length() > 0) + { + String whereClause = " UPPER(name)='" + priceList.toUpperCase() + "' AND AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " AND AD_Org_ID=" + Env.getAD_Org_ID(ctx) + + " AND isSOPriceList='Y' AND isActive='Y'"; + + int[] priceListIds = MPriceList.getAllIDs(MPriceList.Table_Name, whereClause, trxName); + + if(priceListIds.length == 0) + { + throw new OperationException("Pricelist with name " + priceList + " not found."); + } + + else if(priceListIds.length > 1) + { + throw new OperationException("Duplicate pricelist with name " + priceList + " found. Pricelist name should be unique."); + } + else + { + MPriceList priceLst = new MPriceList(ctx, priceListIds[0], trxName); + bean.setPriceListId(priceListIds[0]); + bean.setPriceListName(priceLst.getName()); + } + + } + + if(salesRep != null && salesRep.length() > 0) + { + MBPartner rep = CustomerManager.getBPartner(ctx, salesRep, null, false, false, true, false, trxName); + + if(rep == null) + { + throw new BPartnerNotFoundException("Sales Rep with name " + salesRep + " not found!"); + } + + bean.setSaleRepName(rep.getName()); + bean.setSalesRepId(rep.getC_BPartner_ID()); + } + + bean.setCustIdNumber(accountNo); + bean.setAddress1(address1); + bean.setAddress2(address2); + bean.setCity(address3); + bean.setPostalCode(postalCode); + bean.setPostalAddress(strAddress1); + bean.setPostalAddress1(strAddress2); + bean.setPartnerName(name); + bean.setSurname(name2); + bean.setUsername(contactName); + bean.setEmail(email); + bean.setPhone(phone); + bean.setFax(fax); + bean.setMobile(cell); + bean.setIsActive(true); + bean.setOrgId(Env.getAD_Org_ID(ctx)); + bean.setBankName(bank); + bean.setBranch(branch); + bean.setAccountNo(bankAccountNo); + bean.setTaxNo(taxNo); + + CustomerManager.createSingleCustomerForImport(ctx,bean,trxName); + trx.commit(); + list.add(bean); + } + + catch(OperationException e) + { + trx.rollback(); + importCustomerExMsg.append("
    Customer at line "+ count + " not imported. Cause: " + e.getMessage()); + isCustomerImported = false; + csv.append(s).append("\"\n"); + + } + + finally + { + trx.close(); + } + + } + catch (NoSuchElementException e) + { + trx.rollback(); + importCustomerExMsg.append("
    Customer at line " + count + " not imported. Cause: Cannot pass data from file!"); + isCustomerImported = false; + csv.append(s).append("\"\n"); + } + + finally + { + trx.close(); + } + + }//while + + if (!isCustomerImported) + { + String filename = RandomStringGenerator.randomstring() + ".csv"; + String filepath = ReportManager.getReportPath(filename); + try + { + FileWriter writer = new FileWriter(filepath); + writer.write(csv.toString()); + writer.flush(); + writer.close(); + } + catch (IOException e1) + { + throw new OperationException(e1); + } + throw new CustomerNotImportedException(filename+importCustomerExMsg.toString()); + } + + } + + catch (FileNotFoundException e) + { + + e.printStackTrace(); + } + catch (IOException e) + { + + e.printStackTrace(); + } + + finally + { + if (is != null) + { + try + { + is.close(); + } + catch(Exception ex) + {} + } + + if (bis != null) + { + try + { + bis.close(); + } + catch(Exception ex) + {} + } + + if (reader != null) + { + try + { + reader.close(); + } + catch(Exception ex) + {} + } + } + return list; + } + + private static String getElement(StringTokenizer st) + { + String element = ""; + + if(st.hasMoreTokens()) + { + element = st.nextToken(); + element = element.replaceAll("\"", ""); + } + + return element; + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/PriceListManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/PriceListManager.java new file mode 100644 index 0000000000..9163e36477 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/PriceListManager.java @@ -0,0 +1,1107 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 19, 2005 by praveen + * + */ +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.TreeSet; + +import org.compiere.model.MColumn; +import org.compiere.model.MCurrency; +import org.compiere.model.MDiscountSchema; +import org.compiere.model.MOrg; +import org.compiere.model.MPInstance; +import org.compiere.model.MPriceList; +import org.compiere.model.MPriceListVersion; +import org.compiere.model.MProcess; +import org.compiere.model.MProcessPara; +import org.compiere.model.MProduct; +import org.compiere.model.MProductPrice; +import org.compiere.model.MTax; +import org.compiere.model.MTaxCategory; +import org.compiere.process.M_PriceList_Create; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.process.SvrProcess; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.beans.AttributeValuesBean; +import org.posterita.beans.PriceListBean; +import org.posterita.beans.ProductBean; +import org.posterita.beans.ProductPriceBean; +import org.posterita.beans.SearchBean; +import org.posterita.beans.UDIPair; +import org.posterita.businesslogic.CurrencyManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.SearchManager; +import org.posterita.core.CheckDuplicateEntities; +import org.posterita.exceptions.MandatoryException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.PriceListAlreadyExistsException; +import org.posterita.exceptions.SystemException; +import org.posterita.exceptions.TerminalNotFoundException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class PriceListManager +{ + public static ArrayList getProductPriceList(Properties ctx, int pricelistVersionId) throws OperationException + { + return getProductPriceList(ctx, pricelistVersionId, null, null, null); + } + + public static ArrayList getProductPriceList(Properties ctx, int pricelistVersionId, String searchText, Boolean isSelfService, String classification) throws OperationException + { + ArrayList productPriceList = new ArrayList(); + + int adClientId = Env.getAD_Client_ID(ctx); + int adOrgId = Env.getAD_Org_ID(ctx); + + String sql = "select distinct " + + " p.M_Product_ID," + + " p.name," + + " pp.pricelist," + + " pp.pricestd," + + " pl.name" + + " from M_product p, M_ProductPrice pp, M_PriceList pl, M_PriceList_Version plv" + + " where pp.M_product_id = p.M_product_id" + + " and pp.m_pricelist_version_id = plv.m_pricelist_version_id" + + " and plv.m_pricelist_id = pl.m_pricelist_id" + + " and p.AD_CLIENT_ID = " + adClientId + + " and p.ad_org_id = " + adOrgId + + " and pp.m_pricelist_version_id = " + pricelistVersionId + + " and p.isactive = 'Y' "; + + + if (isSelfService!= null && isSelfService) + sql = sql + " and p.isSelfService = 'Y' "; + if (isSelfService!= null && !isSelfService) + sql = sql + " and p.isSelfService = 'N' "; + + if (classification != null) + sql = sql + " and p.classification='" + classification + "' "; + + if(searchText != null && searchText.length() > 0) + { + SearchBean searchBean = SearchManager.getSearchParams(searchText); + ArrayList andSearchList = searchBean.getAndCriteriasList(); + Iterator andListIter = andSearchList.iterator(); + while(andListIter.hasNext()) + { + String andCriteria = andListIter.next(); + sql += " and ( Upper(p.name) like Upper('%" + andCriteria + "%') "; + sql += " or Upper(p.keyword) like Upper('%" + andCriteria + "%') "; + sql += " or Upper(p.keyword2) like Upper('%" + andCriteria + "%') "; + sql += " or Upper(p.keyword3) like Upper('%" + andCriteria + "%') "; + sql += " or Upper(p.keyword4) like Upper('%" + andCriteria + "%') ) "; + } + + ArrayList orSearchList = searchBean.getOrCriteriasList(); + Iterator orListIter = orSearchList.iterator(); + if(orListIter.hasNext()) + { + sql += " and ( "; + while(orListIter.hasNext()) + { + String orCriteria = orListIter.next(); + sql += " Upper(p.name) like Upper('%" + orCriteria + "%') "; + sql += " or Upper(p.keyword) like Upper('%" + orCriteria + "%') "; + sql += " or Upper(p.keyword2) like Upper('%" + orCriteria + "%') "; + sql += " or Upper(p.keyword3) like Upper('%" + orCriteria + "%') "; + sql += " or Upper(p.keyword4) like Upper('%" + orCriteria + "%') or"; + } + + sql = sql.substring(0, sql.length() - 3); + sql += " ) "; + } + } + + + sql += " Order by p.name"; + + PreparedStatement pstmt = null; + + try + { + pstmt = DB.prepareStatement(sql, null); + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + ProductPriceBean prodPriceBean = new ProductPriceBean(); + prodPriceBean.setProductId(Integer.valueOf(rs.getInt(1))); + prodPriceBean.setProductName(rs.getString(2)); + prodPriceBean.setPriceList(rs.getBigDecimal(3)); + prodPriceBean.setPriceStandard(rs.getBigDecimal(4)); + prodPriceBean.setPriceListName(rs.getString(5)); + prodPriceBean.setPriceListVersionId(Integer.valueOf(pricelistVersionId)); + productPriceList.add(prodPriceBean); + } + rs.close(); + + } + catch(SQLException ex) + { + throw new OperationException("Could not retrieve product price list with sql: " + sql, ex); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + + } + + pstmt = null; + } + + return productPriceList; + } + + public static AttributeValuesBean getAttributeValues(ArrayList priceList) + { + AttributeValuesBean attrValues = new AttributeValuesBean(); + + TreeSet models = new TreeSet(); + TreeSet colour = new TreeSet(); + TreeSet trx = new TreeSet(); + TreeSet year = new TreeSet(); + + Iterator iter = priceList.iterator(); + UDIPair pair = null; + ProductPriceBean bean = null; + + + while(iter.hasNext()) + { + bean = (ProductPriceBean) iter.next(); + + pair = new UDIPair(bean.getAttrModel(),bean.getAttrModel()); + models.add(pair); + + pair = new UDIPair(bean.getAttrColour(),bean.getAttrColour()); + colour.add(pair); + + pair = new UDIPair(bean.getAttrTrx(),bean.getAttrTrx()); + trx.add(pair); + + pair = new UDIPair(bean.getAttrYear(),bean.getAttrYear()); + year.add(pair); + } + + ArrayList list = null; + + list = new ArrayList(); + + if(!models.isEmpty()) + list.addAll(models); + + attrValues.setModel(list); + + list = new ArrayList(); + + if(!colour.isEmpty()) + list.addAll(colour); + + attrValues.setColour(list); + + list = new ArrayList(); + + if(!trx.isEmpty()) + list.addAll(trx); + + attrValues.setTrx(list); + + list = new ArrayList(); + + if(!year.isEmpty()) + list.addAll(year); + + attrValues.setYears(list); + + return attrValues; + } + + public static void editProductPrices(Properties ctx, Integer[] productIds, int priceListVersionId, BigDecimal newPrice, String trxName) throws OperationException, SystemException + { + for (int i = 0; i < productIds.length; i++) + { + editProductPrice(ctx, productIds[i].intValue(), priceListVersionId, newPrice, trxName); + } + } + + public static void editProductPrice(Properties ctx, int productId, int priceListVersionId, BigDecimal newPrice, String trxName) throws OperationException, SystemException + { + int ad_client_id = Env.getAD_Client_ID(ctx); + int ad_org_id = Env.getAD_Org_ID(ctx); + int ad_user_id = Env.getAD_User_ID(ctx); + + BigDecimal priceList = newPrice; + BigDecimal priceStd = newPrice; + BigDecimal priceLimit = newPrice; + + String updateSql = "Update M_PRODUCTPRICE set" + + " UPDATED = sysdate" + + ", UPDATEDBY = " + ad_user_id + + ", PRICELIST = " + priceList + + ", PRICESTD = " + priceStd + + ", PRICELIMIT = " + priceLimit + + ""; + + String whereClause = "" + + " where AD_CLIENT_ID =" + ad_client_id + + " and AD_ORG_ID =" + ad_org_id + + " and M_PRODUCT_ID =" + productId + + " and M_PRICELIST_VERSION_ID =" + priceListVersionId; + + String sqlStatement = updateSql + whereClause; + + System.out.println("Product Price update sql =====> " + sqlStatement); + + int i = DB.executeUpdate(sqlStatement, trxName); + + if(i<0) + { + throw new SystemException("Unable to update product price."); + } + } + + public static ProductPriceBean getProductPrice(Properties ctx, int productId, int priceListVersionId) throws SystemException + { + ProductPriceBean priceBean = null; + + int clientID = Env.getAD_Client_ID(ctx); + int orgID = Env.getAD_Org_ID(ctx); + + + StringBuffer sql = new StringBuffer("select " + + " v.M_product_id," + // 1.ProductID + " v.attr_model," + // 2.Model + " v.attr_colour," + // 3.Colour + " v.attr_trans," + // 4.Transmission + " v.attr_year," + // 5.Year + " pp.pricelist," + // 6.PriceList Price + " pp.pricestd," + // 7.Standard Price + " pl.name" + // 8.PriceList Name + " from U_VEHICLE_V v, M_product p, M_ProductPrice pp, M_PriceList pl, M_PriceList_Version plv" + + " where v.M_product_id = p.M_product_id" + + " and pp.M_product_id = p.M_product_id" + + " and pp.m_pricelist_version_id = plv.m_pricelist_version_id" + + " and plv.m_pricelist_id = pl.m_pricelist_id" + + " and p.AD_CLIENT_ID = " + clientID + + " and p.ad_org_id = " + orgID + + " and pp.m_pricelist_version_id = " + priceListVersionId + + " and v.M_product_id = " + productId + + ""); + + //System.out.println("Query for PriceListManager: " + sql); + + PreparedStatement pstmt = null; + + try + { + pstmt = DB.prepareStatement(sql.toString(),null); + ResultSet rs = pstmt.executeQuery(); + + if(rs.next()) + { + priceBean = new ProductPriceBean(); + + priceBean.setProductId(Integer.valueOf(rs.getInt(1))); + priceBean.setAttrModel(rs.getString(2)); + priceBean.setAttrColour(rs.getString(3)); + priceBean.setAttrTrx(rs.getString(4)); + priceBean.setAttrYear(rs.getString(5)); + priceBean.setPriceList(rs.getBigDecimal(6)); + priceBean.setPriceStandard(rs.getBigDecimal(7)); + priceBean.setPriceListName(rs.getString(8)); + priceBean.setPriceListVersionId(Integer.valueOf(priceListVersionId)); + + } + + rs.close(); + + } + catch (SQLException e) + { + throw new SystemException(e); + + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + + } + + pstmt = null; + } + + return priceBean; + } + + /** + * Retrieves the latest valid price list version id for this price list. + * @param ctx context + * @param priceListId id of the price list whose latest price list version id is to be returned + * @param trxName name of transaction if in transaction scope + * @return id of latest price list version or zero if none found + */ + public static int getPriceListVersionID(Properties ctx, int priceListId, String trxName) throws OperationException + { + return getPriceListVersionID(ctx, priceListId, null, trxName); + } + + + public static int getPriceListVersionID(Properties ctx, int priceListId, Timestamp date, String trxName) throws OperationException + { + MPriceList priceList = new MPriceList(ctx, priceListId, trxName); + MPriceListVersion priceListVersion = priceList.getPriceListVersion(date); + + if (priceListVersion == null) + { + throw new OperationException("No valid price list version present"); + } + + + return priceListVersion.get_ID(); + } + + public static String getCurrency(Properties ctx, int pricelistId) throws OperationException + { + MPriceList priceList = MPriceList.get(ctx, pricelistId, null); + + if (priceList == null) + throw new OperationException("Price list cannot be null!"); + + MCurrency mCurrency = new MCurrency(ctx, priceList.getC_Currency_ID(), null); + + return mCurrency.getCurSymbol(); + + } + + public static MPriceList createPriceList(Properties ctx, String name, int currencyId, int precision, + boolean isSOPriceList, String trxName) throws OperationException + { + MPriceList priceList = createOrUpdatePriceList(ctx, 0, name, true, true, true, true, isSOPriceList, false, + Env.getAD_Org_ID(ctx), currencyId, precision, trxName); + undefaultOtherPriceLists(ctx, priceList, trxName); + return priceList; + } + + private static MPriceList createOrUpdatePriceList(Properties ctx, int priceListId, String name, boolean isActive, + boolean isDefault, boolean isMandatory, boolean isPresentForProduct, boolean isSOPriceList, + boolean isTaxIncluded, int orgId, int currencyId, int precision, String trxName) throws OperationException + { + MPriceList priceList = new MPriceList(ctx, priceListId, trxName); + priceList.setName(name); + priceList.setIsActive(isActive); + priceList.setIsMandatory(isMandatory); + priceList.setisPresentForProduct(isPresentForProduct); + priceList.setAD_Org_ID(orgId); + priceList.setC_Currency_ID(currencyId); + priceList.setIsSOPriceList(isSOPriceList); + priceList.setPricePrecision(precision); + priceList.setIsDefault(isDefault); + priceList.setIsTaxIncluded(isTaxIncluded); + PoManager.save(priceList); + + return priceList; + } + + public static void createOrUpdatePriceList(Properties ctx, PriceListBean priceListBean, String trxName) throws OperationException, InstantiationException, IllegalAccessException + { + Integer priceListId = priceListBean.getPriceListId(); + String name = priceListBean.getName(); + Integer orgId = priceListBean.getOrgId(); + Boolean isSOPriceList = priceListBean.getIsSOPriceList(); + Boolean isMandatory = priceListBean.getIsMandatory(); + Boolean isDefault = priceListBean.getIsDefault(); + Boolean isPresentForProduct = priceListBean.getIsPresentForProduct(); + Boolean isActive = priceListBean.getIsActive(); + Integer basePriceListId = priceListBean.getBasePriceListId(); + Boolean isDeleteOldRecords = priceListBean.getIsDeleteOldRecords(); + Boolean isCreatePriceList = priceListBean.getIsCreatePriceList(); + Boolean isTaxIncluded = priceListBean.getIsTaxIncluded(); + priceListId = priceListId == null? 0:priceListId; + + if (name == null || "".equals(name)) + { + throw new OperationException("Price List Name is mandatory"); + } + + orgId = orgId == null? 0 : orgId; + + if (priceListId.equals(0)) // create new price list - check whether duplicate name + { + if (CheckDuplicateEntities.checkDuplicateName(ctx,name,"M_PriceList")) + { + throw new PriceListAlreadyExistsException("A price list with that name already exists"); + } + } + + MCurrency mCurrency = CurrencyManager.getCurrency(ctx); + int currencyId = mCurrency.getC_Currency_ID(); + int precision = mCurrency.getCostingPrecision(); + + + MPriceList priceList = createOrUpdatePriceList(ctx, priceListId, name, isActive, isDefault, + isMandatory, isPresentForProduct, isSOPriceList, isTaxIncluded, orgId, currencyId, precision, trxName); + setDefaultPriceList(ctx, priceList, isDefault, trxName); + MPriceListVersion plv = getPriceListVersion(ctx, priceList.getM_PriceList_ID(), null, trxName); + // + String whereClause = "AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " and AD_Org_ID= 0"; + int discountSchemaIds[] = MDiscountSchema.getAllIDs(MDiscountSchema.Table_Name, whereClause, trxName); + if (discountSchemaIds == null || discountSchemaIds.length == 0) + { + throw new OperationException("No Discount schema defined"); + } + // + + if (plv == null) + { + plv = new MPriceListVersion(priceList); + plv.set_TrxName(trxName); + plv.setName(priceList.getName()+ " Version"); + plv.setM_DiscountSchema_ID(discountSchemaIds[0]); + if (basePriceListId != null && !basePriceListId.equals(0)) + { + MPriceListVersion basePlv = PriceListManager.getPriceListVersion(ctx, basePriceListId, null, trxName); + plv.setM_Pricelist_Version_Base_ID(basePlv.getM_PriceList_Version_ID()); + } + PoManager.save(plv); + } + if (isCreatePriceList) + { + if (basePriceListId != null && !basePriceListId.equals(0)) + { + SvrProcess priceListCreate = (SvrProcess)M_PriceList_Create.class.newInstance(); + + int columnId = MColumn.getColumn_ID(MPriceListVersion.Table_Name, MPriceListVersion.COLUMNNAME_ProcCreate); + MColumn column = MColumn.get(ctx, columnId); + int processId = column.getAD_Process_ID(); + MProcess process = MProcess.get(ctx, processId); + MPInstance pInstance = new MPInstance(process, 0); + pInstance.save(); + + MProcessPara[] params = process.getParameters(); + ProcessInfoParameter[] processParams = null; + for (MProcessPara para : params) + { + if ("DeleteOld".equals(para.getColumnName())) + { + String deleteOld = isDeleteOldRecords?"Y":"N"; + ProcessInfoParameter parameter = new ProcessInfoParameter(para.getColumnName(), deleteOld, null, null, null); + processParams = new ProcessInfoParameter[]{parameter}; + } + } + + ProcessInfo pi = new ProcessInfo(process.getName(), processId); + pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID()); + pi.setRecord_ID(plv.getM_PriceList_Version_ID()); + pi.setParameter(processParams); + + priceListCreate.startProcess(ctx, pi, Trx.get(trxName, false)); + } + } + + priceListBean.setPriceListId(priceList.getM_PriceList_ID()); + } + + public static void setDefaultPriceList(Properties ctx, MPriceList priceList, boolean isDefault, String trxName) throws OperationException + { + if (isDefault && priceList.isActive()) + { + // set this price list in terminal and set all other price lists as not default + priceList.setIsDefault(isDefault); + POSTerminalManager.setTerminalPriceListId(ctx, priceList.getM_PriceList_ID(), priceList.isSOPriceList(), trxName); + undefaultOtherPriceLists(ctx, priceList, trxName); + } + else // check whether this price list was set in terminal/web store before. Do not 'undefault' if that is the case + { + if (isPriceListOnTerminal(ctx, priceList)) + { + priceList.setIsDefault(true); + priceList.setIsActive(true); + } + else + { + priceList.setIsDefault(false); + } + } + priceList.save(trxName); + } + + private static boolean isPriceListOnTerminal(Properties ctx, MPriceList priceList) throws TerminalNotFoundException + { + int priceListId = priceList.getM_PriceList_ID(); + + int terminalPriceListId = POSTerminalManager.getPriceListId(ctx, priceList.isSOPriceList()); + + if (priceListId == terminalPriceListId) + { + return true; + } + else + { + return false; + } + } + + private static void undefaultOtherPriceLists(Properties ctx, MPriceList priceList, String trxName) throws OperationException + { + ArrayList list = new ArrayList(); + if (priceList.isSOPriceList()) + { + list = getPriceLists(ctx, 0, null, true, true, null, true, trxName); + } + else + { + list = getPriceLists(ctx, 0, null, true, true, null, false, trxName); + } + if (!list.isEmpty()) + { + Iterator iter = list.iterator(); + while (iter.hasNext()) + { + PriceListBean bean = iter.next(); + Integer id = bean.getPriceListId(); + if (id != null || id != 0) + { + MPriceList pl = MPriceList.get(ctx, id, trxName); + if (priceList.getM_PriceList_ID() != id) + { + pl.setIsDefault(false); + PoManager.save(pl); + } + } + } + } + } + + /** + * Loads a particular price list version for a price list as per valid from. + * + * @return price list version for a particular date + * @param ctx context + * @param priceListId id of price list whose version needs to be loaded + * @param validFrom valid from date + * @param trxName name of transaction if in transaction scope + * + */ + public static MPriceListVersion getPriceListVersion(Properties ctx, int priceListId, Timestamp validFrom, String trxName) + { + MPriceList priceList = new MPriceList(ctx, priceListId, trxName); + + return priceList.getPriceListVersion(validFrom); + } + + /** + * Retrieves all valid price lists for this product. + * @param ctx + * @param productId + * @param orgId + * @param trxName + * @return + * @throws OperationException + */ + public static ArrayList getProductPriceLists(Properties ctx, int productId, int orgId, String trxName) throws OperationException + { + Boolean isActive = true; + Boolean isDefault = null; + Boolean isPresentForProduct = true; + Boolean isSOPriceList = null; + + return getProductPriceLists(ctx, productId, orgId, isActive, isDefault, + isPresentForProduct, isSOPriceList, trxName); + } + + public static ArrayList getProductPriceLists(Properties ctx, int productId, int orgId, Boolean isActive, + Boolean isDefault, Boolean isPresentForProduct, Boolean isSOPriceList, String trxName) throws OperationException + { + MProduct product = MProduct.get(ctx, productId); + ArrayList list = getPriceLists(ctx, orgId, "", isActive, isDefault, + isPresentForProduct, isSOPriceList, trxName); + ArrayList productPriceList = new ArrayList(); + for (int i = 0; i< list.size(); i++) + { + PriceListBean priceListBean = list.get(i); + MPriceList pl = MPriceList.get(ctx, priceListBean.getPriceListId(), trxName); + MPriceListVersion plv = getPriceListVersion(ctx, priceListBean.getPriceListId(), null, trxName); + MProductPrice pp = MProductPrice.get(ctx, plv.getM_PriceList_Version_ID(), productId, trxName); + + BigDecimal stdPrice = Env.ZERO; + BigDecimal limitPrice = Env.ZERO; + BigDecimal listPrice = Env.ZERO; + BigDecimal stdPriceIncl = Env.ZERO; + BigDecimal limitPriceIncl = Env.ZERO; + BigDecimal listPriceIncl = Env.ZERO; + + if (pp != null) + { + stdPrice = pp.getPriceStd(); + limitPrice = pp.getPriceLimit(); + listPrice = pp.getPriceList(); + } + ProductBean productBean = new ProductBean(); + MOrg org = MOrg.get(ctx, plv.getAD_Org_ID()); + + productBean.setProductId(productId); + productBean.setPriceListName(priceListBean.getName()); + productBean.setIsSOPriceList(pl.isSOPriceList()); + productBean.setOrgId(org.get_ID()); + productBean.setOrgName(org.getName()); + productBean.setPriceListId(plv.getM_PriceList_ID()); + productBean.setPriceListVersionId(plv.getM_PriceList_Version_ID()); + productBean.setIsMandatory(pl.isMandatory()); + productBean.setIsActive(pl.isActive()); + productBean.setIsPresentForProduct(pl.isPresentForProduct()); + productBean.setIsDefault(pl.isDefault()); + productBean.setIsTaxIncluded(pl.isTaxIncluded()); + + if (!pl.isTaxIncluded()) + { + productBean.setStdPrice(stdPrice); + productBean.setLimitPrice(limitPrice); + productBean.setListPrice(listPrice); + + if (productId != 0) + { + MTaxCategory taxCategory = new MTaxCategory(ctx,product.getC_TaxCategory_ID(),trxName); + MTax tax = TaxManager.getTaxFromCategory(ctx, taxCategory.getC_TaxCategory_ID(), trxName); + + BigDecimal taxRate = tax.getRate().divide(Env.ONEHUNDRED); + + listPriceIncl = listPrice.multiply(taxRate).add(listPrice); + listPriceIncl = listPriceIncl.setScale(listPrice.scale(), RoundingMode.HALF_UP); + stdPriceIncl = stdPrice.multiply(taxRate).add(stdPrice); + stdPriceIncl = stdPriceIncl.setScale(stdPrice.scale(), RoundingMode.HALF_UP); + limitPriceIncl = limitPrice.multiply(taxRate).add(limitPrice); + limitPriceIncl = limitPriceIncl.setScale(limitPrice.scale(), RoundingMode.HALF_UP); + + productBean.setListPriceIncl(listPriceIncl); + productBean.setStdPriceIncl(stdPriceIncl); + productBean.setLimitPriceIncl(limitPriceIncl); + + } + else + { + productBean.setLimitPriceIncl(Env.ZERO); + productBean.setStdPriceIncl(Env.ZERO); + productBean.setListPriceIncl(Env.ZERO); + } + } + else + { + productBean.setStdPriceIncl(stdPrice); + productBean.setListPriceIncl(listPrice); + productBean.setLimitPriceIncl(limitPrice); + + if (productId != 0) + { + MTaxCategory taxCategory = new MTaxCategory(ctx,product.getC_TaxCategory_ID(),trxName); + MTax tax = TaxManager.getTaxFromCategory(ctx, taxCategory.getC_TaxCategory_ID(), trxName); + + BigDecimal taxRateFactor = (tax.getRate().divide(Env.ONEHUNDRED)).add(Env.ONE); + productBean.setStdPrice(stdPrice.divide(taxRateFactor, 2, RoundingMode.HALF_DOWN)); + productBean.setListPrice(listPrice.divide(taxRateFactor, 2, RoundingMode.HALF_DOWN)); + productBean.setLimitPrice(limitPrice.divide(taxRateFactor, 2, RoundingMode.HALF_DOWN)); + } + else + { + productBean.setLimitPrice(Env.ZERO); + productBean.setStdPrice(Env.ZERO); + productBean.setListPrice(Env.ZERO); + } + } + productPriceList.add(productBean); + } + + return productPriceList; + } + + + /** + * Retrieves all price lists under certain conditions + * @param ctx context + * @param isSOPriceList parameter to load sales/purchase price lists. Loads both if null. + * @param trxName name of transaction if in transaction scope + * @return an arraylist of PriceListBean (which is empty if no matching price lists are found). + */ + public static ArrayList getPriceLists(Properties ctx, int adOrgId, boolean isSOPriceList, String trxName) + { + return getPriceLists(ctx, adOrgId, null, Boolean.TRUE, null, null, isSOPriceList, trxName); + } + + /** + * Retrieves all price lists under certain conditions + * @param ctx context + * @param orgId id of the organisation (can be zero in case all orgs as per the role_org_access are to be queried). + * @param name name of the price list (case insensitive and matches any pricelist containing the specified string). Escaped if null. + * @param isActive parameter to load active or inactive price lists. Loads both if parameter is null. + * @param isDefault parameter to load that price list which is default. Typically only one price list can be default at a time. Escaped if null. + * @param isPresentForProduct parameter to load price lists which appear/do not appear on product screen. Loads both if parameter is null. + * @param isSOPriceList parameter to load sales/purchase price lists. Loads both if null. + * @param trxName name of transaction if in transaction scope + * @return an arraylist of PriceListBean (which is empty if no matching price lists are found). + */ + public static ArrayList getPriceLists(Properties ctx, int orgId, String name, + Boolean isActive, Boolean isDefault, Boolean isPresentForProduct, Boolean isSOPriceList, String trxName) + { + StringBuffer whereClause = new StringBuffer(); + + whereClause.append("AD_Client_ID = "+ Env.getAD_Client_ID(ctx)); + + if (orgId == 0) + { + whereClause.append(" AND AD_Org_ID IN (0, " + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+ ")"); + } + else + { + whereClause.append(" AND AD_Org_ID IN ("+ orgId+")"); + } + + if (name!= null && !name.equals("")) + { + whereClause.append(" AND UPPER(name) LIKE UPPER('%"+name+"%')"); + } + + if (isActive !=null) + { + String is_Active = isActive?"'Y'":"'N'"; + whereClause.append(" AND isActive = " + is_Active); + } + + if (isDefault != null) + { + String is_Default = isDefault?"'Y'":"'N'"; + whereClause.append(" AND isDefault = " + is_Default); + } + + if (isPresentForProduct !=null) + { + String is_PresentForProduct = isPresentForProduct?"'Y'":"'N'"; + whereClause.append(" AND isPresentForProduct = " + is_PresentForProduct); + } + + if (isSOPriceList!=null) + { + String is_SOPriceList = isSOPriceList?"'Y'":"'N'"; + whereClause.append(" AND isSOPriceList = " + is_SOPriceList); + } + int[] priceListIds = MPriceList.getAllIDs(MPriceList.Table_Name, whereClause.toString(), trxName); + + ArrayList list = new ArrayList(); + + if (priceListIds == null || priceListIds.length == 0) + { + return list; + } + + for (int id : priceListIds) + { + MPriceList priceList = new MPriceList(ctx, id, trxName); + MOrg org = MOrg.get(ctx, priceList.getAD_Org_ID()); + + PriceListBean bean = new PriceListBean(); + bean.setName(priceList.getName()); + bean.setIsMandatory(priceList.isMandatory()); + bean.setIsDefault(priceList.isDefault()); + bean.setIsPresentForProduct(priceList.isPresentForProduct()); + bean.setPriceListId(priceList.getM_PriceList_ID()); + bean.setOrgName(org.getName()); + bean.setOrgId(priceList.getAD_Org_ID()); + bean.setIsActive(priceList.isActive()); + bean.setIsSOPriceList(priceList.isSOPriceList()); + list.add(bean); + } + + return list; + } + + + public static PriceListBean getPriceList(Properties ctx, + Integer priceListId, String trxName) + { + MPriceList priceList = MPriceList.get(ctx, priceListId, trxName); + MOrg org = MOrg.get(ctx, priceList.getAD_Org_ID()); + + PriceListBean bean = new PriceListBean(); + bean.setName(priceList.getName()); + bean.setIsMandatory(priceList.isMandatory()); + bean.setIsDefault(priceList.isDefault()); + bean.setIsPresentForProduct(priceList.isPresentForProduct()); + bean.setPriceListId(priceList.getM_PriceList_ID()); + bean.setOrgName(org.getName()); + bean.setOrgId(priceList.getAD_Org_ID()); + bean.setIsActive(priceList.isActive()); + bean.setIsSOPriceList(priceList.isSOPriceList()); + bean.setIsTaxIncluded(priceList.isTaxIncluded()); + return bean; + } + + /** + * Updates product price. + * The product and price list are obtained from the product bean. The latest price list version is used. + * @param ctx context + * @param productBean product bean + * @param trxName name of transaction if in transaction scope + * @throws OperationException Exception thrown if price list is mandatory but no prices entered for product. + */ + public static void updatePriceLists(Properties ctx, ProductBean productBean, + String trxName) throws OperationException + { + ArrayList list = productBean.getProductBeanList(); + + if (list!=null) + { + int productId = productBean.getProductId(); + Iterator iter = list.iterator(); + while (iter.hasNext()) + { + ProductBean bean = iter.next(); + + int priceListId = bean.getPriceListId(); + + BigDecimal stdPrice = bean.getStdPrice(); + BigDecimal listPrice = bean.getListPrice(); + BigDecimal limitPrice = bean.getLimitPrice(); + + MPriceList priceList = MPriceList.get(ctx, priceListId, trxName); + + if (priceList.isTaxIncluded()) + { + stdPrice = bean.getStdPriceIncl(); + listPrice = bean.getListPriceIncl(); + limitPrice = bean.getLimitPriceIncl(); + } + updatePriceLists(ctx, productId, priceListId, stdPrice, listPrice, limitPrice, trxName); + } + } + } + + public static void updatePriceLists(Properties ctx, int productId, int priceListId, + BigDecimal stdPrice, BigDecimal listPrice, BigDecimal limitPrice, + String trxName) throws OperationException + { + MPriceList priceList = MPriceList.get(ctx, priceListId, trxName); + + double price_Std = stdPrice == null? 0f: stdPrice.doubleValue(); + double price_List = listPrice == null? 0f:listPrice.doubleValue(); + double price_Limit = limitPrice == null? 0f: limitPrice.doubleValue(); + + int priceListVersionId = getPriceListVersionID(ctx, priceListId, trxName); + MProductPrice productPrice = MProductPrice.get(ctx, priceListVersionId, productId, trxName); + + if (productPrice == null) + { + productPrice = new MProductPrice(ctx, priceListVersionId, productId, trxName); + } + if (priceList.isMandatory()) + { + StringBuffer ex = new StringBuffer(priceList.getName() + " is mandatory"); + int length = ex.length(); + + if (price_Std == 0f) + { + ex.append(", standard price"); + } + if (priceList.isSOPriceList()) + { + if (price_List == 0f) + { + ex.append(", list price"); + } + if (price_Limit == 0f) + { + ex.append(", limit price"); + } + } + if (ex.length() > length) + { + throw new MandatoryException(ex.toString() + " cannot be zero"); + } + } + + if (priceList.isSOPriceList()) + { + productPrice.setPriceLimit(limitPrice); + productPrice.setPriceList(listPrice); + productPrice.setPriceStd(stdPrice); + } + else + { + productPrice.setPriceStd(stdPrice); + productPrice.setPriceLimit(stdPrice); + productPrice.setPriceList(stdPrice); + } + + PoManager.save(productPrice); + } + + /** + * Constructs and returns an Arraylist of Key-Name pair for price lists. + * @param ctx context + * @param priceLists arraylist of pricelists (each price list bean will have its id and name mapped) + * @return arraylist of KeyNamePair + */ + public static ArrayList getKeyNamePair(Properties ctx, + ArrayList priceLists) + { + ArrayList knp = new ArrayList(); + knp.add(new KeyNamePair(0,"")); + if (priceLists != null) + { + + Iterator iter = priceLists.iterator(); + while (iter.hasNext()) + { + PriceListBean bean = iter.next(); + + KeyNamePair keyNamePair = new KeyNamePair(bean.getPriceListId(), bean.getName()); + knp.add(keyNamePair); + } + } + return knp; + } + + public static PriceListBean getPriceListBean(Properties ctx, + ArrayList list, Integer priceListId, Boolean isNext) throws OperationException + { + int index = -1; + + if (priceListId == null || priceListId == 0) + { + PriceListBean priceListBean = new PriceListBean(); + priceListBean.setPriceListId(0); + priceListBean.setOrgId(0); + return priceListBean; + } + else + { + if (list != null) + { + Iterator iter = list.iterator(); + + while (iter.hasNext()) + { + PriceListBean currBean = iter.next(); + if (currBean.getPriceListId().equals(priceListId)) + { + index = list.indexOf(currBean); + } + } + if (index != -1) + { + if (isNext!=null) + { + if (isNext) + { + int nextIndex = (index + 1)%list.size(); + index = nextIndex; + } + else + { + int previousIndex = (index-1)%list.size(); + if (previousIndex < 0) + { + previousIndex += list.size(); + } + index = previousIndex; + } + } + return getPriceList(ctx, list.get(index).getPriceListId(), null); + } + else + { + throw new OperationException("no pricelist not found in search list"); + } + } + else + { + return getPriceList(ctx, priceListId, null); + } + } + } + + /** + * Load Price Lists as HTML with Select Tag + * @param ctx + * @param bean + * @return + */ + public static String loadPriceListAsHTMLSelect(Properties ctx, ArrayList bean) + { + StringBuffer selectHTML = new StringBuffer(); + + int m_pricelist_id = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + + selectHTML.append(""); + + return selectHTML.toString(); + } + + + public static Integer getDefaultPriceListId(Properties ctx, boolean isSOTrx) throws OperationException + { + return POSTerminalManager.getPriceListId(ctx, isSOTrx); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductAttributeManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductAttributeManager.java new file mode 100644 index 0000000000..02f0830d45 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductAttributeManager.java @@ -0,0 +1,193 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 28, 2005 by praveen + * + */ +package org.posterita.businesslogic.administration; + +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MAttribute; +import org.compiere.model.MAttributeSet; +import org.compiere.model.MAttributeUse; +import org.compiere.model.MAttributeValue; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.beans.AttributeValueDetailBean; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductInStockException; +import org.posterita.exceptions.SystemException; +import org.posterita.util.PoManager; + + +public class ProductAttributeManager +{ + public static ArrayList getProductAttributes(Properties ctx, int attributeSetId) throws OperationException, SystemException + { + MAttributeSet attributeSet = new MAttributeSet(ctx, attributeSetId, null); + + MAttribute[] attributes = attributeSet.getMAttributes(false); + + KeyNamePair pair; + ArrayList list = new ArrayList(); + for (int i = 0; i< attributes.length; i++) + { + pair = new KeyNamePair(attributes[i].get_ID(), attributes[i].getName()); + list.add(pair); + + } + + return list; + } + + public static ArrayList getProductAttributeValues(Properties ctx, int attributeId, int productCategoryId) + { + MAttribute attribute = new MAttribute(ctx, attributeId, null); + MAttributeValue attributeValue[] = attribute.getMAttributeValues(); + + int[] attributeValueIds = MAttributeValue.getAllIDs(MAttributeValue.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and m_attribute_id=" + attributeId + " and m_product_category_id=" + productCategoryId+" and isActive='Y' order by name", null); + + ArrayList attributeValues = new ArrayList(); + + if (attributeValue == null) + return attributeValues; + + MAttributeValue value; + for(int i=0;i getProductAttributeValuesDescription(Properties ctx, int attributeId, int productCategoryId, boolean showActiveOnly) + { + MAttribute attribute = new MAttribute(ctx, attributeId, null); + MAttributeValue attributeValue[] = attribute.getMAttributeValues(); + + String isActiveSQL = " "; + + if(showActiveOnly) + { + isActiveSQL = " and isActive = 'Y' "; + } + + int[] attributeValueIds = MAttributeValue.getAllIDs(MAttributeValue.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and m_attribute_id=" + attributeId + " and m_product_category_id=" + productCategoryId+ isActiveSQL +" order by name", null); + + ArrayList attributeValues = new ArrayList(); + + if (attributeValue == null) + return attributeValues; + + MAttributeValue value; + for(int i=0;i 0) + { + throw new ProductInStockException("Unable to perform action. There are some products that use the attribute value."); + } + + MAttributeValue attrValue = new MAttributeValue(ctx,attributeValueId,trxName); + + if(attrValue.isActive()) + { + attrValue.setIsActive(false); + } + else + { + attrValue.setIsActive(true); + } + + PoManager.save(attrValue); + + } + + public static MAttribute createAttribute(Properties ctx, String name) throws OperationException + { + MAttribute attribute = new MAttribute(ctx, 0, null); + attribute.setName(name); + attribute.setAttributeValueType(MAttribute.ATTRIBUTEVALUETYPE_List); + attribute.setIsMandatory(true); + PoManager.save(attribute); + return attribute; + + } + + /*public static void createAttributeUse(Properties ctx, MAttributeSet attributeSet, String attributeKey) throws OperationException + { + MAttribute attribute = ( MAttribute) GenericProductAttributeFactory.getFactoryInstance().get(ctx, attributeKey); + + int attributeUseIds[] = MAttributeUse.getAllIDs(MAttributeUse.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and m_attribute_id=" + attribute.get_ID() + " and m_attributeSet_id=" + attributeSet.get_ID(), null); + + if (attributeUseIds.length!=0) + return; + + MAttributeUse attributeUse = new MAttributeUse(ctx, 0 , null); + attributeUse.setM_AttributeSet_ID(attributeSet.get_ID()); + attributeUse.setM_Attribute_ID(attribute.get_ID()); + attributeUse.setSeqNo(10); + PoManager.save(attributeUse); + + }*/ + + public static void createAttributeUse(Properties ctx, MAttributeSet attributeSet, MAttribute attribute) throws OperationException + { + int attributeUseIds[] = MAttributeUse.getAllIDs(MAttributeUse.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and m_attribute_id=" + attribute.get_ID() + " and m_attributeSet_id=" + attributeSet.get_ID(), null); + + if (attributeUseIds.length!=0) + return; + + MAttributeUse attributeUse = new MAttributeUse(ctx, 0 , null); + attributeUse.setM_AttributeSet_ID(attributeSet.get_ID()); + attributeUse.setM_Attribute_ID(attribute.get_ID()); + attributeUse.setSeqNo(10); + PoManager.save(attributeUse); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductImageManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductImageManager.java new file mode 100644 index 0000000000..135844866c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductImageManager.java @@ -0,0 +1,484 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Apr 25, 2006 by praveen + * + */ + +package org.posterita.businesslogic.administration; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.font.FontRenderContext; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Calendar; +import java.util.Iterator; +import java.util.Properties; + +import javax.imageio.IIOImage; +import javax.imageio.ImageIO; +import javax.imageio.ImageWriteParam; +import javax.imageio.ImageWriter; +import javax.imageio.stream.MemoryCacheImageOutputStream; +import javax.swing.ImageIcon; + +import org.compiere.model.MAttachment; +import org.compiere.model.MProduct; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Trx; + +import org.posterita.businesslogic.ProductImageUploader; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.OperationException; +import org.posterita.util.PathInfo; + + +public class ProductImageManager +{ + private static transient byte[] backgroundImageData = null; + public static final String backImageFileName = "/images/pos/ImageBack.jpg"; + + public static byte[] getBackImageData() throws OperationException + { + if(backgroundImageData != null) + return backgroundImageData; + + try + { + String homePath = PathInfo.PROJECT_HOME; + File imgFile = new File(homePath + backImageFileName); + FileInputStream fileInStream = new FileInputStream(imgFile); + ByteArrayOutputStream byteArrStream = new ByteArrayOutputStream(); + BufferedInputStream bufferedInStream = new BufferedInputStream(fileInStream); + byte data[] = new byte[1024]; + int read = 0; + while((read = bufferedInStream.read(data)) != -1) + { + byteArrStream.write(data, 0, read); + } + byteArrStream.flush(); + backgroundImageData = byteArrStream.toByteArray(); + bufferedInStream.close(); + byteArrStream.close(); + fileInStream.close(); + return backgroundImageData; + } + catch(IOException ex) + { + throw new OperationException("Could not read backgroud image", ex); + } + } + + + /** + * Adds a border round the given image + * @param ctx + * @param m_product_id + * @param borderWidth - the border width + * @return a new Image + * @throws OperationException + */ + public static byte[] addImageBorder(Properties ctx,int m_product_id,byte[] imageData,double borderWidth, String trxName) throws OperationException + { + String sql = "select " + + " ATTR_MODEL," + //1.model + " ATTR_COLOUR," + //2.colour + " ATTR_DESIGN," + //3.design + " ATTR_SIZE" + //4.size + " from U_TShirt_V where M_Product_ID =" + m_product_id; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + String design = null; + + try + { + pstmt = DB.prepareStatement(sql,trxName); + rs = pstmt.executeQuery(); + + if(rs.next()) + { + design = rs.getString(3); + } + else + { + throw new OperationException("Unable to get product's attributes!"); + } + + //------------------------------------------------------------------------------------------- + + Color borderColor = Color.DARK_GRAY; + + char copyrightSign = 169; + + String copyright_notice = copyrightSign + " " + Calendar.getInstance().get(Calendar.YEAR) + " Tamak"; + + Image image = new ImageIcon(imageData).getImage(); + + int width = image.getWidth(null); + int height = image.getHeight(null); + + double frameWidth = (double)width + 2*borderWidth; + double frameHeight = (double)height + borderWidth; + + Rectangle2D nameRect = new Rectangle2D.Double(0.0,frameHeight,frameWidth,80); + + BufferedImage bufferedImage = new BufferedImage((int)frameWidth,(int)(frameHeight + nameRect.getHeight()),BufferedImage.TYPE_USHORT_565_RGB); + Graphics2D g = (Graphics2D) bufferedImage.getGraphics(); + + g.drawImage(image,(int)borderWidth,(int)borderWidth,null); + + Rectangle2D topBorder = new Rectangle2D.Double(0.0,0.0,frameWidth,borderWidth); + //Rectangle2D bottomBorder = new Rectangle2D.Double(0.0,frameHeight-borderWidth,frameWidth,borderWidth); + Rectangle2D leftBorder = new Rectangle2D.Double(0.0,0.0,borderWidth,frameWidth); + Rectangle2D rightBorder = new Rectangle2D.Double(frameWidth-borderWidth,0.0,borderWidth,frameWidth); + + g.setColor(borderColor); + + g.fill(topBorder); + //g.fill(bottomBorder); + g.fill(leftBorder); + g.fill(rightBorder); + + + g.fill(nameRect); + g.setColor(Color.LIGHT_GRAY); + + //drawing smaill squares + double rXcoor = nameRect.getMinX(); + double rYcoor = nameRect.getMinY(); + + double h = nameRect.getHeight() - 2*borderWidth; + double w = h * 1.5; + + + + Rectangle2D rLeft = new Rectangle2D.Double(rXcoor + borderWidth, rYcoor + borderWidth, w,h); + g.fill(rLeft); + + Rectangle2D rRight = new Rectangle2D.Double(nameRect.getMaxX() - w - borderWidth, rYcoor + borderWidth, w,h); + g.fill(rRight); + + w = (rRight.getMinX() - borderWidth) - (rLeft.getMaxX() + borderWidth); + Rectangle2D rCenter = new Rectangle2D.Double(rLeft.getMaxX() + borderWidth, rYcoor + borderWidth, w, h); + g.fill(rCenter); + + + Font font = new Font("Arial", Font.PLAIN, 22); + g.setFont(font); + g.setColor(Color.WHITE); + + FontRenderContext fc = g.getFontRenderContext(); + Rectangle2D bounds = font.getStringBounds(design,fc); + + g.setFont(font); + g.drawString(design,(float)(rCenter.getMinX() + borderWidth),(float)(rCenter.getMinY() + borderWidth + bounds.getHeight())); + + //put copyright notice + g.setColor(Color.BLACK); + g.setFont(new Font("Arial", Font.PLAIN, 10)); + g.drawString(copyright_notice, (float)(2*borderWidth), (float)(frameHeight-borderWidth)); + + //get a writer and set compression + Iterator iter = ImageIO.getImageWritersByFormatName("JPG"); + + if(iter.hasNext()) + { + ImageWriter writer = (ImageWriter) iter.next(); + ImageWriteParam iwp = writer.getDefaultWriteParam(); + iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); + iwp.setCompressionQuality(0.75f); + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + MemoryCacheImageOutputStream mos = new MemoryCacheImageOutputStream(bos); + + writer.setOutput(mos); + + + + IIOImage iIOimage = new IIOImage(bufferedImage,null,null); + writer.write(null,iIOimage,iwp); + + byte retData[] = bos.toByteArray(); + mos.close(); + bos.close(); + return retData; + } + + rs.close(); + + } + catch (Exception e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + pstmt = null; + } + + return null; + } + + /** + * Removes the image's background + * @param img + * @param offset - range of color + * @return + */ + + public static Image removeBgColor(Image img, int offset) + { + return null; + } + + /** + * Clips the given image + * @param imageData + * @param width + * @param height + * @return + * @throws IOException + */ + public static byte[] clipImage(byte[] imageData,int width,int height) throws IOException + { + Image image = new ImageIcon(imageData).getImage(); + + BufferedImage bufferedImage = new BufferedImage(image.getWidth(null),image.getHeight(null),BufferedImage.TYPE_INT_RGB); + + Graphics graphics = bufferedImage.getGraphics(); + graphics.drawImage(image,0,0,null); + + int actualWidth = image.getWidth(null); + int actualHeight = image.getHeight(null); + + width = (actualWidth < width) ? actualWidth : width; + height = (actualHeight < height) ? actualHeight : height; + + //int x = 0, y = 250, w = 400, h = 380; + + // Clip the central part of the image + int x = (actualWidth - width)/2; + int y = (actualHeight - height)/2; + + bufferedImage = bufferedImage.getSubimage(x,y,width,height); + + //get a writer and set compression + Iterator iter = ImageIO.getImageWritersByFormatName("JPG"); + + if(iter.hasNext()) + { + ImageWriter writer = (ImageWriter) iter.next(); + ImageWriteParam iwp = writer.getDefaultWriteParam(); + iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); + iwp.setCompressionQuality(0.75f); + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + MemoryCacheImageOutputStream mos = new MemoryCacheImageOutputStream(bos); + + writer.setOutput(mos); + + IIOImage iIOimage = new IIOImage(bufferedImage,null,null); + writer.write(null,iIOimage,iwp); + + return bos.toByteArray(); + } + + return null; + + } + + + public static byte[] addImageSquareBorder(Properties ctx, byte[] imageData,double borderWidth, String trxName) throws OperationException + { + + + char copyrightSign = 169; + String copyright_notice = copyrightSign + " " + Calendar.getInstance().get(Calendar.YEAR) + " Tamak"; + + Image image = new ImageIcon(imageData).getImage(); + Image backImage = new ImageIcon(getBackImageData()).getImage(); + + + int width = image.getWidth(null); + int height = image.getHeight(null); + + int frameWidth = backImage.getWidth(null); + int frameHeight = backImage.getHeight(null); + + + BufferedImage bufferedImage = new BufferedImage((int)frameWidth,(int)(frameHeight),BufferedImage.TYPE_USHORT_565_RGB); + Graphics2D g = (Graphics2D) bufferedImage.getGraphics(); + + // Draw back image + g.drawImage(backImage, 0, 0, null); + + + // Draw Image in the center of the background + double imagePosX = (frameWidth - (double)width)/2; + double imagePosY = (frameHeight - (double)height)/2; + g.drawImage(image, (int)imagePosX, (int)imagePosY, null); + + // Put Copyright Notice + g.setColor(Color.BLACK); + g.setFont(new Font("Arial", Font.PLAIN, 10)); + g.drawString(copyright_notice, 10.0F, (float)(frameHeight - 5)); + + //get a writer and set compression + Iterator iter = ImageIO.getImageWritersByFormatName("JPG"); + + if(iter.hasNext()) + { + ImageWriter writer = (ImageWriter) iter.next(); + ImageWriteParam iwp = writer.getDefaultWriteParam(); + iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); + iwp.setCompressionQuality(0.75f); + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + MemoryCacheImageOutputStream mos = new MemoryCacheImageOutputStream(bos); + + writer.setOutput(mos); + + try + { + IIOImage iIOimage = new IIOImage(bufferedImage,null,null); + writer.write(null,iIOimage,iwp); + + byte retData[] = bos.toByteArray(); + mos.close(); + bos.close(); + return retData; + } + catch(IOException ex) + { + throw new OperationException("Could not write image", ex); + } + } + + throw new OperationException("JPG Image format is not supported!!!"); + + } + + public static void reprocessAllProductImages(Properties ctx) throws OperationException + { + int adClientID = Env.getAD_Client_ID(ctx); + + String sqlStmt = "Select M_Product_ID from M_Product where AD_Client_ID=" + adClientID + + " and AD_Org_ID=" + Env.getAD_Org_ID(ctx); + + PreparedStatement pstmt = null; + + try + { + pstmt = DB.prepareStatement(sqlStmt, null); + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + int productId = rs.getInt(1); +// System.out.println(productId); + reprocessImage(ctx, productId); + } + + rs.close(); + } + catch(SQLException ex) + { + throw new OperationException("Could not execute query for products: " + sqlStmt, ex); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + } + + public static void reprocessImages(Properties ctx, int productIds[], String trxName) throws OperationException + { + for(int i = 0; i < productIds.length; i++) + { + reprocessImage(ctx, productIds[i]); + } + } + + public static void reprocessImages(Properties ctx, Integer productIds[]) throws OperationException + { + for(int i = 0; i < productIds.length; i++) + { + reprocessImage(ctx, productIds[i].intValue()); + } + } + + public static void reprocessImage(Properties ctx, int productId) + { + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + + try + { + trx.start(); + ProductImageUploader.generateAllSubImages(ctx, productId, trx.getTrxName()); + trx.commit(); + } + catch(OperationException ex) + { + trx.rollback(); + } + finally + { + trx.close(); + } + } + + public static void clearImages(Properties ctx, int product_id, String trxName) + { + MAttachment attachment = MAttachment.get(ctx,MProduct.Table_ID,product_id); + if(attachment != null) + { + attachment.delete(true); + } + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductManager.java new file mode 100644 index 0000000000..9944cda1f1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/ProductManager.java @@ -0,0 +1,1056 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 19, 2005 by alok + * + */ +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.compiere.model.MAttachment; +import org.compiere.model.MAttachmentEntry; +import org.compiere.model.MAttributeValue; +import org.compiere.model.MPriceList; +import org.compiere.model.MProduct; +import org.compiere.model.MProductPrice; +import org.compiere.model.MRevenueRecognition; +import org.compiere.model.MSequence; +import org.compiere.model.MTax; +import org.compiere.model.MTaxCategory; +import org.compiere.model.MUOM; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.ProductBean; +import org.posterita.beans.ProductDetailsBean; +import org.posterita.beans.ProductImageBean; +import org.posterita.beans.ProductImageInfo; +import org.posterita.beans.ProductQuery; +import org.posterita.beans.ProductStatusBean; +import org.posterita.beans.SearchBean; +import org.posterita.businesslogic.POSProductManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.SearchManager; +import org.posterita.businesslogic.StoreManager; +import org.posterita.businesslogic.core.AttachmentManager; +import org.posterita.businesslogic.product.GenericProductImpl; +import org.posterita.businesslogic.product.IProduct; +import org.posterita.exceptions.AttachmentNotFoundException; +import org.posterita.exceptions.BarcodeAlreadyExistsException; +import org.posterita.exceptions.CannotInactivateProductException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.SystemException; +import org.posterita.lib.UdiConstants; +import org.posterita.model.MMAttachment; +import org.posterita.util.PoManager; + +public class ProductManager +{ + public static final String PRODUCT_ATTRIBUTES_DELIMETER = "~"; + + private static IProduct getProductInterface(Properties ctx, int productId, String trxName) throws OperationException + { + return new GenericProductImpl(); + } + + public static int getSimilarProduct(Properties ctx, String productName, String trxName) + { + productName=productName.replaceAll("'","''"); + String whereClause = "AD_Client_id="+Env.getAD_Client_ID(ctx)+ + " and Upper(name) =Upper('"+productName + "')"; + + int productIds[] = MProduct.getAllIDs(MProduct.Table_Name, whereClause, trxName); + + if(productIds.length == 0) + return 0; + else + return productIds[0]; + } + + public static boolean isBarCodePresent(Properties ctx,String barCode, String trxName) + { + String whereClause = "AD_Client_id="+Env.getAD_Client_ID(ctx)+ + " and UPC ='"+barCode + "'"; + + int productIds[] = MProduct.getAllIDs(MProduct.Table_Name, whereClause, trxName); + + if(productIds.length == 0) + return false; + else + return true; + } + public static int getUOMPrecision(Properties ctx, Integer productId) + { + MProduct product = MProduct.get(ctx, productId); + int uomId = product.getC_UOM_ID(); + int precision = MUOM.getPrecision(ctx, uomId); + + return precision; + } + + + public static String getAttributeSearchSQL(Properties ctx, ProductQuery query) throws OperationException + { + int[] attributeValues = query.getAttributeValueIds(); + + String attributeSearchSQL = ""; + + MAttributeValue attributeValue; + for (int i = 0; i < attributeValues.length; i++) + { + if (attributeValues[i]!= 0) + { + attributeValue = new MAttributeValue(ctx, attributeValues[i], null ); + attributeSearchSQL = attributeSearchSQL + generateAttributeSearchSQL(ctx, attributeValue.getM_Attribute_ID(), attributeValue.getM_AttributeValue_ID()); + } + } + + return attributeSearchSQL; + } + + private static String generateAttributeSearchSQL(Properties ctx, int attributeId, int attributeValueId) throws OperationException + { + + String sql = " AND p.M_AttributeSetInstance_ID IN" + + " (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE M_Attribute_ID=@M_ATTRIBUTE_ID@ AND M_AttributeValue_ID=@M_ATTRIBUTEVALUE_ID@ and AD_CLIENT_ID = " + Env.getAD_Client_ID(ctx) + " and AD_ORG_ID = " + Env.getAD_Org_ID(ctx) + " )"; + + sql = sql.replaceAll("@M_ATTRIBUTE_ID@", "" + attributeId); + sql = sql.replaceAll("@M_ATTRIBUTEVALUE_ID@", "" + attributeValueId); + + return sql; + } + + public static void sortProducts(Properties ctx, ArrayList products) + { + Comparator productNameComparator = new Comparator() + { + public int compare(ProductBean o1, ProductBean o2) + { + ProductBean bean1 = (ProductBean) o1; + ProductBean bean2 = (ProductBean) o2; + + if (bean1.getProductName() == null) + return -1; + + if (bean2.getProductName() == null) + return -1; + + return (bean1.getProductName().compareToIgnoreCase(bean2.getProductName())); + + } + }; + Collections.sort(products, productNameComparator); + } + + public static BigDecimal getStdPrice(Properties ctx, int priceListVersionId, int productId, boolean isSales, String trxName) throws OperationException + { + + MProductPrice pp = MProductPrice.get(ctx, priceListVersionId, productId, trxName); + BigDecimal price = Env.ZERO; + if (pp!=null) + { + price = pp.getPriceStd(); + } + + if (price == null || price.doubleValue() == 0f) + { + pp = getTerminalOrStoreProductPrice(ctx, productId, isSales, trxName); + if (pp!=null) + { + price = pp.getPriceStd(); + } + } + return price; + } + + public static BigDecimal getListPrice(Properties ctx, int priceListVersionId, int productId, boolean isSales, String trxName) throws OperationException + { + + MProductPrice pp = MProductPrice.get(ctx, priceListVersionId, productId, trxName); + BigDecimal price = Env.ZERO; + if (pp!=null) + { + price = pp.getPriceList(); + } + + if (price == null || price.doubleValue() == 0f) + { + pp = getTerminalOrStoreProductPrice(ctx, productId, isSales, trxName); + + if (pp!=null) + { + price = pp.getPriceList(); + } + } + return price; + } + + private static MProductPrice getTerminalOrStoreProductPrice(Properties ctx, int productId, boolean isSales, String trxName) throws OperationException + { + int priceListId = 0; + + if (isSales) + { + priceListId = POSTerminalManager.getSOPriceListId(ctx); + } + else + { + priceListId = StoreManager.getPriceListId(ctx); + } + + int priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, trxName); + MProductPrice pp = MProductPrice.get(ctx, priceListVersionId, productId, trxName); + return pp; + } + + public static BigDecimal getLimitPrice(Properties ctx, int priceListVersionId, int productId, boolean isSales, String trxName) throws OperationException + { + + MProductPrice pp = MProductPrice.get(ctx, priceListVersionId, productId, trxName); + BigDecimal price = Env.ZERO; + if (pp!=null) + { + price = pp.getPriceLimit(); + } + if (price == null || price.doubleValue() == 0f) + { + pp = getTerminalOrStoreProductPrice(ctx, productId, isSales, trxName); + if (pp!=null) + { + price = pp.getPriceLimit(); + } + } + return price; + } + + public static ArrayList getProductsToAttachImage(Properties ctx, String prodNameLike, boolean isActive, boolean isWebstoreFeatured) throws OperationException + { + ArrayList productList = getProductList(ctx, prodNameLike, isActive, isWebstoreFeatured); + + Iterator iter = productList.iterator(); + + ProductStatusBean bean; + ProductImageInfo info; + + while (iter.hasNext()) + { + bean = (ProductStatusBean) iter.next(); + info = getProductImageInfo(ctx, bean.getProductId()); + bean.setHasAttachment(info.getHasAttachment()); + } + + return productList; + } + + public static ArrayList getProductList(Properties ctx, String prodNameLike, boolean isActive, boolean isWebstoreFeatured) throws OperationException + { + String sql = "select distinct m_product_id, name, isWebstoreFeatured " + + ", keyword, keyword2, keyword3, keyword4, upc,CLASSIFICATION, isSelfService " + + " from m_product where ad_org_id=" + Env.getAD_Org_ID(ctx) + + " and ad_client_id=" + Env.getAD_Client_ID(ctx); + + if(prodNameLike != null && prodNameLike.length() > 0) + { + SearchBean searchBean = SearchManager.getSearchParams(prodNameLike); + ArrayList andSearchList = searchBean.getAndCriteriasList(); + Iterator andListIter = andSearchList.iterator(); + while(andListIter.hasNext()) + { + String andCriteria = andListIter.next(); + sql += " and ( Upper(name) like Upper('%" + andCriteria + "%') "; + sql += " or Upper(keyword) like Upper('%" + andCriteria + "%') "; + sql += " or Upper(keyword2) like Upper('%" + andCriteria + "%') "; + sql += " or Upper(keyword3) like Upper('%" + andCriteria + "%') "; + sql += " or Upper(keyword4) like Upper('%" + andCriteria + "%') ) "; + } + + ArrayList orSearchList = searchBean.getOrCriteriasList(); + Iterator orListIter = orSearchList.iterator(); + if(orListIter.hasNext()) + { + sql += " and ( "; + while(orListIter.hasNext()) + { + String orCriteria = orListIter.next(); + sql += " Upper(name) like Upper('%" + orCriteria + "%') "; + sql += " or Upper(keyword) like Upper('%" + orCriteria + "%') "; + sql += " or Upper(keyword2) like Upper('%" + orCriteria + "%') "; + sql += " or Upper(keyword3) like Upper('%" + orCriteria + "%') "; + sql += " or Upper(keyword4) like Upper('%" + orCriteria + "%') or"; + } + + sql = sql.substring(0, sql.length() -3 ); + sql += " ) "; + } + } + + if(isActive) + sql += " and IsActive='Y' "; + else + sql += " and IsActive='N' "; + + if(isWebstoreFeatured) + sql += " and IsWebstoreFeatured='Y' "; + else + sql += " and IsWebstoreFeatured='N' "; + + sql += " order by name"; + + PreparedStatement ps = DB.prepareStatement(sql, null); + + ResultSet rs = null; + ProductStatusBean bean; + ArrayList productStatusList = new ArrayList(); + try + { + rs = ps.executeQuery(); + + while (rs.next()) + { + bean = new ProductStatusBean(); + bean.setProductId(Integer.valueOf(rs.getInt(1))); + bean.setProductName(rs.getString(2)); + bean.setKeyword1(rs.getString(4)); + bean.setKeyword2(rs.getString(5)); + bean.setKeyword3(rs.getString(6)); + bean.setKeyword4(rs.getString(7)); + bean.setBarCode(rs.getString(8)); + bean.setProductClassification(rs.getString(9)); + + + boolean isSelfService = false; + String selfServiceStr = rs.getString(10); + if(selfServiceStr != null) + isSelfService = "Y".equals(selfServiceStr); + + bean.setIsSelfService(isSelfService); + + boolean isWebstoredFeatured = false; + String isWStoreFeatured = rs.getString(3); + if(isWStoreFeatured != null) + isWebstoredFeatured = "Y".equals(isWStoreFeatured); + + bean.setIsWebstoreFeatured(Boolean.valueOf(isWebstoredFeatured)); + productStatusList.add(bean); + } + + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + ps.close(); + } + catch (SQLException e1) + {} + + ps = null; + } + + return productStatusList; + } + + /** + * Search product by Name and/or Description + * Ability to Search by using + concatenation + * Picks Price List and Warehouse from Terminal + * @param ctx Context + * @param nameSearch Name like search + * @param descSearch Description like search + * @param trxName Transaction + * @return List of Product Status + * @throws OperationException if error occurred in search + */ + public static ArrayList searchProducts(Properties ctx, int adOrgId, + String nameSearch, String descSearch, String trxName) throws OperationException + { + int priceListId = POSTerminalManager.getSOPriceListId(ctx); + int warehouseId = POSTerminalManager.getWarehouseId(ctx); + + return searchProducts(ctx, adOrgId, nameSearch, descSearch, priceListId, warehouseId, trxName); + } + + /** + * Search product by Name and/or Description + * Ability to Search by using + concatenation + * @param ctx Context + * @param adOrgId Organisation on which to look up for stock + * @param nameSearch Name like search + * @param descSearch Description like search + * @param priceListId Price List on which to search product prices + * @param trxName Transaction + * @return List of Product Status + * @throws OperationException if error occurred in search + */ + public static ArrayList searchProducts(Properties ctx, int adOrgId, + String nameSearch, String descSearch, + int priceListId, int warehouseId, String trxName) throws OperationException + { + if (adOrgId <= 0) + { + throw new IllegalArgumentException("Organisation mandatory"); + } + + if (warehouseId <= 0) + { + throw new IllegalArgumentException("Warehouse mandatory"); + } + + if (priceListId <= 0) + { + throw new IllegalArgumentException("Price List mandatory"); + } + + nameSearch = (nameSearch == null) ? "" : nameSearch; + descSearch = (descSearch == null) ? "" : descSearch; + + int priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null, null); + + StringTokenizer stName = new StringTokenizer(nameSearch, "+"); + StringTokenizer stDesc = new StringTokenizer(descSearch, "+"); + + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append("SELECT p.Name, "); // 1 + sqlStmt.append("p.M_Product_ID, p.UPC, p.Description, "); // 2,3,4 + sqlStmt.append("SUM(s.QtyOnHand), pp.PriceList "); // 5,6 + sqlStmt.append("FROM M_Product p INNER JOIN (M_Storage s INNER JOIN M_ProductPrice pp ON "); + sqlStmt.append("s.M_Product_ID=pp.M_Product_ID) ON p.M_Product_ID=s.M_Product_ID "); + sqlStmt.append("WHERE p.AD_Client_ID=? "); + sqlStmt.append("AND pp.M_PriceList_Version_ID=? "); + sqlStmt.append("AND s.AD_Org_ID=? "); + sqlStmt.append("AND s.M_Locator_ID IN (SELECT M_Locator_ID FROM M_Locator WHERE M_Warehouse_ID=?) "); + sqlStmt.append("AND p.AD_Org_ID IN (").append(Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)).append(") "); + + ArrayList params = new ArrayList(); + String token = null; + while(stName.hasMoreTokens()) + { + token = stName.nextToken().trim(); + token = "%" + token + "%"; + params.add(token); + + sqlStmt.append("AND UPPER(p.Name) LIKE UPPER(?)"); + } + + while(stDesc.hasMoreTokens()) + { + token = stDesc.nextToken().trim(); + token = "%" + token + "%"; + params.add(token); + + sqlStmt.append("AND UPPER(p.Description) LIKE UPPER(?)"); + } + + sqlStmt.append("AND p.IsActive='Y' AND s.IsActive= 'Y' AND pp.IsActive='Y' "); + sqlStmt.append("GROUP BY p.Name, p.M_Product_ID, p.UPC, p.Description, pp.PriceList "); + sqlStmt.append("ORDER BY p.name"); + + MPriceList spriceList = new MPriceList(ctx, priceListId, null); + + PreparedStatement pstmt = null; + ResultSet rs = null; + ProductStatusBean bean; + ArrayList productStatusList = new ArrayList(); + try + { + pstmt = DB.prepareStatement(sqlStmt.toString(), trxName); + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + pstmt.setInt(2, priceListVersionId); + pstmt.setInt(3, adOrgId); + pstmt.setInt(4, warehouseId); + + int index = 5; + + for(String s : params) + { + pstmt.setString(index, s); + index ++; + } + + rs = pstmt.executeQuery(); + + while (rs.next()) + { + String productName = rs.getString(1); + Integer productId = Integer.valueOf(rs.getInt(2)); + + MProduct product = MProduct.get(ctx, productId); + int taxCategoryId = product.getC_TaxCategory_ID(); + MTax tax = TaxManager.getTaxFromCategory(ctx, taxCategoryId, null); + + String barcode = rs.getString(3); + String description = rs.getString(4); + BigDecimal qtyOnHand = rs.getBigDecimal(5); + + + BigDecimal priceList = Env.ZERO; + if(spriceList.isTaxIncluded()) + { + priceList = rs.getBigDecimal(6); + } + else + { + priceList = rs.getBigDecimal(6).multiply((tax.getRate().divide(Env.ONEHUNDRED)).add(Env.ONE)); + } + priceList = priceList.setScale(2, RoundingMode.HALF_DOWN); + bean = new ProductStatusBean(); + bean.setProductName(productName = productName==null?"":productName); + bean.setProductId(productId); + bean.setBarCode(barcode = barcode==null?"":barcode); + bean.setDescription(description = description==null?"":description); + bean.setQtyOnHand(qtyOnHand = qtyOnHand==null?Env.ZERO:qtyOnHand); + bean.setPriceStandard(priceList = priceList==null?Env.ZERO:priceList); + productStatusList.add(bean); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + DB.close(rs, pstmt); + } + + return productStatusList; + } + + /** + * Search for product by name that is present in stock for an organisation + * @param ctx Context + * @param orgId Organisation + * @param searchString search + * @param trxName Transaction + * @return List of Product Status + * @throws OperationException if error in query execution + */ + public static ArrayList searchProductsFromStock(Properties ctx, int orgId, + String searchString, String trxName) throws OperationException + { + searchString = (searchString == null) ? "" : searchString; + + StringTokenizer st = new StringTokenizer(searchString,"+"); + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append("SELECT DISTINCT p.Name, s.M_Product_ID, p.UPC FROM M_Product p "); + sqlStmt.append("INNER JOIN M_Storage s ON p.M_Product_ID=s.M_Product_ID "); + sqlStmt.append("WHERE p.AD_Client_ID=? "); + sqlStmt.append("AND s.AD_Org_ID=? "); + + String token = null; + while(st.hasMoreTokens()) + { + token = st.nextToken().trim(); + sqlStmt.append("AND UPPER(p.Name) LIKE UPPER('%"+token+"%' ) "); + } + + sqlStmt.append("AND p.IsActive='Y' ORDER BY p.name, s.M_Product_ID, p.UPC"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + ProductStatusBean bean; + ArrayList productStatusList = new ArrayList(); + try + { + pstmt = DB.prepareStatement(sqlStmt.toString(), trxName); + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + pstmt.setInt(2, orgId); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + bean = new ProductStatusBean(); + bean.setProductId(Integer.valueOf(rs.getInt(2))); + bean.setProductName(rs.getString(1)); + bean.setBarCode(rs.getString(3)); + productStatusList.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + DB.close(rs, pstmt); + } + + return productStatusList; + } + + public static int[] getProducts(Properties ctx, String productName, String trxName) + { + int adClientId = Env.getAD_Client_ID(ctx); + int adOrgId = Env.getAD_Org_ID(ctx); + String whereClause = "AD_Client_ID=" + adClientId + " and AD_Org_ID=" + adOrgId; + whereClause += " and upper(Name) like upper('" + productName + "')"; + + int productIds[] = MProduct.getAllIDs(MProduct.Table_Name, whereClause, trxName); + + return productIds; + } + + public static int[] getProducts(Properties ctx, String name, String description, String barCode, String trxName) throws OperationException + { + String orgIds = Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + int productIds[] = getProducts(ctx, name, orgIds, description, barCode, trxName); + + return productIds; + } + public static int[] getProducts(Properties ctx, String name, String orgIds, String description, String barCode, String trxName) throws OperationException + { + int adClientId = Env.getAD_Client_ID(ctx); + + if (orgIds == null) + { + throw new OperationException("orgIds cannot be null"); + } + + StringBuffer whereClause = new StringBuffer("AD_Client_ID=" + adClientId + " AND AD_Org_ID IN (" + orgIds +")"); + + if (name != null && !"".equals(name)) + { + whereClause.append(" AND UPPER(name) LIKE UPPER('%" + name + "%')"); + + } + if (description != null && !"".equals(description)) + { + whereClause.append(" AND UPPER(description) LIKE UPPER('%" + description + "%')"); + } + if (barCode != null && !"".equals(barCode)) + { + whereClause.append(" AND UPPER(upc) = UPPER('" + barCode + "')"); + } + + int productIds[] = MProduct.getAllIDs(MProduct.Table_Name, whereClause.toString(), trxName); + + return productIds; + } + + + public static Integer[] getAllProductsHavingAttributeValue(Properties ctx, int attributeValueId) throws SystemException + { + String sql = "select prod.M_PRODUCT_ID " + + "from M_PRODUCT prod,M_ATTRIBUTEINSTANCE attrIns ,M_attribute attr,M_attributeValue attrVal " + + "where prod.M_ATTRIBUTESETINSTANCE_id = attrIns.M_ATTRIBUTESETINSTANCE_id " + + "and prod.isActive = 'Y' " + + "and attr.m_attribute_id = attrIns.M_ATTRIBUTE_ID " + + "and attrIns.m_attributevalue_id = attrVal.m_attributevalue_id " + + "and attrVal.m_attributevalue_id = " + attributeValueId ; + + + PreparedStatement pstmt = null; + ResultSet rs = null; + Integer[] productIds = null; + + try + { + pstmt = DB.prepareStatement(sql, null); + + + + rs = pstmt.executeQuery(); + ArrayList productList = new ArrayList(); + + while(rs.next()) + { + productList.add(Integer.valueOf(rs.getInt(1))); + } + + productIds = new Integer[productList.size()]; + + for(int i=0;i 1) + throw new OperationException("More than one product found with Name: " + productName); + + MProduct product = new MProduct(ctx, productIds[0], trxName); + + return product; + } + + public static MProduct loadProduct(Properties ctx, int productId, String trxName) throws ProductNotFoundException + { + MProduct product = new MProduct(ctx, productId, trxName); + if(product.get_ID() == 0) + throw new ProductNotFoundException("Could not load product with id: " + productId); + return product; + } + + public static String getDistinctFieldSQL(Properties ctx, String fieldName) + { + String sql = "select distinct(" + fieldName + ") from m_product " + + " where ad_client_id=" + Env.getAD_Client_ID(ctx) + + " and AD_Org_ID=" + Env.getAD_Org_ID(ctx) + + " and isActive='Y'" + + " and IsWebstoreFeatured='Y'" + + " and " + fieldName + " is not null"; + + return sql; + } + + + public static void activateProducts(Properties ctx, Integer[] productIds, String trxName) throws OperationException + { + setProductsActive(ctx, productIds, true, trxName); + } + + public static void inactivateProducts(Properties ctx, Integer[] productIds, String trxName) throws OperationException + { + setProductsActive(ctx, productIds, false, trxName); + } + + protected static void setProductsActive(Properties ctx, Integer[] productIds, boolean active, String trxName) throws OperationException + { + if(productIds == null) + throw new OperationException("Product Ids cannot be null"); + + for(int i = 0; i < productIds.length; i++) + { + MProduct product = new MProduct(ctx, productIds[i].intValue(), trxName); + if(product.get_ID() == 0) + throw new OperationException("Could not load product with id: " + productIds[i]); + + if(active == false) + { + String errorMsg=POSProductManager.checkQty(ctx,product.get_ID(),trxName); + if(errorMsg!=null) + throw new CannotInactivateProductException(errorMsg); + + } + product.setIsActive(active); + PoManager.save(product); + } + } + + public static void updateProductsBarcode(Properties ctx, ArrayList productList, String trxName) throws OperationException + { + Iterator iter = productList.iterator(); + + while(iter.hasNext()) + { + ProductImageBean prodImageBean = (ProductImageBean)iter.next(); + if(prodImageBean.getBarCode() != null && prodImageBean.getBarCode().length() > 0) + updateProductBarcode(ctx, prodImageBean.getProductId().intValue(), prodImageBean.getBarCode(), trxName); + } + } + + public static void updateProductBarcode(Properties ctx, int productId, String barCode, String trxName) throws BarcodeAlreadyExistsException, OperationException + { + if(isBarCodePresent(ctx, barCode, trxName)) + throw new BarcodeAlreadyExistsException("Barcode " + barCode + " has already been assigned to another product"); + MProduct product = new MProduct(ctx, productId, trxName); + if(product.get_ID() == 0) + throw new OperationException("Could not load product with id: " + productId); + + + product.setUPC(barCode); + + PoManager.save(product); + } + + + public static int[] getProductsFromAttributeValue(Properties ctx, int attributeId, int attributeValueId, String trxName) + { + int adClientId = Env.getAD_Client_ID(ctx); + int adOrgId = Env.getAD_Org_ID(ctx); + + String whereClause = "AD_Client_ID=" + adClientId + " and AD_Org_ID=" + adOrgId + " and IsActive='Y'"; + whereClause += " and M_AttributeSetInstance_ID in "; + whereClause += " (select M_AttributeSetInstance_ID from M_AttributeInstance where M_Attribute_ID=" + attributeId + " and M_AttributeValue_ID=" + attributeValueId + ")"; + + return MProduct.getAllIDs(MProduct.Table_Name, whereClause, trxName); + } + + public static boolean isProductImagePresent(Properties ctx, int productId, String trxName) + { + MAttachment attachment = MAttachment.get(ctx, MProduct.Table_ID, productId); + + if(attachment == null) + return false; + + ArrayList attachmentEntryList = AttachmentManager.getAttachmentEntriesWithSuffix(ctx, attachment, UdiConstants.IMAGE_EXTENSION, trxName); + + return (attachmentEntryList.size() > 0); + } + + public static ProductDetailsBean getProductDetailInfo(Properties ctx, int productId, String trxName) throws OperationException + { + ProductDetailsBean prodDetailsBean = new ProductDetailsBean(); + MProduct product = loadProduct(ctx, productId, trxName); + + prodDetailsBean.setProductId(productId); + prodDetailsBean.setProductName(product.getName()); + prodDetailsBean.setDescription(product.getDescription()); + prodDetailsBean.setBarCode(product.getUPC()); + prodDetailsBean.setIsActive(product.isActive()); + + int taxCategoryId = product.getC_TaxCategory_ID(); + MTaxCategory taxCategory = new MTaxCategory(ctx, taxCategoryId, trxName); + prodDetailsBean.setTaxCategoryName(taxCategory.getName()); + + int revenueRecognitionId = product.getC_RevenueRecognition_ID(); + MRevenueRecognition revenueRecognition = new MRevenueRecognition(ctx, revenueRecognitionId, trxName); + prodDetailsBean.setRevenueRecognition(revenueRecognition.getName()); + //prodDetailsBean.setStdSalesPrice() + + prodDetailsBean.setHasImage(isProductImagePresent(ctx, productId, trxName)); + + return prodDetailsBean; + } + + public static String getBarcode(Properties ctx, int productId, String trxName) throws OperationException + { + String barcode = getBarcodeForSimilarProducts(ctx, productId, trxName); + + if( barcode == null) + { + barcode = createBarcode(ctx, productId, trxName); + } + + return barcode; + } + + public static String getBarcodeForSimilarProducts(Properties ctx, int productId, String trxName) throws OperationException + { + IProduct iProd = getProductInterface(ctx, productId, trxName); + + return iProd.getBarcodeForSimilarProducts(ctx, productId, trxName); + } + + public MProduct[] getAllOrgsProducts(Properties ctx, String productName, String trxName) + { + int adClientID = Env.getAD_Client_ID(ctx); + int adOrgID = Env.getAD_Org_ID(ctx); + + String whereClause = "AD_Client_ID=" + adClientID + " and AD_Org_ID=" + adOrgID; + whereClause += " and Name like'" + productName + "'"; + + return MProduct.get(ctx, whereClause, trxName); + } + + private static String createBarcode(Properties ctx, int productId, String trxName) throws OperationException + { + MSequence sequence = BarcodeManager.getBarcodeSequence(ctx, trxName); + + int nextID = sequence.getCurrentNext() + sequence.getIncrementNo(); + sequence.setCurrentNext(nextID); + + PoManager.save(sequence); + + StringBuffer barcode = new StringBuffer(); + + barcode.append(sequence.getPrefix()); + barcode.append(nextID); + + return barcode.toString(); + } + + public static Timestamp getProductLastUpdatedTime(Properties ctx, int productId, String trxName) throws OperationException + { + String sql = "Select updated from M_Product where M_Product_ID=" + productId; + + PreparedStatement pstmt = null; + Timestamp retVal = null; + try + { + pstmt = DB.prepareStatement(sql, trxName); + ResultSet rs = pstmt.executeQuery(); + if(rs.next()) + retVal = rs.getTimestamp(1); + + rs.close(); + } + catch(SQLException ex) + { + throw new OperationException("Could not get Product Last update time with sql: " + sql); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + if(retVal == null) + throw new OperationException("Could not retrieve product updated time with productId: " + productId); + + return retVal; + } + + public static HashMap getAllImages(Properties ctx, int productId, String trxName) throws OperationException + { + IProduct iProd = getProductInterface(ctx, productId, trxName); + + return iProd.getAllImages(ctx, productId, trxName); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/RoleManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/RoleManager.java new file mode 100644 index 0000000000..7c1300446b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/RoleManager.java @@ -0,0 +1,826 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 27-Jul-2005 by alok + * + */ +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MOrg; +import org.compiere.model.MRole; +import org.compiere.model.MRoleMenu; +import org.compiere.model.MRoleOrgAccess; +import org.compiere.model.MUserRoles; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.Constants; +import org.posterita.beans.RoleBean; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.RoleMenuManager; +import org.posterita.core.MenuItem; +import org.posterita.exceptions.DuplicateRoleException; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.NoCheckBoxSelectedException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.RoleAlreadyExistsException; +import org.posterita.exceptions.SystemException; +import org.posterita.lib.UdiConstants; +import org.posterita.model.MWebMenu; +import org.posterita.util.PoManager; + + +public class RoleManager +{ + + + + public static MRole createRole(Properties ctx, int orgId, String roleName, boolean isAccessAllOrgs, BigDecimal userDiscount, boolean overwritePriceLimit, boolean isDiscountAllowedOnTotal, boolean isDiscountUptoLimitPrice, boolean canCreateOrder, boolean canAlterOrder, boolean canViewOrder, String trxName) throws OperationException, RoleAlreadyExistsException + { + + String whereClause = "ad_client_id = " + Env.getAD_Client_ID(ctx) +" and ad_org_id in ("+Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM) + ") and name = '"+ roleName +"'"; + + int id[] = MRole.getAllIDs(MRole.Table_Name,whereClause,trxName); + + if(id.length > 0) + { + throw new RoleAlreadyExistsException("Please enter another name for the role. Role " + roleName + "already exists."); + } + + Properties newCtx = (Properties) ctx.clone(); + + Env.setContext(newCtx, "#AD_User_ID", 100); + MRole role = new MRole(newCtx, 0, trxName); + + role.setName(roleName); + role.setUserDiscount(BigDecimal.valueOf(0.00)); + role.setIsPersonalAccess(true); + role.setIsAccessAllOrgs(isAccessAllOrgs); + role.setUserDiscount(userDiscount); + role.setOverwritePriceLimit(overwritePriceLimit); + role.setIsDiscountAllowedOnTotal(isDiscountAllowedOnTotal); + role.setIsDiscountUptoLimitPrice(isDiscountUptoLimitPrice); + role.setAD_Org_ID(orgId); + role.setIsAccessAllOrgs(isAccessAllOrgs); + + + role.setUserLevel(MRole.USERLEVEL_Organization); + + PoManager.save(role); + + + MRoleOrgAccess orgAccess = new MRoleOrgAccess(role,orgId); + PoManager.save(orgAccess); + + return role; + } + + + + + public static MRole createRole(Properties ctx, int orgId, String roleName,Boolean isAccessAllOrgs, Integer[] menuId, BigDecimal userDiscount, Boolean overwriteLimitPrice, Boolean isDiscountAllowedOnTotal, Boolean isDiscountUptoLimitPrice, Boolean canCreateOrder, Boolean canAlterOrder, Boolean canViewOrder, String trxName) throws Exception + { + MRole role = createRole(ctx, orgId, roleName, isAccessAllOrgs.booleanValue(), userDiscount, overwriteLimitPrice.booleanValue(), overwriteLimitPrice.booleanValue(), isDiscountAllowedOnTotal.booleanValue(), canCreateOrder.booleanValue(), canAlterOrder.booleanValue(), canViewOrder.booleanValue(), trxName); + + if(menuId!=null) + { + for(int i=0; i Add default menus e.g. LogOut + int defMenuIds[] = MenuManager.getDefaultMenus(ctx); + for(int i = 0; i < defMenuIds.length; i++) + { + if(!RoleMenuManager.isRoleMenuPresent(ctx, role.get_ID(), defMenuIds[i], trxName)) + RoleMenuManager.createRoleMenu(ctx, role.get_ID(), defMenuIds[i], trxName); + } + + + + return role; + } + + public static RoleBean getRole(Properties ctx, int roleId) throws OperationException + { + RoleBean bean = new RoleBean(); + + MRole role = loadRole(ctx, roleId, null); + + bean.setRoleId(roleId); + bean.setName(role.getName()); + bean.setIsActive(Boolean.valueOf(role.isActive())); + bean.setIsAccessAllOrgs(Boolean.valueOf(role.isAccessAllOrgs())); + bean.setUserDiscount(role.getUserDiscount()); + bean.setIsOverwritePriceLimit(Boolean.valueOf(role.isOverwritePriceLimit())); + bean.setIsDiscountUptoLimitPrice(Boolean.valueOf(role.isDiscountUptoLimitPrice())); + bean.setIsDiscountAllowedOnTotal(role.isDiscountAllowedOnTotal()); + bean.setOrgId(role.getAD_Org_ID()); + + return bean; + } + + public static ArrayList getRoles(Properties ctx, String searchText) + { + ArrayList list = new ArrayList(); + int clientId = Env.getAD_Client_ID(ctx); + + String roleName = ""; + + if (searchText != null) + roleName = searchText; + + int id[] = MRole.getAllIDs(MRole.Table_Name,"upper(name) like '%" + roleName.toUpperCase() + "%' and ad_client_id ="+ clientId +" and isActive = 'Y'"+" and AD_ORG_ID in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+") order by name",null); + + if (id == null || id.length == 0) + { + return list; + } + + RoleBean bean; + + for(int i=0;i getAllRoles(Properties ctx) + { + ArrayList list = new ArrayList(); + int clientId = Env.getAD_Client_ID(ctx); + + + int id[] = MRole.getAllIDs(MRole.Table_Name," ad_client_id ="+ clientId +" and isActive = 'Y'"+" and AD_ORG_ID in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+") order by name",null); + + if (id == null || id.length == 0) + { + return list; + } + + RoleBean bean; + + for(int i=0;i 0) + { + MRole role = new MRole(ctx, roleIds[0], null); + return role; + } + else + return createRole(ctx, orgId, roleName, isAccessAllOrgs, userDiscount, overwriteLimitPrice, isDiscountAllowedOnTotal, isDicountUptoLimitPrice ,canCreateOrder, canAlterOrder, canViewOrder, trxName); + } + catch(Exception ex) + { + throw new OperationException("Cannot create role for: " + roleName); + } + } + + public static MRole getOrCreateRole(Properties ctx, int orgId, String roleName,Boolean isAccessAllOrgs, Integer[] menuId, BigDecimal userDiscount, Boolean overwriteLimitPrice, Boolean isDiscountAllowedOnTotal, Boolean isDicountUptoLimitPrice, Boolean canCreateOrder, Boolean canAlterOrder, Boolean canViewOrder, String trxName) throws OperationException + { + int clientId = Env.getAD_Client_ID(ctx); + int adOrgId = Env.getAD_Org_ID(ctx); + try + { + String sqlStatement = " AD_Client_ID=" + clientId + " and AD_Org_ID=" + adOrgId + " and Name='" + roleName + "'"; + int roleIds[] = MRole.getAllIDs(MRole.Table_Name, sqlStatement, null); + + if (roleIds!=null && roleIds.length > 0) + { + MRole role = new MRole(ctx, roleIds[0], null); + return role; + } + else + return createRole(ctx, orgId, roleName, isAccessAllOrgs, menuId, userDiscount, overwriteLimitPrice, isDiscountAllowedOnTotal, isDicountUptoLimitPrice, canCreateOrder, canAlterOrder, canViewOrder, trxName); + } + catch(Exception ex) + { + throw new OperationException("Cannot create role for: " + roleName); + } + + } + + /** + * Gets all the roles assigned to the user + * @param ctx + * @return an arraylist of keynamepairs + * @throws OperationException + */ + public static ArrayList getMyRoles(Properties ctx) throws OperationException + { + int ad_user_id = Env.getAD_User_ID(ctx); + int ad_client_id = Env.getAD_Client_ID(ctx); + + String sql = "select role.AD_ROLE_ID, role.NAME " + + " from AD_USER_ROLES usrRole, AD_USER usr, AD_ROLE role, AD_ORG org " + + " where org.AD_ORG_ID = role.AD_ORG_ID " + + " and usrRole.AD_USER_ID = usr.AD_USER_ID " + + " and usrRole.AD_ROLE_ID = role.AD_ROLE_ID " + + " and role.AD_CLIENT_ID = ? " + + " and usrRole.AD_USER_ID = ? " + + " order by role.NAME"; + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = null; + ArrayList roleList = new ArrayList(); + + try + { + pstmt.setInt(1,ad_client_id); + pstmt.setInt(2,ad_user_id); + + rs = pstmt.executeQuery(); + + while(rs.next()) + { + KeyNamePair pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + + roleList.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return roleList; + + } + + public static String getWhereClauseOnUserRolesAccess(Properties ctx, String tableAlias) + { + int roleId = Env.getAD_Role_ID(ctx); + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + //#User_Org=0,11,12, + MRole userRole = new MRole(ctx,roleId,null); + String whereClause= " and " + tableAlias+"AD_CLIENT_ID"; + + if(userRole.getUserLevel().equals(MRole.USERLEVEL_Client) || userRole.getUserLevel().equals(MRole.USERLEVEL_ClientPlusOrganization)) + { + return whereClause = whereClause +" and isActive='Y'"; + } + + else + { + return whereClause= whereClause +" and "+tableAlias+"AD_ORG_ID="+Env.getAD_Org_ID(ctx); + } + + } + + private static boolean hasMenu(int menuId, ArrayList menus) + { + boolean menuAvailable = false; + for(MWebMenu menu : menus) + { + if(menu.get_ID() == menuId) + { + menuAvailable = true; + break; + } + } + return menuAvailable; + } + + private static void setRoleMenus(MenuItem menuItem, ArrayList menus) + { + ArrayList children = menuItem.getAllChildren(); + for(MenuItem mItem : children) + { + if(mItem.hasSubMenu()) + setRoleMenus(mItem, menus); + else + { + if(hasMenu(mItem.getMenuId(), menus)) + mItem.setAvailable(true); + } + } + } + + public static MenuItem getAvailableMenus(Properties ctx, int roleId) throws SystemException, OperationException + { + ArrayList roleMenus = MenuManager.getMenus(ctx, roleId); + + ArrayList appMenus = MenuManager.getMenusForOrganisationType(ctx); + MenuItem rootItem = MenuManager.buildMenuTree(ctx, appMenus); + + setRoleMenus(rootItem, roleMenus); + + return rootItem; + } + + public static void editRole(Properties ctx, int roleId, String roleName, boolean isAccessAllOrgs, Integer[] menuId, BigDecimal userDiscount, boolean overwritePriceLimit, boolean isDiscountUptoLimitPrice, boolean isDiscountAllowedOnTotal, String trxName) throws OperationException, RoleAlreadyExistsException + { + if(menuId==null) + { + throw new NoCheckBoxSelectedException("Please select a role"); + } + String nameClause = "AD_Client_ID = " + Env.getAD_Client_ID(ctx) + " and Upper(name)='" + roleName.toUpperCase() + "' and AD_Role_ID <> " + roleId; + + int roleIds[] = MRole.getAllIDs(MRole.Table_Name, nameClause, null); + + if (roleIds!=null && roleIds.length > 0) + throw new RoleAlreadyExistsException("Role with name: " + roleName + " already exists"); + + MRole role = loadRole(ctx, roleId, trxName); + + Boolean isEditable = RoleManager.isEditable(ctx, role.getAD_Org_ID()); + + if (!isEditable) + throw new NoAccessToEditObjectException("You do not have the right organisational access for editing"); + + if(userDiscount == null) + { + userDiscount = Env.ZERO; + } + + role.setName(roleName); + role.setIsAccessAllOrgs(isAccessAllOrgs); + role.setUserDiscount(userDiscount); + role.setOverwritePriceLimit(overwritePriceLimit); + role.setIsDiscountUptoLimitPrice(isDiscountUptoLimitPrice); + role.setIsDiscountAllowedOnTotal(isDiscountAllowedOnTotal); + + PoManager.save(role); + + String whereClause = " AD_Role_ID=" + roleId; + int roleMenuIds[] = MRoleMenu.getAllIDs(MRoleMenu.Table_Name, whereClause, trxName); + + // Delete all associated role menus + for(int i = 0; i < roleMenuIds.length; i++) + { + MRoleMenu roleMenu = new MRoleMenu(ctx, roleMenuIds[i], trxName); + roleMenu.delete(true); + } + + // Create role menus assigned + for(int i = 0; i < menuId.length; i++) + { + MRoleMenu roleMenu = new MRoleMenu(ctx, 0, trxName); + roleMenu.setAD_Role_ID(role.get_ID()); + roleMenu.setU_WebMenu_ID(menuId[i]); + PoManager.save(roleMenu); + } + + // Create role menus for all default menus + int defMenuIds[] = MenuManager.getDefaultMenus(ctx); + for(int i = 0; i < defMenuIds.length; i++) + { + MRoleMenu roleMenu = new MRoleMenu(ctx, 0, trxName); + roleMenu.setAD_Role_ID(role.get_ID()); + roleMenu.setU_WebMenu_ID(defMenuIds[i]); + PoManager.save(roleMenu); + } + } + + public static BigDecimal getDiscountAllowed(Properties ctx, int AD_Role_ID, String trxName) throws OperationException + { + BigDecimal discount = BigDecimal.ZERO; + MRole role = MRole.get(ctx, AD_Role_ID); + + if (role != null) + { + discount = role.getUserDiscount(); + } + + return discount; + } + + public static boolean isOverridePriceLimitAllowed(Properties ctx, int AD_Role_ID, String trxName) throws OperationException + { + MRole role = MRole.get(ctx, AD_Role_ID); + + return role.isOverwritePriceLimit(); + } + + public static boolean isDiscountUptoPriceLimit(Properties ctx, int AD_Role_ID, String trxName) throws OperationException + { + MRole role = MRole.get(ctx, AD_Role_ID); + + return role.isDiscountUptoLimitPrice(); + } + + public static boolean isDiscountAllowedOnTotal(Properties ctx, int AD_Role_ID, String trxName) throws OperationException + { + MRole role = MRole.get(ctx, AD_Role_ID); + + return role.isDiscountAllowedOnTotal(); + } + + public static ArrayList getRoleOrgPairs(Properties ctx, String trxName) throws OperationException + { + int roleId = Env.getAD_Role_ID(ctx); + + RoleBean roleBean = getRole(ctx, roleId); + + ArrayList orgPairs = new ArrayList(); + + if (roleBean.getIsAccessAllOrgs()) + { + orgPairs = OrganisationManager.getAllOrgPairs(ctx, trxName); + } + else + { + MOrg org = MOrg.get(ctx, roleBean.getOrgId()); + KeyNamePair pair = org.getKeyNamePair(); + + orgPairs.add(pair); + } + + + return orgPairs; + + } + + + public static ArrayList getRoleOrgAccess(Properties ctx, int roleId) throws OperationException + { + + MRoleOrgAccess[] orgAccessArr = MRoleOrgAccess.getOfRole(ctx, Env.getAD_Role_ID(ctx)); + MRole role = new MRole(ctx, roleId, null); //trxName can be null here as we are just retrieving data that was previously committed and not doing any update + + ArrayList list = new ArrayList(); + + for (int i = 0; i < orgAccessArr.length; i++) + { + MRoleOrgAccess orgAccess = orgAccessArr[i]; + + MOrg org = MOrg.get(ctx, orgAccess.getAD_Org_ID()); + + RoleBean roleBean = new RoleBean(); + roleBean.setRoleId(orgAccess.getAD_Role_ID()); + roleBean.setName(role.getName()); + + if (orgAccess.getAD_Org_ID() == 0) + roleBean.setOrgName(Constants.ALL_ORGANISATIONS); + else + roleBean.setOrgName(org.getName()); + + roleBean.setOrgId(orgAccess.getAD_Org_ID()); + + + String roleOrgAccessSQL = getRoleOrgAccessSQL(); + + PreparedStatement pstmt = DB.prepareStatement(roleOrgAccessSQL, null); + + ResultSet rs = null; + int count = 0; + Boolean isActive = false; + + try + { + pstmt.setInt(1,Env.getAD_Client_ID(ctx)); + pstmt.setInt(2,org.get_ID()); + pstmt.setInt(3,role.get_ID()); + + rs = pstmt.executeQuery(); + + + + while(rs.next()) + { + if (rs.getString(4).equals("Y")) + isActive = true; + + count++; + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + if (count > 1) + throw new DuplicateRoleException("Duplicate Role Organisation Access"); + else + if (count == 1) + { + roleBean.setIsChecked(isActive); + } + else + { + roleBean.setIsChecked(isActive); + } + + list.add(roleBean); + + + } + + return list; + + } + + + + + public static void editRoleOrgAccess(Properties ctx, ArrayList roleBeanList, String trxName) throws OperationException + { + for (int i = 0; i < roleBeanList.size(); i++) + { + RoleBean bean = roleBeanList.get(i); + + MRole role = new MRole(ctx, bean.getRoleId(), trxName); + + String isChecked = "Y"; + + if (bean.getIsChecked() == null) + isChecked = "N"; + + String roleOrgAccessSQL = getRoleOrgAccessSQL(); + + PreparedStatement pstmt = DB.prepareStatement(roleOrgAccessSQL, trxName); + + ResultSet rs = null; + int count = 0; + + try + { + pstmt.setInt(1,Env.getAD_Client_ID(ctx)); + pstmt.setInt(2, bean.getOrgId()); + pstmt.setInt(3, bean.getRoleId()); + + rs = pstmt.executeQuery(); + + + + while(rs.next()) + { + count++; + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + if (count > 1) + throw new DuplicateRoleException("Duplicate Role Organisation Access"); + else + if (count == 1) + { + StringBuffer strBuff = new StringBuffer(); + + strBuff.append("update ").append(MRoleOrgAccess.Table_Name); + strBuff.append(" set isActive='").append(isChecked).append("'"); + strBuff.append(" where ad_client_id=").append(Env.getAD_Client_ID(ctx)); + strBuff.append(" and ad_org_id=").append(bean.getOrgId()); + strBuff.append(" and ad_role_id=").append(bean.getRoleId()); + + PreparedStatement pstmt1 = DB.prepareStatement(strBuff.toString(), trxName); + + try + { + pstmt1.executeUpdate(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt1.close(); + } + catch(Exception e) + {} + + pstmt1 = null; + } + + } + else + { + MRoleOrgAccess roleOrgAccess = new MRoleOrgAccess(role, bean.getOrgId()); + PoManager.save(roleOrgAccess); + + } + } + + + } + + private static String getRoleOrgAccessSQL() + { + StringBuffer strBuff = new StringBuffer(); + strBuff.append("select ad_role_id, ad_org_id, ad_client_id, isactive from "); + strBuff.append(MRoleOrgAccess.Table_Name); + strBuff.append(" where ad_client_id=?"); + strBuff.append(" and ad_org_id=?"); + strBuff.append(" and ad_role_id=?"); + //strBuff.append(" and isActive='Y'"); + + return strBuff.toString(); + } + + public static String getRoleEditableOrgAccess(Properties ctx) + { + StringBuffer orgIdsStr = new StringBuffer(); + + int roleId = Env.getAD_Role_ID(ctx); + + MRoleOrgAccess[] roleOrgAccessArr = MRoleOrgAccess.getOfRole(ctx, roleId); + + int count = 0; + + if (roleOrgAccessArr==null || roleOrgAccessArr.length==0) + { + return orgIdsStr.toString(); + } + + for (int i = 0; i < roleOrgAccessArr.length; i++) + { + MRoleOrgAccess roleOrgAccess = roleOrgAccessArr[i]; + + if (roleOrgAccess.isActive() == true) + { + + if (roleOrgAccess.getAD_Org_ID() == 0) + { + int[] orgIds = MOrg.getAllIDs(MOrg.Table_Name, "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and isActive='Y' order by name", null); + + StringBuffer allOrgIds = new StringBuffer(); + + allOrgIds.append("0"); + + for (int j = 0; j < orgIds.length; j++) + { + allOrgIds.append(","); + allOrgIds.append(orgIds[j]); + } + + return allOrgIds.toString(); + } + + else + { + orgIdsStr.append(roleOrgAccess.getAD_Org_ID()); + orgIdsStr.append(","); + } + } + } + + orgIdsStr.replace(orgIdsStr.length()-1, orgIdsStr.length()-1, ""); + return orgIdsStr.toString(); + + } + + public static String getRoleViewableOrgAccess(Properties ctx) + { + String roleEditableOrgAccess = getRoleEditableOrgAccess(ctx); + + if (roleEditableOrgAccess.length() == 0) + return "0"; + + if (roleEditableOrgAccess.indexOf(",0") == -1) + return roleEditableOrgAccess + ",0"; + else + return roleEditableOrgAccess; + + } + + + public static Boolean isEditable(Properties ctx, int orgId) + { + int roleId = Env.getAD_Role_ID(ctx); + + MRoleOrgAccess[] roleOrgAccessArr = MRoleOrgAccess.getOfRole(ctx, roleId); + + if (roleOrgAccessArr!=null && roleOrgAccessArr.length >0) + { + for (int i = 0; i < roleOrgAccessArr.length; i++) + { + MRoleOrgAccess roleOrgAccess = roleOrgAccessArr[i]; + + if (roleOrgAccess.getAD_Org_ID() == 0) + return true; + + if (roleOrgAccess.getAD_Org_ID() == orgId) + return true; + } + } + return false; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/TaxManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/TaxManager.java new file mode 100644 index 0000000000..9900550bdc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/TaxManager.java @@ -0,0 +1,415 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * + *Created on Aug 19, 2006 by alok + * + */ + + +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MTax; +import org.compiere.model.MTaxCategory; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.TaxBean; +import org.posterita.exceptions.CannotInactivateTaxException; +import org.posterita.exceptions.InvalidNetDaysException; +import org.posterita.exceptions.MandatoryException; +import org.posterita.exceptions.MandatoryNameException; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.TaxNameAlreadyExistsException; +import org.posterita.exceptions.TaxRateAlreadyExistsException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class TaxManager +{ + + public static MTaxCategory createTaxCategory(Properties ctx, String taxCategoryName, String trxName) throws OperationException + { + MTaxCategory taxCategory = new MTaxCategory(ctx, 0, trxName); + taxCategory.setName(taxCategoryName); + PoManager.save(taxCategory); + return taxCategory; + } + + private static MTaxCategory editTaxCategory(Properties ctx,int orgId, int taxCategoryId, String taxCategoryName, String trxName) throws OperationException + { + MTaxCategory taxCategory = new MTaxCategory(ctx, taxCategoryId, trxName); + taxCategory.setName(taxCategoryName); + taxCategory.setAD_Org_ID(orgId); + PoManager.save(taxCategory); + return taxCategory; + } + + public static MTax createTax(Properties ctx, int orgId, String name, int taxCategoryId, int countryId, BigDecimal rate,String description,boolean isTaxExempt ,String trxName) throws OperationException + { + return createTax(ctx, orgId, name, taxCategoryId, countryId, new Timestamp(System.currentTimeMillis()), rate,description,isTaxExempt, trxName); + } + + + + public static MTax createTax(Properties ctx, int orgId, String name, int taxCategoryId, int countryId, Timestamp validFrom, BigDecimal rate,String description,boolean isTaxExempt, String trxName) throws OperationException + { + MTax tax = new MTax(ctx, 0, trxName); + + tax.setAD_Org_ID(orgId); + tax.setName(name); + tax.setC_TaxCategory_ID(taxCategoryId); + tax.setC_Country_ID(countryId); + tax.setSOPOType(MTax.SOPOTYPE_Both); + tax.setValidFrom(validFrom); + tax.setIsTaxExempt(isTaxExempt); + tax.setIsDocumentLevel(false); + if(isTaxExempt==true) + tax.setRate(new BigDecimal(0)); + else + tax.setRate(rate); + + if(description!=null) + tax.setDescription(description); + PoManager.save(tax); + + return tax; + } + + private static MTax editTax(Properties ctx, int orgId, MTax tax,String name, int countryId, BigDecimal rate,String desc,boolean isTaxExempt, String trxName) throws OperationException + { + tax.setAD_Org_ID(orgId); + tax.setName(name); + tax.setC_Country_ID(countryId); + tax.setSOPOType(MTax.SOPOTYPE_Both); + tax.setIsTaxExempt(isTaxExempt); + tax.setIsDocumentLevel(false); + if(isTaxExempt==true) + tax.setRate(new BigDecimal(0)); + else + tax.setRate(rate); + if(desc!=null) + tax.setDescription(desc); + PoManager.save(tax); + + return tax; + } + + public static BigDecimal getPriceWithTax(Properties ctx,BigDecimal price,BigDecimal rate) + { + return new BigDecimal (price.doubleValue()+((rate.doubleValue()/(100))*price.doubleValue())); + } + + + public static void createEditTaxCategoryAndTax(Properties ctx,TaxBean bean,String trxName) throws MandatoryException,MandatoryNameException,InvalidNetDaysException, OperationException + { + + if(bean.getTaxName()==null) + throw new MandatoryNameException("Name is Mandatory"); + + if(bean.getTaxRate()==null) + throw new MandatoryException("rate"); + if(bean.getTaxRate().intValue()<0) + { + throw new InvalidNetDaysException(" tax rate cannot be negative"); + } + + MOrg org = new MOrg(ctx,Env.getAD_Org_ID(ctx),null); + MBPartner partner = new MBPartner(ctx,org.getLinkedC_BPartner_ID(trxName),null); + MBPartnerLocation bpLocation = new MBPartnerLocation(partner); + MLocation location = new MLocation(ctx,bpLocation.getC_Location_ID(),null); + + String whereClause = "AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " and name='" + bean.getTaxName() + "'"; + int taxId1[] = MTax.getAllIDs(MTax.Table_Name, whereClause, trxName); + + + String whereClause2=" AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and RATE="+bean.getTaxRate(); + int taxId []= MTax.getAllIDs(MTax.Table_Name,whereClause2,trxName); + + + MTaxCategory taxCategory=null; + MTax tax=null; + + if(bean.getTaxId()==null) + { + if(taxId1.length > 0) + throw new TaxNameAlreadyExistsException("tax Name already exists"); + if(taxId.length>0) + throw new TaxRateAlreadyExistsException("The tax rate is already defined"); + taxCategory=createTaxCategory(ctx,bean.getTaxName(),trxName); + tax = createTax(ctx, bean.getOrgId(), bean.getTaxName(),taxCategory.get_ID(),location.getC_Country_ID(),bean.getTaxRate(),bean.getDescription(),bean.getIsTaxExempted(),trxName); + } + + else + { + + MTax mTax = new MTax(ctx,bean.getTaxId().intValue(),null); + + Boolean isEditable = RoleManager.isEditable(ctx, mTax.getAD_Org_ID()); + + if (!isEditable) + throw new NoAccessToEditObjectException("You do not have the right organisational access for editing"); + + + if(taxId1.length>0 && !mTax.getName().equalsIgnoreCase(bean.getTaxName())) + throw new TaxNameAlreadyExistsException("tax Name already exists"); + + if(taxId.length>0 && mTax.getRate().compareTo(bean.getTaxRate()) != 0) + throw new TaxRateAlreadyExistsException("The tax rate is already defined"); + + + + tax=editTax(ctx,bean.getOrgId(), mTax,bean.getTaxName(),location.getC_Country_ID(),bean.getTaxRate(),bean.getDescription(),bean.getIsTaxExempted(),trxName); + taxCategory=editTaxCategory(ctx, bean.getOrgId(), tax.getC_TaxCategory_ID(),bean.getTaxName(),trxName); + } + + + } + + public static MTaxCategory loadTaxCategory(Properties ctx, int taxCategoryId, String trxName) throws OperationException + { + MTaxCategory taxCategory = new MTaxCategory(ctx, taxCategoryId, trxName); + + if(taxCategory.get_ID() == 0) + throw new OperationException("Could not load tax category with id: " + taxCategoryId); + + return taxCategory; + } + + + public static int getTaxCategoryIdByName(Properties ctx, String name, String trxName) throws OperationException + { + int adClientId = Env.getAD_Client_ID(ctx); + + String whereClause = "AD_Client_ID=" + adClientId + " and name='" + name + "'"; + + int taxCategoryIds[] = MTaxCategory.getAllIDs(MTaxCategory.Table_Name, whereClause, trxName); + + if(taxCategoryIds.length == 0) + throw new OperationException("No tax category found with name: " + name); + else if(taxCategoryIds.length > 1) + throw new OperationException(taxCategoryIds.length + " Tax categories found with name: " + name); + else + return taxCategoryIds[0]; + } + + public static MTax loadTax(Properties ctx, int taxId, String trxName) throws OperationException + { + MTax tax = new MTax(ctx, taxId, trxName); + if(tax.get_ID() == 0) + throw new OperationException("Could not load tax with id: " + taxId); + return tax; + } + + public static MTax getTaxFromCategory(Properties ctx, int taxCategoryId, String trxName) throws OperationException + { + int taxIds[] = MTax.getAllIDs(MTax.Table_Name,"AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + +" and C_TAXCATEGORY_ID="+ taxCategoryId + " and IsActive='Y'",trxName); + + if(taxIds.length == 0) + throw new OperationException("No tax found with tax category id: " + taxCategoryId); + else if(taxIds.length > 1) + throw new OperationException(taxIds.length + " Tax found with same tax category with id: " + taxCategoryId); + else + return loadTax(ctx, taxIds[0], trxName); + } + + + public static ArrayList getAllTaxRates(Properties ctx,boolean isActive) throws OperationException + { + String userOrg = Env.getContext(ctx, UdiConstants.ROLE_VIEWABLE_ORGS_CTX_PARAM); + + String sql="select C_TAX_ID,NAME,DESCRIPTION,RATE,ISTAXEXEMPT," + + //" DECODE(isActive,'Y','true','false') active"+ + " CASE WHEN isActive='Y' THEN 'true' ELSE 'false' END AS active"+ + " from C_Tax" + + " where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and AD_ORG_ID in ("+ userOrg + ")" ; + + if(isActive==true) + sql=sql+" and isActive='Y'"; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ArrayList list = new ArrayList(); + TaxBean bean=null; + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + bean = new TaxBean(); + bean.setTaxId(rs.getInt(1)); + bean.setTaxName(rs.getString(2)); + bean.setDescription(rs.getString(3)); + bean.setTaxRate(rs.getBigDecimal(4)); + bean.setIsTaxExempted(Boolean.parseBoolean(rs.getString(5))); + bean.setIsActive(Boolean.parseBoolean(rs.getString(6))); + list.add(bean); + } + rs.close(); + + } catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } catch (SQLException e) + { + + } + } + + return list; + } + + public static TaxBean getTaxRate(Properties ctx,int taxId) throws OperationException + { + String userOrg = Env.getContext(ctx, UdiConstants.ROLE_VIEWABLE_ORGS_CTX_PARAM); + + String sql="select C_TAX_ID, NAME,DESCRIPTION,RATE,ISTAXEXEMPT," + + //" DECODE(isActive,'Y','true','false') active"+ + " CASE WHEN isActive='Y' THEN 'true' ELSE 'false' END AS active,"+ + " AD_ORG_ID" + + " from C_Tax" + + " where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and AD_ORG_ID in ("+ userOrg + ")" + + " and c_TAX_ID="+taxId; + + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + TaxBean bean=null; + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + bean = new TaxBean(); + bean.setTaxId(rs.getInt(1)); + bean.setTaxName(rs.getString(2)); + bean.setDescription(rs.getString(3)); + bean.setTaxRate(rs.getBigDecimal(4)); + bean.setIsTaxExempted(Boolean.parseBoolean(rs.getString(5))); + bean.setIsActive(Boolean.parseBoolean(rs.getString(6))); + bean.setOrgId(rs.getInt(7)); + + } + rs.close(); + + } catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } catch (SQLException e) + { + + } + } + + return bean; + } + + + public static MTax activateTax(Properties ctx,int taxId, boolean activate) throws OperationException + { + MTax tax = new MTax(ctx,taxId,null); + if(activate==true) + { + tax.setIsActive(true); + } + + else + { + if(isTaxUsed(ctx,taxId)==true) + { + throw new CannotInactivateTaxException("The tax can not be set incative, there are product with this tax"); + } + tax.setIsActive(false); + } + + + PoManager.save(tax); + return tax; + } + + + public static boolean isTaxUsed(Properties ctx,int taxId) throws OperationException + { + String sql="select pr.m_product_id " + + "from M_PRODUCT pr,C_TAX t,C_TAXCATEGORY tc" + + " where pr.C_TAXCATEGORY_ID=tc.C_TAXCATEGORY_ID " + + "and tc.C_TAXCATEGORY_ID=t.C_TAXCATEGORY_ID " + + "and t.C_TAX_ID=" +taxId+ + " and t.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + boolean present=false; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + present=true; + + } + rs.close(); + + } catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } catch (SQLException e) + { + + } + } + + return present; + } + +} + diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/UserManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/UserManager.java new file mode 100644 index 0000000000..8ac132daf8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/UserManager.java @@ -0,0 +1,641 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 27-Jul-2005 by alok + * + */ +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; +import java.util.Vector; + +import javax.management.relation.RoleNotFoundException; + +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MCommission; +import org.compiere.model.MCommissionLine; +import org.compiere.model.MCountry; +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MRole; +import org.compiere.model.MRoleOrgAccess; +import org.compiere.model.MUser; +import org.compiere.model.MUserRoles; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.beans.AddressBean; +import org.posterita.beans.UserBean; +import org.posterita.beans.WebstoreUserBean; +import org.posterita.businesslogic.LocationManager; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.DuplicateUserPinException; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.UserAlreadyExistsException; +import org.posterita.exceptions.UserNotFoundException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + + +public class UserManager +{ + + public static MUser createUser(Properties ctx,Integer orgId, String userName,String userSurname,boolean isSalesRep,String address,String postalAddress,String city,String password,String email,boolean isActive,String phone,int regionId,int roleId,int countryId, String userPIN, BigDecimal userDiscount,String docBasisType,BigDecimal amtMultiplier,String frequency,BigDecimal subtractAmt,boolean isFullAccess,String trxName) throws DuplicateUserPinException,OperationException + { + int [] userId = MUser.getAllIDs("AD_USER","AD_CLIENT_ID = "+Env.getAD_Client_ID(ctx),trxName); + + for(int i=0;i0) + throw new DuplicateUserPinException("User Pin Already exists"); + else + user.setUserPIN(userPIN); + } + user.setPassword(password); + user.setEMail(email); + user.setIsActive(isActive); + user.setPhone(phone); + + PoManager.save(user); + + if(isSalesRep==true && docBasisType!=null && amtMultiplier!=null) + { + CommissionManager.getCreateCommission(ctx,bpartner.getName(),bpartner.get_ID(),docBasisType,amtMultiplier,frequency,subtractAmt,trxName); + } + + MUserRoles userRoles = new MUserRoles(ctx, user.get_ID(), roleId, trxName); + userRoles.save(); + + MOrg org = new MOrg(ctx, orgId, trxName); + MRoleOrgAccess roleOrgAccess = new MRoleOrgAccess(org, roleId); + + return user; + } + + + public static Vector getAllOrgUsers(Properties ctx, int orgID) + { + int ids[] = MUser.getAllIDs(MUser.Table_Name, " AD_CLIENT_ID = "+Env.getAD_Client_ID(ctx)+" and AD_Org_ID=" + orgID + " and ISACTIVE='Y' order by name",null); + + MUser user; + + Vector thisOrgUsers = new Vector(); + for (int i = 0; i0) + { + MCommission commission=new MCommission(ctx,commissionIds[0],null); + bean.setDocBasisType(commission.getDocBasisType()); + bean.setFrequencyType(commission.getFrequencyType()); + + MCommissionLine [] line =commission.getLines(); + if(line.length!=1) + throw new OperationException("either No commissionLine or more than One commission Line has bean defined for this bPartner"); + bean.setAmtMultiplier(line[0].getAmtMultiplier().multiply(new BigDecimal(100))); + bean.setSubtractAmt(line[0].getAmtSubtract()); + + } + if(userRole.length>0) + { + bean.setRoleName(role.getName()); + bean.setRoleId(Integer.valueOf(role.get_ID())); + } + + return bean; + + } + + + public static ArrayList getUsers(Properties ctx, String searchText) throws OperationException + { + ArrayList usersList = new ArrayList(); + + int clientId = Env.getAD_Client_ID(ctx); + int orgId = Env.getAD_Org_ID(ctx); + String userOrg = Env.getContext(ctx, UdiConstants.ROLE_VIEWABLE_ORGS_CTX_PARAM); + + String sql = "select u.AD_User_ID from AD_User u, AD_User_Roles ur " + + " where u.AD_Client_ID= " + clientId + + " and u.AD_Org_ID in (" + userOrg + ")" + + " and (Select bp.IsEmployee from C_BPartner bp where u.C_BPartner_ID=bp.C_BPartner_ID) = 'Y'" + + " and ur.ad_user_id= u.ad_user_id" + + " and ur.ad_role_id is not null"; + + if (searchText != null) + sql = sql + " and upper(u.name) like '%" + searchText.toUpperCase() + "%'"; + + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, null); + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + int userId = rs.getInt(1); + UserBean bean = getUser(ctx, userId); + + usersList.add(bean); + } + rs.close(); + } + catch(SQLException ex) + { + throw new OperationException("Could not retrieve employees list with sql: " + sql, ex); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex) + {} + } + return usersList; + } + + + public static ArrayList getAllEmployees(Properties ctx) throws OperationException + { + ArrayList usersList = new ArrayList(); + + int clientId = Env.getAD_Client_ID(ctx); + int orgId = Env.getAD_Org_ID(ctx); + + String sql = "select AD_User_ID from AD_User u " + + " where u.AD_Client_ID= " + clientId + + " and u.AD_Org_ID=" + orgId + + " and (Select bp.IsEmployee from C_BPartner bp where u.C_BPartner_ID=bp.C_BPartner_ID) = 'Y'"; + + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, null); + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + int userId = rs.getInt(1); + UserBean bean = getUser(ctx, userId); + usersList.add(bean); + } + rs.close(); + } + catch(SQLException ex) + { + throw new OperationException("Could not retrieve employees list with sql: " + sql, ex); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex) + {} + } + return usersList; + } + + public static ArrayList getAllUsers(Properties ctx) throws OperationException + { + ArrayList list = new ArrayList(); + + int clientId = Env.getAD_Client_ID(ctx); + int orgId = Env.getAD_Org_ID(ctx); + + int id[] = MUser.getAllIDs(MUser.Table_Name," ad_client_id = "+clientId+" and ad_org_id = "+orgId,null); + // int id[] = MUser.getAllIDs(MUser.Table_Name," ad_client_id = "+clientId+" and ad_org_id = "+orgId+" and isactive = 'Y'",null); + //int id[] = MUser.getAllIDs(MUser.Table_Name," ad_client_id = "+clientId+" and isactive = 'Y'",null); + + for(int i=0;i0) + { + for(int i=0;i 0) + user = new MUser(ctx, userId[0], trxName); + else + user = createUser(ctx, orgId, userName,null, isSalesRep, address, postalAddress, city, password, email, isActive, phone, regionId, roleId,countryId,userPin,null,commDocbaseType,commRate,frequency,subtractAmt,isFullAccess,trxName); + + return user; + } + + public static MUser loadUser(Properties ctx, int adUserID, String trxName) throws OperationException + { + MUser user = new MUser(ctx, adUserID, trxName); + if(user.get_ID() == 0) + throw new OperationException("Could not load user with id: " + adUserID); + + return user; + } + + public static ArrayList getSalesReps(Properties ctx, String trxName) throws OperationException + { + int adClientId = Env.getAD_Client_ID(ctx); + int adOrgId = Env.getAD_Org_ID(ctx); + + String whereClause = "IsActive='Y' and AD_Client_ID=" + adClientId + " and AD_Org_ID=" + adOrgId; + whereClause += " and C_BPartner_ID in (select C_BPartner_ID from C_BPartner where IsActive='Y' and IsSalesRep='Y')"; + + try + { + return KeyNamePairUtil.getData(ctx, MUser.Table_Name, whereClause); + } + catch(SQLException ex) + { + throw new OperationException("Could not retrieve sales rep with whereClause: " + whereClause, ex); + } + } + + + public static ArrayList updateUserListStatus(ArrayList list, Integer userId, Boolean status) + { + if (list == null) + return list; + + for (int i = 0; i < list.size(); i++) + { + UserBean bean = (UserBean) list.get(i); + + if (bean.getUserId().equals(userId)) + { + bean.setIsActive(status); + + list.remove(i); + + list.add(i, bean); + + break; + } + } + + return list; + + } + + public static Integer getRoleId(Properties ctx, String userPIN, String trxName) throws UserNotFoundException, RoleNotFoundException, OperationException + { + int ids[] = MUser.getAllIDs(MUser.Table_Name, "IsActive = 'Y' AND AD_Client_ID=" + Env.getAD_Client_ID(ctx) + " AND userPin='"+userPIN + "'", trxName); + if(ids == null || ids.length == 0) + { + throw new UserNotFoundException(); + } + + MUserRoles[] userRoles = MUserRoles.getOfUser(ctx, ids[0]); + if(userRoles == null || userRoles.length == 0) + { + throw new RoleNotFoundException(); + } + + MUserRoles userRole = userRoles[0]; + int ad_role_id = userRole.getAD_Role_ID(); + + return ad_role_id; + } + + public static BigDecimal getDiscountAllowed(Properties ctx, String userPIN, String trxName) throws UserNotFoundException, RoleNotFoundException, OperationException + { + + int ad_role_id = getRoleId(ctx, userPIN, trxName); + BigDecimal discountAllowed = RoleManager.getDiscountAllowed(ctx, ad_role_id, trxName); + + return discountAllowed; + } + + public static boolean isOverridePriceLimitAllowed(Properties ctx, String userPIN, String trxName) throws UserNotFoundException, RoleNotFoundException, OperationException + { + int ad_role_id = getRoleId(ctx, userPIN, trxName); + boolean isOverrideAllowed = RoleManager.isOverridePriceLimitAllowed(ctx, ad_role_id, trxName); + + return isOverrideAllowed; + } + + public static boolean isDiscountAllowedOnTotal(Properties ctx, String userPIN, String trxName) throws UserNotFoundException, RoleNotFoundException, OperationException + { + int ad_role_id = getRoleId(ctx, userPIN, trxName); + boolean isDisountAllowedOnTotal = RoleManager.isDiscountAllowedOnTotal(ctx, ad_role_id, trxName); + + return isDisountAllowedOnTotal; + } + + public static boolean isDiscountUptoPriceLimit(Properties ctx, String userPIN, String trxName) throws UserNotFoundException, RoleNotFoundException, OperationException + { + int ad_role_id = getRoleId(ctx, userPIN, trxName); + boolean isDiscountUptoPriceLimit = RoleManager.isDiscountUptoPriceLimit(ctx, ad_role_id, trxName); + + return isDiscountUptoPriceLimit; + } + +} + + + + diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/UserRoleManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/UserRoleManager.java new file mode 100644 index 0000000000..bea2ae60dd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/UserRoleManager.java @@ -0,0 +1,58 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 27-Jul-2005 by alok + * + */ +package org.posterita.businesslogic.administration; + +import java.util.Properties; + +import org.compiere.model.MUserRoles; +import org.compiere.util.Trx; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.OperationException; +import org.posterita.util.PoManager; + + +public class UserRoleManager +{ + + + public static MUserRoles createUserRoles(Properties ctx,int roleId,int userId) throws OperationException + { + Trx trx = Trx.get(Trx.createTrxName(TrxPrefix.getPrefix()), true); + trx.start(); + MUserRoles userRoles; + try + { + userRoles = new MUserRoles(ctx,userId,roleId,trx.getTrxName()); + PoManager.save(userRoles); + trx.commit(); + trx.close(); + } + catch(OperationException e) + { + trx.rollback(); + trx.close(); + throw e; + } + + return userRoles; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/VendorManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/VendorManager.java new file mode 100644 index 0000000000..28163e300c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/VendorManager.java @@ -0,0 +1,473 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 02-Sep-2005 by alok + * + */ +package org.posterita.businesslogic.administration; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.compiere.model.MBPartner; +import org.compiere.model.MCountry; +import org.compiere.model.MUser; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.CustomerBean; +import org.posterita.beans.VendorBean; +import org.posterita.exceptions.BPartnerNotFoundException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class VendorManager +{ + + public static MBPartner saveVendor(Properties ctx, int partnerId, VendorBean bean, String trxName) throws OperationException + { + + if (bean.getOrgId() == null) + throw new OperationException("Organisation is not set! Please select an organisation or contact the administrator."); + + int countryId = 0; + + if (bean.getCountryId() == null) + { + MCountry country = MCountry.getDefault(ctx); + countryId = country.get_ID(); + } + else + countryId = bean.getCountryId().intValue(); + + MBPartner bPartner = BPartnerManager.saveBPartner(ctx, bean.getOrgId(), partnerId, 0, bean.getPartnerName(), bean.getSurname(), false, true, false, false, bean.getAddress1(), bean.getAddress2(), "", null, bean.getCity(), bean.getPhone(), bean.getPhone2(), bean.getFax(), countryId, true, true, trxName); + + Integer priceListId = bean.getPriceListId(); + + if (priceListId != null) + { + bPartner.setM_PriceList_ID(priceListId); + bPartner.save(); + } + + MUser user; + + int[] userIds = MUser.getAllIDs(MUser.Table_Name,"AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " and AD_ORG_ID=" + Env.getAD_Org_ID(ctx) + " and C_BPARTNER_ID=" + partnerId,trxName); + + if(userIds.length==0) + user = new MUser(bPartner); + else if (userIds.length > 1) + throw new OperationException("Found more than 1 user for the partner."); + else + user = new MUser(ctx,userIds[0],trxName); + + user.setEMail(bean.getEmail()); + user.setIsActive(false); + PoManager.save(user); + + return bPartner; + } + + + public static ArrayList searchVendors(Properties ctx,String searchString, boolean isPOS) throws OperationException + { + searchString = (searchString==null)? "" : searchString; + + int adOrgID = Env.getAD_Org_ID(ctx); + int adClientID = Env.getAD_Client_ID(ctx); + StringBuffer sql = new StringBuffer(); + + StringTokenizer st = new StringTokenizer(searchString,"+ "); + String token = null; + + sql.append(" select bp.c_bpartner_id,");//1 + sql.append(" bp.name,");//2 + sql.append(" bp.name2,");//3 + sql.append(" bp.m_pricelist_id,");//4 + sql.append(" bp.so_creditlimit,"); //5 + sql.append(" bp.so_creditused,"); //6 + sql.append(" bp.totalopenbalance"); //7 + sql.append(" from C_BPARTNER bp"); + sql.append(" where bp.AD_CLIENT_ID = ? "); + sql.append(" and bp.ad_org_id in (" + Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM)+")"); + sql.append(" and bp.isActive = 'Y' "); + sql.append(" and bp.isVendor='Y'"); + + while(st.hasMoreTokens()) + { + token = st.nextToken().trim(); + sql.append(" and (upper(bp.name) like upper('%"+ token +"%' ) or upper(bp.name2) like upper('%"+ token +"%' ))"); + } + + + if(!isPOS) + sql.append(" and bp.name not in (select name from ad_org where ad_org_id = " + adOrgID + ")") ; + + + sql.append(" order by bp.name,bp.name2"); + + PreparedStatement pstmt =null; + + CustomerBean customer = null; + ArrayList customers = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sql.toString(),null); + pstmt.setInt(1, adClientID); + ResultSet rs = pstmt.executeQuery(); + + + while (rs.next()) + { + customer = new CustomerBean(); + customer.setBpartnerId(Integer.valueOf(rs.getInt(1))); + customer.setPartnerName(rs.getString(2)); + customer.setSurname(rs.getString(3)); + customer.setPriceListId(rs.getInt(4)); + customer.setCreditStatus(MBPartner.SOCREDITSTATUS_CreditOK); //no limit for purchase + + BigDecimal creditLimit = rs.getBigDecimal(5); + BigDecimal creditUsed = rs.getBigDecimal(6); + BigDecimal openBalance = rs.getBigDecimal(7); + + creditLimit = creditLimit == null ? Env.ZERO : creditLimit; + creditUsed = creditUsed == null ? Env.ZERO : creditUsed; + openBalance = openBalance == null ? Env.ZERO : openBalance; + + BigDecimal creditAvailable = Env.ZERO; + if(creditLimit.doubleValue() > 0.0d) + { + creditAvailable = creditLimit.subtract(creditUsed); + } + + customer.setTotalOpenBalance(openBalance); + customer.setCreditAvailable(creditAvailable); + customer.setCreditLimit(creditLimit); + customer.setCreditUsed(creditUsed); + + customers.add(customer); + } + + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException("Sql used:" + sql,e); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + } + pstmt = null; + } + + return customers; + + } + + private static String getVendorSQL(Properties ctx) + { + int ad_client_id = Env.getAD_Client_ID(ctx); + String sql = " select" + + " bp.name as firstname," + //1.firstname + " bp.name2 as lastname," +//2.lastname + " loc.address1," +//3.address1 + " loc.address2," +//4.address2 + " bploc.phone," +//5.phone + " bploc.fax," +//6.fax + " bp.isactive, " +//7.isactive + " bp.c_bpartner_id, " + //8.partnerid + " loc.city," + //9.city + " bploc.phone2, " +//10.phone + " bp.ad_org_id, " + //11.orgId + " bp.M_PriceList_ID"+ //12.priceListId + " from c_bpartner bp left outer join (c_bpartner_location bploc left outer join c_location loc on bploc.C_LOCATION_ID = loc.C_LOCATION_ID) on bp.c_bpartner_id = bploc.c_bpartner_id"+ + " where bp.ad_client_id = " + ad_client_id + + " and bp.ad_ORG_ID in (" + Env.getContext(ctx,UdiConstants.ROLE_VIEWABLE_ORGS_CTX_PARAM)+")"+ + " and bp.ISVENDOR = 'Y'"; + + + return sql; + } + + + public static ArrayList searchVendors(Properties ctx, String searchText) throws OperationException + { + + ArrayList list = new ArrayList(); + + + String sql = getVendorSQL(ctx); + + if (searchText != null) + sql = sql + " and (upper(bp.name) like '%" + searchText.toUpperCase() + "%')"; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs = null; + + VendorBean bean = null; + + try + { + rs =pstmt.executeQuery(); + + while(rs.next()) + { + bean = new VendorBean(); + + //set bean + bean.setPartnerName(rs.getString(1)); + bean.setSurname(rs.getString(2)); + bean.setAddress1(rs.getString(3)); + bean.setAddress2(rs.getString(4)); + bean.setPhone(rs.getString(5)); + bean.setFax(rs.getString(6)); + bean.setPhone2(rs.getString(10)); + bean.setOrgId(rs.getInt(11)); + + + Boolean isActive = Boolean.valueOf(false); + + if(rs.getString(7).equalsIgnoreCase("Y")) + { + isActive = Boolean.valueOf(true); + } + bean.setIsActive(isActive); + bean.setBpartnerId(rs.getInt(8)); + + list.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + } + + + + public static ArrayList getAllVendors(Properties ctx) throws OperationException + { + + ArrayList list = new ArrayList(); + + + String sql = getVendorSQL(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs = null; + + VendorBean bean = null; + + try + { + rs =pstmt.executeQuery(); + + while(rs.next()) + { + bean = new VendorBean(); + + //set bean + bean.setPartnerName(rs.getString(1)); + bean.setSurname(rs.getString(2)); + bean.setAddress1(rs.getString(3)); + bean.setAddress2(rs.getString(4)); + bean.setPhone(rs.getString(5)); + bean.setFax(rs.getString(6)); + bean.setPhone2(rs.getString(10)); + bean.setOrgId(rs.getInt(11)); + + + Boolean isActive = Boolean.valueOf(false); + + if(rs.getString(7).equalsIgnoreCase("Y")) + { + isActive = Boolean.valueOf(true); + } + bean.setIsActive(isActive); + bean.setBpartnerId(rs.getInt(8)); + + list.add(bean); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return list; + } + + + public static VendorBean getVendor(Properties ctx,int vendorId) throws OperationException + { + String sql = getVendorSQL(ctx); + sql += " and bp.c_bpartner_id=" + vendorId+ + " order by upper(bp.name)"; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs = null; + VendorBean bean = new VendorBean(); + + try + { + rs =pstmt.executeQuery(); + + if(rs.next()) + { + + + //set bean + bean.setPartnerName(rs.getString(1)); + bean.setSurname(rs.getString(2)); + bean.setAddress1(rs.getString(3)); + bean.setAddress2(rs.getString(4)); + bean.setPhone(rs.getString(5)); + bean.setFax(rs.getString(6)); + bean.setCity(rs.getString(9)); + bean.setPhone2(rs.getString(10)); + bean.setOrgId(rs.getInt(11)); + bean.setPriceListId(rs.getInt(12)); + + Boolean isActive = Boolean.valueOf(false); + + if(rs.getString(7).equalsIgnoreCase("Y")) + { + isActive = Boolean.valueOf(true); + } + bean.setIsActive(isActive); + bean.setBpartnerId(rs.getInt(8)); + + MUser user=null; + int userIds [] =MUser.getAllIDs(MUser.Table_Name,"AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " and AD_ORG_ID=" + Env.getAD_Org_ID(ctx) + " and C_BPARTNER_ID="+ vendorId ,null); + if(userIds.length==0) + { + user = new MUser(ctx,0,null); + user.setName(bean.getPartnerName()); + } + else + { + user = new MUser(ctx,userIds[0],null); + } + + bean.setEmail(user.getEMail()); + + } + else + throw new BPartnerNotFoundException("No Business Partner found with id: " + vendorId); + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return bean; + } + + + public static void activateVendor(Properties ctx, int bpartnerId, String trxName) throws OperationException + { + BPartnerManager.activateBPartner(ctx,bpartnerId,false, trxName); + + } + + public static void deactivateVendor(Properties ctx, int bpartnerId, String trxName) throws OperationException + { + BPartnerManager.deactivateBPartner(ctx,bpartnerId, trxName); + + } + + public static ArrayList updateVendorListStatus(ArrayList list, Integer partnerId, Boolean status) + { + if (list == null) + return list; + + for (int i = 0; i < list.size(); i++) + { + VendorBean bean = (VendorBean) list.get(i); + + if (bean.getBpartnerId().equals(partnerId)) + { + bean.setIsActive(status); + + list.remove(i); + + list.add(i, bean); + + break; + } + + } + + return list; + + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/administration/WarehouseManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/administration/WarehouseManager.java new file mode 100644 index 0000000000..700e236912 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/administration/WarehouseManager.java @@ -0,0 +1,385 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 22-Jul-2005 by alok + * + */ +package org.posterita.businesslogic.administration; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.model.MLocation; +import org.compiere.model.MLocator; +import org.compiere.model.MWarehouse; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.ProductBean; +import org.posterita.beans.WarehouseBean; +import org.posterita.businesslogic.LocationManager; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.core.CheckDuplicateEntities; +import org.posterita.exceptions.CanNotMoveStockException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.WarehouseAlreadyExistsException; +import org.posterita.keyname.LocatorKeyNamePair; +import org.posterita.keyname.WarehouseKeyNamePair; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderType; +import org.posterita.util.PoManager; + +public class WarehouseManager +{ + private static final CLogger log = CLogger.getCLogger(WarehouseManager.class); + + public static MWarehouse createWarehouse(Properties ctx, int orgId, String warehouseName, String address1,String postalAddress1,String city,int regionId, int countryId,String trxName) throws OperationException, WarehouseAlreadyExistsException + { + MWarehouse warehouse; + + if (CheckDuplicateEntities.checkDuplicateName(ctx, warehouseName, MWarehouse.Table_Name)) + throw new WarehouseAlreadyExistsException("Warehouse already exists"); + + try + { + MLocation location = LocationManager.createLocation(ctx, orgId, address1, "", postalAddress1, city, regionId, countryId, trxName); + warehouse = createWarehouse(ctx, orgId, warehouseName, location.getC_Location_ID(), trxName); + } + catch(OperationException e) + { + throw e; + } + + return warehouse; + + } + + public static MWarehouse createWarehouse(Properties ctx, int orgId, String warehouseName, int c_location_id, String trxName) throws OperationException, WarehouseAlreadyExistsException + { + MWarehouse warehouse; + + if (CheckDuplicateEntities.checkDuplicateName(ctx, warehouseName, MWarehouse.Table_Name)) + throw new WarehouseAlreadyExistsException("Warehouse already exists"); + + try + { + warehouse = new MWarehouse(ctx,0,trxName); + warehouse.setName(warehouseName); + warehouse.setC_Location_ID(c_location_id); + warehouse.setAD_Org_ID(orgId); + PoManager.save(warehouse); + + createLocator(ctx, orgId, warehouse.get_ID(), true,"0","0","0", trxName); + } + catch(OperationException e) + { + throw e; + } + + return warehouse; + + } + + public static MLocator createLocator(Properties ctx,int orgId, int warehouseId,boolean isDefault, String aisle,String bin,String level, String trxName) throws OperationException + { + + MLocator locator = new MLocator(ctx,0,trxName); + + try + { + locator.setAD_Org_ID(orgId); + locator.setM_Warehouse_ID(warehouseId); + locator.setXYZ(aisle,bin,level); + locator.setIsDefault(isDefault); + + PoManager.save(locator); + } + catch(OperationException e) + { + throw new OperationException("Could not create locator!!"); + } + + return locator; + + } + + /** + * Returns all the warehouse present and viewable by the user + * @param ctx context + * @return List of Warehouses + * @throws OperationException if problem with sql or DB + */ + public static ArrayList getAllWarehouses(Properties ctx) throws OperationException + { + int viewableOrgs[] = OrganisationManager.getUserViewableOrganisations(ctx); + return getAllWarehouses(ctx, viewableOrgs); + } + + /** + * Returns all warehouses that is present for the organisation provided. + * @param ctx Context + * @param adOrgId Organisation + * @return List of Warehouses + * @throws OperationException if problem with sql or DB + */ + public static ArrayList getAllWarehouses(Properties ctx, int adOrgId) throws OperationException + { + int orgs[] = new int[] {adOrgId}; + return getAllWarehouses(ctx, orgs); + } + + /** + * Returns all the warehouse present for the organisations + * @param ctx context + * @param adOrgId organisation + * @return List of warehouses + * @throws OperationException if problem with sql or DB + */ + public static ArrayList getAllWarehouses(Properties ctx, int[] adOrgIds) throws OperationException + { + if (adOrgIds.length == 0) + { + throw new IllegalArgumentException("At least one organisation should be provided"); + } + + int adClientID = Env.getAD_Client_ID(ctx); + StringBuffer sqlStmt = new StringBuffer(); + + sqlStmt.append(" SELECT w.M_Warehouse_ID,"); //1 + sqlStmt.append(" w.Name,"); //2 + sqlStmt.append(" l.Address1,"); //3 + sqlStmt.append(" l.City,"); //4 + sqlStmt.append(" l.Postal_Add,");//5 + sqlStmt.append(" l.RegionName,"); //6 + sqlStmt.append(" w.Description,");//7 + sqlStmt.append(" w.IsActive"); //8 + sqlStmt.append(" FROM M_Warehouse w, C_Location l "); + sqlStmt.append(" WHERE l.C_Location_ID=W.C_Location_ID "); + sqlStmt.append(" AND w.AD_Org_ID IN ( "); + + int i; + for (i = 0; i < adOrgIds.length - 1; i++) + { + sqlStmt.append(adOrgIds[i]).append(","); + } + sqlStmt.append(adOrgIds[i]).append(")"); + + sqlStmt.append(" AND w.AD_Client_ID = ? "); + sqlStmt.append(" ORDER BY w.Name"); + + WarehouseBean warehouse=null; + ArrayList warehouses = new ArrayList(); + + String isActive; + PreparedStatement pstmt =null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sqlStmt.toString(), null); + pstmt.setInt(1, adClientID); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + warehouse = new WarehouseBean(); + warehouse.setWarehouseId(Integer.valueOf(rs.getInt(1))); + warehouse.setWarehouseName(rs.getString(2)); + + warehouse.setAddress1(rs.getString(3)); + warehouse.setCity(rs.getString(4)); + warehouse.setPostalAddress(rs.getString(5)); + warehouse.setRegionName(rs.getString(6)); + warehouse.setDescription(rs.getString(7)); + isActive = rs.getString(8); + warehouse.setIsActive("Y".equals(isActive)); + warehouses.add(warehouse); + } + } + catch(SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + return warehouses; + } + + public static WarehouseBean getWarehouse(Properties ctx, Integer warehouseId, ArrayList warehouses) + { + Iterator iter = (warehouses.iterator()); + + while (iter.hasNext()) + { + WarehouseBean warehouseBean = (WarehouseBean) iter.next(); + + if (warehouseBean.getWarehouseId().equals(warehouseId)) + return warehouseBean; + } + + return new WarehouseBean(); + } + + + + + public static ArrayList getOrganisationWarehouses(Properties ctx) throws OperationException + { + ArrayList warehouses; + + warehouses = WarehouseKeyNamePair.getKeyNamePair(ctx); + + return warehouses; + } + + public static ArrayList getOrganisationWarehouses(Properties ctx,ArrayList products) throws OperationException + { + ArrayList warehouses; + + Iterator prodIter = products.iterator(); + + ProductBean prodBean = null; + int warehouseId=0; + + while(prodIter.hasNext()) + { + prodBean = (ProductBean)prodIter.next(); + if(warehouseId==0 || warehouseId==prodBean.getWarehouseId().intValue()) + { + warehouseId=prodBean.getWarehouseId().intValue(); + } + else + { + throw new CanNotMoveStockException("Please select the products form single warehouse"); + } + } + warehouses = WarehouseKeyNamePair.getKeyNamePair(ctx,warehouseId); + + return warehouses; + } + + + + public static ArrayList getOrganisationLocators(Properties ctx) throws OperationException + { + ArrayList locators; + + locators = LocatorKeyNamePair.getKeyNamePair(ctx); + + return locators; + } + + public static MWarehouse getStorageWarehouse(Properties ctx, UDIOrderType type) throws OperationException + { + return getDefaultWarehouse(ctx); + + } + + public static MWarehouse getDefaultWarehouse(Properties ctx) throws OperationException + { + int warehouseID = Env.getContextAsInt(ctx, "#M_Warehouse_ID"); + MWarehouse warehouse = new MWarehouse(ctx, warehouseID, null); + if(warehouse.get_ID() != 0) + return warehouse; + throw new OperationException(" Cannot find default warehouse for organisation"); + } + + public static MWarehouse editWarehouse(Properties ctx, WarehouseBean bean) throws OperationException + { + MWarehouse warehouse = new MWarehouse(ctx, bean.getWarehouseId().intValue(), null); + + warehouse.setName(bean.getWarehouseName()); + + warehouse.setIsActive(bean.getIsActive().booleanValue()); + + PoManager.save(warehouse); + + return warehouse; + } + + + public static int getOrganisationWarehouse(Properties ctx, int adOrgId, String trxName) throws OperationException + { + int warehouseId = -1; + String sqlStmt = "SELECT M_Warehouse_ID FROM AD_OrgInfo WHERE AD_Org_ID=?"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sqlStmt, trxName); + pstmt.setInt(1, adOrgId); + + rs = pstmt.executeQuery(); + if (rs.next()) + { + warehouseId = rs.getInt(1); + } + } + catch (Exception ex) + { + log.log(Level.SEVERE, "Could not get organisation warehouse", ex); + throw new OperationException("Could not get organisation warehouse", ex); + } + finally + { + DB.close(rs, pstmt); + } + + return warehouseId; + } + + public static String getLocatorIds(Properties ctx, Integer orgId) throws OperationException + { + String orgIds = orgId.toString(); + + if (orgId == 0) + { + orgIds = Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM).toString(); + } + + int[] locatorIds = MLocator.getAllIDs(MLocator.Table_Name, "AD_Client_ID = " + Env.getAD_Client_ID(ctx)+ " AND AD_Org_ID IN (" + orgIds + ")", null); + + StringBuffer locIds = new StringBuffer(); + if (locatorIds != null && locatorIds.length>0) + { + for (int i = 0; i 0) + { + return elementValueId; + } + + int acctSchemaId = Env.getContextAsInt(ctx, "$C_AcctSchema_ID"); + + String sqlStmt = "SELECT C_Element_ID FROM C_AcctSchema_Element WHERE C_AcctSchema_ID=? AND ElementType=?"; + + int elementId = DB.getSQLValue(trxName, sqlStmt, acctSchemaId, MAcctSchemaElement.ELEMENTTYPE_Account); + + if (elementId <= 0) + { + throw new OperationException("Could not get Element of type Account from the accounting schema!!!"); + } + + MElementValue elementValue = new MElementValue(ctx, 0, trxName); + elementValue.setAD_Org_ID(0); + elementValue.setC_Element_ID(elementId); + elementValue.setValue(ELEMENT_DUMMY_CASH); + elementValue.setName("Dummy Cash"); + elementValue.setAccountType(MElementValue.ACCOUNTTYPE_Asset); + elementValue.setAccountSign(MElementValue.ACCOUNTSIGN_Natural); + elementValue.setPostActual(true); + elementValue.setPostBudget(true); + elementValue.setPostStatistical(true); + elementValue.setIsDocControlled(false); + elementValue.setIsBankAccount(false); + + PoManager.save(elementValue); + + elementValueId = elementValue.get_ID(); + + return elementValueId; + } + + + /** + * Returns the first accounting schema defined for the client + * @param ctx Context + * @param adClientId Client + * @param trxName Transaction + * @return Accouting Schema Id + */ + public static int getAcctSchemaId(Properties ctx, int adClientId, String trxName) + { + String sql = "SELECT C_AcctSchema_ID " + + "FROM C_AcctSchema a, AD_ClientInfo c " + + "WHERE a.C_AcctSchema_ID=c.C_AcctSchema1_ID " + + "AND c.AD_Client_ID=?"; + + int acctSchemaId = DB.getSQLValue(trxName, sql, adClientId); + return acctSchemaId; + } + + /** + * Returns the currency of the accounting schema + * @param ctx Context + * @param clientId Client + * @param trxName Transaction + * @return Currency Id + */ + public static int getCurrencyId(Properties ctx, int clientId, String trxName) + { + int acctSchemaId = getAcctSchemaId(ctx, clientId, trxName); + MAcctSchema acctSchema = MAcctSchema.get(ctx, acctSchemaId); + return acctSchema.getC_Currency_ID(); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/core/ApplicationManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/core/ApplicationManager.java new file mode 100644 index 0000000000..c040369311 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/core/ApplicationManager.java @@ -0,0 +1,88 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + + + +package org.posterita.businesslogic.core; + +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MStore; +import org.compiere.util.Env; +import org.posterita.beans.ApplicationParametersBean; +import org.posterita.lib.UdiConstants; + + /** + * @author Ashley + */ + +public class ApplicationManager +{ + public static void setApplicationParametersInContext(Properties tmkCtx, int storeId) + { + Env.setContext(tmkCtx, "#AD_Client_ID", 0); + Env.setContext(tmkCtx, "#AD_Org_ID", 0); + MStore store = new MStore(tmkCtx, storeId, null); + + if(store.get_ID() == 0) + throw new RuntimeException("No store found for application with ID: " + storeId); + Env.setContext(tmkCtx, UdiConstants.CLIENT_ID_CTX_PARAM, store.getAD_Client_ID()); + Env.setContext(tmkCtx, UdiConstants.ORG_ID_CTX_PARAM, store.getAD_Org_ID()); + Env.setContext(tmkCtx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM, store.getAD_Org_ID()); + Env.setContext(tmkCtx, UdiConstants.CSS, store.getWebParam5()); + Env.setContext(tmkCtx, UdiConstants.FORWARD, store.getWebParam6()); + Env.setContext(tmkCtx, UdiConstants.WSTORE_CTX_PARAM, store.get_ID()); + + String language = store.getWebParam4(); + if (language != null && language != "") + { + Env.setContext(tmkCtx, UdiConstants.LANGUAGE_CTX_PARAM, language); + } + + int acctSchemaId = AccountingManager.getAcctSchemaId(tmkCtx, store.getAD_Client_ID(), null); + Env.setContext(tmkCtx, "$C_AcctSchema_ID", acctSchemaId); + } + + //TODO Refactor, work with store id instead of context + public static ArrayList getAvailableApplications() + { + String whereClause = "IsActive='Y' order by Name"; + int storeIds[] = MStore.getAllIDs(MStore.Table_Name, whereClause, null); + + ArrayList appList = new ArrayList(); + Properties ctx = Env.getCtx(); + + for(int i = 0; i < storeIds.length; i++) + { + MStore store = new MStore(ctx, storeIds[i], null); + String appContextPath = store.getWebContext(); + appContextPath = appContextPath.replaceAll("/", ""); + + ApplicationParametersBean appParamBean = new ApplicationParametersBean(); + appParamBean.setApplicationName(store.getName()); + appParamBean.setApplicationWebContext(appContextPath); + appParamBean.setStoreId(store.get_ID()); + appList.add(appParamBean); + } + + return appList; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/core/AttachmentManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/core/AttachmentManager.java new file mode 100644 index 0000000000..41aa019fa9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/core/AttachmentManager.java @@ -0,0 +1,310 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Praveen + */ + +package org.posterita.businesslogic.core; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Properties; + +import org.apache.struts.upload.FormFile; +import org.compiere.model.MAttachment; +import org.compiere.model.MAttachmentEntry; +import org.compiere.util.Env; +import org.posterita.core.UDIPropertiesManager; +import org.posterita.exceptions.AttachmentNotFoundException; +import org.posterita.exceptions.DeleteAttachmentException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.PropertiesConstant; +import org.posterita.util.ListUtil; +import org.posterita.util.PoManager; + + + +public class AttachmentManager +{ + + public static void attachImage(Properties ctx,FormFile file,String name) throws OperationException, FileNotFoundException + { + /*X_U_UDI_LOGO attach = new X_U_UDI_LOGO(ctx,0,null); + + attach.setName(name); + + UDIMAttachment udiAttachment = new UDIMAttachment(attach); + + try + { + saveLogo(ctx,file); + udiAttachment.save(); + } + catch (OperationException e) + { + throw new OperationException("Error occurred on saving file!!"); + } + catch (FileNotFoundException e) + { + throw new FileNotFoundException("File to save not found!!"); + }*/ + } + + + + public static String getImage(Properties ctx,String name) throws OperationException + { + int orgId = Env.getAD_Org_ID(ctx); + String path = UDIPropertiesManager.getProperty().get(ctx, PropertiesConstant.LOGO_HOME)+orgId+"/"+name; + return path; + } + + public static ArrayList getAttachmentEntriesWithPrefix(Properties ctx, MAttachment attachment, String prefix, String trxName) + { + if(attachment == null) + throw new IllegalArgumentException("Attachment cannot be null"); + + + ArrayList attachmentEntryList = new ArrayList(); + + MAttachmentEntry entries[] = attachment.getEntries(); + if (prefix!=null) + prefix = prefix.toUpperCase(); + + for(int i = 0; i < entries.length; i++) + { + String attachmentName = entries[i].getName(); + attachmentName = attachmentName.toUpperCase(); + if(prefix ==null || attachmentName.startsWith(prefix)) + attachmentEntryList.add(entries[i]); + } + + return attachmentEntryList; + } + + public static ArrayList getAttachmentEntriesWithSuffix(Properties ctx, MAttachment attachment, String suffix, String trxName) + { + if(attachment == null) + throw new IllegalArgumentException("Attachment cannot be null"); + + + + ArrayList attachmentEntryList = new ArrayList(); + + MAttachmentEntry entries[] = attachment.getEntries(); + if (suffix!=null) + suffix = suffix.toUpperCase(); + + for(int i = 0; i < entries.length; i++) + { + String attachmentName = entries[i].getName(); + attachmentName = attachmentName.toUpperCase(); + if(suffix ==null || attachmentName.endsWith(suffix)) + attachmentEntryList.add(entries[i]); + } + + return attachmentEntryList; + } + + public static void addAttachment(Properties ctx, int ad_table_id, int record_id, MAttachmentEntry[] entries, String trxName) throws OperationException + { + MAttachment attachment; + if(!AttachmentManager.hasAttachment(ctx, ad_table_id, record_id, trxName)) + attachment = new MAttachment(ctx,0,trxName); + else + { + attachment = loadAttachment(ctx, ad_table_id, record_id); + attachment.set_TrxName(trxName); + } + + attachment.setAD_Table_ID(ad_table_id); + attachment.setRecord_ID(record_id); + + for(int i = 0; i < entries.length; i++) + { + attachment.addEntry(entries[i]); + } + + PoManager.save(attachment); + } + + public static void addAttachmentEntry(Properties ctx, MAttachment attachment, String fileName, byte data[], String trxName) throws OperationException + { + MAttachmentEntry attachmentEntry = new MAttachmentEntry(fileName, data); + + addAttachmentEntries(ctx, attachment, new MAttachmentEntry[]{attachmentEntry}, trxName); + } + + public static void addAttachmentEntries(Properties ctx, MAttachment attachment, MAttachmentEntry[] entries, String trxName) throws OperationException + { + for(int i = 0; i < entries.length; i++) + { + attachment.addEntry(entries[i]); + } + + PoManager.save(attachment); + } + + public static void addAttachment(Properties ctx, int adTableId, int recordId, String fileName, byte data[], String trxName) throws OperationException + { + MAttachmentEntry attachmentEntry = new MAttachmentEntry(fileName, data); + + addAttachment(ctx, adTableId, recordId, new MAttachmentEntry[]{attachmentEntry}, trxName); + } + + public static boolean hasAttachment(Properties ctx, int ad_table_id, int record_id, String trxName) + { + String whereClause = "AD_Table_ID=" + ad_table_id + " and Record_ID=" + record_id; + int mAttachmentIDs[] = MAttachment.getAllIDs(MAttachment.Table_Name, whereClause, trxName); + + if(mAttachmentIDs.length == 0) + return false; + return true; + } + + public static boolean hasAttachment(Properties ctx, int ad_table_id, int record_id, String attachmentName, String trxName) + { + String whereClause = "AD_Table_ID=" + ad_table_id + " and Record_ID=" + record_id; + int mAttachmentIDs[] = MAttachment.getAllIDs(MAttachment.Table_Name, whereClause, trxName); + + if(mAttachmentIDs.length == 0) + return false; + + for(int i = 0; i < mAttachmentIDs.length; i++) + { + MAttachment attachment = MAttachment.get(ctx, ad_table_id, record_id); + if(getAttachmentEntryIndex(ctx, attachment, attachmentName) != -1) + return true; + } + return false; + } + + public static int getAttachmentEntryIndex(Properties ctx, MAttachment attachment, String attachmentName) + { + int retIndex = -1; + + MAttachmentEntry entries[] = attachment.getEntries(); + + for(int i = 0; i < entries.length; i++) + { + MAttachmentEntry entry = entries[i]; + + if(entry.getName().equalsIgnoreCase(attachmentName)) + { + retIndex = i; + break; + } + } + return retIndex; + } + + public static void addAttachmentEntry(MAttachment attachment, MAttachmentEntry entry) throws OperationException + { + if(!attachment.addEntry(entry)) + { + throw new OperationException("Could not add Attachment Entry with name: " + entry.getName() + + " to attachment with table id: " + attachment.get_Table_ID() + " and record id: " + attachment.getRecord_ID()); + } + } + + public static void deleteAttachmentEntry(MAttachment attachment, int index) throws OperationException + { + if(!attachment.deleteEntry(index)) + { + throw new OperationException("Could not add Attachment Entry with index: " + index + + " to attachment with table id: " + attachment.get_Table_ID() + " and record id: " + attachment.getRecord_ID()); + } + } + + public static void deleteAvailableAttachment(Properties ctx, int adTableId, int recordId, String trxName) + { + if(hasAttachment(ctx, adTableId, recordId, trxName)) + { + MAttachment attachment = MAttachment.get(ctx, adTableId, recordId); + attachment.set_TrxName(trxName); + attachment.delete(true); + } + } + + public static ArrayList getAllAttachmentEntries(Properties ctx, int adTableId, int recordId) + { + ArrayList entryList = new ArrayList(); + + if(hasAttachment(ctx, adTableId, recordId, null)) + { + MAttachment attachment = MAttachment.get(ctx, adTableId, recordId); + return ListUtil.getListFromArray(attachment.getEntries()); + } + return entryList; + } + + public static ArrayList getAllImagesAttachmentEntries(Properties ctx, int adTableId, int recordId, String trxName) + { + ArrayList entryList = new ArrayList(); + + if(hasAttachment(ctx, adTableId, recordId, trxName)) + { + MAttachment attachment = MAttachment.get(ctx, adTableId, recordId); + + MAttachmentEntry attachmentEntries[] = attachment.getEntries(); + for(MAttachmentEntry entry : attachmentEntries) + { + if(entry.isGraphic()) + entryList.add(entry); + } + } + return entryList; + } + + public static MAttachment loadAttachment(Properties ctx, int adTableId, int recordId) throws AttachmentNotFoundException + { + MAttachment attachment = MAttachment.get(ctx, adTableId, recordId); + + if(attachment == null) + throw new AttachmentNotFoundException("Could not load attachment for table with id: " + adTableId + " and record: " + recordId); + + return attachment; + } + + public static MAttachment deleteAvailableAttachmentEntry(Properties ctx, int adTableId, int recordId, String attachmentName, String trxName) throws OperationException, AttachmentNotFoundException, DeleteAttachmentException + { + MAttachment retAttachment = null; + if(hasAttachment(ctx, adTableId, recordId, trxName)) + { + MAttachment attachment = loadAttachment(ctx, adTableId, recordId); + attachment.set_TrxName(trxName); + + int index = getAttachmentEntryIndex(ctx, attachment, attachmentName); + + if(index != -1) + { + boolean deleted = attachment.deleteEntry(index); + + if(!deleted) + throw new DeleteAttachmentException("Could not delete attachment for Table with id: " + adTableId + ", Record ID: " + recordId + " and attachment Name" + attachmentName); + + PoManager.save(attachment); + } + retAttachment = attachment; + } + return retAttachment; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/core/AttributeManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/core/AttributeManager.java new file mode 100644 index 0000000000..fac9b8ca5a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/core/AttributeManager.java @@ -0,0 +1,47 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author ashley + */ + +package org.posterita.businesslogic.core; + +import java.util.Properties; + +import org.compiere.model.MAttributeInstance; +import org.compiere.model.MAttributeValue; +import org.posterita.exceptions.OperationException; +import org.posterita.util.PoManager; + +public class AttributeManager +{ + public static void createAttributeInstance(Properties ctx, int attributeSetInstanceId, int attributeId, MAttributeValue attributeValue, String trxName) throws OperationException + { + MAttributeInstance attInst = new MAttributeInstance(ctx, 0, trxName); + attInst.setM_AttributeSetInstance_ID(attributeSetInstanceId); + attInst.setM_Attribute_ID(attributeId); + attInst.setM_AttributeValue_ID(attributeValue.get_ID()); + + attInst.setValue(attributeValue.getName()); + + PoManager.save(attInst); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/core/ChargeManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/core/ChargeManager.java new file mode 100644 index 0000000000..f0f5f1c3fc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/core/ChargeManager.java @@ -0,0 +1,45 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Ashley + */ + +package org.posterita.businesslogic.core; + +import java.util.Properties; + +import org.compiere.model.MCharge; + +import org.posterita.exceptions.OperationException; + +public class ChargeManager +{ + + public static MCharge loadCharge(Properties ctx, int chargeId, String trxName) throws OperationException + { + MCharge charge = new MCharge(ctx, chargeId, trxName); + if(charge.get_ID() == 0) + throw new OperationException("Could not load charge with id: " + chargeId); + + return charge; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/creditsales/CreditOrderManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/creditsales/CreditOrderManager.java new file mode 100644 index 0000000000..c7bc15b477 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/creditsales/CreditOrderManager.java @@ -0,0 +1,909 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Alok Pathak + */ + +package org.posterita.businesslogic.creditsales; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; + +import org.compiere.model.MBPartner; +import org.compiere.model.MCashLine; +import org.compiere.model.MInOut; +import org.compiere.model.MInvoice; +import org.compiere.model.MOrder; +import org.compiere.model.MPInstance; +import org.compiere.model.MPayment; +import org.compiere.process.Aging; +import org.compiere.process.DocumentEngine; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.AgingBean; +import org.posterita.beans.CheckoutBean; +import org.posterita.beans.CreditPaymentDetailsBean; +import org.posterita.beans.OpenItemBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.PaymentAllocationBean; +import org.posterita.beans.PaymentTypeBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.businesslogic.CashManager; +import org.posterita.businesslogic.InvoiceManager; +import org.posterita.businesslogic.MinOutManager; +import org.posterita.businesslogic.OrderManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.PaymentManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.exceptions.BPartnerNotFoundException; +import org.posterita.exceptions.BPartnerOverCreditLimitException; +import org.posterita.exceptions.DiscountLimitException; +import org.posterita.exceptions.MandatoryException; +import org.posterita.exceptions.NoPaymentAmountException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + + +public class CreditOrderManager +{ + private static final int PROCESS_ID=238; + + public static int createCreditOrder(Properties ctx, CheckoutBean checkoutBean, HttpServletRequest request, String trxName) + throws DiscountLimitException,BPartnerOverCreditLimitException,OperationException + { + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + OrderLineBean orderBean = new OrderLineBean(); + + //populate orderlineBean + orderBean.setBpartnerId(checkoutBean.getBpartnerId()); + orderBean.setToBeShipped(checkoutBean.getToBeShipped().toString()); + orderBean.setUserDiscount(null); + orderBean.setActualPrice(null); + orderBean.setTrxType(MOrder.PAYMENTRULE_OnCredit); + orderBean.setPaymentTermId(null); + + MOrder order = createCreditOrder(ctx, orderBean, cartBean.getItems(), trxName); + + return order.get_ID(); + } + + + public static MOrder createCreditOrder(Properties ctx,OrderLineBean bean,ArrayList cartBeanItems, String trxName) throws DiscountLimitException,BPartnerOverCreditLimitException,OperationException + { + bean.setTrxType(MOrder.PAYMENTRULE_OnCredit); + MBPartner bPartner = new MBPartner(ctx,bean.getBpartnerId(),trxName); + if(bPartner.getC_PaymentTerm_ID()==0) + throw new MandatoryException("Customer does not has a Payment Term,Please create one"); + MOrder creditOrder=null; + if(Boolean.parseBoolean(bean.getToBeShipped())==true) + { + creditOrder= POSManager.createCreditOrder(ctx,bean,cartBeanItems,trxName); + completeCreditOrder(ctx, creditOrder, trxName); + } + else + { + creditOrder= POSManager.createPOSOrder(ctx,bean,cartBeanItems,trxName); + } + + return creditOrder; + + } + + + public static MOrder completeCreditOrder(Properties ctx,int orderId, String trxName) throws BPartnerOverCreditLimitException,OperationException + { + + MOrder order = new MOrder(ctx,orderId,trxName); + + if(order.getC_DocTypeTarget_ID()==OrderManager.getDocTypeIDForStandardOrder(ctx)) + { + return completeCreditOrderWithOutShipment(ctx,order,trxName); + } + + else + { + return completeCreditOrder(ctx,order, trxName); + } + + } + + public static MOrder completeCreditOrderWithOutShipment(Properties ctx,MOrder order, String trxName) throws BPartnerOverCreditLimitException, OperationException + { + MOrder completedOrder = OrderManager.completeOrder(ctx,order); + MInvoice customerInvoice = POSManager.createCustomerInvoice(ctx, order); + customerInvoice.processIt(DocumentEngine.ACTION_Complete); + return completedOrder; + } + + + + + public static PaymentTypeBean createPayment(Properties ctx,OpenItemBean bean,String trxName) throws NoPaymentAmountException,OperationException + { + MInvoice invoice = new MInvoice(ctx,bean.getInvoiceId(),trxName); + MPayment payment=null; + MCashLine cashLine=null; + PaymentTypeBean pBean = null; + if(bean.getPaymentAmt()==null) + throw new NoPaymentAmountException("Payment amount can not be null"); + + + /* + if(bean.getTrxType().equals(MInvoice.PAYMENTRULE_Cash)) + { + cashLine=CashManager.createCashLineForInvoice(ctx,bean,trxName); + } + else + { + payment = PaymentManager.createARReceiptForCreditOrder(ctx,invoice,bean,trxName); + PoManager.save(payment); + } + */ + + payment = PaymentManager.createPaymentForCreditOrder(ctx,invoice,bean,trxName); + PoManager.save(payment); + + + if(cashLine != null) + { + pBean = new PaymentTypeBean(); + pBean.setPaymentType("cash"); + pBean.setId(cashLine.get_ID()); + + } + else + { + pBean = new PaymentTypeBean(); + pBean.setPaymentType("Card_Cheque"); + pBean.setId(payment.get_ID()); + } + + return pBean; + + } + + + public static ArrayList getOpenItems(Properties ctx,Integer C_BPartner_ID) throws OperationException + { + MBPartner bpartner = MBPartner.get(ctx, C_BPartner_ID); + + if(bpartner == null) + { + throw new BPartnerNotFoundException("customer not found"); + } + + String sql="select op.DOCUMENTNO," +//1 + "op.C_INVOICE_ID," +//2 + "op.C_ORDER_ID," +//3 + "op.ISSOTRX," +//4 + "op.DATEINVOICED," +//5 + "op.NETDAYS," +//6 + "op.DUEDATE," +//7 + "op.DAYSDUE," +//8 + "op.DISCOUNTDATE," +//9 + "op.DISCOUNTAMT ," +//10 + "ord.GRANDTOTAL ," +//11 + "op.PAIDAMT," +//12 + "op.OPENAMT," +//13 + "op.C_CURRENCY_ID," +//14 + "op.C_PAYMENTTERM_ID ," +//15 + "op.C_INVOICEPAYSCHEDULE_ID," +//16 + "ord.DOCUMENTNO,"+ //17 + "cr.ISO_CODE,"+ //18 + "pt.NAME,"+//19 + "bp.name|| ' ' || bp.name2,"+//20 + "op.C_BPARTNER_ID,"+//21 + //"DECODE(ord.GRANDTOTAL-nvl(sum(cl.AMOUNT),0),0,'"+Constants.PAID+"',ord.GRANDTOTAL,'"+Constants.UNPAID+"','"+Constants.PARTIALLY_PAID+"') status,"+//22 + " CASE WHEN ord.GRANDTOTAL-COALESCE(sum(cl.AMOUNT),0) = 0 THEN '"+Constants.PAID+"' WHEN ord.GRANDTOTAL-COALESCE(sum(cl.AMOUNT),0) = ord.GRANDTOTAL THEN '"+Constants.UNPAID+"' ELSE '"+Constants.PARTIALLY_PAID+"' END AS status,"+//22 + //" DECODE(sign(op.OPENAMT),-1,'"+Constants.OVER_PAID+"','NULL') sign"+//23 + " CASE WHEN sign(op.OPENAMT) = -1 THEN '"+Constants.OVER_PAID+"' ELSE 'NULL' END AS sign"+//23 + " from RV_OPENITEM op left outer join c_cashline cl on op.C_INVOICE_ID=cl.C_INVOICE_ID,C_ORDER ord,C_CURRENCY cr,C_PAYMENTTERM pt,c_bpartner bp " + + " where op.C_ORDER_ID=ord.C_ORDER_ID"+ + " and op.C_CURRENCY_ID=cr.C_CURRENCY_ID"+ + " and ord.C_PAYMENTTERM_ID=pt.C_PAYMENTTERM_ID"+ + " and op.C_BPARTNER_ID=bp.C_BPARTNER_ID"+ + " and op.C_BPARTNER_ID="+ C_BPartner_ID + + " and op.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + sql=sql+" group by"+ + " op.DOCUMENTNO," +//1 + "op.C_INVOICE_ID," +//2 + "op.C_ORDER_ID," +//3 + "op.ISSOTRX," +//4 + "op.DATEINVOICED," +//5 + "op.NETDAYS," +//6 + "op.DUEDATE," +//7 + "op.DAYSDUE," +//8 + "op.DISCOUNTDATE," +//9 + "op.DISCOUNTAMT ," +//10 + "ord.GRANDTOTAL ," +//11 + "op.PAIDAMT," +//12 + "op.OPENAMT," +//13 + "op.C_CURRENCY_ID," +//14 + "op.C_PAYMENTTERM_ID ," +//15 + "op.C_INVOICEPAYSCHEDULE_ID," +//16 + "ord.DOCUMENTNO,"+ //17 + "cr.ISO_CODE,"+ //18 + "pt.NAME,"+//19 + "bp.name|| ' ' || bp.name2,"+//20 + "op.C_BPARTNER_ID"+ + " order by op.DATEINVOICED desc "; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + OpenItemBean bean=null; + BigDecimal amt = BigDecimal.valueOf(0.0); + + ArrayList list=new ArrayList(); + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean=new OpenItemBean(); + + bean.setInvoiceNo(rs.getString(1)); + bean.setInvoiceId(rs.getInt(2)); + bean.setOrderId(rs.getInt(3)); + boolean isSoTrx = "Y".equals(rs.getString(4)); + bean.setIsSoTrx(isSoTrx); + bean.setInvoiceDate(rs.getString(5)); + bean.setNetDays(rs.getInt(6)); + bean.setDueDate(rs.getTimestamp(7)); + bean.setDaysDue(rs.getInt(8)); + bean.setDiscountDate(rs.getString(9)); + bean.setDiscountAmt(rs.getBigDecimal(10)); + bean.setInvoiceGrandTotal(rs.getBigDecimal(11)); + amt = getNonProcessedCashAmt(ctx,rs.getInt(2)); + + BigDecimal paidAmt = rs.getBigDecimal(12).add(amt); + if(!isSoTrx) + { + paidAmt = paidAmt.negate(); + } + + bean.setPaidAmt(paidAmt); + bean.setOpenAmt(rs.getBigDecimal(13).subtract(amt)); + bean.setCurrencyId(rs.getInt(14)); + bean.setPaymentTermId(rs.getInt(15)); + bean.setInvoiceScheduleId(rs.getInt(16)); + bean.setDocumentNo(rs.getString(17)); + bean.setCurrencySymbole(rs.getString(18)); + bean.setPaymentTermName(rs.getString(19)); + bean.setPartnerName(rs.getString(20)); + bean.setBpartnerId(rs.getInt(21)); + if(rs.getString(23)==null) + { + bean.setAllocationStatus(rs.getString(22)); + } + else + { + bean.setAllocationStatus(rs.getString(23)); + } + + if (rs.getBigDecimal(12).doubleValue()>0) + { + bean.setAllocationStatus(Constants.PARTIALLY_PAID); + } + list.add(bean); + } + rs.close(); + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch (SQLException e) + { + + } + + } + return list; + } + + + + + + + public static ArrayList getUnallocatedPayments(Properties ctx,int bPartnerId) throws OperationException + { + String sql="select C_PAYMENT_ID ," +//1 + "DOCUMENTNO," +//2 + " CREATED," +//3 + "C_BPARTNER_ID," +//4 + "C_INVOICE_ID," +//5 + //"DECODE(TENDERTYPE,'K','Cheque','C','Card','Cash') tenderType," +//6 + "CASE WHEN TENDERTYPE='K' THEN 'Cheque' WHEN TENDERTYPE= 'C' THEN 'Card' ELSE 'Cash' END AS tenderType," +//6 + "PAYAMT," +//7 + "DISCOUNTAMT,"+//8 + "WRITEOFFAMT," +//9 + "TAXAMT, " +//10 + "OVERUNDERAMT," +//11 + "ALLOCATEDAMT," +//12 + "AVAILABLEAMT," + //13 + "ISRECEIPT " + //14 + " from RV_payment " + + " where C_BPARTNER_ID="+bPartnerId+ + " and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " AND DocStatus IN ('CO','CL') " + + " and AVAILABLEAMT <> 0"; + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + OpenItemBean bean=null; + + ArrayList list=new ArrayList(); + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean=new OpenItemBean(); + + bean.setPaymentId(rs.getInt(1)); + bean.setPaymentNo(rs.getString(2)); + bean.setTrxDate(rs.getString(3)); + bean.setBpartnerId(rs.getInt(4)); + bean.setInvoiceId(rs.getInt(5)); + bean.setTenderType(rs.getString(6)); + + boolean isReceipt = "Y".equalsIgnoreCase(rs.getString(14)); + BigDecimal paymentAmt = rs.getBigDecimal(7); + BigDecimal discountAmt = rs.getBigDecimal(8); + BigDecimal writeOffAmt = rs.getBigDecimal(9); + BigDecimal taxedAmt = rs.getBigDecimal(10); + BigDecimal overUnderPayment = rs.getBigDecimal(11); + BigDecimal paymentAllocatedAmt = rs.getBigDecimal(12); + BigDecimal availableAmt = rs.getBigDecimal(13); + + bean.setPaymentAmt(isReceipt ? paymentAmt : paymentAmt.negate()); + bean.setDiscountAmt(isReceipt ? discountAmt : discountAmt.negate()); + bean.setWriteOffAmt(isReceipt ? writeOffAmt : writeOffAmt.negate()); + bean.setTaxedAmt(isReceipt ? taxedAmt : taxedAmt.negate()); + bean.setOverUnderPayment(isReceipt ? overUnderPayment : overUnderPayment.negate()); + bean.setPaymentAllocatedAmt(isReceipt ? paymentAllocatedAmt : paymentAllocatedAmt.negate()); + bean.setAvailableAmt(isReceipt ? availableAmt : availableAmt.negate()); + + list.add(bean); + } + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + + } + + } + return list; + + + } + + + public static ArrayList getAging(Properties ctx,int bPartnerId) throws OperationException + { + ProcessInfoParameter param[]={ + new ProcessInfoParameter("C_BPartner_ID",new BigDecimal(bPartnerId),null,null,null), + new ProcessInfoParameter("IsSOTrx","Y",null,null,null) + }; + + MPInstance instance = new MPInstance(ctx,PROCESS_ID,bPartnerId); + instance.save(); + + ProcessInfo poInfo = new ProcessInfo("Aging",PROCESS_ID); + poInfo.setParameter(param); + poInfo.setAD_Process_ID(PROCESS_ID); + poInfo.setAD_PInstance_ID(instance.get_ID()); + Aging aging = new Aging(); + boolean success= aging.startProcess(ctx, poInfo,null); + ArrayList list = new ArrayList(); + if(success) + { + String sql="select C_CURRENCY_ID," +//1 + " DUEDATE ," +//2 + " C_BP_GROUP_ID," +//3 + " INVOICEDAMT," +//4 + " OPENAMT," +//5 + " PASTDUE91_PLUS," +//6 + " PASTDUE61_90," +//7 + " PASTDUE31_60," +//8 + " PASTDUE1_30 ," +//9 + " PASTDUE8_30," +//10 + " PASTDUE1_7," +//11 + " PASTDUEAMT," +//12 + " DUEAMT," +//13 + " DUE0," +//14 + " DUE1_7," +//15 + " DUE8_30," +//16 + " DUE0_30," +//17 + " DUE31_60," +//18 + " DUE61_90," +//19 + " DUE91_PLUS, " +//20 + " C_INVOICE_ID"+//21 + " from T_AGING"+ + " where C_BPARTNER_ID="+bPartnerId+ + " and AD_PINSTANCE_ID="+instance.get_ID(); + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + + AgingBean bean=null; + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean=new AgingBean(); + bean.setCurrencyId(rs.getInt(1)); + bean.setDueDate(rs.getTimestamp(2)); + bean.setInvoicedAmt(rs.getBigDecimal(4)); + bean.setOpenAmt(rs.getBigDecimal(5)); + bean.setPastDue91_plus(rs.getBigDecimal(6)); + bean.setPastDue61_90(rs.getBigDecimal(7)); + bean.setPastDue31_60(rs.getBigDecimal(8)); + bean.setPastDue1_30(rs.getBigDecimal(9)); + bean.setPastDue8_30(rs.getBigDecimal(10)); + bean.setPastDue1_7(rs.getBigDecimal(11)); + bean.setPastDueAmt(rs.getBigDecimal(12)); + bean.setDueAmt(rs.getBigDecimal(13)); + bean.setDue0(rs.getBigDecimal(14)); + bean.setDue1_7(rs.getBigDecimal(15)); + bean.setDue8_30(rs.getBigDecimal(16)); + bean.setDue0_30(rs.getBigDecimal(17)); + bean.setDue31_60(rs.getBigDecimal(18)); + bean.setDue61_90(rs.getBigDecimal(19)); + bean.setDue91_PLUS(rs.getBigDecimal(20)); + bean.setInvoiceId(rs.getInt(21)); + + list.add(bean); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + } + } + return list; + } + + + public static ArrayList getAllCashPaymentForInvoice(Properties ctx,Integer invoiceId) throws OperationException + { + String sql="select " + + " C_CASHLINE_ID ," + //1 + " CREATED," + //2 + " CREATEDBY," + //3 + " C_CASH_ID," + //4 + " DESCRIPTION," + //5 + " CASHTYPE," + //6 + " C_INVOICE_ID," + //7 + " C_CURRENCY_ID," + //8 + " AMOUNT," +//9 + " DISCOUNTAMT," +//10 + " WRITEOFFAMT" +//11 + " from C_CASHLINE" + + " where C_INVOICE_ID="+invoiceId+ + " and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " order by CREATED"; + + ArrayList list = new ArrayList(); + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + + CreditPaymentDetailsBean bean=null; + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean=new CreditPaymentDetailsBean(); + bean.setCashLineId(rs.getInt(1)); + bean.setDateCreated(rs.getTimestamp(2)); + bean.setUserID(rs.getInt(3)); + bean.setCashId(rs.getInt(4)); + bean.setDescription(rs.getString(5)); + bean.setCashType(rs.getString(6)); + bean.setInvoiceId(rs.getInt(7)); + bean.setCurrencyId(rs.getInt(8)); + bean.setPaidAmt(rs.getBigDecimal(9)); + bean.setDiscountAmt(rs.getBigDecimal(10)); + bean.setWriteOffAmt(rs.getBigDecimal(11)); + bean.setTenderType("Cash"); + + list.add(bean); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + } + + return list; + } + + public static ArrayList getAllPaymentForInvoice(Properties ctx,Integer invoiceId) throws OperationException + { + String sql="select C_PAYMENT_ID," + //1 + "CREATED," +//2 + "CREATEDBY," +//3 + "DOCUMENTNO," +//4 + "C_INVOICE_ID," +//5 + //"decode(TENDERTYPE,'"+MPayment.TENDERTYPE_Check+"','Cheque','" + + "CASE WHEN TENDERTYPE='"+MPayment.TENDERTYPE_Check+"' THEN 'Cheque' " + + //MPayment.TENDERTYPE_CreditCard+"','Card')," +//6 + " WHEN TENDERTYPE='"+MPayment.TENDERTYPE_CreditCard+"' THEN 'Card' END ," +//6 + "CREDITCARDNUMBER," +//7 + "CHECKNO," +//8 + "PAYAMT," +//9 + "DISCOUNTAMT," +//110 + "WRITEOFFAMT," +//11 + "C_CURRENCY_ID" + //12 + " from c_payment"+ + " where C_INVOICE_ID="+invoiceId+ + " and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " order by CREATED";; + + ArrayList list = new ArrayList(); + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + + CreditPaymentDetailsBean bean=null; + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean=new CreditPaymentDetailsBean(); + bean.setPaymentId(rs.getInt(1)); + bean.setDateCreated(rs.getTimestamp(2)); + bean.setUserID(rs.getInt(3)); + bean.setDocumentNo(rs.getString(4)); + bean.setInvoiceId(rs.getInt(5)); + bean.setTenderType(rs.getString(6)); + bean.setCreditCardNumber(rs.getString(7)); + bean.setChequeNo(rs.getString(8)); + bean.setPaidAmt(rs.getBigDecimal(9)); + bean.setDiscountAmt(rs.getBigDecimal(10)); + bean.setWriteOffAmt(rs.getBigDecimal(11)); + bean.setCurrencyId(rs.getInt(12)); + + list.add(bean); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + + { + if(rs!=null) + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + + } + } + + return list; + } + + public static MInOut createAndCompleteShipment(Properties ctx,int invoiceId) throws OperationException + { + return createAndCompleteShipment(ctx, invoiceId, null); + } + + public static MInOut createAndCompleteShipment(Properties ctx, int invoiceId, String trxName) throws OperationException + { + MInvoice invoice = new MInvoice(ctx,invoiceId,trxName); + MOrder order = new MOrder(ctx,invoice.getC_Order_ID(),trxName); + MInOut shipment=MinOutManager.createMInOut(ctx,invoice,order.getM_Warehouse_ID()); + MInOut completedShipment= MinOutManager.completeShipment(ctx, shipment); + order.setIsDelivered(true); + PoManager.save(order); + return completedShipment; + } + + public static ArrayList viewAllocation(Properties ctx,String bpartnerName, String invoiceNumber, boolean isCustomer, boolean isVendor) throws OperationException + { + String sql="select al.C_INVOICE_ID," +//1 + "inv.documentNo," +//2 + "al.C_BPARTNER_ID," +//3 + "al.C_ORDER_ID," +//4 + "ord.documentno," +//5 + "al.C_PAYMENT_ID," +//6 + "al.C_CASHLINE_ID," +//7 + "al.AMOUNT," +//8 + "al.DISCOUNTAMT," +//9 + "al.WRITEOFFAMT," +//10 + "bp.name||' ' ||bp.name2 ," +//11 + "al.OVERUNDERAMT, " +//12 + "al.C_ALLOCATIONHDR_ID"+//13 + " from C_ALLOCATIONLINE al,c_invoice inv,c_order ord,c_bpartner bp" + + " where al.c_invoice_id = inv.c_invoice_id" + + " and al.C_ORDER_ID=ord.C_ORDER_ID"+ + " and al.C_BPARTNER_ID=bp.C_BPARTNER_ID "; + + if(isCustomer) + sql=sql+ " and bp.isCustomer='Y'"; + + if(isVendor) + sql=sql+ " and bp.isVendor='Y'"; + + if(bpartnerName!=null) + sql=sql+ " and lower(bp.name||' ' ||bp.name2) like lower('%"+bpartnerName+"%')"; + + if(invoiceNumber!=null) + sql=sql+" and inv.documentNo='"+invoiceNumber+"'"; + + ArrayList list = new ArrayList(); + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + + String invoiceNo=null; + String documentNo=null; + String partnerName=null; + + PaymentAllocationBean bean=null; + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + + bean=new PaymentAllocationBean(); + bean.setInvoiceId(rs.getInt(1)); + if(invoiceNo==null || !invoiceNo.equals(rs.getString(2))) + { + bean.setInvoiceNo(rs.getString(2)); + invoiceNo=rs.getString(2); + } + bean.setBpartnerId(rs.getInt(3)); + bean.setOrderId(rs.getInt(4)); + if(documentNo==null || !documentNo.equals(rs.getString(5))) + { + bean.setDocumentNo(rs.getString(5)); + documentNo=rs.getString(5); + } + + if(rs.getInt(6)!=0) + { + bean.setPaymentId(rs.getInt(6)); + } + + if(rs.getInt(7)!=0) + { + bean.setCashLineId(rs.getInt(7)); + } + if(rs.getInt(6)==0 && rs.getInt(7)==0) + { + getReturnedInvoice(ctx,bean,rs.getInt(1),rs.getInt(13),rs.getBigDecimal(8)); + } + + bean.setAmount(rs.getBigDecimal(8)); + bean.setDiscountAmt(rs.getBigDecimal(9)); + bean.setWriteOffAmt(rs.getBigDecimal(10)); + + if(partnerName==null || !partnerName.equals(rs.getString(11))) + { + bean.setPartnerName(rs.getString(11)); + partnerName=rs.getString(11); + } + bean.setOverUnderPayment(rs.getBigDecimal(12)); + list.add(bean); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + if(rs!=null) + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + + } + } + + return list; + + } + + + private static void getReturnedInvoice(Properties ctx,PaymentAllocationBean bean,int invoiceId, int C_ALLOCATIONHDR_ID,BigDecimal amt) throws OperationException + { + String sql="select al.C_INVOICE_ID,inv.documentNo" + + " from C_ALLOCATIONLINE al,c_invoice inv " + + " where al.c_invoice_id = inv.c_invoice_id"+ + " and al.C_ALLOCATIONHDR_ID= "+C_ALLOCATIONHDR_ID+ + " and al.C_INVOICE_ID<>"+invoiceId+ + " and al.AMOUNT="+amt.negate(); + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + + + try + { + rs = pstmt.executeQuery(); + while(rs.next()) + { + bean.setCreditMemoId(rs.getInt(1)); + bean.setCreditMemoNumber(rs.getString(2)); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + + { + if(rs!=null) + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + + } + } + + + } + + + + + private static MOrder completeCreditOrder(Properties ctx,MOrder order, String trxName) throws BPartnerOverCreditLimitException,OperationException + { + // POSManager.completePOSOrder2() + MOrder completedOrder = OrderManager.completeOrder(ctx,order); + int [] invoiceIds=InvoiceManager.getInvoiceIdsForOrder(ctx,order.get_ID(),trxName); + if(invoiceIds.length<1) + throw new OperationException("No invoice generated"); + if(invoiceIds.length>1) + throw new OperationException("More than one invoice for the order has been generated"); + //MInvoice invoice = new MInvoice(ctx,invoiceIds[0],trxName); + //InvoiceManager.printInvoice(ctx,invoice); + + return completedOrder; + } + + private static BigDecimal getNonProcessedCashAmt(Properties ctx, int invoiceId) throws OperationException + { + String sql = "select nvl(sum(cl.AMOUNT),0)" + + " from c_cashline cl,C_CASH ca" + + " where cl.c_cash_id = ca.c_cash_id " + + " and cl.c_invoice_id = " +invoiceId+ + " and cl.AD_CLIENT_ID = " +Env.getAD_Client_ID(ctx)+ + " and ca.docstatus = '"+DocumentEngine.STATUS_Drafted+"'"; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + ResultSet rs=null; + BigDecimal amt = new BigDecimal(0); + + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + amt=rs.getBigDecimal(1); + } + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + + } + + } + return amt; + + + } + +} + + diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/CSVReportManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/CSVReportManager.java new file mode 100644 index 0000000000..d30a559f85 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/CSVReportManager.java @@ -0,0 +1,165 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Praveen Beekoo + */ +package org.posterita.businesslogic.performanceanalysis; + +import java.io.FileWriter; +import java.io.IOException; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.util.DB; + +import org.posterita.core.RandomStringGenerator; +import org.posterita.exceptions.OperationException; + +public class CSVReportManager +{ + public static String generateCSVReport(Properties ctx, String sql) throws OperationException + { + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + return generateCSVReport(ctx, pstmt); + } + public static String generateCSVReport(Properties ctx, PreparedStatement pstmt) throws OperationException + { + ResultSet rs; + StringBuffer sb = new StringBuffer(); + +// int count=0; + try + { + rs = pstmt.executeQuery(); + + int columnCount = rs.getMetaData().getColumnCount(); + for(int i = 1; i <= columnCount; i++) + { + if(i == 1) + sb.append("\""); + else + sb.append(",\""); + + sb.append(rs.getMetaData().getColumnName(i)); + sb.append("\""); + } + + sb.append("\n"); + + while(rs.next()) + { + for(int i = 1; i <= columnCount; i++) + { + if(i == 1) + sb.append("\""); + else + sb.append(",\""); + + sb.append(rs.getObject(i)); + sb.append("\""); + } + + sb.append("\n"); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception ex){} + + pstmt = null; + } + + String filename = RandomStringGenerator.randomstring() + ".csv"; + String filepath = ReportManager.getReportPath(filename); + + try + { + FileWriter writer = new FileWriter(filepath); + writer.write(sb.toString()); + writer.flush(); + writer.close(); + } + catch (IOException e1) + { + throw new OperationException(e1); + } + + return filename; + } + + public static String generateCSVReport(Properties ctx, ArrayList reportDataSource) throws OperationException + { +// ResultSet rs; + StringBuffer sb = new StringBuffer(); + + Iterator iter = reportDataSource.iterator(); + + while(iter.hasNext()) + { + Object[] obj = (Object[]) iter.next(); + + for(int i = 0; i < obj.length; i++) + { + if(i == 0) + sb.append("\""); + else + sb.append(",\""); + + sb.append(obj[i]); + sb.append("\""); + } + + sb.append("\n"); + } + + String filename = RandomStringGenerator.randomstring() + ".csv"; + String filepath = ReportManager.getReportPath(filename); + + try + { + FileWriter writer = new FileWriter(filepath); + writer.write(sb.toString()); + writer.flush(); + writer.close(); + } + catch (IOException e1) + { + throw new OperationException(e1); + } + + return filename; + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/CustomPOSReportManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/CustomPOSReportManager.java new file mode 100644 index 0000000000..64c2d21933 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/CustomPOSReportManager.java @@ -0,0 +1,553 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author Praveen Beekoo + */ +package org.posterita.businesslogic.performanceanalysis; + +import java.awt.Color; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; +import java.util.Properties; +import java.util.TreeMap; + +import org.compiere.util.Env; +import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.labels.StandardPieSectionLabelGenerator; +import org.jfree.chart.plot.PiePlot; +import org.jfree.chart.plot.XYPlot; +import org.jfree.data.category.DefaultCategoryDataset; +import org.jfree.data.general.DefaultPieDataset; +import org.jfree.data.time.Day; +import org.jfree.data.time.TimeSeries; +import org.jfree.data.time.TimeSeriesCollection; +import org.posterita.Constants; +import org.posterita.beans.ReportBean; +import org.posterita.beans.TabularReportRecordBean; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.core.BarChart; +import org.posterita.core.PieChart; +import org.posterita.core.TabularReport; +import org.posterita.core.TimeSeriesChart; +import org.posterita.core.TimestampConvertor; +import org.posterita.exceptions.OperationException; + +public class CustomPOSReportManager +{ + public static PieChart generatePieChart(Properties ctx,String title,String subtitle,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup,String priceQtyFilter) throws OperationException + { + PieChart pieChart = new PieChart(); + pieChart.setTitle(title); + pieChart.setSubtitle(subtitle); + + String pieChartSQL = SalesAnalysisReportManager.getPieChartDataSetSQL(ctx,account_id,fromDate,toDate,salesGroup); + ArrayList list = ReportManager.getReportData(ctx,pieChartSQL,false); + DefaultPieDataset pieDataset = new DefaultPieDataset(); + StandardPieSectionLabelGenerator labelGenerator = null; + + + if(priceQtyFilter.equalsIgnoreCase(Constants.PRICE)) + { + //against price + for(Object[] obj:list) + { + String name = (String) obj[0]; + BigDecimal price = (BigDecimal) obj[1]; + + pieDataset.setValue(name,price); + } + + String currency = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + labelGenerator = new StandardPieSectionLabelGenerator("{0} = "+ currency +"{1}"); + } + else + { + //against qty + for(Object[] obj:list) + { + String name = (String) obj[0]; + BigDecimal qty = (BigDecimal) obj[2]; + + pieDataset.setValue(name,qty); + } + + labelGenerator = new StandardPieSectionLabelGenerator(); + } + + + pieChart.setDataset(pieDataset); + PiePlot p = (PiePlot) pieChart.getChart().getPlot(); + p.setLegendLabelGenerator(labelGenerator); + pieChart.getChart().setBackgroundPaint(Color.white); + + return pieChart; + } + + public static BarChart generateBarChart(Properties ctx,String title,String subtitle,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup,String priceQtyFilter) throws OperationException + { + BarChart barChart = new BarChart(); + barChart.setTitle(title); + barChart.setSubtitle(subtitle); + //barChart.getDataSetFromSQL(barChartSQL); + + String barChartSQL = SalesAnalysisReportManager.getBarChartDataSetSQL(ctx,account_id,fromDate,toDate,salesGroup); + ArrayList list = ReportManager.getReportData(ctx,barChartSQL,true); + DefaultCategoryDataset categoryDataset = new DefaultCategoryDataset(); + + Object[] header = list.remove(0); + String grouping = header[0]+""; + String yLabel = null; + + + if(priceQtyFilter.equalsIgnoreCase(Constants.PRICE)) + { + String currency = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + + //against price + for(Object[] obj:list) + { + String name = (String) obj[0]; + BigDecimal price = (BigDecimal) obj[1]; + + categoryDataset.setValue(price,grouping,name); + yLabel = "Value (" + currency + ")"; + } + } + else + { + //against qty + for(Object[] obj:list) + { + String name = (String) obj[0]; + BigDecimal qty = (BigDecimal) obj[2]; + + categoryDataset.setValue(qty,grouping,name); + yLabel = "Quantity"; + } + } + + //xLabel = grouping; + + //--------------------------------------------------------------------------------- + barChart.setDataset(categoryDataset); + barChart.setIntegerTickUnits(true); + + //CategoryItemRenderer itemRender = barChart.getChart().getPlot(); + //itemRender.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); + + barChart.setYLabel(yLabel); + //barChart.setXLabel(xLabel); + barChart.setShowLabels(true); + barChart.getChart().setBackgroundPaint(Color.white); + + + return barChart; + } + + public static TimeSeriesChart generateTimeSeriesChart(Properties ctx,String title,String subtitle,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup,String priceQtyFilter) throws OperationException + { + TimeSeriesChart timeSeriesChart = new TimeSeriesChart(); + timeSeriesChart.setTitle(title); + timeSeriesChart.setSubtitle(subtitle); + timeSeriesChart.setShowShapes(true); + //timeSeriesChart.getDataSetFromSQL(timeSeriesChartSQL); + + String timeSeriesChartSQL = SalesAnalysisReportManager.getTimeSeriesDataSetSQL(ctx,account_id,fromDate,toDate,salesGroup); + ArrayList list = ReportManager.getReportData(ctx,timeSeriesChartSQL,false); + + TimeSeriesCollection dataset = new TimeSeriesCollection(); + TimeSeries series = null; + String yLabel = null; + + String seriesName = null; + String date = null; + BigDecimal price = null; + String[] s = null; + int day,month,year; + + for (Object[] data : list) + { + seriesName = (String)data[0]; + date = (String)data[1]; + price = (BigDecimal) data[2]; + s = date.split("-"); + + if(s.length!=3) + throw new OperationException("Unable to generate timeseries. " + + "Cause:Invalid date format, the date returned should have the following format 'DD-MM-YYYY'"); + + SimpleDateFormat sdf = new SimpleDateFormat(); + Calendar cal = Calendar.getInstance(); + Date d = null; + + try + { + sdf.applyPattern("dd-MM-yyyy"); + d = sdf.parse(date); + } + catch (ParseException e1) + { + try + { + sdf.applyPattern("dd-MMM-yyyy"); + d = sdf.parse(date); + } + catch (ParseException e) + { + throw new OperationException("Unable to generate timeseries. " + + "Cause:Invalid date format, the date returned should have one of the following formats 'DD-MM-YYYY' or 'DD-MMM-YYYY'",e); + } + } + + + cal.setTime(d); + + day = cal.get(Calendar.DATE); + month = cal.get(Calendar.MONTH) + 1; + year = cal.get(Calendar.YEAR); + + series = dataset.getSeries(seriesName); + + if(series == null) + { + series = new TimeSeries(seriesName,Day.class); + series.add(new Day(day,month,year),price); + + dataset.addSeries(series); + } + else + { + series.add(new Day(day,month,year),price); + }//if + + }//for + + if(priceQtyFilter.equalsIgnoreCase(Constants.PRICE)) + { + //against price + String currency = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + yLabel = "Value (" + currency + ")"; + } + else + { + yLabel = "Quantity"; + } + + timeSeriesChart.setYLabel(yLabel); + timeSeriesChart.setDataset(dataset); + XYPlot plot = (XYPlot) timeSeriesChart.getChart().getPlot(); + DateAxis axis = (DateAxis) plot.getDomainAxis(); + + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + + axis.setRange(fromDate, toDate); + //axis.setTickUnit(new DateTickUnit(DateTickUnit.MONTH,1,new SimpleDateFormat("MMM-yyyy"))); + timeSeriesChart.getChart().setBackgroundPaint(Color.white); + + return timeSeriesChart; + } + + public static TabularReport generateTabularReport(Properties ctx,String title,String subtitle,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup,String priceQtyFilter) throws OperationException + { + String sql = SalesAnalysisReportManager.getTabularDataSetSQL(ctx,account_id,fromDate,toDate,salesGroup); + ArrayList tmpData = ReportManager.getReportData(ctx,sql,true); + String currency = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + + ArrayList reportData = new ArrayList(); + //copying data from tmpData to reportData + + NumberFormat formatter = new DecimalFormat("###,###,##0.00"); + + Iterator iter = tmpData.iterator(); + + Object[] data = null; + Object[] headers = null; + BigDecimal b,c = null; + + boolean isTaxDue = (account_id == Constants.TAX_DUE.intValue() ); + boolean isTaxCredit = (account_id == Constants.TAX_CREDIT.intValue() ); + + if(isTaxCredit || isTaxDue) + { + //copying header + headers = iter.next(); + + reportData.add( new Object[]{ + headers[0] +"("+ currency +")", + }); + + while(iter.hasNext()) + { + data = iter.next(); + + if(data.length == 1) + { + b = (BigDecimal)data[0]; + data[0] = formatter.format(b.doubleValue()); + } + + reportData.add(data); + } + } + else + { + //copying header + headers = iter.next(); + + reportData.add( new Object[]{ + headers[0], + headers[1], + headers[2] +"("+ currency +")", + headers[3] + }); + + double totalAmt = 0.0d; + BigDecimal totalQty = Env.ZERO; + + while(iter.hasNext()) + { + data = iter.next(); + + + if(data.length > 2) + { + b = (BigDecimal)data[2]; + c = (BigDecimal)data[3]; + + data[2] = formatter.format(b.doubleValue()); + + totalAmt += b.doubleValue(); + totalQty = totalQty.add(c); + + } + + reportData.add(data); + } + + reportData.add(new Object[]{"Total","", formatter.format(totalAmt)+"", totalQty+""}); + + } + + + //style for table + String tableStyle = "display"; + //style for columns + String[] styles = new String[]{"string","date","currency","numeric"}; + + if(isTaxCredit || isTaxDue) + { + styles = new String[]{"numeric"}; + } + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + //tReport.setSortable(true); + tReport.setHeaderStyle(styles); + tReport.setStyle(tableStyle); + tReport.setTitle(title); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + return tReport; + } + + public static TabularReport generateTabularReportGroupByDate(Properties ctx,String title,String subtitle,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup,String priceQtyFilter) throws OperationException + { + boolean isTaxDue = (account_id == Constants.TAX_DUE.intValue() ); + boolean isTaxCredit = (account_id == Constants.TAX_CREDIT.intValue() ); + + NumberFormat formatter = new DecimalFormat("###,###,##0.00"); + + String sql = SalesAnalysisReportManager.getTabularDataSetSQL(ctx,account_id,fromDate,toDate,salesGroup); + ArrayList tmpData = ReportManager.getReportData(ctx,sql,true); + String currency = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + + + ArrayList reportData = new ArrayList(); + Object[] data = null; + BigDecimal b = null; + + if(isTaxCredit || isTaxDue) + { + reportData.add( tmpData.remove(0) ); + Iterator iter = tmpData.iterator(); + + while(iter.hasNext()) + { + data = iter.next(); + + if(data.length == 1) + { + b = (BigDecimal)data[0]; + data[0] = formatter.format(b.doubleValue()); + } + + reportData.add(data); + } + } + else + { + //---------------------------------------------------------------------------------------------------------------------------------------------------------- + TreeMap map = new TreeMap(); + + String productName = null; + BigDecimal price = null; + BigDecimal qty = null; + + TabularReportRecordBean bean = null; + + ArrayList reportData2 = new ArrayList(); + Object[] headers = tmpData.remove( 0 ); + + //adding headers + reportData2.add( new Object[]{ + headers[0], + //headers[1], + headers[2] +"("+ currency +")", + headers[3] + } ); + + double totalAmt = 0.0d; + int totalQty = 0; + + for( Object[] record : tmpData) + { + productName = (String) record[0]; + price = (BigDecimal) record[2]; + qty = (BigDecimal) record[3]; + + totalAmt += price.doubleValue(); + totalQty += qty.intValue(); + + bean = map.get( productName ); + + if( bean == null ) + { + bean = new TabularReportRecordBean(); + + bean.setProductName( productName ); + bean.setDate(""); + bean.setPrice( price ); + bean.setQty( qty ); + } + else + { + bean.setPrice( bean.getPrice().add( price ) ); + bean.setQty( bean.getQty().add( qty ) ); + } + + map.put( productName, bean ); + + }//for + + + Collection c = map.values(); + + for( TabularReportRecordBean tbean : c ) + { + Object[] obj = new Object[]{ + tbean.getProductName(), + tbean.getPrice(), + tbean.getQty() + }; + + reportData2.add( obj ); + } + + reportData.add( reportData2.remove(0) ); + + Iterator iter = reportData2.iterator(); + + while(iter.hasNext()) + { + data = iter.next(); + + if(data.length > 2) + { + b = (BigDecimal)data[1]; + data[1] = formatter.format(b.doubleValue()); + } + + reportData.add(data); + } + + reportData.add(new Object[]{"Total","" + formatter.format(totalAmt), totalQty + ""}); + + } + + + //style for table + String tableStyle = "display"; + //style for columns + String[] styles = new String[]{"string","currency","numeric"}; + + if(isTaxCredit || isTaxDue) + { + styles = new String[]{"numeric"}; + } + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + //tReport.setSortable(true); + tReport.setHeaderStyle(styles); + tReport.setStyle(tableStyle); + tReport.setTitle(title); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + return tReport; + } + + /** + * Generates the title of the custom report + * @param ctx + * @param title + * @param bean + * @return true is returned if set + */ + public static boolean setTitle(Properties ctx, String title, ReportBean bean) + { + return true; + } + + /** + * Generates the subtitle of the custom report + * @param ctx + * @param subtitle + * @param bean + * @return true is returned if set + */ + public static String setSubTitle(Properties ctx, String subtitle, ReportBean bean) + { + return null; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/POSReportManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/POSReportManager.java new file mode 100644 index 0000000000..6347071ad4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/POSReportManager.java @@ -0,0 +1,3962 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 9, 2006 by alok + */ + +package org.posterita.businesslogic.performanceanalysis; + +import java.awt.Color; +import java.io.FileOutputStream; +import java.io.PrintWriter; +import java.io.Writer; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.DateFormatSymbols; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.apache.ecs.XhtmlDocument; +import org.apache.ecs.xhtml.head; +import org.compiere.db.Database; +import org.compiere.model.I_AD_ReportView; +import org.compiere.model.Lookup; +import org.compiere.model.MBPartner; +import org.compiere.model.MBPartnerLocation; +import org.compiere.model.MDocType; +import org.compiere.model.MInOut; +import org.compiere.model.MInvoice; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MPInstance; +import org.compiere.model.MPInstancePara; +import org.compiere.model.MProcess; +import org.compiere.model.MProcessPara; +import org.compiere.model.MProduct; +import org.compiere.model.MQuery; +import org.compiere.model.MRole; +import org.compiere.model.MTable; +import org.compiere.model.MTransaction; +import org.compiere.model.MUOM; +import org.compiere.model.MUser; +import org.compiere.model.MWarehouse; +import org.compiere.model.PrintInfo; +import org.compiere.print.DataEngine; +import org.compiere.print.MPrintFormat; +import org.compiere.print.MPrintFormatItem; +import org.compiere.print.PrintData; +import org.compiere.print.PrintDataElement; +import org.compiere.print.ReportEngine; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.report.ReportStarter; +import org.compiere.util.DB; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; +import org.compiere.util.Language; +import org.compiere.util.Util; +import org.compiere.utils.DBUtils; +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.CloseTillBean; +import org.posterita.beans.POSHistoryBean; +import org.posterita.beans.POSReportBean; +import org.posterita.beans.ProductBean; +import org.posterita.beans.WebMinOutLineBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.MinOutManager; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSStockManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.core.RandomStringGenerator; +import org.posterita.core.TimestampConvertor; +import org.posterita.exceptions.LogoException; +import org.posterita.exceptions.MandatoryException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.UnsupportedDatabaseException; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; +import org.posterita.util.PathInfo; +import org.posterita.util.TmkPrinterConstants; + +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; + +public class POSReportManager { + + private static final String ASCENDING_SORT = "asc"; + + private static String getMaxMinSoldProductsSQL(Properties ctx, + String reportType, Timestamp fromDate, Timestamp toDate) { + String sql = ""; + if (DB.getDatabase().getName().equals(Database.DB_POSTGRESQL) || DB.getDatabase().getName().equals(Database.DB_ORACLE)) + { + sql = "select qty,name,COALESCE(upc, ' ') as barcode,M_PRODUCT_ID from " + + "(select sum(ol.QTYENTERED) as qty,pr.NAME, pr.UPC,ol.M_PRODUCT_ID," + //+ "DENSE_RANK() OVER (ORDER BY sum(ol.QTYENTERED) " + //+ reportType + //+ " NULLS LAST) AS Drank" + + " max(ol.QTYENTERED) AS Drank" + + " from C_ORDERLINE ol,C_ORDER ord,M_product pr" + + " where ol.C_ORDER_ID=ord.c_order_id" + + " and ol.M_PRODUCT_ID=pr.M_PRODUCT_ID" + + " and ol.AD_ORG_ID=" + + Env.getAD_Org_ID(ctx) + + " and ol.AD_CLIENT_ID=" + + Env.getAD_Client_ID(ctx) + + " and ord.ISACTIVE='Y'" + + " and ol.CREATED between " + DB.TO_DATE(fromDate, false) + + " and " + DB.TO_DATE(toDate, false) + + " and ord.ORDERTYPE='"+ UDIOrderTypes.POS_ORDER.getOrderType() +"'" + + " and ord.DOCSTATUS='CO' group by pr.NAME,pr.UPC,ol.M_PRODUCT_ID) fastStockMovement" + + " where drank <26 order by qty " + reportType; + } + + else + throw new UnsupportedDatabaseException( + "Operation GetMaxMinSoldProducts not supported on Database: " + + DB.getDatabase().getName()); + + return sql; + } + + public static ArrayList getMaxMinSoldProducts(Properties ctx, + String reportType, Timestamp fromDate, Timestamp todate) + throws OperationException { + String sql = getMaxMinSoldProductsSQL(ctx, reportType, fromDate, todate); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + ProductBean bean = null; + ArrayList list = new ArrayList(); + + // TreeMap tree = new + // TreeMap(); + try { + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + bean = new ProductBean(); + BigDecimal qty = getQtyReturnedFromCustomer(ctx, rs.getInt(4), + fromDate, todate); + bean.setProductName(rs.getString(2).replaceAll("~", " ")); + bean.setBarCode(rs.getString(3)); + BigDecimal qty1 = rs.getBigDecimal(1); + int productId = rs.getInt(4); + MProduct product = new MProduct(ctx, productId, null); + String uom = product.getUOMSymbol(); + bean.setUom(uom); + if (qty1 == null) + { + qty1 = BigDecimal.ZERO; + } + if (qty == null) + { + qty = BigDecimal.ZERO; + } + + BigDecimal quantity = qty1.subtract(qty); + bean.setQuantity(quantity); + + list.add(bean); + } + rs.close(); + + Collections.sort(list, getSortingComparator(reportType)); + return list; + + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + + } + + private static Comparator getSortingComparator( + final String order) { + Comparator comp = new Comparator() { + + public int compare(ProductBean o1, ProductBean o2) { + if (o1.getQuantity().intValue() < o2.getQuantity().intValue()) + return (order.equals(ASCENDING_SORT) ? -1 : 1); + else if (o1.getQuantity().intValue() > o2.getQuantity() + .intValue()) + return (order.equals(ASCENDING_SORT) ? 1 : -1); + else + return 0; + } + + }; + return comp; + } + + private static BigDecimal getQtyReturnedFromCustomer(Properties ctx, + int productId, Timestamp fromDate, Timestamp toDate) + throws OperationException { + BigDecimal qty = Env.ZERO; + + String sql = "select" + " sum(ol.qtyordered)" + + " from C_ORDER ord,C_ORDERLINE ol" + + " where ord.C_ORDER_ID=ol.c_order_id " + + " and ord.AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and ol.M_PRODUCT_ID=" + productId + " and ord.orderType='" + + UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType() + "'" + + " and ol.CREATED between "+ DB.TO_DATE(fromDate, false) + " and " + DB.TO_DATE(toDate, false); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + try { + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + qty = rs.getBigDecimal(1); + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + + return qty; + } + + public static ArrayList getStockMovementReport( + Properties ctx, Timestamp fromDate, Timestamp toDate) + throws OperationException { + + String sql = "select distinct v.m_product_id," + " pr.name" + + " from M_TRANSACTION_V v,m_product pr" + + " where v.m_product_id=pr.m_product_id" + + " and v.CREATED between "+DB.TO_DATE(fromDate, false) + + " and "+ DB.TO_DATE(toDate, false) + + " and v.AD_CLIENT_ID=" + + Env.getAD_Client_ID(ctx) + " and v.AD_ORG_ID=" + + Env.getAD_Org_ID(ctx) + " order by pr.name"; + + MWarehouse warehouse = POSTerminalManager.getWarehouse(ctx); + /* + * String sql = "select" + " distinct M_PRODUCT_ID " + //3 " from + * M_STORAGE st" + " where st.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ " + * and st.AD_ORG_ID=" +Env.getAD_Org_ID(ctx)+ " and st.M_LOCATOR_ID=" + * +warehouse.getDefaultLocator().getID(); + */ + + // String whereClause = "AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and + // AD_ORG_ID="+Env.getAD_Org_ID(ctx); + + POSReportBean bean; + ArrayList list = new ArrayList(); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + ResultSet rs; + try { + rs = pstmt.executeQuery(); + while (rs.next()) { + BigDecimal qtyOfSales; + BigDecimal qtyOfReceipts; + BigDecimal qtyOfReturn; + BigDecimal qtyOfCustReturn; + BigDecimal openingBal; + BigDecimal closingBal; + BigDecimal qtyofSalesByCredit; + BigDecimal qtyInventoryIn; + // int qtyInventoryOut; + + /* + * if(!isProductPresentInOrder(ctx,rs.getInt(1),fromDate,todate)) + * continue; + */ + MProduct product = MProduct.get(ctx, rs.getInt(1)); + int uomPrecision = MUOM.getPrecision(ctx, product.getC_UOM_ID()); + String uom = product.getUOMSymbol(); + openingBal = getQtyOfOrders(ctx, null, rs.getInt(1), fromDate, + toDate, "opening", warehouse).setScale(uomPrecision, RoundingMode.HALF_UP); + // closingBal=getQtyOfOrders(ctx,null,rs.getInt(1),fromDate,todate,"closing",warehouse); + qtyOfSales = getQtyOfOrders(ctx, UDIOrderTypes.POS_ORDER + .getOrderType(), rs.getInt(1), fromDate, toDate, + "none", warehouse).setScale(uomPrecision, RoundingMode.HALF_UP); + qtyofSalesByCredit = getQtyOfOrders(ctx, + UDIOrderTypes.CREDIT_ORDER.getOrderType(), + rs.getInt(1), fromDate, toDate, "none", warehouse).setScale(uomPrecision, RoundingMode.HALF_UP); + qtyOfReceipts = getQtyOfOrders(ctx, + UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType(), rs + .getInt(1), fromDate, toDate, "none", warehouse).setScale(uomPrecision, RoundingMode.HALF_UP); + qtyOfReturn = getQtyOfOrders(ctx, + UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType(), rs + .getInt(1), fromDate, toDate, "none", warehouse).setScale(uomPrecision, RoundingMode.HALF_UP); + qtyOfCustReturn = getQtyOfOrders(ctx, + UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType(), rs + .getInt(1), fromDate, toDate, "none", warehouse).setScale(uomPrecision, RoundingMode.HALF_UP); + qtyInventoryIn = getQtyOfOrders(ctx, null, rs.getInt(1), + fromDate, toDate, "inventortIn", warehouse).setScale(uomPrecision, RoundingMode.HALF_UP); + // qtyInventoryOut + // =getQtyOfOrders(ctx,null,rs.getInt(1),fromDate,todate,"inventoryOut",warehouse); + closingBal = openingBal.subtract( + (qtyOfSales.add(qtyOfReturn).add(qtyofSalesByCredit). + add(qtyOfReceipts).add(qtyOfCustReturn).add(qtyInventoryIn))); + bean = new POSReportBean(); + try + { + bean.setProductName(ProductManager.getProductName(ctx, rs.getInt(1))); + bean.setProductId(rs.getInt(1)); + } + + catch (Exception e) + { + throw new OperationException(e); + } + + bean.setOpeningBalanceQty(openingBal); + bean.setQtyOfGoodsSold(qtyOfSales.add(qtyofSalesByCredit)); + bean.setQtyOfGoodsReceived(qtyOfReceipts); + bean.setQtyOfGoodsReturned(qtyOfReturn); + bean.setCloseingBalanceQty(closingBal); + bean.setQtyInventoryIn(qtyInventoryIn); + // bean.setQtyInventoryOut(Integer.valueOf(qtyInventoryOut)); + bean.setQtyReturnedByCustomer(qtyOfCustReturn); + bean.setUom(uom); + list.add(bean); + } + + rs.close(); + + } + + catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + + return list; + + } + + public static ArrayList getStockMovementReportData( + Properties ctx, Timestamp fromDate, Timestamp todate) + throws OperationException { + + ArrayList list = getStockMovementReport(ctx, fromDate, + todate); + ArrayList reportData = new ArrayList(); + + Object[] headers = new Object[] { "Product Name", "Uom","Opening Balance", + "Inventory In / Out", "Qty Received", "Qty Sold", + "Qty Returned to Supplier", "Qty Returned by Customer", + "Closing Balance" }; + + Object[] data = null; + + reportData.add(headers); + + for (POSReportBean bean : list) { + data = new Object[9]; + + data[0] = bean.getProductName(); + data[1] = bean.getUom(); + data[2] = bean.getOpeningBalanceQty(); + data[3] = bean.getQtyInventoryIn(); + data[4] = bean.getQtyOfGoodsReceived(); + data[5] = bean.getQtyOfGoodsSold(); + data[6] = bean.getQtyOfGoodsReturned(); + data[7] = bean.getQtyReturnedByCustomer(); + data[8] = bean.getCloseingBalanceQty(); + + reportData.add(data); + } + + return reportData; + } + + private static BigDecimal getQtyOfOrders(Properties ctx, String orderType, + int productId, Timestamp fromDate, Timestamp toDate, String queryType, + MWarehouse warehouse) throws OperationException { + + String sql = null; + String whereClause = "ol.AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and ol.AD_ORG_ID=" + Env.getAD_Org_ID(ctx); + + // SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + // String date = sdf.format(toDate); + + if (queryType.equalsIgnoreCase("none")) + + sql = "select sum(ol.qtyInvoiced)" + + " from c_orderLine ol,C_ORDER ord" + + " where ol.C_ORDER_ID=ord.C_ORDER_ID and " + whereClause + + " and M_PRODUCT_ID=" + productId + + " and ol.CREATED BETWEEN "+DB.TO_DATE(fromDate, false) + + " and "+DB.TO_DATE(toDate, false) + + " and ord.ORDERTYPE='" + + orderType + "'" + " and ord.DOCSTATUS in ('CO','CL')" + + " and ord.M_WAREHOUSE_ID=" + warehouse.get_ID() + + " and ord.ISACTIVE='Y'"; + + else if (queryType.equalsIgnoreCase("opening")) + + sql = "select sum(MOVEMENTQTY)" + " from M_TRANSACTION_V " + + " where M_PRODUCT_ID=" + productId + " and M_LOCATOR_ID=" + + warehouse.getDefaultLocator().get_ID() + + " and AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and AD_ORG_ID=" + Env.getAD_Org_ID(ctx) + + " and created< "+DB.TO_DATE(fromDate, false); + + else if (queryType.equalsIgnoreCase("inventortIn")) + sql = "select sum(MOVEMENTQTY)" + " from M_TRANSACTION_V " + + " where M_PRODUCT_ID=" + productId + " and M_LOCATOR_ID=" + + warehouse.getDefaultLocator().get_ID() + + " and AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and AD_ORG_ID=" + Env.getAD_Org_ID(ctx) + + " and created> "+DB.TO_DATE(fromDate, false) + " and MOVEMENTTYPE='" + + MTransaction.MOVEMENTTYPE_InventoryIn + "'"; + + else if (queryType.equalsIgnoreCase("inventoryOut")) + + sql = "select sum(MOVEMENTQTY)" + " from M_TRANSACTION_V " + + " where M_PRODUCT_ID=" + productId + " and M_LOCATOR_ID=" + + warehouse.getDefaultLocator().get_ID() + + " and AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and AD_ORG_ID=" + Env.getAD_Org_ID(ctx) + + " and created> "+DB.TO_DATE(fromDate, false) + " and MOVEMENTTYPE='" + + MTransaction.MOVEMENTTYPE_InventoryOut + "'"; + + else if (queryType.equalsIgnoreCase("closing")) + + sql = "select sum(MOVEMENTQTY)" + " from M_TRANSACTION_V " + + " where M_PRODUCT_ID=" + productId + " and M_LOCATOR_ID=" + + warehouse.getDefaultLocator().get_ID() + + " and AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and AD_ORG_ID=" + Env.getAD_Org_ID(ctx) + + " and created< "+DB.TO_DATE(toDate, true); + /* + * sql = "select" + " sum(st.QTYONHAND)" + //3 " from M_STORAGE st" + " + * where st.M_PRODUCT_ID=" +productId+ " and + * st.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ " and st.AD_ORG_ID=" + * +Env.getAD_Org_ID(ctx)+ " and st.M_LOCATOR_ID=" + * +warehouse.getDefaultLocator().getID()+ " and created getOrderHistory(Properties ctx, + String orderType, String docStatus, Integer month, Integer year, + String paymentRule, String trxName) throws OperationException + { + StringBuffer payAmtSql = new StringBuffer(); + payAmtSql.append(" (SELECT SUM(p.Amount) FROM"); + payAmtSql.append(" ((SELECT payAmt as Amount FROM C_Payment p") + .append(" WHERE p.C_Invoice_ID=i.C_Invoice_ID AND p.DocStatus IN ('CO', 'CL'))"); + payAmtSql.append(" UNION"); + payAmtSql.append(" (SELECT Amount FROM C_CashLine cl") + .append(" WHERE (cl.c_Invoice_ID=i.C_Invoice_ID))) as p)"); + + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append(" SELECT o.C_Order_ID, o.DateOrdered, o.DateAcct, o.DocumentNo, o.GrandTotal, o.OrderType, o.PaymentRule, o.DocStatus,"); + sqlStmt.append(" bp.C_BPartner_ID, bp.Name, bp.IsCustomer,"); + sqlStmt.append(" i.C_Invoice_ID, i.DocumentNo, (CASE WHEN i.C_Invoice_ID IS NULL THEN 0 ELSE "); + sqlStmt.append(payAmtSql.toString()).append(" END) as PayAmt"); + sqlStmt.append(" FROM C_Order o"); + sqlStmt.append(" INNER JOIN C_BPartner bp ON bp.C_BPartner_ID=o.C_BPartner_ID"); + sqlStmt.append(" LEFT JOIN C_Invoice i ON (i.C_Order_ID=o.C_Order_ID AND i.DocStatus IN ('CO', 'CL'))"); + + sqlStmt.append(" WHERE o.AD_Client_ID=?"); + sqlStmt.append(" AND o.IsActive='Y'"); + + if (orderType != null) + { + sqlStmt = sqlStmt.append(" AND o.OrderType='").append(orderType).append("'"); + } + + if (paymentRule != null) + { + sqlStmt = sqlStmt.append(" AND o.PaymentRule='").append(paymentRule).append("'"); + } + + if (docStatus != null) + { + sqlStmt = sqlStmt.append(" AND o.DocStatus='").append(docStatus).append("'"); + } + + if (month != null) + { + String mm = String.valueOf(month); + if (mm.length() == 1) + { + mm = "0" + mm; + } + + sqlStmt = sqlStmt.append( " AND TO_CHAR(o.DateOrdered, 'mm')= '").append(mm).append("'"); + } + + if (year != null) + { + sqlStmt = sqlStmt.append(" AND TO_CHAR(o.DateOrdered, 'yyyy') ='").append(year).append("'"); + } + sqlStmt = sqlStmt.append(" ORDER BY o.DateOrdered DESC"); + + + PreparedStatement pstmt = null; + ResultSet rs = null; + ArrayList list = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sqlStmt.toString(), trxName); + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + POSHistoryBean bean = new POSHistoryBean(); + bean.setOrderId(Integer.valueOf(rs.getInt(1))); + bean.setDateOrdered(rs.getTimestamp(2)); + bean.setDateAcct(rs.getTimestamp(3)); + bean.setDocumentNo(rs.getString(4)); + bean.setOrderGrandTotal(rs.getBigDecimal(5)); + bean.setOrderType(rs.getString(6)); + bean.setPaymentRule(rs.getString(7)); + bean.setDocStatus(rs.getString(8)); + bean.setBpartnerId(rs.getInt(9)); + bean.setPartnerName(rs.getString(10)); + bean.setIsCustomer("Y".equals(rs.getString(11)) ? true : false); + bean.setInvoiceDocumentNo(rs.getString(13)); + bean.setAmountPaid(rs.getBigDecimal(14)); + list.add(bean); + } + } + catch (SQLException e) + { + throw new OperationException("Could not retrieve order history with sql: " + sqlStmt.toString(), e); + } + finally + { + DB.close(rs, pstmt); + pstmt = null; + pstmt = null; + } + + return list; + + } + + public static ArrayList getDraftedOrderHistory( + Properties ctx, String orderType, Integer month, Integer year) + throws OperationException { + String sql = "select ord.C_ORDER_ID," + + // "inv.c_invoice_id," + + "ord.created," + "ord.grandtotal," + "ord.DOCUMENTNO," + + "bp.name" + " from c_order ord,C_BPARTNER bp" + + " where ord.C_BPARTNER_ID=bp.C_BPARTNER_ID" + + " and ord.DOCSTATUS = 'DR'" + " and ord.AD_ORG_ID=" + + Env.getAD_Org_ID(ctx) + " and ord.AD_CLIENT_ID=" + + Env.getAD_Client_ID(ctx); + + if (orderType != null) + sql = sql + " and ord.ORDERTYPE='" + orderType + "'"; + + if (month != null) + sql = sql + " and to_char(ord.created, 'mm') = " + month; + + if (year != null) + sql = sql + " and to_char(ord.created, 'yyyy') = " + year; + + sql = sql + " order by ord.created desc"; + + System.out.println(sql); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + POSHistoryBean bean = null; + ArrayList list = new ArrayList(); + + try { + ResultSet rs = pstmt.executeQuery(); + + while (rs.next()) { + bean = new POSHistoryBean(); + bean.setOrderId(Integer.valueOf(rs.getInt(1))); + + bean.setDateAcct(rs.getTimestamp(2)); + bean.setOrderGrandTotal(rs.getBigDecimal(3)); + bean.setDocumentNo(rs.getString(4)); + bean.setPartnerName(rs.getString(5)); + + list.add(bean); + + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + return list; + + } + + public static ArrayList getPartialOrderHistory( + Properties ctx, String orderType, Integer month, Integer year) + throws OperationException { + String sql = "select ord.C_ORDER_ID," + + // "inv.c_invoice_id," + + "ord.created," + "ord.grandtotal," + "ord.DOCUMENTNO," + + "bp.name" + " from c_order ord,C_BPARTNER bp" + + " where ord.C_BPARTNER_ID=bp.C_BPARTNER_ID" + + " and ord.DOCSTATUS = 'IP'" + " and ord.AD_ORG_ID=" + + Env.getAD_Org_ID(ctx) + " and ord.AD_CLIENT_ID=" + + Env.getAD_Client_ID(ctx); + + if (orderType != null) + sql = sql + " and ord.ORDERTYPE='" + orderType + "'"; + + if (month != null) + { + String mm = String.valueOf(month); + if (mm.length() == 1) + { + mm = "0" + mm; + } + sql = sql + " and to_char(ord.created, 'mm') = '" + mm + "' " ; + } + + if (year != null) + sql = sql + " and to_char(ord.created, 'yyyy') = " + year; + + sql = sql + " order by ord.created desc"; + + System.out.println(sql); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + POSHistoryBean bean = null; + ArrayList list = new ArrayList(); + + try { + ResultSet rs = pstmt.executeQuery(); + + while (rs.next()) { + bean = new POSHistoryBean(); + bean.setOrderId(Integer.valueOf(rs.getInt(1))); + + bean.setDateAcct(rs.getTimestamp(2)); + bean.setOrderGrandTotal(rs.getBigDecimal(3)); + bean.setDocumentNo(rs.getString(4)); + bean.setPartnerName(rs.getString(5)); + + list.add(bean); + + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + return list; + + } + + public static ArrayList getAllOrderTypes(Properties ctx) + throws OperationException { + String sql = "select distinct orderType from c_order where AD_CLIENT_ID=" + + Env.getAD_Client_ID(ctx) + + " and AD_ORG_ID=" + + Env.getAD_Org_ID(ctx) + + " and isActive='Y' and ORDERTYPE is not null"; + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + POSHistoryBean bean = null; + ArrayList list = new ArrayList(); + + try { + ResultSet rs = pstmt.executeQuery(); + + while (rs.next()) { + bean = new POSHistoryBean(); + bean.setOrderType(rs.getString(1)); + + list.add(bean); + + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + + return list; + + } + + public static ArrayList getAllPaymentRule(Properties ctx) + throws OperationException { + String sql = "select distinct paymentRule from c_order where AD_CLIENT_ID=" + + Env.getAD_Client_ID(ctx) + + " and AD_ORG_ID=" + + Env.getAD_Org_ID(ctx) + " and isActive='Y'"; + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + POSHistoryBean bean = null; + ArrayList list = new ArrayList(); + + try { + ResultSet rs = pstmt.executeQuery(); + + while (rs.next()) { + bean = new POSHistoryBean(); + bean.setPaymentRule(rs.getString(1)); + + list.add(bean); + + } + + rs.close(); + } catch (SQLException e) { + throw new OperationException(e); + } finally { + try { + pstmt.close(); + } catch (Exception e) { + } + + pstmt = null; + } + + return list; + + } + + public static ArrayList getMaxMinSoldProductReportData( + Properties ctx, String reportType, Timestamp fromDate, Timestamp todate) + throws OperationException { + ArrayList list = getMaxMinSoldProducts(ctx, reportType, + fromDate, todate); + ArrayList reportData = new ArrayList(); + + reportData.add(new Object[] { "Name", "Uom","Barcode", " Net Qty Sold" }); + + String name = null; + String barcode = null; + BigDecimal qty = null; + String uom = null; + for (ProductBean bean : list) { + name = bean.getProductName(); + name = name.replaceAll("~", " "); + qty = bean.getQuantity(); + barcode = bean.getBarCode(); + uom = bean.getUom(); + reportData.add(new Object[] { name, uom, barcode, qty }); + } + + return reportData; + } + + public static String getCompleteOrderPDFReport(Properties ctx, int orderId, + String trxName) throws OperationException { + String docStatus = null; + String dateOrdered = null; + String orderType = null; + String orgName = null; + String orgAddress = null; + String salesRep = null; + String paymentBy = null; + String customerName = null; + String customerAddress = null; + String documentNo = null; + String currency = "Rs "; + NumberFormat formatter = new DecimalFormat("###,###,##0.00"); + + currency = POSTerminalManager.getDefaultSalesCurrency(ctx) + .getCurSymbol() + + " "; + MOrder order = new MOrder(ctx, orderId, trxName); + + // getting payment info + int[] invoiceIds = MInvoice.getAllIDs(MInvoice.Table_Name, + "AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " and C_ORDER_ID=" + + order.get_ID(), null); + double paymentByCash = 0.0; + double paymentByCard = 0.0; + double paymentByCheque = 0.0; + + MInvoice invoice = null; + String paymentRule = null; + boolean isMixed = false; + + for (int i = 0; i < invoiceIds.length; i++) { + invoice = new MInvoice(ctx, invoiceIds[i], trxName); + + if (i == 0) { + paymentRule = invoice.getPaymentRule(); + } else { + if (!paymentRule.equalsIgnoreCase(invoice.getPaymentRule())) { + isMixed = true; + } + } + + if (invoice.getPaymentRule().equals(MOrder.PAYMENTRULE_Cash)) { + paymentByCash += invoice.getGrandTotal().doubleValue(); + paymentBy = Constants.PAYMENT_RULE_CASH; + } + + if (invoice.getPaymentRule().equals(MOrder.PAYMENTRULE_CreditCard)) { + paymentByCard += invoice.getGrandTotal().doubleValue(); + paymentBy = Constants.PAYMENT_RULE_CARD; + } + + if (invoice.getPaymentRule().equals(MOrder.PAYMENTRULE_DirectDebit)) { + paymentByCard += invoice.getGrandTotal().doubleValue(); + paymentBy = Constants.PAYMENT_RULE_CARD; + } + + if (invoice.getPaymentRule().equals(MOrder.PAYMENTRULE_Check)) { + paymentByCheque += invoice.getGrandTotal().doubleValue(); + paymentBy = Constants.PAYMENT_RULE_CHEQUE; + } + + }// for + + if (isMixed) { + paymentBy = "Mixed (Cash:" + formatter.format(paymentByCash) + + " Card:" + formatter.format(paymentByCard) + " Cheque:" + + formatter.format(paymentByCheque) + ")"; + } + + // getting orgInfo + MOrg org = new MOrg(ctx, order.getAD_Org_ID(), trxName); + int location_id = org.getInfo().getC_Location_ID(); + MLocation location = new MLocation(ctx, location_id, trxName); + + orgName = org.getName(); + + String address1 = (location.getAddress1() == null) ? " " : location + .getAddress1(); + String address2 = (location.getAddress2() == null) ? " " : location + .getAddress2(); + orgAddress = (address1 + " " + address2).trim(); + + // getting order type + orderType = order.getOrderType(); + + // getting orderInfo + docStatus = order.getDocStatusName(); + documentNo = order.getDocumentNo(); + + Date d = new Date(order.getCreated().getTime()); + SimpleDateFormat s = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + dateOrdered = s.format(d); + + // getting salesrep + int saleRep_id = order.getSalesRep_ID(); + MUser user = new MUser(ctx, saleRep_id, trxName); + salesRep = user.getName(); + + // getting customer info + int bpartner_id = order.getBill_BPartner_ID(); + BPartnerBean bean = BPartnerManager.getBpartner(ctx, bpartner_id, + trxName); + + String name1 = (bean.getPartnerName() == null) ? " " : bean + .getPartnerName(); + String name2 = (bean.getName2() == null) ? " " : bean.getName2(); + customerName = (name1 + " " + name2).trim(); + + address1 = (bean.getAddress1() == null) ? " " : bean.getAddress1(); + address2 = (bean.getAddress2() == null) ? " " : bean.getAddress2(); + customerAddress = (address1 + " " + address2).trim(); + + ArrayList orderLineList = POSManager + .populateOrderLines(ctx, order); + + // ----------------------------------- generating pdf + // -------------------------------------- + String reportName = RandomStringGenerator.randomstring() + ".pdf"; + String reportPath = ReportManager.getReportPath(reportName); + + Font titleFont = new Font(Font.TIMES_ROMAN, 18, Font.BOLD); + Font subtitleFont = new Font(Font.TIMES_ROMAN, 14, Font.BOLD); + + Font headerFont = new Font(Font.TIMES_ROMAN, 11, Font.BOLD); + Font simpleFont = new Font(Font.TIMES_ROMAN, 10); + + float cellBorderWidth = 0.0f; + + // step 1: creation of a document-object + Document document = new Document(PageSize.A4, 30, 30, 20, 40);// l,r,t,b + // document.getPageSize().set; + + System.out.println(document.leftMargin()); + + try { + // step 2: + // we create a writer that listens to the document + // and directs a PDF-stream to a file + PdfWriter.getInstance(document, new FileOutputStream(reportPath)); + + // step 3: we open the document + document.open(); + // step 4: we add a paragraph to the document + + Image logo = null; + + String imageURI = PathInfo.PROJECT_HOME + "images/logo.gif"; + // "images/pos/openBLUE_POS_Logo.gif"; + + try { + byte logoData[] = OrganisationManager.getLogo(ctx, null); + logo = Image.getInstance(logoData); + } catch (LogoException ex) { + logo = Image.getInstance(imageURI); + } + + logo.setAbsolutePosition(document.left(), document.top() + - logo.height()); + document.add(logo); + + PdfPTable table = new PdfPTable(2); + PdfPCell cell = null; + + // + table.getDefaultCell().setPadding(5.0f); + table.setWidthPercentage(100.0f); + + // header cell + Paragraph title = new Paragraph(); + title.add(new Chunk(orgName, subtitleFont)); + title.add(new Chunk("\n")); + title.add(new Chunk(orgAddress, subtitleFont)); + + // cell = new PdfPCell(new Paragraph(new + // Chunk("Title1",titleFont))); + cell = new PdfPCell(title); + + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); + cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); + cell.setFixedHeight(logo.height()); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + cell = new PdfPCell(new Paragraph("")); + cell.setBorderWidth(cellBorderWidth); + cell.setFixedHeight(10); + cell.setColspan(2); + table.addCell(cell); + + // doc type + cell = new PdfPCell(new Paragraph(new Chunk(orderType, titleFont))); + + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); + cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setBorderWidth(cellBorderWidth); + cell.setFixedHeight(10); + cell.setColspan(2); + table.addCell(cell); + + // row 1 + cell = new PdfPCell(new Paragraph(new Chunk(customerName, + headerFont))); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + cell = new PdfPCell(new Paragraph(new Chunk("Sales Rep: " + + salesRep, headerFont))); + cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // row 2 + cell = new PdfPCell(new Paragraph(new Chunk(customerAddress, + headerFont))); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setBorderWidth(cellBorderWidth); + cell.setFixedHeight(10); + cell.setColspan(2); + table.addCell(cell); + + // row 3 + cell = new PdfPCell(new Paragraph(new Chunk( + "Ref No: " + documentNo, headerFont))); + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // row 4 + cell = new PdfPCell(new Paragraph(new Chunk("Doc Status: " + + docStatus, headerFont))); + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // row 5 + cell = new PdfPCell(new Paragraph(new Chunk("Payment By: " + + paymentBy, headerFont))); + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // row 6 + cell = new PdfPCell(new Paragraph(new Chunk("Date: " + dateOrdered, + headerFont))); + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setColspan(2); + cell.setFixedHeight(10); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setColspan(2); + cell.setFixedHeight(10); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // ------------------------------------------------------ + cell = new PdfPCell(); + cell.setColspan(2); + cell.setBorderWidth(cellBorderWidth); + + PdfPTable t = new PdfPTable(6); + t.getDefaultCell().setPadding(3.0f); + t.setWidthPercentage(100.0f); + + int[] widths = { 1, 4, 1, 2, 2, 2 }; + t.setWidths(widths); + + // setting headers + t.addCell(new Paragraph(new Chunk("SerNo", headerFont))); + t.addCell(new Paragraph(new Chunk("Name", headerFont))); + t.addCell(new Paragraph(new Chunk("Qty", headerFont))); + t.addCell(new Paragraph(new Chunk("Price", headerFont))); + t.addCell(new Paragraph(new Chunk("VAT", headerFont))); + t.addCell(new Paragraph(new Chunk("Total", headerFont))); + + // setting table data + // --------------------------------writing table + // data------------------------------ + int serNo = 0; + int totalQty = 0; + double totalAmt = 0.0; + double totalTaxAmt = 0.0; + double grandTotal = 0.0; + + BigDecimal qty = null; + BigDecimal lineAmt = null; + BigDecimal taxAmt = null; + BigDecimal lineTotalAmt = null; + + for (WebOrderLineBean orderlineBean : orderLineList) { + serNo++; + qty = orderlineBean.getQtyOrdered(); + lineAmt = orderlineBean.getLineNetAmt(); + taxAmt = orderlineBean.getTaxAmt(); + lineTotalAmt = orderlineBean.getLineTotalAmt(); + + totalQty += qty.intValue(); + totalAmt += lineAmt.doubleValue(); + totalTaxAmt += taxAmt.doubleValue(); + grandTotal += lineTotalAmt.doubleValue(); + + t.addCell(new Paragraph(new Chunk(serNo + "", simpleFont))); + t.addCell(new Paragraph(new Chunk(orderlineBean + .getProductName(), simpleFont))); + t.addCell(new Paragraph(new Chunk(qty.intValue() + "", + simpleFont))); + t.addCell(new Paragraph(new Chunk(formatter.format(lineAmt + .doubleValue()), simpleFont))); + t.addCell(new Paragraph(new Chunk(formatter.format(taxAmt + .doubleValue()), simpleFont))); + t.addCell(new Paragraph(new Chunk(formatter.format(lineTotalAmt + .doubleValue()), simpleFont))); + } + // ----------------------------------------------------------------------------------- + + // setting table footer + t.getDefaultCell().setBackgroundColor(new Color(240, 240, 240)); + + PdfPCell c = new PdfPCell(new Paragraph(new Chunk("ORDER TOTAL", + headerFont))); + c.setColspan(2); + c.setBackgroundColor(new Color(240, 240, 240)); + t.addCell(c); + + t.addCell(new Paragraph(new Chunk(totalQty + "", simpleFont))); + t.addCell(new Paragraph(new Chunk(currency + + formatter.format(totalAmt), simpleFont))); + t.addCell(new Paragraph(new Chunk(currency + + formatter.format(totalTaxAmt), simpleFont))); + t.addCell(new Paragraph(new Chunk(currency + + formatter.format(grandTotal), simpleFont))); + + t.setSplitRows(true); + cell.addElement(t); + // ------------------------------------------------------ + + // table.addCell(cell); + table.setSplitRows(true); + + document.add(table); + document.add(t); + + } catch (Exception e) { + throw new OperationException(e); + } + + // step 5: we close the document + document.close(); + + return reportName; + } + + /* + * public static String getInvoiceFromOrderPDFReport(Properties ctx, int + * orderId, String trxName) throws OperationException { int invoiceIds[] = + * InvoiceManager.getInvoiceIdsForOrder(ctx, orderId, trxName); + * + * if(invoiceIds.length == 0) throw new OperationException("No invoice found + * for Order with id: " + orderId); else if(invoiceIds.length == 1) return + * getInvoicePDFReport(ctx, invoiceIds[0], trxName); else return + * getCompleteOrderPDFReport(ctx, orderId, trxName); } + */ + + /* + * public static String getInvoicePDFReport(Properties ctx, int invoiceId, + * String trxName) throws OperationException { String docStatus = null; + * String dateOrdered = null; String docType = null; String orgName = null; + * String orgAddress = null; String salesRep = null; String phone = " "; + * String fax = " "; + * + * String customerName = null; String customerAddress = null; String + * documentNo = null; String currency = "Rs "; NumberFormat formatter = new + * DecimalFormat("###,###,##0.00"); + * + * currency = + * POSTerminalManager.getPOSDefaultSellCurrency(ctx).getCurSymbol()+ " "; + * + * MInvoice invoice = InvoiceManager.loadInvoice(ctx, invoiceId, trxName); + * + * //getting orgInfo MOrg org = new + * MOrg(ctx,invoice.getAD_Org_ID(),trxName); int location_id = + * org.getInfo().getC_Location_ID(); MLocation location = new + * MLocation(ctx,location_id,trxName); MBPartner orgPartner = new + * MBPartner(ctx, org.getLinkedC_BPartner_ID(), trxName); MBPartnerLocation + * meLocation[] = MBPartnerLocation.getForBPartner(ctx,orgPartner.getID()); + * + * if (meLocation.length != 1) throw new OperationException("Should have + * only 1 location for organisation business partner!!"); + * + * MBPartnerLocation orgLocation = meLocation[0]; + * + * if (orgLocation.getPhone() != null); phone = orgLocation.getPhone(); + * + * if (orgLocation.getFax() != null) fax = orgLocation.getFax();; + * + * orgName = org.getName(); + * + * String address1 = (location.getAddress1() == null)? " " : + * location.getAddress1(); String address2 = (location.getAddress2() == + * null)? " " : location.getAddress2(); orgAddress = (address1 + " " + + * address2).trim(); + * + * //getting order type MDocType doctype = MDocType.get(ctx, + * invoice.getC_DocType_ID()); docType = doctype.getName(); + * + * //getting orderInfo docStatus = invoice.getDocStatusName(); documentNo = + * invoice.getDocumentNo(); + * + * Date d = new Date(invoice.getCreated().getTime()); SimpleDateFormat s = + * new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); dateOrdered = s.format(d); + * + * //getting salesrep int saleRep_id = invoice.getSalesRep_ID(); MUser user = + * new MUser(ctx,saleRep_id,trxName); salesRep = user.getName(); + * + * //getting customer info int bpartner_id = invoice.getC_BPartner_ID(); + * BPartnerBean bean = BPartnerManager.getBpartner(ctx,bpartner_id, + * trxName); + * + * String name1 = (bean.getPartnerName() == null)? " " : + * bean.getPartnerName(); String name2 = (bean.getName2() == null)? " " : + * bean.getName2(); customerName = (name1 + " " + name2).trim(); + * + * address1 = (bean.getAddress1() == null)? " " : bean.getAddress1(); + * address2 = (bean.getAddress2() == null)? " " : bean.getAddress2(); + * customerAddress = (address1 + " " + address2).trim(); + * + * + * ArrayList orderLineList = + * InvoiceManager.populateInvoiceLines(ctx,invoice, false); + * + * //----------------------------------- generating pdf + * -------------------------------------- String reportName = + * RandomStringGenerator.randomstring() + ".pdf"; String reportPath = + * ReportManager.getReportPath(reportName); + * + * + * Font titleFont = new Font(Font.TIMES_ROMAN, 18,Font.BOLD); Font + * subtitleFont = new Font(Font.TIMES_ROMAN, 14,Font.BOLD); + * + * Font headerFont = new Font(Font.TIMES_ROMAN, 11,Font.BOLD); Font + * simpleFont = new Font(Font.TIMES_ROMAN, 10); + * + * float cellBorderWidth = 0.0f; + * // step 1: creation of a document-object Document document = new + * Document(PageSize.A4,30,30,20,40);//l,r,t,b //document.getPageSize().set; + * + * System.out.println(document.leftMargin()); + * + * try { // step 2: // we create a writer that listens to the document // + * and directs a PDF-stream to a file PdfWriter.getInstance(document,new + * FileOutputStream(reportPath)); + * // step 3: we open the document document.open(); // step 4: we add a + * paragraph to the document + * + * Image logo = null; + * + * //TODO: make this part dynamic <------------------------------ IMPORTANT + * !!!!!!!!!!!!!!!!!!!!!!!!!!! String imageURI = PathInfo.PROJECT_HOME + + * "images/pos/openBLUE_POS_Logo.gif"; logo = Image.getInstance(imageURI); + * + * //MAttachment attachment = new + * MAttachment(ctx,MOrg.Table_ID,org.getID(),null); //logo = + * Image.getInstance(attachment.getEntries()[0].getData()); + * + * try { byte logoData[] = OrganisationManager.getLogo(ctx, null); logo = + * Image.getInstance(logoData); } catch(LogoException ex) { logo = + * Image.getInstance(imageURI); } + * + * logo.setAbsolutePosition(document.left(),document.top()-logo.height()); + * document.add(logo); + * + * PdfPTable table = new PdfPTable(2); PdfPCell cell = null; + * // table.getDefaultCell().setPadding(5.0f); + * table.setWidthPercentage(100.0f); + * + * //header cell Paragraph title = new Paragraph(); title.add(new + * Chunk(orgName,subtitleFont)); title.add(new Chunk("\n")); title.add(new + * Chunk(orgAddress,subtitleFont)); title.add(new Chunk("\n")); + * title.add(new Chunk("Phone: " + phone,subtitleFont)); title.add(new + * Chunk("\n")); title.add(new Chunk("Fax: " + fax,subtitleFont)); + * + * + * //cell = new PdfPCell(new Paragraph(new Chunk("Title1",titleFont))); cell = + * new PdfPCell(title); + * + * cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); + * cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); + * cell.setFixedHeight(logo.height()); cell.setBorderWidth(cellBorderWidth); + * table.addCell(cell); + * + * cell = new PdfPCell(new Paragraph("")); + * cell.setBorderWidth(cellBorderWidth); cell.setFixedHeight(10); + * cell.setColspan(2); table.addCell(cell); + * + * //doc type cell = new PdfPCell(new Paragraph(new + * Chunk(docType,titleFont))); + * + * cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); + * cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //spacing cell = new PdfPCell(new Paragraph("")); + * cell.setBorderWidth(cellBorderWidth); cell.setFixedHeight(10); + * cell.setColspan(2); table.addCell(cell); + * + * + * //row 1 cell = new PdfPCell(new Paragraph(new + * Chunk(customerName,headerFont))); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * + * cell = new PdfPCell(new Paragraph(new Chunk("Sales Rep: + * "+salesRep,headerFont))); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //row 2 cell = new PdfPCell(new Paragraph(new + * Chunk(customerAddress,headerFont))); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //spacing cell = new PdfPCell(new Paragraph("")); + * cell.setBorderWidth(cellBorderWidth); cell.setFixedHeight(10); + * cell.setColspan(2); table.addCell(cell); + * + * //row 3 cell = new PdfPCell(new Paragraph(new Chunk("No: " + documentNo, + * headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //row 4 cell = new PdfPCell(new Paragraph(new Chunk("Doc Status: + * "+docStatus,headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * + * //row 5 cell = new PdfPCell(new Paragraph(new Chunk("Payment By: + * "+paymentBy,headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * + * //row 6 cell = new PdfPCell(new Paragraph(new Chunk("Date: + * "+dateOrdered,headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //spacing cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); + * cell.setFixedHeight(10); cell.setBorderWidth(cellBorderWidth); + * table.addCell(cell); + * + * //spacing cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); + * cell.setFixedHeight(10); cell.setBorderWidth(cellBorderWidth); + * table.addCell(cell); + * + * + * //------------------------------------------------------ cell = new + * PdfPCell(); cell.setColspan(2); cell.setBorderWidth(cellBorderWidth); + * + * PdfPTable t = new PdfPTable(6); t.getDefaultCell().setPadding(3.0f); + * t.setWidthPercentage(100.0f); + * + * int[] widths = {1,4,1,2,2,2}; t.setWidths(widths); + * + * //setting headers t.addCell(new Paragraph(new + * Chunk("SerNo",headerFont))); t.addCell(new Paragraph(new + * Chunk("Name",headerFont))); t.addCell(new Paragraph(new + * Chunk("Qty",headerFont))); t.addCell(new Paragraph(new + * Chunk("Price",headerFont))); t.addCell(new Paragraph(new + * Chunk("VAT",headerFont))); t.addCell(new Paragraph(new + * Chunk("Total",headerFont))); + * + * //setting table data //--------------------------------writing table + * data------------------------------ int serNo = 0; int totalQty = 0; + * double totalAmt = 0.0; double totalTaxAmt = 0.0; double grandTotal = 0.0; + * + * BigDecimal qty = null; BigDecimal lineAmt = null; BigDecimal taxAmt = + * null; BigDecimal lineTotalAmt = null; + * + * for (WebOrderLineBean orderlineBean : orderLineList) { serNo++; qty = + * orderlineBean.getQtyOrdered(); lineAmt = orderlineBean.getLineNetAmt(); + * taxAmt = orderlineBean.getTaxAmt(); lineTotalAmt = + * orderlineBean.getLineTotalAmt(); + * + * totalQty += qty.intValue(); totalAmt += lineAmt.doubleValue(); + * totalTaxAmt += taxAmt.doubleValue(); grandTotal += + * lineTotalAmt.doubleValue(); + * + * t.addCell(new Paragraph(new Chunk(serNo+"",simpleFont))); t.addCell(new + * Paragraph(new Chunk(orderlineBean.getProductName(),simpleFont))); + * t.addCell(new Paragraph(new Chunk(qty.intValue()+"",simpleFont))); + * t.addCell(new Paragraph(new + * Chunk(formatter.format(lineAmt.doubleValue()),simpleFont))); + * t.addCell(new Paragraph(new + * Chunk(formatter.format(taxAmt.doubleValue()),simpleFont))); t.addCell(new + * Paragraph(new + * Chunk(formatter.format(lineTotalAmt.doubleValue()),simpleFont))); } + * //----------------------------------------------------------------------------------- + * + * //setting table footer t.getDefaultCell().setBackgroundColor(new + * Color(240,240,240)); + * + * PdfPCell c = new PdfPCell(new Paragraph(new Chunk("ORDER + * TOTAL",headerFont))); c.setColspan(2); c.setBackgroundColor(new + * Color(240,240,240)); t.addCell(c); + * + * t.addCell(new Paragraph(new Chunk(totalQty + "",simpleFont))); + * t.addCell(new Paragraph(new Chunk(currency + + * formatter.format(totalAmt),simpleFont))); t.addCell(new Paragraph(new + * Chunk(currency + formatter.format(totalTaxAmt),simpleFont))); + * t.addCell(new Paragraph(new Chunk(currency + + * formatter.format(grandTotal),simpleFont))); + * + * t.setSplitRows(true); cell.addElement(t); + * //------------------------------------------------------ + * + * //table.addCell(cell); table.setSplitRows(true); + * + * + * document.add(table); document.add(t); + * } catch (Exception e) { throw new OperationException(e); } + * // step 5: we close the document document.close(); + * + * + * return reportName; } + */ + + /* + * public static String getPaymentPDFReport(Properties ctx, int paymentId, + * String trxName) throws OperationException { String docStatus = null; + * String dateOrdered = null; String docType = null; String orgName = null; + * String orgAddress = null; String salesRep = null; String phone = " "; + * String fax = " "; + * + * String customerName = null; String customerAddress = null; String + * documentNo = null; String currency = "Rs "; NumberFormat formatter = new + * DecimalFormat("###,###,##0.00"); + * + * currency = + * POSTerminalManager.getPOSDefaultSellCurrency(ctx).getCurSymbol()+ " "; + * + * MPayment payment = PaymentManager.loadPayment(ctx, paymentId, trxName); + * + * //getting orgInfo MOrg org = new + * MOrg(ctx,payment.getAD_Org_ID(),trxName); int location_id = + * org.getInfo().getC_Location_ID(); MLocation location = new + * MLocation(ctx,location_id,trxName); MBPartner orgPartner = new + * MBPartner(ctx, org.getLinkedC_BPartner_ID(), trxName); MBPartnerLocation + * meLocation[] = MBPartnerLocation.getForBPartner(ctx,orgPartner.getID()); + * + * if (meLocation.length != 1) throw new OperationException("Should have + * only 1 location for organisation business partner!!"); + * + * MBPartnerLocation orgLocation = meLocation[0]; + * + * if (orgLocation.getPhone() != null); phone = orgLocation.getPhone(); + * + * if (orgLocation.getFax() != null) fax = orgLocation.getFax();; + * + * orgName = org.getName(); + * + * String address1 = (location.getAddress1() == null)? " " : + * location.getAddress1(); String address2 = (location.getAddress2() == + * null)? " " : location.getAddress2(); orgAddress = (address1 + " " + + * address2).trim(); + * + * //getting order type MDocType doctype = MDocType.get(ctx, + * payment.getC_DocType_ID()); docType = doctype.getName(); + * + * //getting orderInfo docStatus = payment.getDocStatusName(); documentNo = + * payment.getDocumentNo(); + * + * Date d = new Date(payment.getCreated().getTime()); SimpleDateFormat s = + * new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); dateOrdered = s.format(d); + * + * //getting salesrep int saleRep_id = payment.getDoc_User_ID(); MUser user = + * new MUser(ctx,saleRep_id,trxName); salesRep = user.getName(); + * + * //getting customer info int bpartner_id = payment.getC_BPartner_ID(); + * BPartnerBean bean = BPartnerManager.getBpartner(ctx,bpartner_id, + * trxName); + * + * String name1 = (bean.getPartnerName() == null)? " " : + * bean.getPartnerName(); String name2 = (bean.getName2() == null)? " " : + * bean.getName2(); customerName = (name1 + " " + name2).trim(); + * + * address1 = (bean.getAddress1() == null)? " " : bean.getAddress1(); + * address2 = (bean.getAddress2() == null)? " " : bean.getAddress2(); + * customerAddress = (address1 + " " + address2).trim(); + * + * + * ArrayList orderLineList = + * PaymentManager.getWebPaymentBean(ctx,payment); + * + * //----------------------------------- generating pdf + * -------------------------------------- String reportName = + * RandomStringGenerator.randomstring() + ".pdf"; String reportPath = + * ReportManager.getReportPath(reportName); + * + * + * Font titleFont = new Font(Font.TIMES_ROMAN, 18,Font.BOLD); Font + * subtitleFont = new Font(Font.TIMES_ROMAN, 14,Font.BOLD); + * + * Font headerFont = new Font(Font.TIMES_ROMAN, 11,Font.BOLD); Font + * simpleFont = new Font(Font.TIMES_ROMAN, 10); + * + * float cellBorderWidth = 0.0f; + * // step 1: creation of a document-object Document document = new + * Document(PageSize.A4,30,30,20,40);//l,r,t,b //document.getPageSize().set; + * + * System.out.println(document.leftMargin()); + * + * try { // step 2: // we create a writer that listens to the document // + * and directs a PDF-stream to a file PdfWriter.getInstance(document,new + * FileOutputStream(reportPath)); + * // step 3: we open the document document.open(); // step 4: we add a + * paragraph to the document + * + * Image logo = null; + * + * //TODO: make this part dynamic <------------------------------ IMPORTANT + * !!!!!!!!!!!!!!!!!!!!!!!!!!! String imageURI = PathInfo.PROJECT_HOME + + * "images/pos/openBLUE_POS_Logo.gif"; logo = Image.getInstance(imageURI); + * + * //MAttachment attachment = new + * MAttachment(ctx,MOrg.Table_ID,org.getID(),null); //logo = + * Image.getInstance(attachment.getEntries()[0].getData()); + * + * try { byte logoData[] = OrganisationManager.getLogo(ctx, null); logo = + * Image.getInstance(logoData); } catch(LogoException ex) { logo = + * Image.getInstance(imageURI); } + * + * logo.setAbsolutePosition(document.left(),document.top()-logo.height()); + * document.add(logo); + * + * PdfPTable table = new PdfPTable(2); PdfPCell cell = null; + * // table.getDefaultCell().setPadding(5.0f); + * table.setWidthPercentage(100.0f); + * + * //header cell Paragraph title = new Paragraph(); title.add(new + * Chunk(orgName,subtitleFont)); title.add(new Chunk("\n")); title.add(new + * Chunk(orgAddress,subtitleFont)); title.add(new Chunk("\n")); + * title.add(new Chunk("Phone: " + phone,subtitleFont)); title.add(new + * Chunk("\n")); title.add(new Chunk("Fax: " + fax,subtitleFont)); + * + * + * //cell = new PdfPCell(new Paragraph(new Chunk("Title1",titleFont))); cell = + * new PdfPCell(title); + * + * cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); + * cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); + * cell.setFixedHeight(logo.height()); cell.setBorderWidth(cellBorderWidth); + * table.addCell(cell); + * + * cell = new PdfPCell(new Paragraph("")); + * cell.setBorderWidth(cellBorderWidth); cell.setFixedHeight(10); + * cell.setColspan(2); table.addCell(cell); + * + * //doc type cell = new PdfPCell(new Paragraph(new + * Chunk(docType,titleFont))); + * + * cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); + * cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //spacing cell = new PdfPCell(new Paragraph("")); + * cell.setBorderWidth(cellBorderWidth); cell.setFixedHeight(10); + * cell.setColspan(2); table.addCell(cell); + * + * + * //row 1 cell = new PdfPCell(new Paragraph(new + * Chunk(customerName,headerFont))); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * + * cell = new PdfPCell(new Paragraph(new Chunk("Sales Rep: + * "+salesRep,headerFont))); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //row 2 cell = new PdfPCell(new Paragraph(new + * Chunk(customerAddress,headerFont))); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //spacing cell = new PdfPCell(new Paragraph("")); + * cell.setBorderWidth(cellBorderWidth); cell.setFixedHeight(10); + * cell.setColspan(2); table.addCell(cell); + * + * //row 3 cell = new PdfPCell(new Paragraph(new Chunk("No: " + documentNo, + * headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //row 4 cell = new PdfPCell(new Paragraph(new Chunk("Doc Status: + * "+docStatus,headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * + * //row 5 cell = new PdfPCell(new Paragraph(new Chunk("Payment By: + * "+paymentBy,headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * + * //row 6 cell = new PdfPCell(new Paragraph(new Chunk("Date: + * "+dateOrdered,headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + * + * //spacing cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); + * cell.setFixedHeight(10); cell.setBorderWidth(cellBorderWidth); + * table.addCell(cell); + * + * //spacing cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); + * cell.setFixedHeight(10); cell.setBorderWidth(cellBorderWidth); + * table.addCell(cell); + * + * + * //------------------------------------------------------ cell = new + * PdfPCell(); cell.setColspan(2); cell.setBorderWidth(cellBorderWidth); + * + * PdfPTable t = new PdfPTable(6); t.getDefaultCell().setPadding(3.0f); + * t.setWidthPercentage(100.0f); + * + * int[] widths = {1,4,1,2,2,2}; t.setWidths(widths); + * + * //setting headers t.addCell(new Paragraph(new + * Chunk("SerNo",headerFont))); t.addCell(new Paragraph(new + * Chunk("Name",headerFont))); t.addCell(new Paragraph(new + * Chunk("Qty",headerFont))); t.addCell(new Paragraph(new + * Chunk("Price",headerFont))); t.addCell(new Paragraph(new + * Chunk("VAT",headerFont))); t.addCell(new Paragraph(new + * Chunk("Total",headerFont))); + * + * //setting table data //--------------------------------writing table + * data------------------------------ int serNo = 0; int totalQty = 0; + * double totalAmt = 0.0; double totalTaxAmt = 0.0; double grandTotal = 0.0; + * + * BigDecimal qty = null; BigDecimal lineAmt = null; BigDecimal taxAmt = + * null; BigDecimal lineTotalAmt = null; + * + * for (WebOrderLineBean orderlineBean : orderLineList) { serNo++; qty = + * orderlineBean.getQtyOrdered(); lineAmt = orderlineBean.getLineNetAmt(); + * taxAmt = orderlineBean.getTaxAmt(); lineTotalAmt = + * orderlineBean.getLineTotalAmt(); + * + * totalQty += qty.intValue(); totalAmt += lineAmt.doubleValue(); + * totalTaxAmt += taxAmt.doubleValue(); grandTotal += + * lineTotalAmt.doubleValue(); + * + * t.addCell(new Paragraph(new Chunk(serNo+"",simpleFont))); t.addCell(new + * Paragraph(new Chunk(orderlineBean.getProductName(),simpleFont))); + * t.addCell(new Paragraph(new Chunk(qty.intValue()+"",simpleFont))); + * t.addCell(new Paragraph(new + * Chunk(formatter.format(lineAmt.doubleValue()),simpleFont))); + * t.addCell(new Paragraph(new + * Chunk(formatter.format(taxAmt.doubleValue()),simpleFont))); t.addCell(new + * Paragraph(new + * Chunk(formatter.format(lineTotalAmt.doubleValue()),simpleFont))); } + * //----------------------------------------------------------------------------------- + * + * //setting table footer t.getDefaultCell().setBackgroundColor(new + * Color(240,240,240)); + * + * PdfPCell c = new PdfPCell(new Paragraph(new Chunk("ORDER + * TOTAL",headerFont))); c.setColspan(2); c.setBackgroundColor(new + * Color(240,240,240)); t.addCell(c); + * + * t.addCell(new Paragraph(new Chunk(totalQty + "",simpleFont))); + * t.addCell(new Paragraph(new Chunk(currency + + * formatter.format(totalAmt),simpleFont))); t.addCell(new Paragraph(new + * Chunk(currency + formatter.format(totalTaxAmt),simpleFont))); + * t.addCell(new Paragraph(new Chunk(currency + + * formatter.format(grandTotal),simpleFont))); + * + * t.setSplitRows(true); cell.addElement(t); + * //------------------------------------------------------ + * + * //table.addCell(cell); table.setSplitRows(true); + * + * + * document.add(table); document.add(t); + * } catch (Exception e) { throw new OperationException(e); } + * // step 5: we close the document document.close(); + * + * + * return reportName; } + */ + + public static String getShipmentPDFReport(Properties ctx, int minoutId, + String trxName) throws OperationException { + String docStatus = null; + String dateOrdered = null; + String docType = null; + String orgName = null; + String orgAddress = null; + String salesRep = null; + String phone = " "; + String fax = " "; + + String customerName = null; + String customerAddress = null; + String documentNo = null; + + MInOut minout = MinOutManager.loadMInOut(ctx, minoutId, trxName); + + // getting orgInfo + MOrg org = new MOrg(ctx, minout.getAD_Org_ID(), trxName); + int location_id = org.getInfo().getC_Location_ID(); + MLocation location = new MLocation(ctx, location_id, trxName); + MBPartner orgPartner = new MBPartner(ctx, org.getLinkedC_BPartner_ID(trxName), + trxName); + MBPartnerLocation meLocation[] = MBPartnerLocation.getForBPartner(ctx, + orgPartner.get_ID()); + + if (meLocation.length != 1) + throw new OperationException( + "Should have only 1 location for organisation business partner!!"); + + MBPartnerLocation orgLocation = meLocation[0]; + + if (orgLocation.getPhone() != null) + phone = orgLocation.getPhone(); + + if (orgLocation.getFax() != null) + fax = orgLocation.getFax(); + ; + + orgName = org.getName(); + + String address1 = (location.getAddress1() == null) ? " " : location + .getAddress1(); + String address2 = (location.getAddress2() == null) ? " " : location + .getAddress2(); + orgAddress = (address1 + " " + address2).trim(); + + // getting order type + MDocType doctype = MDocType.get(ctx, minout.getC_DocType_ID()); + docType = doctype.getName(); + + // getting orderInfo + docStatus = minout.getDocStatusName(); + documentNo = minout.getDocumentNo(); + + Date d = new Date(minout.getCreated().getTime()); + SimpleDateFormat s = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + dateOrdered = s.format(d); + + // getting salesrep + int saleRep_id = minout.getSalesRep_ID(); + MUser user = new MUser(ctx, saleRep_id, trxName); + salesRep = user.getName(); + + // getting customer info + int bpartner_id = minout.getC_BPartner_ID(); + BPartnerBean bean = BPartnerManager.getBpartner(ctx, bpartner_id, + trxName); + + String name1 = (bean.getPartnerName() == null) ? " " : bean + .getPartnerName(); + String name2 = (bean.getName2() == null) ? " " : bean.getName2(); + customerName = (name1 + " " + name2).trim(); + + address1 = (bean.getAddress1() == null) ? " " : bean.getAddress1(); + address2 = (bean.getAddress2() == null) ? " " : bean.getAddress2(); + customerAddress = (address1 + " " + address2).trim(); + + ArrayList orderLineList = MinOutManager + .getWebMinOutLines(ctx, minout); + + // ----------------------------------- generating pdf + // -------------------------------------- + String reportName = RandomStringGenerator.randomstring() + ".pdf"; + String reportPath = ReportManager.getReportPath(reportName); + + Font titleFont = new Font(Font.TIMES_ROMAN, 18, Font.BOLD); + Font subtitleFont = new Font(Font.TIMES_ROMAN, 14, Font.BOLD); + + Font headerFont = new Font(Font.TIMES_ROMAN, 11, Font.BOLD); + Font simpleFont = new Font(Font.TIMES_ROMAN, 10); + + float cellBorderWidth = 0.0f; + + // step 1: creation of a document-object + Document document = new Document(PageSize.A4, 30, 30, 20, 40);// l,r,t,b + // document.getPageSize().set; + + System.out.println(document.leftMargin()); + + try { + // step 2: + // we create a writer that listens to the document + // and directs a PDF-stream to a file + PdfWriter.getInstance(document, new FileOutputStream(reportPath)); + + // step 3: we open the document + document.open(); + // step 4: we add a paragraph to the document + + Image logo = null; + + // TODO: make this part dynamic <------------------------------ + // IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!! + String imageURI = PathInfo.PROJECT_HOME + + "images/pos/openBLUE_POS_Logo.gif"; + logo = Image.getInstance(imageURI); + + // MAttachment attachment = new + // MAttachment(ctx,MOrg.Table_ID,org.getID(),null); + // logo = Image.getInstance(attachment.getEntries()[0].getData()); + + try { + byte logoData[] = OrganisationManager.getLogo(ctx, null); + logo = Image.getInstance(logoData); + } catch (LogoException ex) { + logo = Image.getInstance(imageURI); + } + + logo.setAbsolutePosition(document.left(), document.top() + - logo.height()); + document.add(logo); + + PdfPTable table = new PdfPTable(2); + PdfPCell cell = null; + + // + table.getDefaultCell().setPadding(5.0f); + table.setWidthPercentage(100.0f); + + // header cell + Paragraph title = new Paragraph(); + title.add(new Chunk(orgName, subtitleFont)); + title.add(new Chunk("\n")); + title.add(new Chunk(orgAddress, subtitleFont)); + title.add(new Chunk("\n")); + title.add(new Chunk("Phone: " + phone, subtitleFont)); + title.add(new Chunk("\n")); + title.add(new Chunk("Fax: " + fax, subtitleFont)); + + // cell = new PdfPCell(new Paragraph(new + // Chunk("Title1",titleFont))); + cell = new PdfPCell(title); + + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); + cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); + cell.setFixedHeight(logo.height()); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + cell = new PdfPCell(new Paragraph("")); + cell.setBorderWidth(cellBorderWidth); + cell.setFixedHeight(10); + cell.setColspan(2); + table.addCell(cell); + + // doc type + cell = new PdfPCell(new Paragraph(new Chunk(docType, titleFont))); + + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); + cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setBorderWidth(cellBorderWidth); + cell.setFixedHeight(10); + cell.setColspan(2); + table.addCell(cell); + + // row 1 + cell = new PdfPCell(new Paragraph(new Chunk(customerName, + headerFont))); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + cell = new PdfPCell(new Paragraph(new Chunk("Sales Rep: " + + salesRep, headerFont))); + cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // row 2 + cell = new PdfPCell(new Paragraph(new Chunk(customerAddress, + headerFont))); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setBorderWidth(cellBorderWidth); + cell.setFixedHeight(10); + cell.setColspan(2); + table.addCell(cell); + + // row 3 + cell = new PdfPCell(new Paragraph(new Chunk("No: " + documentNo, + headerFont))); + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // row 4 + cell = new PdfPCell(new Paragraph(new Chunk("Doc Status: " + + docStatus, headerFont))); + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + /* + * //row 5 cell = new PdfPCell(new Paragraph(new Chunk("Payment By: + * "+paymentBy,headerFont))); cell.setColspan(2); + * cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + * cell.setBorderWidth(cellBorderWidth); table.addCell(cell); + */ + + // row 6 + cell = new PdfPCell(new Paragraph(new Chunk("Date: " + dateOrdered, + headerFont))); + cell.setColspan(2); + cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setColspan(2); + cell.setFixedHeight(10); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setColspan(2); + cell.setFixedHeight(10); + cell.setBorderWidth(cellBorderWidth); + table.addCell(cell); + + // ------------------------------------------------------ + cell = new PdfPCell(); + cell.setColspan(2); + cell.setBorderWidth(cellBorderWidth); + + PdfPTable t = new PdfPTable(3); + t.getDefaultCell().setPadding(3.0f); + t.setWidthPercentage(100.0f); + + int[] widths = { 1, 10, 1 }; + t.setWidths(widths); + + // setting headers + t.addCell(new Paragraph(new Chunk("SerNo", headerFont))); + t.addCell(new Paragraph(new Chunk("Name", headerFont))); + t.addCell(new Paragraph(new Chunk("Qty", headerFont))); + + // setting table data + // --------------------------------writing table + // data------------------------------ + int serNo = 0; + + BigDecimal qty = null; + + for (WebMinOutLineBean orderlineBean : orderLineList) { + serNo++; + qty = orderlineBean.getQtyOrdered(); + + t.addCell(new Paragraph(new Chunk(serNo + "", simpleFont))); + t.addCell(new Paragraph(new Chunk(orderlineBean + .getProductName(), simpleFont))); + t.addCell(new Paragraph(new Chunk(qty.intValue() + "", + simpleFont))); + } + // ----------------------------------------------------------------------------------- + + // table.addCell(cell); + table.setSplitRows(true); + + document.add(table); + document.add(t); + + } catch (Exception e) { + throw new OperationException(e); + } + + // step 5: we close the document + document.close(); + + return reportName; + } + + public static String endOfTheDayPDF(Properties ctx, CloseTillBean bean) throws OperationException { + String reportName = RandomStringGenerator.randomstring() + ".pdf"; + String reportPath = ReportManager.getReportPath(reportName); + + double beginningBalance = (bean.getBeginningBalance() == null ? 0 + : bean.getBeginningBalance().doubleValue()); + double statementDifference = (bean.getNetCashTrx() == null ? 0 + : bean.getNetCashTrx().doubleValue()); + double transferAmount = (bean.getBalanceEntered() == null ? 0 + : bean.getBalanceEntered().doubleValue()); + double differenceAmount = (bean.getDifference() == null ? 0 + : bean.getDifference().doubleValue()); + double endingBalance = (bean.getEndingBalance() == null ? 0 + : bean.getEndingBalance().doubleValue()); + double tillCashTotal = (bean.getCashTotal() == null ? 0 : bean + .getCashTotal().doubleValue()); + double cashBeanCardTotal = (bean.getCardTotal() == null ? 0 + : bean.getCardTotal().doubleValue()); + double tillCardTotal = (bean.getCardTotal() == null ? 0 : bean + .getCardTotal().doubleValue()); + double cardDifference = (bean.getCardDifference() == null ? 0 + : bean.getCardDifference().doubleValue()); + double cashBeanChequeTotal = (bean.getChequeTotal() == null ? 0 + : bean.getChequeTotal().doubleValue()); + double tillChequeTotal = (bean.getChequeTotal() == null ? 0 + : bean.getChequeTotal().doubleValue()); + double chequeDifference = (bean.getChequeDifference() == null ? 0 + : bean.getChequeDifference().doubleValue()); + double grandTotal = (bean.getGrandTotal() == null ? 0 + : bean.getGrandTotal().doubleValue()); + + Font titleFont = new Font(Font.TIMES_ROMAN, 8, Font.BOLD); + Font subtitleFont = new Font(Font.TIMES_ROMAN, 8, Font.BOLD); + + // Font headerFont = new Font(Font.TIMES_ROMAN, 8,Font.BOLD); + Font simpleFont = new Font(Font.TIMES_ROMAN, 8); + + final float NO_BORDER = 0.0f; + // final float THIN_BORDER = 1.0f; + + String currency = "Rs "; + NumberFormat formatter = new DecimalFormat("###,###,##0.00"); + PdfPCell cell = null; + + // step 1: creation of a document-object + Document document = new Document(PageSize.A7, 3, 3, 2, 4);// l,r,t,b + // document.getPageSize().set; + + System.out.println(document.leftMargin()); + + try { + currency = POSTerminalManager.getDefaultSalesCurrency(ctx) + .getCurSymbol(); + PdfWriter.getInstance(document, new FileOutputStream(reportPath)); + + document.open(); + + PdfPTable layoutTbl = new PdfPTable(1); + layoutTbl.getDefaultCell().setBorderWidth(NO_BORDER); + layoutTbl.getDefaultCell().setPadding(2.0f); + + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + Date today = new Date(System.currentTimeMillis()); + + // 1.add title + Paragraph title = new Paragraph(new Chunk("End of the Day Report", + titleFont)); + title.setAlignment(Paragraph.ALIGN_CENTER); + cell = new PdfPCell(title); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setBorderWidth(NO_BORDER); + layoutTbl.addCell(cell); + + Paragraph subTitle = new Paragraph(new Chunk(sdf.format(today), + subtitleFont)); + subTitle.setAlignment(Paragraph.ALIGN_CENTER); + cell = new PdfPCell(subTitle); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setBorderWidth(NO_BORDER); + layoutTbl.addCell(cell); + + // spacing + cell = new PdfPCell(new Paragraph("")); + cell.setFixedHeight(10); + cell.setBorderWidth(NO_BORDER); + layoutTbl.addCell(cell); + + // display report data + PdfPTable table = new PdfPTable(2); + Phrase phrase = null; + + // row 1 + phrase = new Phrase("Till No:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(bean.getTillName(), simpleFont); + table.addCell(phrase); + + // row 2 + phrase = new Phrase("Begining Balance:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(beginningBalance), + simpleFont); + table.addCell(phrase); + + // row 3 + phrase = new Phrase("Net Cash Trx:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + + formatter.format(statementDifference), simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Till Balance Entered:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(transferAmount), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Difference:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(differenceAmount), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Ending Balance:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(endingBalance), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Cash Total:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(tillCashTotal), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Card Amt Entered:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(cashBeanCardTotal), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Card Total:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(tillCardTotal), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Card Difference:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(cardDifference), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Cheque Amt Entered:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + + formatter.format(cashBeanChequeTotal), simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Cheque Total:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(tillChequeTotal), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Cheque Difference:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(chequeDifference), + simpleFont); + table.addCell(phrase); + + phrase = new Phrase("Grand Total:", simpleFont); + table.addCell(phrase); + + phrase = new Phrase(currency + formatter.format(grandTotal), + simpleFont); + table.addCell(phrase); + + layoutTbl.addCell(table); + + document.add(layoutTbl); + + } + catch (Exception e) + { + throw new OperationException(e); + } + + document.close(); + + return reportName; + + } + + public static String endOfTheDayReport(Properties ctx, CloseTillBean bean) { + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + // String currency = + // POSTerminalManager.getPOSDefaultCurrency(ctx).getCurSymbol(); + Date today = new Date(System.currentTimeMillis()); + StringBuffer reportData = new StringBuffer(); + + String title = "End of the Day Report"; + String subtitle = sdf.format(today); + + // adding logo + reportData.append(TmkPrinterConstants.LOGO1); + + // adding title + reportData.append(title).append(TmkPrinterConstants.LINE_FEED); + + // adding subtitle + reportData.append(subtitle).append(TmkPrinterConstants.LINE_FEED); + + // adding space + reportData.append(TmkPrinterConstants.LINE_FEED); + + // adding report data + int maxwidth = 60; + int column1 = 30; + int column2 = maxwidth - column1; + + String format1 = "%1$-" + column1 + "s%2$" + column2 + "s%n"; // string,string + String format2 = "%1$-" + column1 + "s%2$" + column2 + ".2f%n"; // string,bigdecimal + + String tillNo = String + .format(format1, "Till No", bean.getTillName()); + String beginningBalance = String.format(format2, "Beginning Balance",bean.getBeginningBalance().doubleValue()); + String netCashTrx = String.format(format2, "Net Cash Trx", bean.getNetCashTrx().doubleValue()); + String tillBalanceEntered = String.format(format2,"Till Balance Entered", bean.getBalanceEntered().doubleValue()); + String difference = String.format(format2, "Difference", bean.getDifference().doubleValue()); + String endingBalance = String.format(format2, "Ending Balance",bean.getEndingBalance().doubleValue()); + String cashTotal = String.format(format2, "Cash Total", bean.getCashTotal().doubleValue()); + String cardTotal = String.format(format2, "Card Total", bean.getCardTotal().doubleValue()); + String chequeTotal = String.format(format2, "Cheque Total", bean.getChequeTotal()); + String grandTotal = String.format(format2, "Grand Total", bean.getGrandTotal()); + + // some new lines + // String cashEntered = String.format(format1, "Cash Amt Entered", + // cashBean.getca); + String cardEntered = String.format(format2, "Card Amt Entered",bean.getCardTotal()); + String cardDifference = String.format(format2, "Card Difference",bean.getCardDifference()); + String chequeEntered = String.format(format2, "Cheque Amt Entered",bean.getChequeTotal()); + String chequeDifference = String.format(format2, "Cheque Difference",bean.getChequeDifference()); + + reportData.append(tillNo).append(beginningBalance).append(netCashTrx) + .append(tillBalanceEntered).append(difference).append( + endingBalance) + // .append(cashEntered) + .append(cashTotal).append(cardEntered).append(cardTotal) + .append(cardDifference).append(chequeEntered).append( + chequeTotal).append(chequeDifference) + .append(grandTotal).append(TmkPrinterConstants.PAPER_CUT).append(TmkPrinterConstants.LINE_FEED); + + return reportData.toString(); + } + + public static String getDailySalesReport( Properties ctx, Timestamp time, int C_POS_ID, int maxLength, String trxName) throws SQLException, OperationException + { + if (maxLength < TmkPrinterConstants.PRINTER_DEFAULT_WIDTH) + { + maxLength = TmkPrinterConstants.PRINTER_DEFAULT_WIDTH; + } + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + Date today = new Date(System.currentTimeMillis()); + String subtitle = sdf.format(today); + + StringBuffer sql = new StringBuffer(); + + sql.append(" select PROD.NAME,"); + sql.append(" SUM(0 - FACT.QTY) as Qty,"); + sql.append(" round(SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) * ((tax.RATE+100)/100),3) as Value"); + sql.append(" from FACT_ACCT FACT"); + sql.append(" inner join M_PRODUCT PROD on FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID"); + sql.append(" inner join C_TAX tax on tax.C_TAX_ID = FACT.C_TAX_ID"); + sql.append(" inner join C_INVOICE inv on inv.C_INVOICE_ID = fact.RECORD_ID"); + sql.append(" inner join C_ORDER ord on ord.C_Order_ID = inv.C_Order_ID"); + sql.append(" where FACT.ACCOUNT_ID = (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '41000' and AD_CLIENT_ID ="+Env.getAD_Client_ID(ctx)+")"); + sql.append(" and fact.DATEACCT = ").append(DB.TO_DATE(time)); + sql.append(" and fact.AD_ORG_ID= ? "); + sql.append(" and fact.AD_CLIENT_ID = ? "); + sql.append(" and ord.C_POS_ID = ?"); + sql.append(" GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),"); + sql.append(" tax.RATE,"); + sql.append(" PROD.NAME "); + sql.append(" Order by to_char(fact.DATEACCT,'DD-MM-YYYY')"); + sql.append(" desc,PROD.NAME asc"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + pstmt = DB.prepareStatement(sql.toString(),trxName); + pstmt.setInt(1, Env.getAD_Org_ID(ctx)); + pstmt.setInt(2, Env.getAD_Client_ID(ctx)); + pstmt.setInt(3, C_POS_ID); + pstmt.execute(); + + BigDecimal totalQty = Env.ZERO; + BigDecimal totalValue = Env.ZERO; + + ArrayList list = new ArrayList(); + Object[] data = null; + + try + { + rs = pstmt.executeQuery(); + + while (rs.next()) + { + data = new Object[3]; + + data[0] = rs.getString(1); + data[1] = rs.getBigDecimal(2); + data[2] = rs.getBigDecimal(3); + + totalQty = totalQty.add(rs.getBigDecimal(2)); + totalValue = totalValue.add(rs.getBigDecimal(3)); + + list.add(data); + } + + } + catch(SQLException e) + { + throw new OperationException(e); + } + finally + { + DBUtils.close(rs); + DBUtils.close(pstmt); + } + + String doubleLine = ""; + String line = ""; + + for(int i=0; i getBestSellingItemsData(Properties ctx, Timestamp fromDate, Timestamp toDate, String trxName) throws OperationException, SQLException + { + ArrayList reportData = new ArrayList(); + Object[] data = null; + + BigDecimal totalQty = Env.ZERO; + BigDecimal totalValue = Env.ZERO; + + StringBuffer sql = new StringBuffer(); + + sql.append(" select PROD.NAME, SUM(0 - FACT.QTY) as QTY, round(SUM(FACT.AMTACCTCR - FACT.AMTACCTDR),2) as VALUE,"); + + if(DB.getDatabase().getName().equals(Database.DB_POSTGRESQL)) + { + sql.append(" case when prod.GROUP1 is null then 'OTHERS' else trim(prod.GROUP1) end as GROUP1"); + } + + if(DB.getDatabase().getName().equals(Database.DB_ORACLE)) + { + sql.append(" case when prod.GROUP1 is null then 'OTHERS' else to_char(prod.GROUP1) end as GROUP1"); + } + + sql.append(" from FACT_ACCT FACT inner join M_PRODUCT PROD on FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID") + .append(" where FACT.ACCOUNT_ID = (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '41000' and AD_CLIENT_ID ="+Env.getAD_Client_ID(ctx)+")") + .append(" and fact.DATEACCT between " + DB.TO_DATE(fromDate) + " and " + DB.TO_DATE(toDate) ) + .append(" and fact.AD_ORG_ID="+Env.getAD_Org_ID(ctx)) + .append(" and fact.AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)) + .append(" and PROD.ISACTIVE='Y'"); + + if(DB.getDatabase().getName().equals(Database.DB_ORACLE)) + { + sql.append(" and ROWNUM < 101"); + } + + sql.append(" GROUP BY PROD.NAME, prod.GROUP1, prod.GROUP2") + .append(" Order by round(SUM(FACT.AMTACCTCR - FACT.AMTACCTDR),3) desc"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement (sql.toString(), trxName); + rs = pstmt.executeQuery(); + + while(rs.next()) + { + data = new Object[4]; + + data[0] = rs.getString(1); + data[1] = rs.getBigDecimal(2); + data[2] = rs.getBigDecimal(3); + data[3] = rs.getString(4); + + totalQty = totalQty.add(rs.getBigDecimal(2)); + totalValue = totalValue.add(rs.getBigDecimal(3)); + + reportData.add(data); + } + + Object[] totalValues = {"TOTAL ", totalQty, totalValue, ""}; + reportData.add(totalValues); + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + DBUtils.close(rs); + DBUtils.close(pstmt); + + } + + return reportData; + } + + /** + * Get Stock Enquiry Data + * @param ctx + * @param fromDate + * @param toDate + * @param trxName + * @return Array of Object + * @throws OperationException + * @throws SQLException + */ + public static ArrayList getStockEnquiryData(Properties ctx, Timestamp fromDate, Timestamp toDate, String trxName) throws OperationException, SQLException + { + ArrayList reportData = new ArrayList(); + Object[] data = null; + + BigDecimal totalOpStockQty = Env.ZERO; + BigDecimal totalOpStockValue = Env.ZERO; + BigDecimal totalClosingStockQty = Env.ZERO; + BigDecimal totalClosingStockValue = Env.ZERO; + + StringBuffer sql = new StringBuffer(); + + sql.append(" select p.UPC as Barcode, p.Name as Product,") + .append(" case when openB.sumO is null then 0 else openB.sumO end as OpStock, ") + .append(" (price.PRICESTD * (case when openB.sumO is null then 0 else openB.sumO end)) as TotalValue, ") + .append(" case when openC.sum1 is null then 0 else openC.sum1 end as ClosingStock ,") + .append(" (price.PRICESTD * (case when openC.sum1 is null then 0 else openC.sum1 end)) as TotValue ") + .append(" from (M_Product p ") + .append(" INNER JOIN ") + .append(" ( ") + .append(" Select M_Product_ID, sum(MovementQty) as sum1 from M_Transaction trx1 where trx1.MOVEMENTDATE < ").append(DB.TO_DATE(fromDate)).append(" and trx1.MOVEMENTTYPE in ('V+','V-','C-','C+','I+') group by M_Product_ID) openC ON p.M_PRODUCT_ID=openC.M_Product_ID ") + .append(" left outer JOIN (Select M_Product_ID, sum(MovementQty) as sumO from M_Transaction trxO where trxO.MOVEMENTDATE < ").append(DB.TO_DATE(toDate)).append(" and trxO.MOVEMENTTYPE in ('V+','V-','C-','C+','I+') group by M_Product_ID) openB ON p.M_PRODUCT_ID=openB.M_Product_ID ") + .append(" ) ") + .append(" left outer join M_PRODUCTPRICE price on p.M_Product_ID=price.M_Product_ID,AD_ORG org ") + .append(" where p.AD_ORG_ID = org.AD_ORG_ID ") + .append(" and p.AD_ORG_ID = ").append(Env.getAD_Org_ID(ctx)) + .append(" and p.ISACTIVE='Y' ") + .append(" and price.M_PRICELIST_VERSION_ID = ").append(Env.getContextAsInt(ctx,UdiConstants.POS_PURCHASE_PL_VERSION)) + .append(" order by p.Name "); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement (sql.toString(), trxName); + rs = pstmt.executeQuery(); + + while(rs.next()) + { + data = new Object[6]; + + data[0] = rs.getString(1); // Bar code + data[1] = rs.getString(2); // Product Name + data[2] = rs.getBigDecimal(3); // Opening Stock + data[3] = rs.getBigDecimal(4); // Opening Value + data[4] = rs.getBigDecimal(5); // Closing Stock + data[5] = rs.getBigDecimal(6); // Closing Value + + totalOpStockQty = totalOpStockQty.add(rs.getBigDecimal(3)); + totalOpStockValue = totalOpStockValue.add(rs.getBigDecimal(4)); + totalClosingStockQty = totalClosingStockQty.add(rs.getBigDecimal(5)); + totalClosingStockValue = totalClosingStockValue.add(rs.getBigDecimal(6)); + + reportData.add(data); + } + + Object[] totalValues = {"TOTAL VALUE ", "", totalOpStockQty, totalOpStockValue, totalClosingStockQty, totalClosingStockValue}; + reportData.add(totalValues); + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + DBUtils.close(rs); + DBUtils.close(pstmt); + + } + + return reportData; + } + + public static ArrayList getStockSalesReport(Properties ctx, HashMap> productOrgList, ArrayList stockSalesList, boolean isSales, Integer productId, Integer orgId, Timestamp fromDate, Timestamp toDate) throws OperationException, SQLException + { + + if (productId == null) + { + throw new OperationException("product Id is null, cannot search for stock and sales by org"); + } + if (orgId == null) + { + throw new OperationException("org id is null, cannot search for stock and sales"); + } + + if (productOrgList == null) + { + productOrgList = new HashMap>(); + } + + MProduct product = MProduct.get(ctx, productId); + String productName = product.getName(); + int adClientId = Env.getAD_Client_ID(ctx); + + BigDecimal data = null; + BigDecimal stock = null; + boolean queryOrg = true; + MOrg org = MOrg.get(ctx, orgId); + + if (stockSalesList == null) + { + stockSalesList = new ArrayList(); + + data = getData(ctx, isSales, productId, orgId, fromDate, toDate); + + Object[] headerSales = new Object[] {"Product", org.getName(), "Total"}; + Object[] row = new Object[]{productName, data, data}; + stockSalesList.add(headerSales); + stockSalesList.add(row); + ArrayList orgList = new ArrayList(); + orgList.add(org.getName()); + productOrgList.put(productId, orgList); + } + + else + { + Object[] headerSales = stockSalesList.get(0); + + for (int i=1; i clone = new ArrayList(); + Iterator iterClone = stockSalesList.iterator(); + + while (iterClone.hasNext()) + { + clone.add(iterClone.next()); + } + + Iterator iter = stockSalesList.subList(1, stockSalesList.size()).iterator(); + while (iter.hasNext()) + { + Object[] row = iter.next(); + String prodName = row[0].toString(); + int[] ids = ProductManager.getProducts(ctx, prodName, "", "",null); + Integer prodId = 0; + if (ids !=null && ids.length >0) + { + prodId= Integer.valueOf(ids[0]); + } + data = getData(ctx, isSales, prodId, orgId, fromDate, toDate); + updateRow(clone,row, data); + productOrgList.get(prodId).add(org.getName()); // update list + } + stockSalesList = clone; + clone = null; + + } + if (!productOrgList.containsKey(productId)) // need to add new product + { + // add product for all existing orgs (plus the new one if just added) + headerSales = stockSalesList.get(0); + + Object[] newRowAdded = new Object[headerSales.length]; + newRowAdded[0] = productName; + ArrayList orgList = new ArrayList(); + BigDecimal total = Env.ZERO; + for (int i = 1; i< headerSales.length-1; i++) + { + String existingOrg = headerSales[i].toString(); + orgList.add(existingOrg); + Integer existingOrgId = OrganisationManager.getOrgByName(ctx, existingOrg, null).get_ID(); + data = getData(ctx, isSales, productId, existingOrgId, fromDate, toDate); + + newRowAdded[i] = data; + total = total.add(data); + } + newRowAdded[headerSales.length-1] = total; + productOrgList.put(productId, orgList); + stockSalesList.add(newRowAdded); + } + } + + return stockSalesList; + + } + + public static ArrayList doBackup(ArrayList list) + { + ArrayList backup = null; + if (list != null) + { + Iterator iter = list.iterator(); + + backup = new ArrayList(); + + while (iter.hasNext()) + { + backup.add(iter.next()); + } + } + return backup; + } + + + private static void updateRow(ArrayList stockSalesList, Object[] row, BigDecimal data) throws OperationException + { + Object[] newRow = new Object[stockSalesList.get(0).length]; + + if (!(newRow.length == row.length + 1)) + { + throw new OperationException("inconsistent header and row length"); + } + + for (int i=0; i< row.length-1; i++) + { + newRow[i] = row[i]; // fill new row with data of old row (product name to data for last org) exclude total + } + + newRow[row.length-1] = data; // append new data for new org added + + + BigDecimal total = Env.ZERO; // calculate new total + for (int j = 1; j orgSales = POSSalesReportManager.getSalesByOrg(ctx, productId, orgId, fromDate, toDate, null); + + data = orgSales.get(orgId); + + } + + else + { + HashMap orgStock = POSStockManager.getStockByOrg(ctx, productId, toDate, orgId, null); + data = orgStock.get(orgId); + + } + if (data == null) + { + return Env.ZERO; + } + + return data; + } + + public static ArrayList getStockSalesReportComplete(Properties ctx, HashSet productListCompleteSet, boolean isSales, ArrayList listComplete, Integer productId, + Integer orgId, Timestamp fromDate, Timestamp toDate) throws OperationException, SQLException + { + HashMap list = null; + + if (productListCompleteSet == null) + { + productListCompleteSet = new HashSet(); + } + + if (!productListCompleteSet.isEmpty() && productListCompleteSet.contains(productId)) + { + return listComplete; + } + else + { + productListCompleteSet.add(productId); + } + + if (isSales) + { + list = POSSalesReportManager.getSalesByOrg(ctx, productId, orgId, fromDate, toDate, null); + } + else + { + list = POSStockManager.getStockByOrg(ctx, productId, toDate, orgId, null); + } + + if (listComplete == null) + { + listComplete = getHeaderComplete(ctx); + } + + MProduct product = MProduct.get(ctx, productId); + Object[] header = listComplete.get(0); + Object[] row = new Object[header.length]; + + row[0] = product.getName(); + BigDecimal total = Env.ZERO; + for (int i = 1; i getHeaderComplete(Properties ctx) + { + ArrayList listComplete = new ArrayList(); + String orgList = Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + String[] orgs = orgList.split(","); + + Object[] header = new Object[orgs.length +1]; + header[0] = "Product"; + + int i = 1; + for (String org : orgs) + { + Integer org_Id = Integer.valueOf(org); + if (org_Id != 0) + { + MOrg organisation = MOrg.get(ctx, org_Id); + header[i] = organisation.getName(); + i++; + } + } + header[i] = "Total"; + listComplete.add(header); + return listComplete; + } + + public static String getListMonthYears(Timestamp fromDate, Timestamp toDate) throws OperationException + { + DateFormatSymbols dfs = new DateFormatSymbols(Locale.ENGLISH); + + String date1 = TimestampConvertor.convertTimeStamp(fromDate, TimestampConvertor.BIRTH_DATE); + String date2 = TimestampConvertor.convertTimeStamp(toDate, TimestampConvertor.BIRTH_DATE); + String[] monthName = dfs.getMonths(); + + + StringBuffer list_monthYears = new StringBuffer(); + String[] s_date1 = date1.split("/"); + String[] s_date2 = date2.split("/"); + int begin_month = 0; + int begin_year = 0; + int end_month = 0; + int end_year = 0; + + if (s_date1 != null); + { + begin_month = Integer.parseInt(s_date1[1]); + begin_year = Integer.parseInt(s_date1[2]); + + } + + if (s_date2 != null); + { + end_month = Integer.parseInt(s_date2[1]); + end_year = Integer.parseInt(s_date2[2]); + } + + int month = begin_month -1; + int year = begin_year; + + while (month <= Calendar.DECEMBER && year <= end_year) + { + list_monthYears.append(monthName[month] + " " + year + ","); + + if (month == Calendar.DECEMBER) + { + year++; + month = -1; + } + month %= Calendar.DECEMBER; + month++; + + if (year == end_year) + { + if (month >= end_month) + { + break; + } + } + + } + + return list_monthYears.toString(); + + } + + public static ArrayList formatStockSalesReportData(ArrayList reportData, HashMap monthYearQtyMap, + Timestamp fromDate, Timestamp toDate, int precision) throws OperationException + { + String list_monthYears = POSReportManager.getListMonthYears(fromDate, toDate); + String[] listOfMonthYrs = list_monthYears.split(","); + + if (reportData == null) + { + reportData = new ArrayList(); + } + + if (monthYearQtyMap.isEmpty()) + { + List repDataOnly = reportData.subList(1, reportData.size()); + if (repDataOnly.isEmpty()) + { + for (String monthYear: listOfMonthYrs) + { + Object[] data = {monthYear, Env.ZERO}; + reportData.add(data); + } + } + else + { + for (int index =1; index iter = reportData.iterator(); + int j =1; + iter.next(); // escape headers + + while (iter.hasNext()) + { + Object[] dat = iter.next(); + String monthYr = dat[0].toString(); + if (monthYear.equals(monthYr)) + { + index = j; + } + j++; + } + } + if (index != -1) + { + Object[] oldData = reportData.get(index); + reportData.remove(index); + data = new Object[oldData.length +1]; + for (int i =0; i loadReports(Properties ctx) + { + int roleId = Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID); + + return loadReports(ctx, roleId); + } + + /** + * Loads reports accessible by this role. + * Reports are granted to a particular role as process accesses for that role. + * For the reports to be accessible, these process accesses should be active + * and this role should have read-write permissions. + * + * @param ctx context + * @param roleId id of role for which the accessible reports are to be loaded + * @return an arraylist of process ids which are the ids of those processes accessible by that role + */ + public static ArrayList loadReports(Properties ctx, int roleId) + { + if (roleId == 0) + { + return new ArrayList(); + } + MRole role = MRole.get(ctx, roleId); + int adClientId = role.getAD_Client_ID(); + + StringBuffer sqlBuffer = new StringBuffer(); + sqlBuffer.append("SELECT process.AD_Process_ID FROM AD_Process process") + .append(" INNER JOIN AD_Process_Access processAccess ON process.AD_Process_ID = processAccess.AD_Process_ID") + .append(" WHERE process.isActive='Y' AND process.isReport = 'Y' and process.isDirectPrint = 'N'") + .append(" AND processAccess.isActive = 'Y' AND processAccess.isReadWrite = 'Y' AND processAccess.AD_Role_ID = ?") + .append(" AND processAccess.AD_Client_ID = " + adClientId); + + ArrayList processList = new ArrayList(); + + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sqlBuffer.toString(), null); + pstmt.setInt(1, roleId); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + processList.add(rs.getInt(1)); + } + } + catch(SQLException e) + { + + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + return processList; + + } + + /** + * Creates a process instance for this process and populates its parameters. + * For every mapping found in the hashmap paramKeyValue, a parameter is created. + * Each parameter is populated thus: + * Each key is a column name identifying a parameter and the corresponding + * hashmap value is the parameter value. + * + * @param ctx context + * @param processId id of the process whose instance is to be created + * @param paramKeyValue hashmap of column names mapped to their respective values + * + * @return id of the process instance created + * @throws OperationException + */ + public static ProcessInfo createProcessInstance(Properties ctx, int processId, Map map, String trxName) throws OperationException + { + checkProcessAccess(ctx, processId, trxName); + + MProcess process = MProcess.get(ctx, processId); + MProcessPara[] processParams = process.getParameters(); + ProcessInfoParameter[] pInfoParams = new ProcessInfoParameter[processParams.length]; + MPInstance processInstance = new MPInstance(ctx, processId, 0); + processInstance.save(trxName); + + int sequence = 0; + for (MProcessPara parameter : processParams) + { + String columnName = parameter.getColumnName(); + boolean isRange = parameter.isRange(); + int displayType = parameter.getAD_Reference_ID(); + + Class classType = DisplayType.getClass(displayType, true); + Object value = null; + Object value_to = null; + + if (isRange) + { + value = map.get(columnName + "From"); + value_to = map.get(columnName + "To"); + } + else + { + value = map.get(columnName); + } + + if (parameter.isMandatory()) + { + if (isRange) + { + if (value_to == null) + { + throw new MandatoryException(columnName + " value_to parameter is mandatory"); + } + } + if (value == null) + { + throw new MandatoryException(columnName + " value parameter is mandatory"); + } + } + + value = convertValue(value, classType); + value_to = convertValue(value_to, classType); + + MPInstancePara param = new MPInstancePara(processInstance, sequence); + param.setParameterName(columnName); + setParameterValue(param, value, value_to); + String info = null; + String info_to = null; + Lookup lookup = parameter.getLookup(); + if (lookup != null) + { + if (value != null) + { + info = lookup.get(value).toString(); + } + if (value_to != null) + { + info_to = parameter.getLookup().get(value_to).toString(); + } + param.setInfo(info); + param.setInfo_To(info_to); + } + param.save(trxName); + + ProcessInfoParameter infoParam = new ProcessInfoParameter(columnName, value, value_to, null, null); + pInfoParams[sequence] = infoParam; + + sequence++; + } + + ProcessInfo pi = new ProcessInfo(process.getName(), processId); + pi.setTitle(process.getName()); + pi.setTransactionName(trxName); + pi.setAD_Client_ID(Env.getAD_Client_ID(ctx)); + pi.setParameter(pInfoParams); + pi.setAD_PInstance_ID(processInstance.getAD_PInstance_ID()); + pi.setClassName(process.getClassname()); + + return pi; + } + + /** + * + * @param param + * @param value + * @param value_to + */ + private static void setParameterValue(MPInstancePara param, Object value, Object value_to) + { + if (value == null) + { + return; + } + + if (value.getClass() == Integer.class) + { + param.setP_Number((Integer)value); + + if (value_to !=null) + { + param.setP_Number_To((Integer)value_to); + } + } + else if (value.getClass() == BigDecimal.class) + { + param.setP_Number((BigDecimal)value); + + if (value_to !=null) + { + param.setP_Number_To((BigDecimal)value_to); + } + } + else if (value.getClass() == Timestamp.class) + { + param.setP_Date((Timestamp)value); + if (value_to !=null) + { + param.setP_Date_To((Timestamp)value_to); + } + } + else + { + param.setP_String(value.toString()); + if (value_to !=null) + { + param.setP_String_To(value_to.toString()); + } + } + + } + + /** + * + * @param value + * @param classType + * @return + */ + private static Object convertValue(Object value, Class classType) + { + if (value != null) + { + String[] values = (String[]) value; + String val = values[0]; + + if ("".equals(val)) + { + return null; + } + + if (classType == String.class || classType == Boolean.class) + { + value = val; + } + else if (classType == Integer.class || classType == BigDecimal.class) + { + value = BigDecimal.valueOf(Integer.valueOf(val)); + } + else if (classType == Timestamp.class) + { + val = val +" 0:0:0.0"; // SENDYFIXME Need to fix this + value = Timestamp.valueOf(val); + } + } + return value; + } + + /** + * Loads the print format associated with a process or if none is found, loads its default one. + * + * @param ctx context + * @param process the process whose print format is to be loaded + * @return print format to use with that process + * @throws Exception + */ + public static MPrintFormat loadPrintFormat(Properties ctx, MProcess process, String trxName) throws Exception + { + MPrintFormat retValue = null; + if (process.getAD_PrintFormat_ID() ==0) + { + I_AD_ReportView reportView = process.getAD_ReportView(); + int reportViewId = 0; + int tableId = 0; + + if (reportView != null) + { + reportViewId = reportView.getAD_ReportView_ID(); + tableId = reportView.getAD_Table_ID(); + } + + PreparedStatement pstmt = null; + ResultSet rs = null; + String sql = "SELECT * FROM AD_PrintFormat WHERE "; + if (reportViewId > 0) + { + sql += "AD_ReportView_ID=?"; + } + else + { + sql += "AD_Table_ID=?"; + } + + sql += " AND AD_Client_ID = " +Env.getAD_Client_ID(ctx); + sql += " ORDER BY IsDefault DESC"; + try + { + pstmt = DB.prepareStatement (sql, trxName); + pstmt.setInt (1, reportViewId > 0 ? reportViewId : tableId); + rs = pstmt.executeQuery (); + if (rs.next ()) + { + retValue = new MPrintFormat (ctx, rs, trxName); + } + } + catch (Exception e) + { + } + finally + { + DB.close(rs, pstmt); + pstmt = null; + rs = null; + } + retValue = retValue == null ? MPrintFormat.createFromTable(ctx, tableId) : retValue; + } + else + { + retValue = new MPrintFormat(ctx, process.getAD_PrintFormat_ID(), null); + } + return retValue; + } + + /** + * + * @param ctx + * @param className + * @param pi + * @param trx + * @throws InstantiationException + * @throws IllegalAccessException + * @throws ClassNotFoundException + *//* + public static void startProcess(Properties ctx, String className, ProcessInfo pi,Trx trx) + throws InstantiationException, IllegalAccessException, ClassNotFoundException + { + if (className == null) + { + return; + } + Class cl = Class.forName(className); + + if (cl == ReportStarter.class) + { + ReportStarter reportStarter = (ReportStarter)cl.newInstance(); + reportStarter.startProcess(ctx, pi, trx); + return; + } + SvrProcess server = (SvrProcess)cl.newInstance(); + server.startProcess(ctx, pi, trx); + }*/ + + public static boolean isJasperReport(String className) throws ClassNotFoundException + { + if (className!=null) + { + Class cl = Class.forName(className); + + if (cl == ReportStarter.class) + { + return true; + } + } + return false; + } + + /** + * + * @param ctx + * @param processId + * @param trxName + * @throws OperationException + */ + private static void checkProcessAccess(Properties ctx, int processId, String trxName) throws OperationException + { + String sql = "SELECT isActive, isReadWrite FROM AD_Process_Access WHERE AD_Process_ID = ? " + + "AND AD_Role_ID = ? AND AD_Client_ID = ?"; + + MProcess process = MProcess.get(ctx, processId); + PreparedStatement pstmt = null; + ResultSet rs = null; + + String isActive = "N"; + String isReadWrite = "N"; + + + int roleId = Env.getAD_Role_ID(ctx); + MRole role = MRole.get(ctx, roleId); + int adClientId = Env.getAD_Client_ID(ctx); + try + { + pstmt = DB.prepareStatement(sql, trxName); + pstmt.setInt(1, processId); + pstmt.setInt(2, roleId); + pstmt.setInt(3, adClientId); + + rs = pstmt.executeQuery(); + + if (rs.next()) + { + isActive = rs.getString(1); + isReadWrite = rs.getString(2); + } + else + { + throw new OperationException("The report "+process.getName()+" does not exist for role " + role.getName()); + } + } + catch (SQLException e) + { + + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + if (!"Y".equals(isActive)) + { + throw new OperationException("The access to the report "+process.getName()+" for role "+role.getName()+" is not active"); + } + + if (!"Y".equals(isReadWrite)) + { + throw new OperationException("Role "+role.getName()+ " does not have read/write permissions for report "+ process.getName()); + } + } + + /** + * + * @param writer + * @param title + * @param paramMap + * @param printData + * @param printFormat + * @param pdfURI + * @param csvURI + */ + public static void createHTML(Writer writer, String title, HashMap paramMap, + PrintData printData, MPrintFormat printFormat) + { + Language language = printFormat.getLanguage(); + XhtmlDocument doc = new XhtmlDocument(); + + String style = ""; + + head head = new head(style); + doc.appendHead(head); + + try + { + writer.append(""); + writer.append("
    "+title+"
    "); + + Set parameters = paramMap.keySet(); + + Iterator columnIter = parameters.iterator(); + writer.append("
    Parameters:
    "); + while (columnIter.hasNext()) + { + String columnName = columnIter.next(); + String value = paramMap.get(columnName); + writer.append("
    " + columnName+": " + value + "
    "); + } + writer.append("
     
    "); + writer.append(""); + // for all rows (-1 = header row) + for (int row = -1; row < printData.getRowCount(); row++) + { + writer.append(""); + if (row != -1) + printData.setRowIndex(row); + // for all columns + String rowClass = "odd"; + if (row%2==0) + { + rowClass = "even"; + } + for (int col = 0; col < printFormat.getItemCount(); col++) + { + MPrintFormatItem item = printFormat.getItem(col); + if (item.isPrinted()) + { + // header row + if (row == -1) + { + writer.append(""); + } + else + { + writer.append(""); + } + else if (obj instanceof PrintDataElement) + { + String value = ((PrintDataElement)obj).getValueDisplay(language); // formatted + writer.append(Util.maskHTML(value)+""); + } + else if (obj instanceof PrintData) + { + // ignore contained Data + } + else + { + + } + } + } // printed + } // for all columns + writer.append(""); + } // for all rows + writer.append("
    "+Util.maskHTML(item.getPrintName(language))+""); + Object obj = printData.getNode(new Integer(item.getAD_Column_ID())); + if (obj == null) + { + writer.append(" 
    "); + PrintWriter printWriter = new PrintWriter(writer); + doc.output(printWriter); + printWriter.flush(); + printWriter.close(); + } + catch (Exception e) + { + } + } + + /** + * Load specific reportEngine for this print format and this process info + * @param ctx context + * @param printFormat print format + * @param pi + * @return + * @throws Exception + */ + public static ReportEngine getReportEngine(Properties ctx, MPrintFormat printFormat, ProcessInfo pi) throws Exception + { + MProcess process = MProcess.get(ctx, pi.getAD_Process_ID()); + int tableId = process.getAD_ReportView().getAD_Table_ID(); + String tableName = MTable.getTableName(ctx, tableId); + // Create query from parameters + MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), tableName); + PrintInfo printInfo = new PrintInfo(pi); + ReportEngine reportEngine = new ReportEngine(ctx, printFormat, query, printInfo); + + return reportEngine; + } + + /** + * + * @param ctx + * @param printFormat + * @param pi + * @return + * @throws Exception + */ + public static PrintData getPrintData(Properties ctx, MPrintFormat printFormat, ProcessInfo pi) throws Exception + { + MProcess process = MProcess.get(ctx, pi.getAD_Process_ID()); + int tableId = process.getAD_ReportView().getAD_Table_ID(); + String tableName = MTable.getTableName(ctx, tableId); + // Create query from parameters + MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), tableName); + + DataEngine dataEngine = new DataEngine(printFormat.getLanguage()); + return dataEngine.getPrintData(ctx, printFormat, query); + } + + /** + * + * @param ctx + * @param pinstanceId + * @param trxName + * @return + */ + public static HashMap getReportParameters(Properties ctx, int pinstanceId, String trxName) + { + HashMap map = new HashMap(); + + MPInstance pinstance = new MPInstance(ctx, pinstanceId, trxName); + + MPInstancePara[] params = pinstance.getParameters(); + + for (MPInstancePara para: params) + { + String columnName = para.getParameterName(); + String info = para.getInfo(); + String info_to = para.getInfo_To(); + + String name = getElementName(columnName, trxName); + + StringBuffer value = new StringBuffer(); + + if (info != null) + { + value.append(info); + + if (info_to != null) + { + value.append("-").append(info_to); + } + map.put(name, value.toString()); + } + } + + + return map; + } + + /** + * + * @param columnName + * @param trxName + * @return + */ + private static String getElementName(String columnName, String trxName) + { + String adElementName = null; + String sql = "SELECT name from AD_Element where columnName = '" + columnName +"'"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sql, trxName); + rs = pstmt.executeQuery(); + + if (rs.next()) + { + adElementName = rs.getString(1); + } + } + catch (SQLException e) + { + + } + finally + { + DB.close(rs, pstmt); + pstmt = null; + rs = null; + } + + return adElementName; + } + + /** + * Return an HTML version of close till report + * @param ctx + * @param tillBean + * @param cashBean + * @return + */ + public static String endOfTheDayHTMLReport(Properties ctx, CloseTillBean bean) { + + double beginningBalance = (bean.getBeginningBalance() == null ? 0 + : bean.getBeginningBalance().doubleValue()); + double statementDifference = (bean.getNetCashTrx() == null ? 0 + : bean.getNetCashTrx().doubleValue()); + double transferAmount = (bean.getBalanceEntered() == null ? 0 + : bean.getBalanceEntered().doubleValue()); + double differenceAmount = (bean.getDifference() == null ? 0 + : bean.getDifference().doubleValue()); + double endingBalance = (bean.getEndingBalance() == null ? 0 + : bean.getEndingBalance().doubleValue()); + double tillCashTotal = (bean.getCashTotal() == null ? 0 : bean + .getCashTotal().doubleValue()); + double cashBeanCardTotal = (bean.getCardTotal() == null ? 0 + : bean.getCardTotal().doubleValue()); + double tillCardTotal = (bean.getCardTotal() == null ? 0 : bean + .getCardTotal().doubleValue()); + double cardDifference = (bean.getCardDifference() == null ? 0 + : bean.getCardDifference().doubleValue()); + double cashBeanChequeTotal = (bean.getChequeTotal() == null ? 0 + : bean.getChequeTotal().doubleValue()); + double tillChequeTotal = (bean.getChequeTotal() == null ? 0 + : bean.getChequeTotal().doubleValue()); + double chequeDifference = (bean.getChequeDifference() == null ? 0 + : bean.getChequeDifference().doubleValue()); + double grandTotal = (bean.getGrandTotal() == null ? 0 + : bean.getGrandTotal().doubleValue()); + + + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + // String currency = + // POSTerminalManager.getPOSDefaultCurrency(ctx).getCurSymbol(); + Date today = new Date(System.currentTimeMillis()); + StringBuffer reportData = new StringBuffer(); + + String title = "

    End of the Day Report

    "; + String subtitle = "

    " + sdf.format(today) + "

    "; + + // adding title + reportData.append(title); + + // adding subtitle + reportData.append(subtitle); + + // adding space + reportData.append("
    "); + + // adding report data + int maxwidth = 40; + int column1 = 20; + int column2 = maxwidth - column1; + + String format1 = "%1$-" + column1 + "s%2$" + column2 + "s%n"; // string,string + String format2 = "%1$-" + column1 + "s%2$" + column2 + ".2f%n"; // string,bigdecimal + + String tillNoTxt = String.format(format1, "Till No", bean.getTillName()); + String beginningBalanceTxt = String.format(format2, "Beginning Balance",beginningBalance); + String netCashTrxTxt = String.format(format2, "Net Cash Trx", statementDifference); + String tillBalanceEnteredTxt = String.format(format2, "Till Balance Entered", transferAmount); + String differenceTxt = String.format(format2, "Difference", differenceAmount); + String endingBalanceTxt = String.format(format2, "Ending Balance", endingBalance); + String cashTotalTxt = String.format(format2, "Cash Total", tillCashTotal); + String cardTotalTxt = String.format(format2, "Card Total", tillCardTotal); + String chequeTotalTxt = String.format(format2, "Cheque Total", tillChequeTotal); + String grandTotalTxt = String.format(format2, "Grand Total", grandTotal); + + // some new lines + // String cashEntered = String.format(format1, "Cash Amt Entered", + String cardEnteredTxt = String.format(format2, "Card Amt Entered",cashBeanCardTotal); + String cardDifferenceTxt = String.format(format2, "Card Difference",cardDifference); + String chequeEnteredTxt = String.format(format2, "Cheque Amt Entered",cashBeanChequeTotal); + String chequeDifferenceTxt = String.format(format2, "Cheque Difference",chequeDifference); + + reportData.append(tillNoTxt) + .append(beginningBalanceTxt) + .append(netCashTrxTxt) + .append(tillBalanceEnteredTxt) + .append(differenceTxt) + .append(endingBalanceTxt) + // .append(cashEntered) + .append(cashTotalTxt) + .append(cardEnteredTxt) + .append(cardTotalTxt) + .append(cardDifferenceTxt) + .append(chequeEnteredTxt) + .append(chequeTotalTxt) + .append(chequeDifferenceTxt) + .append(grandTotalTxt) + .append("
    "); + + return reportData.toString(); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/POSSalesReportManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/POSSalesReportManager.java new file mode 100644 index 0000000000..6fcf741c38 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/POSSalesReportManager.java @@ -0,0 +1,1049 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 17-Jul-2006 14:15:12 by praveen + * + */ + +package org.posterita.businesslogic.performanceanalysis; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Properties; +import java.util.TreeMap; + +import org.compiere.model.MBPartner; +import org.compiere.model.MCashLine; +import org.compiere.model.MInvoice; +import org.compiere.model.MOrder; +import org.compiere.model.MPayment; +import org.compiere.model.MPriceList; +import org.compiere.model.MTransaction; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.POSHistoryBean; +import org.posterita.beans.ReportBean; +import org.posterita.beans.SalesDetailsBean; +import org.posterita.beans.UDIPair; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.OrderManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.WarehouseManager; +import org.posterita.core.TimestampConvertor; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; + +public class POSSalesReportManager +{ + public static ArrayList getSalesGroupList(Properties ctx,ReportBean bean) throws OperationException + { + ArrayList groupList = new ArrayList(); + groupList.add(new UDIPair("Revenue Recognition",Constants.REVENUE_RECOGNITION)); + groupList.add(new UDIPair("Product",Constants.PRODUCT)); + groupList.add(new UDIPair("Customer",Constants.CUSTOMER)); + groupList.add(new UDIPair("AttributeSet",Constants.ATTRIBUTESET)); + groupList.add(new UDIPair("Group1",Constants.GROUP1)); + groupList.add(new UDIPair("Group2",Constants.GROUP2)); + + // String fromDate = null; + // String toDate = null; + + if(bean.getDateRange().equalsIgnoreCase(Constants.FIXED_DATE_RANGE)) + { + if(bean.getTimePeriod() == null) + { + throw new OperationException("Invalid parameter: timeperiod is null"); + } + + //Date startDate = + ReportDateManager.getStartDateForPeriod(bean.getTimePeriod()); + //Date endDate = + ReportDateManager.getEndDateForPeriod(bean.getTimePeriod()); + + //SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); + //fromDate = sdf.format(startDate); + //toDate = sdf.format(endDate); + } + else + { + //fromDate = BirtReportManager.getFromDate(bean); + // toDate = BirtReportManager.getToDate(bean); + } + + int ad_client_id = Env.getAD_Client_ID(ctx); + + if(bean.getAccountId()==null) + { + throw new OperationException("Invalid parameter value : accountId->" + bean.getAccountId()); + } + + int account_id = bean.getAccountId().intValue(); + + String sql = "select distinct attrSet.NAME as ATTRIBUTESET_NAME,attr.NAME as ATTRIBUTE_NAME,attrSet.M_ATTRIBUTESET_ID as ATTRIBUTESET_ID,attr.M_ATTRIBUTE_ID as ATTRIBUTE_ID " + + "from M_ATTRIBUTESETINSTANCE attrSetIns,M_PRODUCT prod,M_ATTRIBUTESET attrSet,M_ATTRIBUTEUSE attrUse,M_ATTRIBUTE attr,FACT_ACCT fact " + + "where prod.M_ATTRIBUTESETINSTANCE_ID = attrSetIns.M_ATTRIBUTESETINSTANCE_ID " + + "and attrSet.M_ATTRIBUTESET_ID = attrSetIns.M_ATTRIBUTESET_ID " + + "and attrUse.M_ATTRIBUTESET_ID = attrSet.M_ATTRIBUTESET_ID " + + "and attr.M_ATTRIBUTE_ID = attrUse.M_ATTRIBUTE_ID " + + "and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID " + + "and fact.account_id = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = ? and AD_CLIENT_ID = ? ) " + + "and fact.AD_CLIENT_ID = ? "; + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + try + { + pstmt.setString(1,account_id+""); + pstmt.setInt(2,ad_client_id); + pstmt.setInt(3,ad_client_id); + + ArrayList data = ReportManager.getReportData(pstmt,false); + String attributeSetName = null; + String attributeSetId = null; + String attributeName = null; + String attributeId = null; + + for (Object[] objects : data) + { + attributeSetName = objects[0]+""; + attributeName = objects[1]+""; + + attributeSetId = objects[2]+""; + attributeId = objects[3]+""; + + groupList.add(new UDIPair(attributeSetName+"_"+attributeName,attributeSetId+"_"+attributeId)); + } + } + catch (SQLException e) + { + throw new OperationException(e); + } + + return groupList; + } + + public static ArrayList getPriceQtyFilter(Properties ctx) + { + ArrayList filter = new ArrayList(); + filter.add(new UDIPair("Price",Constants.PRICE)); + filter.add(new UDIPair("Quantity",Constants.QUANTITY)); + + return filter; + } + + //-------------------------------------------------------------------------------------- + public static ArrayList getSalesOrPurchaseReportData(Properties ctx, ReportBean bean, String trxName) throws Exception + { + Timestamp startDate = null; + Timestamp endDate = null; + boolean isFullDetails = false; + + String isSalesRPT = bean.getIsSalesReport(); + Boolean isSalesReport = Boolean.valueOf(isSalesRPT); + String reportType = "SALES"; + String orderType = "POS Order"; + String returnedOrderType = "Customer Returned Order"; + String isSOTrx = "Y"; + + if(!(isSalesReport)) + { + reportType = "PURCHASES"; + orderType = "POS Goods Receive Note"; + returnedOrderType = "POS Goods Returned Note"; + isSOTrx = "N"; + } + + BigDecimal totalPayment = Env.ZERO; + + if (Constants.FULL_DETAILS.equals(bean.getFullDetails())) + { + isFullDetails = true; + + if(!(isSalesReport)) + { + isFullDetails = false; + } + } + + if(bean.getDateRange().equalsIgnoreCase(Constants.FIXED_DATE_RANGE)) + { + if(bean.getTimePeriod() == null) + { + throw new OperationException("Invalid parameter: timeperiod is null"); + } + + startDate = ReportDateManager.getStartDateForPeriod(bean.getTimePeriod()); + endDate = ReportDateManager.getEndDateForPeriod(bean.getTimePeriod()); + + } + else + { + startDate = ReportDateManager.getFromDateAsDate(bean); + endDate = ReportDateManager.getEndDateAsDate(bean); + } + int ad_client_id = Env.getAD_Client_ID(ctx); + + SalesDetailsBean sbean = null; + ArrayList salesList = new ArrayList(); + + //Purchase Price List + int purchasePriceListId = POSTerminalManager.getPOPriceListId(ctx); + Integer ppriceListVersionId = PriceListManager.getPriceListVersionID(ctx, purchasePriceListId, null); + MPriceList ppriceList = new MPriceList(ctx, purchasePriceListId, null); + StringBuffer sqlOrder = new StringBuffer(); + if(isSalesReport) + { + sqlOrder.append(" issotrx = 'Y'"); + } + else + { + sqlOrder.append(" issotrx = 'N'"); + } + + sqlOrder.append(" and c_pos_id=").append(Env.getContextAsInt(ctx, UdiConstants.TERMINAL_ID)); + sqlOrder.append(" and docstatus in ('CO','CL')"); + + if(isSalesReport) + { + sqlOrder.append(" and ordertype in ('POS Order','Credit Order','Customer Returned Order')"); + } + else + { + sqlOrder.append(" and ordertype in ('").append(orderType).append("','").append(returnedOrderType).append("') "); + } + + sqlOrder.append(" and ad_client_id = ").append(ad_client_id); + sqlOrder.append(" and dateacct between ").append(DB.TO_DATE(startDate, false)); + sqlOrder.append(" and ").append(DB.TO_DATE(endDate, false)); + sqlOrder.append(" and ad_org_id =").append(Env.getAD_Org_ID(ctx)); + sqlOrder.append(" order by dateacct"); + + // Get All Orders + int[] orderId = MOrder.getAllIDs(MOrder.Table_Name, sqlOrder.toString(), null); + + if(orderId != null) + { + + for (int c_order_id : orderId) + { + sbean = new SalesDetailsBean(); + BigDecimal productCost = Env.ZERO; + BigDecimal totalProductCosts = Env.ZERO; + BigDecimal taxAmt = Env.ZERO; + BigDecimal totalTaxAmt = Env.ZERO; + BigDecimal salesExempt = Env.ZERO; + BigDecimal totalSalesExempt = Env.ZERO; + BigDecimal salesExcVat = Env.ZERO; + BigDecimal totalSalesExcVat = Env.ZERO; + BigDecimal creditNoteExcVat = Env.ZERO; + BigDecimal totalCreditNoteExcVat = Env.ZERO; + BigDecimal creditNoteExempt = Env.ZERO; + BigDecimal totalCreditNoteExempt = Env.ZERO; + BigDecimal purchasesExempt = Env.ZERO; + BigDecimal totalPurchasesExempt = Env.ZERO; + BigDecimal purchasesExcVat = Env.ZERO; + BigDecimal totalPurchasesExcVat = Env.ZERO; + BigDecimal debitNoteExcVat = Env.ZERO; + BigDecimal totalDebitNoteExcVat = Env.ZERO; + BigDecimal debitNoteExempt = Env.ZERO; + BigDecimal totalDebitNoteExempt = Env.ZERO; + + MOrder order = new MOrder(ctx, c_order_id, null); + sbean.setOrderId(c_order_id); + sbean.setOrderType(order.getOrderType()); + sbean.setLinesTotals(order.getTotalLines()); + sbean.setBPartnerId(order.getC_BPartner_ID()); + sbean.setDate(order.getDateAcct()); + + ArrayList list = POSManager.populateOrderLines(ctx, order); + + for (WebOrderLineBean webOrderLineBean : list) + { + sbean.setGrandTotals(webOrderLineBean.getGrandTotal()); + sbean.setLinesTotals(webOrderLineBean.getTotalAmt()); + + taxAmt = webOrderLineBean.getTaxAmt(); + + if(taxAmt.equals(Env.ZERO)) + { + + if(order.getOrderType().equals(UDIOrderTypes.POS_ORDER.getOrderType())) + { + salesExempt = webOrderLineBean.getLineTotalAmt().subtract(taxAmt); + salesExcVat = Env.ZERO; + } + + if(order.getOrderType().equals(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())) + { + salesExempt = webOrderLineBean.getLineTotalAmt().subtract(taxAmt).negate(); + taxAmt = taxAmt.negate(); + salesExcVat = Env.ZERO; + } + + if(order.getOrderType().equals(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + creditNoteExempt = webOrderLineBean.getLineTotalAmt().subtract(taxAmt); + creditNoteExcVat = Env.ZERO; + } + + if(order.getOrderType().equals(UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType())) + { + purchasesExempt = webOrderLineBean.getLineTotalAmt().subtract(taxAmt); + purchasesExcVat = Env.ZERO; + } + + if(order.getOrderType().equals(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType())) + { + debitNoteExempt = webOrderLineBean.getLineTotalAmt().subtract(taxAmt); + debitNoteExcVat = Env.ZERO; + } + + } + else + { + if(order.getOrderType().equals(UDIOrderTypes.POS_ORDER.getOrderType())) + { + salesExempt = Env.ZERO; + salesExcVat = webOrderLineBean.getLineTotalAmt().subtract(taxAmt); + } + + if(order.getOrderType().equals(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())) + { + salesExempt = Env.ZERO; + salesExcVat = webOrderLineBean.getLineTotalAmt().subtract(taxAmt).negate(); + taxAmt = taxAmt.negate(); + } + + if(order.getOrderType().equals(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + creditNoteExempt = Env.ZERO; + creditNoteExcVat = webOrderLineBean.getLineTotalAmt().subtract(taxAmt); + } + + if(order.getOrderType().equals(UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType())) + { + purchasesExcVat = webOrderLineBean.getLineTotalAmt().subtract(taxAmt); + purchasesExempt = Env.ZERO; + } + + if(order.getOrderType().equals(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType())) + { + debitNoteExcVat = webOrderLineBean.getLineTotalAmt().subtract(taxAmt); + debitNoteExempt = Env.ZERO; + } + } + + if(order.getOrderType().equals(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())) + { + productCost = webOrderLineBean.getPurchasePriceList().negate().multiply(webOrderLineBean.getQtyOrdered()); + } + else + { + productCost = webOrderLineBean.getPurchasePriceList().multiply(webOrderLineBean.getQtyOrdered()); + } + + totalTaxAmt = totalTaxAmt.add(taxAmt); + totalProductCosts = totalProductCosts.add(productCost); + totalSalesExempt = totalSalesExempt.add(salesExempt); + totalSalesExcVat = totalSalesExcVat.add(salesExcVat); + totalCreditNoteExcVat = totalCreditNoteExcVat.add(creditNoteExcVat); + totalCreditNoteExempt = totalCreditNoteExempt.add(creditNoteExempt); + totalPurchasesExcVat = totalPurchasesExcVat.add(purchasesExcVat); + totalPurchasesExempt = totalPurchasesExempt.add(purchasesExempt); + } + + sbean.setTotalTaxAmount(totalTaxAmt); + sbean.setTotalCosts(totalProductCosts); + sbean.setSalesExempt(totalSalesExempt); + sbean.setSalesExcVat(totalSalesExcVat); + sbean.setCreditNoteExcVat(totalCreditNoteExcVat); + sbean.setCreditNoteExempt(totalCreditNoteExempt); + sbean.setPurchasesExcVat(totalPurchasesExcVat); + sbean.setPurchasesExempt(totalPurchasesExempt); + sbean.setDebitNoteExcVat(totalDebitNoteExcVat); + sbean.setDebitNoteExempt(totalDebitNoteExempt); + + sbean.setCashAmount(Env.ZERO); + sbean.setCardAmount(Env.ZERO); + sbean.setChequeAmount(Env.ZERO); + + if (order.getPaymentRule().equals(MOrder.PAYMENTRULE_Cash) || order.getPaymentRule().equals(MOrder.PAYMENTRULE_Mixed)) + { + MInvoice invoice = MInvoice.get(ctx, order.getC_Invoice_ID()); + MCashLine cashLine = new MCashLine(ctx, invoice.getC_CashLine_ID(), null); + if (cashLine.getC_CashLine_ID() != 0) + { + sbean.setCashAmount(cashLine.getAmount()); + } + } + + if(order.getPaymentRule().equals(MOrder.PAYMENTRULE_Check) || order.getPaymentRule().equals(MOrder.PAYMENTRULE_CreditCard) || order.getPaymentRule().equals(MOrder.PAYMENTRULE_Mixed)) + { + int[] payIds = MPayment.getAllIDs(MPayment.Table_Name, "C_Invoice_ID = " + order.getC_Invoice_ID(), null); + for (int payId : payIds) + { + MPayment payment = new MPayment(ctx, payId, null); + + if (payment.get_ID() != 0) + { + if(payment.getTenderType().equals(MPayment.TENDERTYPE_CreditCard)) + { + sbean.setCardAmount(payment.getPayAmt()); + } + + if(payment.getTenderType().equals(MPayment.TENDERTYPE_Check)) + { + sbean.setChequeAmount(payment.getPayAmt()); + } + } + } + } + + totalPayment = sbean.getCardAmount().add(sbean.getCashAmount()).add(sbean.getChequeAmount()); + sbean.setTotal(totalPayment); + + salesList.add(sbean); + + } + + TreeMap map = new TreeMap(); + for(SalesDetailsBean salesBean : salesList) + { + Timestamp date = salesBean.getDate(); + SalesDetailsBean myDetailsBean = map.get(date); + if(myDetailsBean == null) + { + myDetailsBean = salesBean; + } + else + { + //merge myDetailsBean and salesBean + BigDecimal salesExcVat = myDetailsBean.getSalesExcVat().add(salesBean.getSalesExcVat()); + BigDecimal salesExempt = myDetailsBean.getSalesExempt().add(salesBean.getSalesExempt()); + BigDecimal totalCosts = myDetailsBean.getTotalCosts().add(salesBean.getTotalCosts()); + BigDecimal total = myDetailsBean.getTotal().add(salesBean.getTotal()); + BigDecimal totalTaxAmount = myDetailsBean.getTotalTaxAmount().add(salesBean.getTotalTaxAmount()); + BigDecimal creditNoteExcVat = myDetailsBean.getCreditNoteExcVat().add(salesBean.getCreditNoteExcVat()); + BigDecimal creditNoteExempt = myDetailsBean.getCreditNoteExempt().add(salesBean.getCreditNoteExempt()); + BigDecimal purchasesExcVat = myDetailsBean.getPurchasesExcVat().add(salesBean.getPurchasesExcVat()); + BigDecimal purchasesExempt = myDetailsBean.getPurchasesExempt().add(salesBean.getPurchasesExempt()); + BigDecimal debitNoteExcVat = myDetailsBean.getDebitNoteExcVat().add(salesBean.getDebitNoteExempt()); + BigDecimal debitNoteExempt = myDetailsBean.getDebitNoteExempt().add(salesBean.getDebitNoteExempt()); + + myDetailsBean.setDate(date); + myDetailsBean.setSalesExcVat(salesExcVat); + myDetailsBean.setSalesExempt(salesExempt); + myDetailsBean.setTotalCosts(totalCosts); + myDetailsBean.setTotal(total); + myDetailsBean.setTotalTaxAmount(totalTaxAmount); + myDetailsBean.setCreditNoteExcVat(creditNoteExcVat); + myDetailsBean.setCreditNoteExempt(creditNoteExempt); + myDetailsBean.setPurchasesExcVat(purchasesExcVat); + myDetailsBean.setPurchasesExempt(purchasesExempt); + myDetailsBean.setDebitNoteExcVat(debitNoteExcVat); + myDetailsBean.setDebitNoteExempt(debitNoteExempt); + } + + map.put(date, myDetailsBean); + + } + + salesList = new ArrayList(); + salesList.addAll(map.values()); + } + + + + ArrayList reportData = new ArrayList(); + + String note = ""; + if(isSalesReport) + { + note = "CREDIT NOTE "; + } + else + { + note = "DEBIT NOTE "; + } + + Object[] headers = { + "DATE", + reportType + " EXCL VAT", + note + "EXCL VAT", + "EXEMPT " + reportType, + "EXEMPT " + note, + "VAT", + "NET TOTAL " + reportType + }; + Object[] totals = { + "TOTAL", + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO + }; + + if (isFullDetails) + { + headers = new Object[]{ + "DATE", + reportType + " EXCL VAT", + note + "EXCL VAT", + "EXEMPT " + reportType, + "EXEMPT " + note, + "VAT", + "NET TOTAL " + reportType, + "COST", + "PROFIT", + "GP %" + }; + totals = new Object[]{ + "TOTAL", + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO, + Env.ZERO + }; + + } + + // add header + reportData.add(headers); + + + BigDecimal grossProfit = Env.ZERO; + + for (SalesDetailsBean sdBean : salesList) + { + String date = sdBean.getDate().toString(); + BigDecimal salesOrPurchasesEV = Env.ZERO; + + if(isSalesReport) + { + salesOrPurchasesEV = sdBean.getSalesExcVat(); + } + else + { + salesOrPurchasesEV = sdBean.getPurchasesExcVat(); + } + BigDecimal creditOrDebitNEV = Env.ZERO; + + if(isSalesReport) + { + creditOrDebitNEV = sdBean.getCreditNoteExcVat(); + } + else + { + creditOrDebitNEV = sdBean.getDebitNoteExcVat(); + } + + BigDecimal exemptSalesOrPurchases = Env.ZERO; + + if(isSalesReport) + { + exemptSalesOrPurchases = sdBean.getSalesExempt(); + } + else + { + exemptSalesOrPurchases = sdBean.getPurchasesExempt(); + } + + BigDecimal exemptCNOrDN = Env.ZERO; + if(isSalesReport) + { + exemptCNOrDN = sdBean.getCreditNoteExempt(); + } + else + { + exemptCNOrDN = sdBean.getDebitNoteExempt(); + } + + BigDecimal vat = sdBean.getTotalTaxAmount(); + BigDecimal total = salesOrPurchasesEV.add(vat).add(exemptSalesOrPurchases).add(creditOrDebitNEV).add(exemptCNOrDN); + BigDecimal cost = sdBean.getTotalCosts(); + BigDecimal payAmt = sdBean.getTotal(); + cost = cost.setScale(total.scale(), RoundingMode.HALF_DOWN); + BigDecimal profit = total.subtract(cost); + + if (total.doubleValue() != 0.0f) + { + double prof = profit.doubleValue(); + double tots = total.doubleValue(); + grossProfit = new BigDecimal(prof/tots*100.0); + grossProfit = grossProfit.setScale(2, RoundingMode.HALF_UP); + } + Object[] data = null; + + if (isFullDetails) + { + data = new Object[]{ + date, + salesOrPurchasesEV, + creditOrDebitNEV, + exemptSalesOrPurchases, + exemptCNOrDN, + vat, + total, + cost, + profit, + grossProfit + }; + } + else + { + data = new Object[]{ + date, + salesOrPurchasesEV, + creditOrDebitNEV, + exemptSalesOrPurchases, + exemptCNOrDN, + vat, + total + }; + } + + reportData.add(data); + + //update totals + totals[1] = ((BigDecimal)totals[1]).add(salesOrPurchasesEV); + totals[2] = ((BigDecimal)totals[2]).add(creditOrDebitNEV); + totals[3] = ((BigDecimal)totals[3]).add(exemptSalesOrPurchases); + totals[4] = ((BigDecimal)totals[4]).add(exemptCNOrDN); + totals[5] = ((BigDecimal)totals[5]).add(vat); + totals[6] = ((BigDecimal)totals[6]).add(total); + + if (isFullDetails) + { + totals[7] = ((BigDecimal)totals[7]).add(cost); + totals[8] = ((BigDecimal)totals[8]).add(profit); + totals[9] = ((BigDecimal)totals[9]).add(grossProfit); + } + } + if (isFullDetails) + { + BigDecimal salesTotal = ((BigDecimal)totals[1]).add((BigDecimal)totals[2]).add((BigDecimal)totals[3]).add((BigDecimal)totals[4]).add((BigDecimal)totals[5]); + + if (salesTotal.doubleValue() != 0f) + { + double prof = ((BigDecimal)totals[8]).doubleValue(); + double tots = ((BigDecimal)salesTotal).doubleValue(); + grossProfit = new BigDecimal(prof/tots*100.0); + totals[9] = grossProfit.setScale(2, RoundingMode.HALF_UP); + } + } + + + reportData.add(totals); + + return reportData; + + } + + public static ArrayList getDetailedSalesReport(Properties ctx, String salesType, boolean isSalesReport, Timestamp date1, Timestamp date2, String trxName) throws OperationException + { + + + String sql = "select ord.C_ORDER_ID," + // 1 + " ord.dateordered," + // 2 + " ord.grandtotal," + // 3 + " ord.DOCUMENTNO," + // 4 + " (name || ' ' || COALESCE(name2,trim(' '))) as name, " + // 5 + " ord.docStatus, " + // 6 + " ord.paymentrule," + // 7 + " bp.C_BPARTNER_ID," + // 8 + " bp.isCustomer," + // 9 + " ord.ORDERTYPE " + // 10 + " from c_order ord,C_BPARTNER bp" + + " where ord.C_BPARTNER_ID=bp.C_BPARTNER_ID" + + " and ord.docStatus in ('CL', 'CO')" + + " and ord.AD_ORG_ID=" + Env.getAD_Org_ID(ctx) + + " and ord.AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + + " and ord.isActive='Y'"; + + if("1".equals(salesType)) + { + if(isSalesReport) + { + sql = sql + " and ord.totallines <> ord.grandtotal and ord.ordertype in ('POS Order','Credit Order')"; + } + else + { + sql = sql + " and ord.totallines <> ord.grandtotal and ord.ordertype in ('POS Goods Receive Note')"; + } + } + + if("2".equals(salesType)) + { + if(isSalesReport) + { + sql = sql + " and ord.totallines <> ord.grandtotal and ord.ordertype in ('Customer Returned Order')"; + } + else + { + sql = sql + " and ord.totallines <> ord.grandtotal and ord.ordertype in ('POS Goods Returned Note')"; + } + } + + if("3".equals(salesType)) + { + if(isSalesReport) + { + sql = sql + " and ord.totallines <> ord.grandtotal and ord.ordertype in ('POS Order','Credit Order')"; + } + else + { + sql = sql + " and ord.totallines <> ord.grandtotal and ord.ordertype in ('POS Goods Receive Note')"; + } + } + + if("4".equals(salesType)) + { + if(isSalesReport) + { + sql = sql + " and ord.totallines <> ord.grandtotal and ord.ordertype in ('Customer Returned Order')"; + } + else + { + sql = sql + " and ord.totallines <> ord.grandtotal and ord.ordertype in ('POS Goods Returned Note')"; + } + } + + sql = sql + " and ord.dateordered between "+ DB.TO_DATE(date1, false)+ " and "+ DB.TO_DATE(date2, false); + + sql = sql + " order by ord.created desc"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + POSHistoryBean bean = null; + ArrayList list = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sql, trxName); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + int c_order_id = rs.getInt(1); + bean = new POSHistoryBean(); + bean.setOrderId(c_order_id); + bean.setDateAcct(rs.getTimestamp(2)); + bean.setOrderGrandTotal(rs.getBigDecimal(3)); + bean.setDocumentNo(rs.getString(4)); + bean.setPartnerName(rs.getString(5)); + bean.setDocStatus(rs.getString(6)); + bean.setPaymentRule(rs.getString(7)); + bean.setBpartnerId(rs.getInt(8)); + bean.setIsCustomer("Y".equals(rs.getString(9)) ? true : false); + bean.setOrderType(rs.getString(10)); + + MOrder order = new MOrder(ctx, c_order_id, trxName); + MInvoice invoice = MInvoice.get(ctx, order.getC_Invoice_ID()); + BigDecimal amountPaid = Env.ZERO; + if (invoice.getC_CashLine_ID() != 0) + { + MCashLine cashLine = new MCashLine(ctx, invoice.getC_CashLine_ID(), trxName); + amountPaid = cashLine.getAmount(); + } + int[] payIds = MPayment.getAllIDs(MPayment.Table_Name, "C_Invoice_ID = " + invoice.get_ID() + + " AND AD_Client_ID = " + Env.getAD_Client_ID(ctx), trxName); + if (payIds != null && payIds.length != 0) + { + for (int payId : payIds) + { + MPayment payment = new MPayment(ctx, payId, trxName); + amountPaid = amountPaid.add(payment.getPayAmt()); + } + } + amountPaid = amountPaid.setScale(2, RoundingMode.HALF_DOWN); + bean.setAmountPaid(amountPaid); + BigDecimal grossProfit = Env.ZERO.setScale(2, RoundingMode.HALF_DOWN); + + if ("1".equals(salesType) || "3".equals(salesType)) + { + grossProfit = getGrossProfit(ctx, c_order_id, date1, date2, trxName); + } + + if (grossProfit == null) + { + grossProfit = Env.ZERO; + } + + bean.setGrossProfit(grossProfit); + list.add(bean); + + } + + } catch (SQLException e) { + throw new OperationException( + "Could not retrieve order history with sql: " + sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + return list; + + } + + private static BigDecimal getGrossProfit(Properties ctx, int c_order_id, Timestamp date1, Timestamp date2, String trxName) throws OperationException + { + + int poPriceListId = POSTerminalManager.getPOPriceListId(ctx); + int poPriceListVersionId = PriceListManager.getPriceListVersionID(ctx, poPriceListId, trxName); + + String sql = "select (l.qtyordered*(case when pp.pricelist is null then 0 else pp.pricelist end)) as cost, o.totallines as sales from" + + " c_order o inner join (c_orderline l left outer join m_productprice pp on" + + " (l.m_product_id = pp.m_product_id and pp.m_pricelist_version_id = " + poPriceListVersionId + ")) on" + + " o.c_order_id = l.c_order_id" + + " where o.issotrx = 'Y' " + + " and o.c_order_id = " + c_order_id + + " and o.docstatus in ('CO','CL')" + + " and o.C_Doctype_ID IN ('"+ OrderManager.getDocTypeFromOrderType(ctx, UDIOrderTypes.POS_ORDER.getOrderType(), true)+"')" + + " and o.ad_client_id = " + Env.getAD_Client_ID(ctx) + + " and o.ad_org_id = "+ Env.getAD_Org_ID(ctx) + + " and o.dateacct between " + DB.TO_DATE(date1, true)+ + " and "+ DB.TO_DATE(date2, true); + + PreparedStatement pstmt = null; + ResultSet rs = null; + BigDecimal grossProfit = Env.ZERO; + BigDecimal cost = Env.ZERO; + BigDecimal sales = Env.ZERO; + + try + { + pstmt = DB.prepareStatement(sql, trxName); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + cost = cost.add(rs.getBigDecimal("cost")); + sales = rs.getBigDecimal("sales"); + } + + + + if (!sales.equals(Env.ZERO)) + { + BigDecimal profit = sales.subtract(cost); + + grossProfit = new BigDecimal(profit.doubleValue() / sales.doubleValue() * 100.0f); + } + else + { + grossProfit = BigDecimal.valueOf(0.0f); + } + } + catch (SQLException e) + { + throw new OperationException("Could not retrieve order history", e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + return grossProfit; + } + + + + public static HashMap getSalesByOrg(Properties ctx, Integer productId, Integer orgId, Timestamp fromDate, Timestamp toDate, String trxName) throws OperationException + { + + if (productId == null) + { + throw new OperationException("product Id is null, cannot search for sales by org for that product"); + } + + if (orgId == null) + { + throw new OperationException("org Id is null, cannot search for sales by org for that org"); + } + if (fromDate == null || toDate == null) + { + throw new OperationException("date cannot be null"); + } + + String locatorIds = WarehouseManager.getLocatorIds(ctx, orgId); + + StringBuffer sql = new StringBuffer("SELECT SUM(trx.movementQty), loc.AD_Org_ID") + .append(" FROM M_Transaction trx INNER JOIN M_Locator loc ON trx.M_Locator_ID = loc.M_Locator_ID") + .append(" WHERE trx.M_Product_ID = ? AND trx.M_Locator_ID IN (" + locatorIds + ")") + .append(" AND trx.movementDate BETWEEN " + DB.TO_DATE(fromDate, true) +" AND " + DB.TO_DATE(toDate, true)) + .append(" AND trx.movementType = ?") + .append(" GROUP BY loc.AD_Org_ID"); + + + PreparedStatement pstmt = null; + ResultSet rs = null; + HashMap orgSales = new HashMap(); + + try + { + pstmt = DB.prepareStatement(sql.toString(), trxName); + pstmt.setInt(1, productId); + pstmt.setString(2, MTransaction.MOVEMENTTYPE_CustomerShipment); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + BigDecimal qty = rs.getBigDecimal(1); + Integer org_Id = rs.getInt(2); + + orgSales.put(org_Id, qty); + + } + } + catch (SQLException e) + { + throw new OperationException("could not retrieve sales by org from sql" + sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + return orgSales; + + } + + public static ArrayList getOrderDetailsPerProduct(Properties ctx,boolean isSales, + String productId, String orgIds, Timestamp date1, Timestamp date2) throws OperationException + { + StringBuffer payAmtSql = new StringBuffer(); + payAmtSql.append(" (SELECT SUM(p.Amount) FROM"); + payAmtSql.append(" ((SELECT payAmt as Amount FROM C_Payment p") + .append(" WHERE p.C_Invoice_ID=inv.C_Invoice_ID AND p.DocStatus IN ('CO', 'CL'))"); + payAmtSql.append(" UNION"); + payAmtSql.append(" (SELECT Amount FROM C_CashLine cl") + .append(" WHERE (cl.c_Invoice_ID=inv.C_Invoice_ID))) as p)"); + + StringBuffer sql = new StringBuffer("select ord.C_ORDER_ID,") + .append("inv.documentNo, ") + .append("(CASE WHEN inv.C_Invoice_ID IS NULL THEN 0 ELSE ") + .append(payAmtSql.toString()).append(" END) PayAmt") + .append(" from (c_order ord inner join c_orderline ordl ") + .append(" on ord.c_order_id = ordl.c_order_id) inner join c_invoice inv on") + .append(" ord.c_order_id = inv.c_order_id") + .append(" where ord.docStatus in ('CL', 'CO')"); + if (isSales) + { + sql = sql.append(" and ord.orderType = '"+UDIOrderTypes.POS_ORDER.getOrderType()+"'"); + } + else + { + sql = sql.append(" and ord.orderType = '"+ UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType()+"'"); + } + + sql = sql.append(" and ord.AD_ORG_ID in (" + orgIds + ") and ord.AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx)) + .append( " and ord.isActive='Y' and ordl.m_product_id = " + productId) + .append(" and ord.dateordered between "+DB.TO_DATE(date1, true)+" and " + DB.TO_DATE(date2, true)) + .append(" order by ord.created desc"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + POSHistoryBean bean = null; + ArrayList list = new ArrayList(); + + try + { + pstmt = DB.prepareStatement(sql.toString(), null); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + /*ReportBean bean = new ReportBean();*/ + bean = new POSHistoryBean(); + int orderId = rs.getInt(1); + String invoiceDocumentNo = rs.getString(2); + BigDecimal amountPaid = rs.getBigDecimal(3); + + MOrder order = new MOrder(ctx, orderId, null); + MBPartner partner = MBPartner.get(ctx, order.getC_BPartner_ID()); + bean.setOrderId(orderId); + bean.setDateAcct(order.getDateAcct()); + bean.setDateOrdered(order.getDateOrdered()); + bean.setOrderGrandTotal(order.getGrandTotal()); + bean.setDocumentNo(order.getDocumentNo()); + bean.setDocStatus(order.getDocStatus()); + bean.setPaymentRule(order.getPaymentRule()); + bean.setOrderType(order.getOrderType()); + bean.setOrgId(order.getAD_Org_ID()); + bean.setInvoiceDocumentNo(invoiceDocumentNo); + bean.setPartnerName(partner.getName()); + bean.setBpartnerId(partner.getC_BPartner_ID()); + bean.setIsCustomer(partner.isCustomer()); + bean.setAmountPaid(amountPaid); + BigDecimal grossProfit = Env.ZERO.setScale(2, RoundingMode.HALF_UP); + + grossProfit = getGrossProfit(ctx, orderId, date1, date2, null); + + if (grossProfit == null) + { + grossProfit = Env.ZERO; + } + + bean.setGrossProfit(grossProfit); + list.add(bean); + + } + + } catch (SQLException e) { + throw new OperationException( + "Could not retrieve sales details per product", e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + return list; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/ReportDateManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/ReportDateManager.java new file mode 100644 index 0000000000..576876e1c7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/ReportDateManager.java @@ -0,0 +1,260 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 19-Jul-2005 by alok + * + */ +package org.posterita.businesslogic.performanceanalysis; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.StringTokenizer; + +import org.jfree.date.SerialDate; + +import org.posterita.beans.ReportBean; +import org.posterita.core.TimestampConvertor; +import org.posterita.exceptions.InvalidDateTimeException; +import org.posterita.exceptions.InvalidMonthException; +import org.posterita.exceptions.OperationException; + +/** + * @author Praveen + * + * To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class ReportDateManager +{ + + public static String getEquivalentMonth(String month) throws InvalidMonthException + { + int intMonth = Integer.parseInt(month); + + switch(intMonth) + { + case 1: + return "Jan"; + case 2: + return "Feb"; + case 3: + return "Mar"; + case 4: + return "Apr"; + case 5: + return "May"; + case 6: + return "Jun"; + case 7: + return "Jul"; + case 8: + return "Aug"; + case 9: + return "Sep"; + case 10: + return "Oct"; + case 11: + return "Nov"; + case 12: + return "Dec"; + + default: + throw new InvalidMonthException("Invalid Month"); + + } + + } + + + public static ReportBean formatDate(ReportBean bean) throws InvalidMonthException + { + String fromDate = bean.getFromDate(); + String toDate = bean.getToDate(); + String delimiter = "/"; + + String newFromDate = format(fromDate, delimiter); + String newToDate = format(toDate, delimiter); + bean.setFromDate(newFromDate); + bean.setToDate(newToDate); + + return bean; + + } + + + public static String format(String date, String delimiter) throws InvalidMonthException + { + String newDateFormatDelimiter = "-"; + StringTokenizer dateTokenizer = new StringTokenizer(date, delimiter); + + String day = dateTokenizer.nextToken(); + String month = dateTokenizer.nextToken(); + String year = dateTokenizer.nextToken(); + + String equiMonth = getEquivalentMonth(month); + + ///dd/mm/yyyy + String newDateFormat = day + + newDateFormatDelimiter + + equiMonth + + newDateFormatDelimiter + + year; + + return newDateFormat; + } + + public static Timestamp getStartDateForPeriod(String period) throws OperationException + { + Calendar cal = Calendar.getInstance(); + SerialDate serialDate = null; + + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + if(period.equalsIgnoreCase(TODAY)) + { + //return default + } + else if(period.equalsIgnoreCase(CURRENT_WEEK)) + { + int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); + int d = 1-dayOfWeek; + + serialDate = SerialDate.createInstance(cal.getTime()); + SerialDate s = SerialDate.addDays(d,serialDate); + cal.setTime(s.toDate()); + + } + else if(period.equalsIgnoreCase(LAST_2WEEKS)) + { + int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); + int d = 1-dayOfWeek-7; + + serialDate = SerialDate.createInstance(cal.getTime()); + SerialDate s = SerialDate.addDays(d,serialDate); + cal.setTime(s.toDate()); + } + else if(period.equalsIgnoreCase(LAST_3WEEKS)) + { + int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); + int d = 1-dayOfWeek-14; + + serialDate = SerialDate.createInstance(cal.getTime()); + SerialDate s = SerialDate.addDays(d,serialDate); + cal.setTime(s.toDate()); + } + else if(period.equalsIgnoreCase(CURRENT_MONTH)) + { + cal.set(Calendar.DATE,1); + } + else if(period.equalsIgnoreCase(LAST_3MONTHS)) + { + cal.set(Calendar.DATE,1); + serialDate = SerialDate.createInstance(cal.getTime()); + SerialDate s = SerialDate.addMonths(-2,serialDate); + cal.setTime(s.toDate()); + } + else if(period.equalsIgnoreCase(LAST_2MONTHS)) + { + cal.set(Calendar.DATE,1); + serialDate = SerialDate.createInstance(cal.getTime()); + SerialDate s = SerialDate.addMonths(-1,serialDate); + cal.setTime(s.toDate()); + } + else if(period.equalsIgnoreCase(LAST_6MONTHS)) + { + cal.set(Calendar.DATE,1); + serialDate = SerialDate.createInstance(cal.getTime()); + SerialDate s = SerialDate.addMonths(-5,serialDate); + cal.setTime(s.toDate()); + } + else if(period.equalsIgnoreCase(CURRENT_YEAR)) + { + cal.set(Calendar.DATE,1); + cal.set(Calendar.MONTH,0); + + } + else + { + throw new OperationException("Invalid Period Format - " + period); + } + + return new Timestamp(cal.getTimeInMillis()); + } + + public static Timestamp getEndDateForPeriod(String period) + { + Calendar cal = Calendar.getInstance(); + return new Timestamp(cal.getTimeInMillis()); + } + + public static final String TODAY = "Today"; + + public static final String CURRENT_WEEK = "Current Week"; + public static final String LAST_2WEEKS = "Last 2 Weeks"; + public static final String LAST_3WEEKS = "Last 3 Weeks"; + + public static final String CURRENT_MONTH = "Current Month"; + public static final String LAST_2MONTHS = "Last 2 months"; + public static final String LAST_3MONTHS = "Last 3 Months"; + public static final String LAST_6MONTHS = "Last 6 Months"; + + public static final String CURRENT_YEAR = "Current Year"; + + + public static Timestamp getFromDate(ReportBean reportBean) throws InvalidMonthException, InvalidDateTimeException + { + //String delimiter = "/"; + //String dateFrom = ReportDateManager.format(reportBean.getFromDate(),delimiter); + + String dateFrom = reportBean.getFromDate(); + String timeFrom = dateFrom + " " + reportBean.getStartHour() + ":" + reportBean.getStartMinute() + ":00"; + return TimestampConvertor.getTimestamp(timeFrom, TimestampConvertor.DEFAULT_DATE_PATTERN1); + } + + public static Timestamp getToDate(ReportBean reportBean) throws InvalidMonthException, InvalidDateTimeException + { + //String delimiter = "/"; + //String dateTo = ReportDateManager.format(reportBean.getToDate(),delimiter); + + String dateTo = reportBean.getToDate(); + String timeTo = dateTo + " " + reportBean.getEndHour() + ":" + reportBean.getEndMinute() + ":00"; + return TimestampConvertor.getTimestamp(timeTo, TimestampConvertor.DEFAULT_DATE_PATTERN1); + } + + public static Timestamp getFromDateAsDate(ReportBean bean) throws InvalidMonthException, ParseException, InvalidDateTimeException + { + Timestamp date = getFromDate(bean); + + return date; + } + + public static Timestamp getEndDateAsDate(ReportBean bean) throws InvalidMonthException, ParseException, InvalidDateTimeException + { + Timestamp date = getToDate(bean); + + return date; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/ReportManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/ReportManager.java new file mode 100644 index 0000000000..7e7719f698 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/ReportManager.java @@ -0,0 +1,263 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Feb 10, 2006 by praveen + * + */ +package org.posterita.businesslogic.performanceanalysis; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.compiere.util.DB; +import org.compiere.util.MimeType; +import org.posterita.exceptions.OperationException; + +public class ReportManager +{ + + public static ArrayList getReportData(Properties ctx, PreparedStatement pstmt) throws OperationException + { + ResultSet rs = null; + + try + { + ArrayList reportData = new ArrayList(); + + rs = pstmt.executeQuery(); + + int columnCount = rs.getMetaData().getColumnCount(); + + Object[] data = null; + + + Object[] header = new Object[columnCount]; + Object[] columnType = new Object[columnCount]; + + for(int i = 0; i < columnCount; i++) + { + header[i] = rs.getMetaData().getColumnName(i+1); + columnType[i] = rs.getMetaData().getColumnTypeName(i+1); + } + + reportData.add(header); + + while(rs.next()) + { + data = new Object[columnCount]; + + for(int i = 0; i < columnCount; i++) + { + data[i] = rs.getObject(i+1); + } + + reportData.add(data); + } + + rs.close(); + + return reportData; + } + catch (Exception e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception e) + {} + + pstmt = null; + } + + } + + public static ArrayList getReportData(Properties ctx, PreparedStatement pstmt, boolean columnHeader) throws OperationException + { + ResultSet rs = null; + + try + { + ArrayList reportData = new ArrayList(); + + rs = pstmt.executeQuery(); + + int columnCount = rs.getMetaData().getColumnCount(); + + Object[] data = null; + + + if(columnHeader) + { + Object[] header = new Object[columnCount]; + Object[] columnType = new Object[columnCount]; + + for(int i = 0; i < columnCount; i++) + { + header[i] = rs.getMetaData().getColumnName(i+1); + columnType[i] = rs.getMetaData().getColumnTypeName(i+1); + } + + reportData.add(header); + } + + + while(rs.next()) + { + data = new Object[columnCount]; + + for(int i = 0; i < columnCount; i++) + { + data[i] = rs.getObject(i+1); + } + + reportData.add(data); + } + + rs.close(); + + + return reportData; + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + } + + public static ArrayList getReportData(PreparedStatement pstmt) throws OperationException + { + return getReportData(null,pstmt); + } + + public static ArrayList getReportData(PreparedStatement pstmt,boolean columnHeader) throws OperationException + { + return getReportData(null,pstmt,columnHeader); + } + + public static ArrayList getReportData(Properties ctx,String sql,boolean columnHeader) throws OperationException + { + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + return getReportData(ctx,pstmt,columnHeader); + } + + public static ArrayList getReportData(Properties ctx,String sql) throws OperationException + { + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + return getReportData(ctx,pstmt); + } + + public static String getReportDirectoryFromServletContext(HttpServlet servlet) + { + ServletContext context = servlet.getServletContext(); + String reportDirectory = context.getRealPath(context.getInitParameter("REPORT_DIRECTORY")) + System.getProperty("file.separator"); + + return reportDirectory; + } + + public static String getReportDirectory() + { + //String + return System.getProperty("java.io.tmpdir"); + } + + public static String getReportURI(String reportName,HttpServletRequest request) + { + //return request.getContextPath() + "/GetReportAction.do?reportName=" + reportName; + return request.getContextPath() + "/servlet/DisplayReportServlet/" + reportName; + } + + public static String getReportPath(String reportName) + { + String path = getReportDirectory() + System.getProperty("file.separator") + reportName; + + return path; + } + + public static void writeReport(String reportName, HttpServletResponse response) throws OperationException + { + String reportPath= getReportPath(reportName); + + File f = new File(reportPath); + + if(!f.exists()) + { + throw new OperationException("Unable to load " + reportName + ". Cause file not found."); + } + + String mimeType = null; + mimeType = MimeType.getMimeType(reportName); + + try + { + response.setContentType(mimeType); + + FileInputStream fis = new FileInputStream(f); + BufferedInputStream bis = new BufferedInputStream(fis); + BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); + + //Transfer bytes from bis to bos + byte[] buf = new byte[1024]; + int len; + while ((len = bis.read(buf)) > 0) + { + bos.write(buf, 0, len); + } + bis.close(); + + bos.flush(); + bos.close(); + + } + catch (Exception e) + { + throw new OperationException(e); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/SalesAnalysisReportManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/SalesAnalysisReportManager.java new file mode 100644 index 0000000000..4800b08dcc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/performanceanalysis/SalesAnalysisReportManager.java @@ -0,0 +1,791 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 05-Jul-2006 13:45:44 by praveen + * + */ + +package org.posterita.businesslogic.performanceanalysis; + +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MAttribute; +import org.compiere.model.MElementValue; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.exceptions.OperationException; + +public class SalesAnalysisReportManager +{ + public static String getCVSReport(Properties ctx,Timestamp fromDate,Timestamp toDate) throws OperationException + { + ArrayList reportDataSource = getReportData(ctx,fromDate,toDate); + + return CSVReportManager.generateCSVReport(ctx,reportDataSource); + } + + public static String getPDFReport(Properties ctx,String fromDate,String toDate) throws OperationException + { + return null; + } + + private static ArrayList getReportData(Properties ctx,Timestamp fromDate,Timestamp toDate) throws OperationException + { + ArrayList reportData = null; + String sql = getReportSQL(); + int ad_client_id = Env.getAD_Client_ID(ctx); + int ad_org_id = Env.getAD_Org_ID(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + try + { + pstmt.setInt(1,ad_client_id); + pstmt.setInt(2,ad_org_id); + pstmt.setTimestamp(3,fromDate); + pstmt.setTimestamp(4,toDate); + + reportData = ReportManager.getReportData(ctx,pstmt); + + return reportData; + + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + pstmt=null; + } + } + + private static String getReportSQL() + { + String sql = "select bp.name as \"Supplier\"," + + "pc.name as \"Category\"," + + "attr_brand as \"Brand\"," + + "attr_model as \"Model\"," + + "attr_design as \"Design\"," + + "attr_colour as \"Colour\"," + + "attr_size as \"Size\"," + + "sum(ol.qtyordered) as \"Quantity\"," + + "sum(ol.LINENETAMT) as \"Amount\" "+ + "from c_orderline ol,c_order ord,u_tshirt_v v,c_bpartner bp,c_bpartner_product bpp,C_REVENUERECOGNITION pc,M_PRODUCT pr " + + "where ord.orderType='POS Order' " + + "and ol.c_order_id=ord.c_order_id " + + "and v.m_product_id=ol.m_product_id " + + "and ol.M_PRODUCT_ID=bpp.M_PRODUCT_ID " + + "and bpp.c_bpartner_id=bp.c_bpartner_id " + + "and ol.M_PRODUCT_ID=pr.M_PRODUCT_ID " + + "and ol.AD_CLIENT_ID=? " + + "and ol.AD_ORG_ID=? " + + "and pr.C_REVENUERECOGNITION_ID=pc.C_REVENUERECOGNITION_ID " + + "and ord.docstatus='CO' " + + "and ol.CREATED between to_date(?,'DD-MM-YYYY HH24:MI:SS') " + + "and to_date(?,'DD-MM-YYYY HH24:MI:SS') " + + "group by bp.name,pc.name,attr_brand,attr_model,attr_design,attr_colour,attr_size"; + + return sql; + } + + public static String getPieChartDataSetSQL(Properties ctx,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup) throws OperationException + { + return dataSetSQL(ctx,account_id,fromDate,toDate,salesGroup); + }//getPieChartDataSetSQL + + public static String getBarChartDataSetSQL(Properties ctx,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup) throws OperationException + { + return dataSetSQL(ctx,account_id,fromDate,toDate,salesGroup); + }//getBarChartDatasetSQL + + public static String getTabularDataSetSQL(Properties ctx,int account_id, Timestamp fromDate, Timestamp toDate,String salesGroup) throws OperationException + { + + int ad_client_id = Env.getAD_Client_ID(ctx); + String sql = null; + + + + //check account type + boolean isTaxDue = (account_id == Constants.TAX_DUE); + boolean isTaxCredit = (account_id == Constants.TAX_CREDIT); + boolean isProfitMargin = (account_id == Constants.PROFIT_MARGIN); + + final int TRADE_REVENUE = Constants.TRADE_REVENUE.intValue(); + final int COGS = Constants.COGS.intValue(); + + if(isProfitMargin) + { + String sql1 = getTabularDataSetSQL(ctx, TRADE_REVENUE, fromDate, toDate, salesGroup); + String sql2 = getTabularDataSetSQL(ctx, COGS, fromDate, toDate, salesGroup); + + sql2 = sql2.replace("SUM(0 - FACT.QTY)","SUM(FACT.QTY)"); + + if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) + { + sql = "" + + "select rev.\"Revenue_Recognition\",rev.\"Date\",(rev.\"Value\" + co.\"Value\") as \"value\",rev.\"Qty\" from" + + "(" + sql1 + ") rev," + + "(" + sql2 + ") co " + + "where rev.\"Revenue_Recognition\" = co.\"Revenue_Recognition\" " + + "and co.\"Date\" = rev.\"Date\" " + + "and co.\"Qty\" = rev.\"Qty\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET)) + { + sql = "" + + "select rev.\"Attributeset\",rev.\"Date\",(rev.\"Value\" + co.\"Value\") as \"value\",rev.\"Qty\" from" + + "(" + sql1 + ") rev," + + "(" + sql2 + ") co " + + "where rev.\"Attributeset\" = co.\"Attributeset\" " + + "and co.\"Date\" = rev.\"Date\" " + + "and co.\"Qty\" = rev.\"Qty\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.PRODUCT)) + { + sql = "" + + "select rev.\"Product\",rev.\"Date\",(rev.\"Value\" + co.\"Value\") as \"value\",rev.\"Qty\" from" + + "(" + sql1 + ") rev," + + "(" + sql2 + ") co " + + "where rev.\"Product\" = co.\"Product\" " + + "and co.\"Date\" = rev.\"Date\" " + + "and co.\"Qty\" = rev.\"Qty\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP1)) + { + sql = "" + + "select rev.\"Group1\",rev.\"Date\",(rev.\"Value\" + co.\"Value\") as \"value\",rev.\"Qty\" from" + + "(" + sql1 + ") rev," + + "(" + sql2 + ") co " + + "where rev.\"Group1\" = co.\"Group1\" " + + "and co.\"Date\" = rev.\"Date\" " + + "and co.\"Qty\" = rev.\"Qty\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP2)) + { + sql = "" + + "select rev.\"Group2\",rev.\"Date\",(rev.\"Value\" + co.\"Value\") as \"value\",rev.\"Qty\" from" + + "(" + sql1 + ") rev," + + "(" + sql2 + ") co " + + "where rev.\"Group2\" = co.\"Group2\" " + + "and co.\"Date\" = rev.\"Date\" " + + "and co.\"Qty\" = rev.\"Qty\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.CUSTOMER)) + { + sql = "" + + "select rev.\"Customer\",rev.\"Date\",(rev.\"Value\" + co.\"Value\") as \"value\",rev.\"Qty\" from" + + "(" + sql1 + ") rev," + + "(" + sql2 + ") co " + + "where rev.\"Customer\" = co.\"Customer\" " + + "and co.\"Date\" = rev.\"Date\" " + + "and co.\"Qty\" = rev.\"Qty\""; + } + else + { + String[] s = salesGroup.split("_"); + + if(s.length!=2) + { + throw new OperationException("Cannot generate sql. Unknown salesGroup parameter:"+salesGroup); + } + + int attributeId = Integer.parseInt(s[1]); + + String attributeName = new MAttribute(ctx,attributeId,null).getName(); + + sql = "" + + "select rev.\""+ attributeName +"\",rev.\"Date\",(rev.\"Value\" + co.\"Value\") as \"value\",rev.\"Qty\" from" + + "(" + sql1 + ") rev," + + "(" + sql2 + ") co " + + "where rev.\""+ attributeName +"\" = co.\""+ attributeName +"\" " + + "and co.\"Date\" = rev.\"Date\" " + + "and co.\"Qty\" = rev.\"Qty\""; + } + + + + return sql; + } + + if(isTaxCredit || isTaxDue) + { + int[] ids = MElementValue.getAllIDs(MElementValue.Table_Name,"AD_CLIENT_ID ="+ Env.getAD_Client_ID(ctx) + " AND VALUE ='"+ account_id + "'",null); + MElementValue elementValue = new MElementValue(ctx,ids[0],null); + String accountName = elementValue.getName(); + + sql = "" + + "select COALESCE(SUM(fact.AMTACCTDR - fact.AMTACCTCR), 0) as \""+ accountName +"\" " + + "from FACT_ACCT FACT where fact.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '" + account_id + "' and AD_CLIENT_ID = "+ ad_client_id +") " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = " + ad_client_id; + + return sql; + } + + if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) + { + sql = "" + + "select DECODE(rev.NAME, null, 'others', rev.Name) as \"Revenue_Recognition\"," + //1.Revenue Recognition + "to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //2.Date + "SUM(fact.AMTACCTCR-fact.AMTACCTDR) as \"Value\"," + //3.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty + "from FACT_ACCT fact, (M_PRODUCT prod left outer join C_REVENUERECOGNITION rev on rev.C_REVENUERECOGNITION_ID = prod.C_REVENUERECOGNITION_ID ) " + + "where fact.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id+") " + + "and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID " + + //"and rev.C_REVENUERECOGNITION_ID(+) = prod.C_REVENUERECOGNITION_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " group by rev.NAME,to_char(fact.DATEACCT,'DD-MM-YYYY') " + + " order by to_char(fact.DATEACCT,'DD-MM-YYYY') desc,rev.NAME asc"; + } + else if(salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET)) + { + sql = "" + + " select DECODE(attrSet.NAME, null, 'others', attrSet.NAME) as \"Attributeset\"," + //1.Attributeset + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //2.Date + " SUM(fact.AMTACCTCR-fact.AMTACCTDR) as \"Value\"," + //3.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty + " from FACT_ACCT fact, (M_PRODUCT prod left outer join C_REVENUERECOGNITION rev on rev.C_REVENUERECOGNITION_ID = prod.C_REVENUERECOGNITION_ID ),M_ATTRIBUTESETINSTANCE attrSetIns, M_ATTRIBUTESET attrSet " + + " where fact.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID " + + //" and rev.C_REVENUERECOGNITION_ID(+) = prod.C_REVENUERECOGNITION_ID " + + " and prod.M_ATTRIBUTESETINSTANCE_ID = attrSetIns.M_ATTRIBUTESETINSTANCE_ID " + + " and attrSet.M_ATTRIBUTESET_ID = attrSetIns.M_ATTRIBUTESET_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " group by attrSet.name,to_char(fact.DATEACCT,'DD-MM-YYYY') " + + " order by to_char(fact.DATEACCT,'DD-MM-YYYY') desc,attrSet.name asc"; + } + else if(salesGroup.equalsIgnoreCase(Constants.PRODUCT)) + { + sql = "" + + " select PROD.NAME as \"Product\"," + //1.Product + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //3.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //4.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //5.Qty + " from FACT_ACCT FACT, M_PRODUCT PROD " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),PROD.NAME" + + " Order by to_char(fact.DATEACCT,'DD-MM-YYYY') desc,PROD.NAME asc"; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP1)) + { + sql = "" + + " select DECODE(PROD.GROUP1, null, 'Ungroup', PROD.GROUP1) as \"Group1\"," + //1.Product + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //3.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //4.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //5.Qty + " from FACT_ACCT FACT, M_PRODUCT PROD " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),PROD.GROUP1" + + " Order by to_char(fact.DATEACCT,'DD-MM-YYYY') desc,PROD.GROUP1 asc"; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP2)) + { + sql = "" + + " select DECODE(PROD.GROUP2, null, 'Ungroup', PROD.GROUP2) as \"Group2\"," + //1.Product + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //3.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //4.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //5.Qty + " from FACT_ACCT FACT, M_PRODUCT PROD " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),PROD.GROUP2" + + " Order by to_char(fact.DATEACCT,'DD-MM-YYYY') desc,PROD.GROUP2 asc"; + } + else if(salesGroup.equalsIgnoreCase(Constants.CUSTOMER)) + { + sql = "" + + //" select BP.NAME||' '||BP.NAME2 \"Customer\"," + //1.Customer + " Select BP.NAME as \"Customer\","+ + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //2.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //3.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty + " from FACT_ACCT FACT, C_BPARTNER BP " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.C_BPARTNER_ID = BP.C_BPARTNER_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + //" having SUM(0 - FACT.QTY) <> 0 " + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),BP.NAME" + + " Order by to_char(fact.DATEACCT,'DD-MM-YYYY') desc,BP.NAME asc"; + //" GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),BP.NAME||' '||BP.NAME2" + + //" Order by to_char(fact.DATEACCT,'DD-MM-YYYY') desc,BP.NAME||' '||BP.NAME2 asc"; + } + else + { + String[] s = salesGroup.split("_"); + + if(s.length!=2) + { + throw new OperationException("Cannot generate sql. Unknown salesGroup parameter:"+salesGroup); + } + + int attributeSetId = Integer.parseInt(s[0]); + int attributeId = Integer.parseInt(s[1]); + + String attributeName = new MAttribute(ctx,attributeId,null).getName(); + + sql = "select ATTRIBUTE_VALUE as \""+attributeName+ "\"," + + "to_char(DATEACCT,'DD-MM-YYYY') as \"Date\"," + + "sum(AMTACCTCR-AMTACCTDR) as \"Value\"," + + "SUM(0 - QTY) as \"Qty\" " + + "from " + + "(" + + " select attrIns.m_attribute_id,prod.m_product_category_id, attrIns.m_attributevalue_id,attr.name ATTRIBUTE_NAME,attrSet.name ATTRIBUTESET_NAME,attrSet.M_ATTRIBUTESET_ID,prod.m_product_id, attrVal.name ATTRIBUTE_VALUE, attrVal.description,fact.AMTACCTCR,fact.AMTACCTDR,fact.DATEACCT,fact.QTY" + + " from M_PRODUCT prod,M_ATTRIBUTEINSTANCE attrIns ,M_attribute attr,M_attributeValue attrVal, M_ATTRIBUTESETINSTANCE attrSetIns, M_ATTRIBUTESET attrSet, FACT_ACCT fact" + + " where prod.M_ATTRIBUTESETINSTANCE_id = attrIns.M_ATTRIBUTESETINSTANCE_id" + + " and attr.m_attribute_id = attrIns.m_attribute_id" + + " and attrIns.m_attributevalue_id = attrVal.m_attributevalue_id" + + " and prod.M_ATTRIBUTESETINSTANCE_ID = attrSetIns.M_ATTRIBUTESETINSTANCE_ID" + + " and attrSet.M_ATTRIBUTESET_ID = attrSetIns.M_ATTRIBUTESET_ID" + + " and fact.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID" + + " and fact.AD_CLIENT_ID = " + ad_client_id + + " and attrSetIns.M_ATTRIBUTESET_ID = " + attributeSetId + + " and attr.M_ATTRIBUTE_ID = " + attributeId + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + ")" + + "group by ATTRIBUTE_VALUE,to_char(DATEACCT,'DD-MM-YYYY') " + + "order by to_char(DATEACCT,'DD-MM-YYYY') desc,ATTRIBUTE_VALUE asc"; + } + + return sql; + + }//getTabularDataSetSQL + + public static String dataSetSQL(Properties ctx,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup) throws OperationException + { + int ad_client_id = Env.getAD_Client_ID(ctx); + String sql = null; + + + + boolean isProfitMargin = (account_id == Constants.PROFIT_MARGIN); + + if(isProfitMargin) + { + String innerSql = getTabularDataSetSQL(ctx, account_id, fromDate, toDate, salesGroup); + + if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) + { + sql = "select \"Revenue_Recognition\",sum(\"value\"),sum(\"Qty\") from ("+ innerSql +") sub group by \"Revenue_Recognition\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET)) + { + sql = "select \"Attributeset\",sum(\"value\"),sum(\"Qty\") from ("+ innerSql +") att group by \"Attributeset\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.PRODUCT)) + { + sql = "select \"Product\",sum(\"value\"),sum(\"Qty\") from ("+ innerSql +") prod group by \"Product\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.CUSTOMER)) + { + sql = "select \"Customer\",sum(\"value\"),sum(\"Qty\") from ("+ innerSql +") customer group by \"Customer\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP1)) + { + sql = "select \"Group1\",sum(\"value\"),sum(\"Qty\") from ("+ innerSql +") group1 group by \"Group1\""; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP2)) + { + sql = "select \"Group2\",sum(\"value\"),sum(\"Qty\") from ("+ innerSql +") group2 group by \"Group2\""; + } + else + { + String[] s = salesGroup.split("_"); + + if(s.length!=2) + { + throw new OperationException("Cannot generate sql. Unknown salesGroup parameter:"+salesGroup); + } + + int attributeId = Integer.parseInt(s[1]); + + String attributeName = new MAttribute(ctx,attributeId,null).getName(); + + sql = "select \""+ attributeName +"\",sum(\"value\"),sum(\"Qty\") from ("+ innerSql +") attName group by \""+ attributeName +"\""; + } + + return sql; + } + + if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) + { + sql = "select DECODE(rev.NAME, null, 'Others', rev.NAME) as RevenueRecognition,SUM(fact.AMTACCTCR - fact.AMTACCTDR) as Revenue_Recognition,SUM(0-fact.QTY) as Qty " + + "from FACT_ACCT fact, (M_PRODUCT prod right outer join C_REVENUERECOGNITION rev on rev.C_REVENUERECOGNITION_ID = prod.C_REVENUERECOGNITION_ID) " + + "where fact.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id+") " + + "and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " group by rev.NAME"; + } + else if(salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET)) + { + sql = "select attrSet.name as attributeset,SUM(fact.AMTACCTCR - fact.AMTACCTDR) as Attribute_Set,SUM(0-fact.QTY) as Qty " + + "from FACT_ACCT fact, (M_PRODUCT prod right outer join C_REVENUERECOGNITION rev on rev.C_REVENUERECOGNITION_ID = prod.C_REVENUERECOGNITION_ID),M_ATTRIBUTESETINSTANCE attrSetIns, M_ATTRIBUTESET attrSet " + + "where fact.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + "and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID " + + "and prod.M_ATTRIBUTESETINSTANCE_ID = attrSetIns.M_ATTRIBUTESETINSTANCE_ID " + + "and attrSet.M_ATTRIBUTESET_ID = attrSetIns.M_ATTRIBUTESET_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " group by attrSet.name"; + } + else if(salesGroup.equalsIgnoreCase(Constants.PRODUCT)) + { + sql = "select PROD.NAME as \"Product\",SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + + "from FACT_ACCT FACT, M_PRODUCT PROD " + + "where FACT.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + "AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY PROD.NAME"; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP1)) + { + sql = "select DECODE(PROD.GROUP1, null, 'Ungrouped', PROD.GROUP1) as \"Group1\",SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + + "from FACT_ACCT FACT, M_PRODUCT PROD " + + "where FACT.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + "AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY PROD.GROUP1"; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP2)) + { + sql = "select DECODE(PROD.GROUP2, null, 'Ungrouped', PROD.GROUP2) as \"Group2\",SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + + "from FACT_ACCT FACT, M_PRODUCT PROD " + + "where FACT.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + "AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY PROD.GROUP2"; + } + else if(salesGroup.equalsIgnoreCase(Constants.CUSTOMER)) + { + //sql = "select BP.NAME || ' ' || BP.NAME2 as \"Customer\", " + + sql = "Select BP.NAME as \"Customer\","+ + "SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\", SUM(0 - FACT.QTY) as \"Qty\" " + + "from FACT_ACCT FACT, C_BPARTNER BP " + + "where FACT.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + "AND FACT.C_BPARTNER_ID = BP.C_BPARTNER_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + //" having SUM(0 - FACT.QTY) <> 0 " + + " GROUP BY BP.NAME Order by BP.NAME asc"; + //"GROUP BY BP.NAME || ' ' || BP.NAME2 Order by BP.NAME || ' ' || BP.NAME2 asc"; + } + else + { + String[] s = salesGroup.split("_"); + + if(s.length!=2) + { + throw new OperationException("Cannot generate sql. Unknown salesGroup parameter:"+salesGroup); + } + + int attributeSetId = Integer.parseInt(s[0]); + int attributeId = Integer.parseInt(s[1]); + + String attributeName = new MAttribute(ctx,attributeId,null).getName(); + + sql = "select ATTRIBUTE_VALUE, sum(AMTSOURCECR - AMTSOURCEDR) as \""+attributeName+ "\",SUM(0-QTY) as Qty from " + + "(" + + " select attrIns.m_attribute_id,prod.m_product_category_id, attrIns.m_attributevalue_id,attr.name ATTRIBUTE_NAME,attrSet.name ATTRIBUTESET_NAME,attrSet.M_ATTRIBUTESET_ID,prod.m_product_id, attrVal.name ATTRIBUTE_VALUE, attrVal.description,fact.AMTSOURCECR,fact.AMTSOURCEDR,fact.QTY" + + " from M_PRODUCT prod,M_ATTRIBUTEINSTANCE attrIns ,M_attribute attr,M_attributeValue attrVal, M_ATTRIBUTESETINSTANCE attrSetIns, M_ATTRIBUTESET attrSet, FACT_ACCT fact" + + " where prod.M_ATTRIBUTESETINSTANCE_id = attrIns.M_ATTRIBUTESETINSTANCE_id" + + " and attr.m_attribute_id = attrIns.m_attribute_id" + + " and attrIns.m_attributevalue_id = attrVal.m_attributevalue_id" + + " and prod.M_ATTRIBUTESETINSTANCE_ID = attrSetIns.M_ATTRIBUTESETINSTANCE_ID" + + " and attrSet.M_ATTRIBUTESET_ID = attrSetIns.M_ATTRIBUTESET_ID" + + " and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID" + + " and fact.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " and fact.AD_CLIENT_ID = " + ad_client_id + + " and attrSetIns.M_ATTRIBUTESET_ID = " + attributeSetId + + " and attr.M_ATTRIBUTE_ID = " + attributeId + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + ")" + + " group by ATTRIBUTE_VALUE"; + + + } + + return sql; + }//dataSetSQL + + public static String getTimeSeriesDataSetSQL(Properties ctx,int account_id,Timestamp fromDate,Timestamp toDate,String salesGroup) throws OperationException + { + + int ad_client_id = Env.getAD_Client_ID(ctx); + String sql = null; + + + + boolean isProfitMargin = (account_id == Constants.PROFIT_MARGIN); + if(isProfitMargin) + { + return getTabularDataSetSQL(ctx, account_id, fromDate, toDate, salesGroup); + } + + + + if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) + { + sql = "" + + "select DECODE(rev.NAME, null, 'others', rev.Name) as RevenueRecognition," + //1.Revenue Recognition + "to_char(fact.DATEACCT,'DD-MM-YYYY')," + //2.Date + "SUM(fact.AMTACCTCR-fact.AMTACCTDR) as REVENUE," + //3.Value + "SUM(0-fact.QTY) " + //4.Qty + "from FACT_ACCT fact, (M_PRODUCT prod left outer join C_REVENUERECOGNITION rev on rev.C_REVENUERECOGNITION_ID = prod.C_REVENUERECOGNITION_ID ) " + + "where fact.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id+") " + + "and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID " + + //"and rev.C_REVENUERECOGNITION_ID(+) = prod.C_REVENUERECOGNITION_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + "and fact.AD_CLIENT_ID = "+ad_client_id + + " group by rev.NAME,to_char(fact.DATEACCT,'DD-MM-YYYY')"; + } + else if(salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET)) + { + sql = "select attrSet.name as attributeset,to_char(fact.DATEACCT,'DD-MM-YYYY'),SUM(fact.AMTACCTCR-fact.AMTACCTDR) as REVENUE,SUM(0-fact.QTY) " + + "from FACT_ACCT fact, (M_PRODUCT prod left outer join C_REVENUERECOGNITION rev on rev.C_REVENUERECOGNITION_ID = prod.C_REVENUERECOGNITION_ID ),M_ATTRIBUTESETINSTANCE attrSetIns, M_ATTRIBUTESET attrSet " + + "where fact.ACCOUNT_ID = " + + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + "and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID " + + //"and rev.C_REVENUERECOGNITION_ID(+) = prod.C_REVENUERECOGNITION_ID " + + "and prod.M_ATTRIBUTESETINSTANCE_ID = attrSetIns.M_ATTRIBUTESETINSTANCE_ID " + + "and attrSet.M_ATTRIBUTESET_ID = attrSetIns.M_ATTRIBUTESET_ID " + + "and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + "and fact.AD_CLIENT_ID = "+ad_client_id + + " group by attrSet.name,to_char(fact.DATEACCT,'DD-MM-YYYY')"; + } + else if(salesGroup.equalsIgnoreCase(Constants.PRODUCT)) + { + sql = "" + + " select PROD.NAME as \"Product\"," + //1.Product + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //2.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //3.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty + " from FACT_ACCT FACT, M_PRODUCT PROD " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),PROD.NAME"; + } + else if(salesGroup.equalsIgnoreCase(Constants.PRODUCT)) + { + sql = "" + + " select PROD.NAME as \"Product\"," + //1.Product + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //2.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //3.Value + " SUM(0 - FACT.QTY) \"Qty\" " + //4.Qty + " from FACT_ACCT FACT, M_PRODUCT PROD " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),PROD.NAME"; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP1)) + { + sql = "" + + " select NVL(PROD.GROUP1,'OTHERS') as \"Group1\"," + //1.Product + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //2.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //3.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty + " from FACT_ACCT FACT, M_PRODUCT PROD " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),PROD.GROUP1"; + } + else if(salesGroup.equalsIgnoreCase(Constants.GROUP2)) + { + sql = "" + + " select NVL(PROD.GROUP2,'OTHERS') as \"Group2\"," + //1.Product + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //2.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //3.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty + " from FACT_ACCT FACT, M_PRODUCT PROD " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.M_PRODUCT_ID = PROD.M_PRODUCT_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),PROD.GROUP2"; + } + else if(salesGroup.equalsIgnoreCase(Constants.CUSTOMER)) + { + sql = "" + + //" select BP.NAME||' '||BP.NAME2 as \"Customer\"," + //1.Customer + "Select BP.NAME as \"Customer\","+ + " to_char(fact.DATEACCT,'DD-MM-YYYY') as \"Date\"," + //2.Date + " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //3.Value + " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty + " from FACT_ACCT FACT, C_BPARTNER BP " + + " where FACT.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " AND FACT.C_BPARTNER_ID = BP.C_BPARTNER_ID " + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " and fact.AD_CLIENT_ID = "+ad_client_id + + //" having SUM(0 - FACT.QTY) <> 0 " + + " GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),BP.NAME"; + //" GROUP BY to_char(fact.DATEACCT,'DD-MM-YYYY'),BP.NAME||' '||BP.NAME2"; + + } + else + { + String[] s = salesGroup.split("_"); + + if(s.length!=2) + { + throw new OperationException("Cannot generate sql. Unknown salesGroup parameter:"+salesGroup); + } + + int attributeSetId = Integer.parseInt(s[0]); + int attributeId = Integer.parseInt(s[1]); + + sql = "select ATTRIBUTE_VALUE,to_char(DATEACCT,'DD-MM-YYYY'),sum(AMTACCTCR-AMTACCTDR),SUM(0-QTY) from " + + "(" + + " select attrIns.m_attribute_id,prod.m_product_category_id, attrIns.m_attributevalue_id,attr.name ATTRIBUTE_NAME,attrSet.name ATTRIBUTESET_NAME,attrSet.M_ATTRIBUTESET_ID,prod.m_product_id, attrVal.name ATTRIBUTE_VALUE, attrVal.description,fact.AMTACCTCR,fact.AMTACCTDR,fact.DATEACCT,fact.QTY" + + " from M_PRODUCT prod,M_ATTRIBUTEINSTANCE attrIns ,M_attribute attr,M_attributeValue attrVal, M_ATTRIBUTESETINSTANCE attrSetIns, M_ATTRIBUTESET attrSet, FACT_ACCT fact" + + " where prod.M_ATTRIBUTESETINSTANCE_id = attrIns.M_ATTRIBUTESETINSTANCE_id" + + " and attr.m_attribute_id = attrIns.m_attribute_id" + + " and attrIns.m_attributevalue_id = attrVal.m_attributevalue_id" + + " and prod.M_ATTRIBUTESETINSTANCE_ID = attrSetIns.M_ATTRIBUTESETINSTANCE_ID" + + " and attrSet.M_ATTRIBUTESET_ID = attrSetIns.M_ATTRIBUTESET_ID" + + " and fact.ACCOUNT_ID = " + + " (select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + + " and fact.M_PRODUCT_ID = prod.M_PRODUCT_ID" + + " and fact.AD_CLIENT_ID = " + ad_client_id + + " and attrSetIns.M_ATTRIBUTESET_ID = " + attributeSetId + + " and attr.M_ATTRIBUTE_ID = " + attributeId + + " and fact.DATEACCT between " + + DB.TO_DATE(fromDate, false) + + " and " + + DB.TO_DATE(toDate, false) + + " group by ATTRIBUTE_VALUE,to_char(DATEACCT,'DD-MM-YYYY')"; + } + + return sql; + + }//getTimeSeriesDataSetSQL + +}//SalesAnalysisReportManager diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/product/GenericProductImpl.java b/posterita/posterita/src/main/org/posterita/businesslogic/product/GenericProductImpl.java new file mode 100644 index 0000000000..34769bec44 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/product/GenericProductImpl.java @@ -0,0 +1,69 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 10, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.businesslogic.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Properties; + +import org.compiere.model.MAttachmentEntry; +import org.compiere.model.MProduct; + +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.core.AttachmentManager; +import org.posterita.exceptions.OperationException; + +public class GenericProductImpl implements IProduct +{ + + public String getProductName(Properties ctx, int productId, String trxName) throws OperationException + { + MProduct product = ProductManager.loadProduct(ctx, productId, trxName); + + return product.getName(); + } + + public String getBarcodeForSimilarProducts(Properties ctx, int productId, String trxName) throws OperationException + { + return null; + } + + public HashMap getAllImages(Properties ctx, int productId, String trxName) throws OperationException + { + HashMap imagesMap = new HashMap(); + ArrayList entryList = AttachmentManager.getAllImagesAttachmentEntries(ctx, MProduct.Table_ID, productId, trxName); + + for(MAttachmentEntry entry : entryList) + { + imagesMap.put(entry.getName(), entry.getData()); + } + + return imagesMap; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/product/IProduct.java b/posterita/posterita/src/main/org/posterita/businesslogic/product/IProduct.java new file mode 100644 index 0000000000..a8d521c111 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/product/IProduct.java @@ -0,0 +1,43 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 10, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.businesslogic.product; + +import java.util.HashMap; +import java.util.Properties; + +import org.posterita.exceptions.OperationException; + +public interface IProduct +{ + + public String getProductName(Properties ctx, int productId, String trxName) throws OperationException; + + public String getBarcodeForSimilarProducts(Properties ctx, int productId, String trxName) throws OperationException; + + public HashMap getAllImages(Properties ctx, int productId, String trxName) throws OperationException; +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/stock/InventoryCartManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/stock/InventoryCartManager.java new file mode 100644 index 0000000000..7c68dc61c3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/stock/InventoryCartManager.java @@ -0,0 +1,684 @@ +package org.posterita.businesslogic.stock; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.NoSuchElementException; +import java.util.Properties; +import java.util.StringTokenizer; + +import javax.servlet.http.HttpServletRequest; +import javax.swing.text.NumberFormatter; + +import org.apache.ecs.xhtml.div; +import org.apache.ecs.xhtml.table; +import org.apache.ecs.xhtml.tbody; +import org.apache.ecs.xhtml.td; +import org.apache.ecs.xhtml.tfoot; +import org.apache.ecs.xhtml.th; +import org.apache.ecs.xhtml.thead; +import org.apache.ecs.xhtml.tr; +import org.apache.struts.upload.FormFile; +import org.compiere.model.MDocType; +import org.compiere.model.MInventory; +import org.compiere.model.MInventoryLine; +import org.compiere.model.MPInstance; +import org.compiere.model.MProduct; +import org.compiere.model.MProductPrice; +import org.compiere.model.MUOM; +import org.compiere.process.InventoryCountCreate; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.InventoryCartBean; +import org.posterita.beans.InventoryLineBean; +import org.posterita.beans.ItemBean; +import org.posterita.beans.ProductBean; +import org.posterita.businesslogic.POSProductManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.RandomStringGenerator; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.BarcodeAlreadyExistsException; +import org.posterita.exceptions.CannotCreateInventoryLineException; +import org.posterita.exceptions.ImportProductException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductAlreadyExistException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotImportedException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + +public class InventoryCartManager +{ + private static final int CREATE_INVENTORY_COUNT_LIST_PROCESS=289; + + private static String getInventoryCartAsHTML(ArrayList itemList, Properties ctx) throws ParseException, OperationException + { + NumberFormatter formatter = new NumberFormatter(new DecimalFormat("0")); + + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + String currSymbol = PriceListManager.getCurrency(ctx, priceListId); + + BigDecimal totalQtyCount = Env.ZERO; + BigDecimal totalQtyBook = Env.ZERO; + BigDecimal totalQtyCsv = Env.ZERO; + BigDecimal difference = Env.ZERO; + BigDecimal totalDifference = Env.ZERO; + + String[] headers = {"Name","Description","UOM","Quantity CSV", "Quantity Book","Quantity Count", "Difference"}; + table tbl = new table("0", "0", "0", "100%", ""); + tbl.setID("inventoryCart"); + tbl.addAttribute("class", "filterable sortable"); + + BigDecimal qtyCsv = Env.ZERO; + BigDecimal qtyCount = Env.ZERO; + BigDecimal qtyBook = Env.ZERO; + + thead theader = new thead(); + + tr headerRow = new tr(); + headerRow.setClass("itemTitleList"); + + for(String header : headers) + { + th h = new th(header); + headerRow.addElement(h); + } + + theader.addElement(headerRow); + tbl.addElement(theader); + + + //add body + tbody body = new tbody(); + int count = 0; + + if(itemList != null) + { + for(ItemBean bean : itemList) + { + count ++; + + tr dataRow = new tr(); + + dataRow.setClass("evenRow"); + dataRow.setID("row" + count); + dataRow.addAttribute("productId", bean.getProductId().toString()); + dataRow.addAttribute("qty", bean.getQtyCount().toString()); + dataRow.addAttribute("qtyBook", bean.getQtyBook().toString()); + + qtyCount = bean.getQtyCount(); + qtyCsv = bean.getQtyCsv(); + qtyBook = bean.getQtyBook(); + + difference = qtyBook.subtract(qtyCount); + + totalQtyCount = totalQtyCount.add(bean.getQtyCount()); + totalQtyBook = totalQtyBook.add(bean.getQtyBook()); + totalQtyCsv = totalQtyCsv.add(bean.getQtyCsv()); + totalDifference = totalDifference.add(difference); + + int n = qtyCount.compareTo(qtyBook); + + //Greater + if(n == -1) + { + dataRow.addAttribute("style", "color:#0101DF"); + } + + //Equal + if(n == 0) + { + dataRow.addAttribute("style", "color:#000000"); + } + + //less + if(n == 1) + { + dataRow.addAttribute("style", "color:#DF0101"); + } + + + + String[] columnData = { + bean.getProductName(), + bean.getDescription(), + bean.getUom(), + formatter.valueToString(bean.getQtyCsv()), + formatter.valueToString(bean.getQtyBook()), + formatter.valueToString(bean.getQtyCount()), + formatter.valueToString(difference) + }; + + for(int i=0; iTotal ").setColSpan("3")); + footerRow.addElement(new td(new div(formatter.valueToString(totalQtyCsv)).setID("cartTotalCsv"))); + footerRow.addElement(new td(new div(formatter.valueToString(totalQtyBook)).setID("cartTotalBook"))); + footerRow.addElement(new td(new div(formatter.valueToString(totalQtyCount)).setID("cartTotalCount"))); + footerRow.addElement(new td(new div(formatter.valueToString(totalDifference)).setID("cartDifference"))); + + footer.addElement(footerRow); + tbl.addElement(footer); + + + return tbl.toString(); + } + + public static String getInventoryCartAsHTML(HttpServletRequest request) throws ParseException, OperationException + { + //add body + ArrayList itemList = (ArrayList) request.getSession().getAttribute(Constants.INVENTORY_CART_ITEMS); + Properties ctx = TmkJSPEnv.getCtx(request); + return getInventoryCartAsHTML(itemList, ctx); + } + + public static void clearInventorycart(Properties ctx, HttpServletRequest request) + { + //bug fix + request.setAttribute("cartTotalCsv", null); + request.setAttribute("cartTotalBook", null); + request.setAttribute("cartTotalCount", null); + + Env.setContext(ctx, Constants.DESCRIPTION, ""); + Env.setContext(ctx, Constants.INVENTORY_ID, ""); + + request.getSession().setAttribute(Constants.DOC_NO, null); + request.getSession().setAttribute(Constants.DOC_STATUS, null); + request.getSession().setAttribute(Constants.DESCRIPTION, null); + request.getSession().setAttribute(Constants.INVENTORY_ID, null); + request.getSession().setAttribute(Constants.INVENTORY_CART, null); + request.getSession().setAttribute(Constants.INVENTORY_CART_ITEMS, null); + } + + public static void saveCountQtyInInventoryLine(Properties ctx,int inventoryLineId, BigDecimal qtyBook, BigDecimal countQty, BigDecimal qtyCsv, String trxName) throws OperationException + { + MInventoryLine line = new MInventoryLine(ctx,inventoryLineId,trxName); + line.setQtyCount(countQty); + line.setQtyBook(qtyBook); + line.setQtyCsv(qtyCsv); + PoManager.save(line); + } + + public static boolean addInventoryLine(Properties ctx, Integer inventoryId,Integer productId, BigDecimal qtyBook, BigDecimal qtyCount, BigDecimal qtyCsv, boolean updateCount,String trxName) throws OperationException + { + if(productId == null || productId.intValue()==0) + { + throw new ProductNotFoundException("product not available"); + } + + MProduct product = new MProduct(ctx,productId.intValue(),trxName); + if(product.getProductType().equalsIgnoreCase(MProduct.PRODUCTTYPE_Service)) + { + throw new CannotCreateInventoryLineException("product is a service, cannot add to inventory"); + } + MInventory inventory = new MInventory(ctx,inventoryId,trxName); + MInventoryLine inventoryLine[]=inventory.getLines(true); + boolean added=true; + if(inventoryLine.length>0) + { + for(int i=0;i 1) + { + throw new OperationException("More that one inventory lines found matching criteria"); + } + else + { + return inventoryLines[0]; + } + + } + + public static MInventory createInventory(Properties ctx,String description,String trxName) throws OperationException + { + MInventory inventory = new MInventory(ctx,0,trxName); + MDocType[] docTypes= MDocType.getOfDocBaseType(ctx,MDocType.DOCBASETYPE_MaterialPhysicalInventory); + if(docTypes.length>1) + throw new OperationException("More than one document type for Physical Inventory"); + + inventory.setC_DocType_ID(docTypes[0].get_ID()); + inventory.setM_Warehouse_ID(POSTerminalManager.getWarehouseId(ctx)); + if(description!=null) + inventory.setDescription(description); + + PoManager.save(inventory); + return inventory; + + } + + public static ArrayList getInventoryLines(Properties ctx,int inventoryId) throws OperationException + { + + MInventory inventory = new MInventory(ctx,inventoryId,null); + MInventoryLine inventoryLine[]=inventory.getLines(true); + + ArrayList countList = new ArrayList(); + + ItemBean bean=null; + BigDecimal bookQtyValue=null; + BigDecimal countQtyValue=null; + + for(int i=0;i getInventoryData(Properties ctx, ArrayList list, String trxName) throws ParseException + { + + ArrayList reportData = new ArrayList(); + NumberFormatter formatter = new NumberFormatter(new DecimalFormat("0.00")); + NumberFormatter qtyFormatter = new NumberFormatter(new DecimalFormat("0")); + + String productName = null; + String productDescrition = null; + String barcode = null; + + BigDecimal qtyBook = Env.ZERO; + BigDecimal qtyCount = Env.ZERO; + BigDecimal qtyCsv = Env.ZERO; + + BigDecimal bookValue = Env.ZERO; + BigDecimal countValue = Env.ZERO; + + BigDecimal qtyBookTotal = Env.ZERO; + BigDecimal qtyCountTotal = Env.ZERO; + BigDecimal qtyCsvTotal = Env.ZERO; + + BigDecimal valueBookTotal = Env.ZERO; + BigDecimal valueCountTotal = Env.ZERO; + + BigDecimal qtyDifference = Env.ZERO; + BigDecimal valueDifference = Env.ZERO; + + + for(ItemBean itemBean : list) + { + qtyBook = itemBean.getQtyBook(); + qtyCount = itemBean.getQtyCount(); + + qtyBookTotal = qtyBookTotal.add(qtyBook); + qtyCountTotal = qtyCountTotal.add(qtyCount); + + productName = itemBean.getProductName(); + productDescrition = itemBean.getDescription(); + barcode = itemBean.getBarCode(); + + int purchasePriceListVersionId = Env.getContextAsInt(ctx,UdiConstants.POS_PURCHASE_PL_VERSION); + MProductPrice purchasePrice = MProductPrice.get(ctx, purchasePriceListVersionId, itemBean.getProductId(), trxName); + + if(purchasePrice==null) + { + bookValue=new BigDecimal(0); + countValue=new BigDecimal(0); + } + else + { + bookValue=purchasePrice.getPriceList().multiply(itemBean.getQtyBook()); + countValue=purchasePrice.getPriceList().multiply(itemBean.getQtyCount()); + } + + valueBookTotal = valueBookTotal.add(bookValue); + valueCountTotal = valueCountTotal.add(countValue); + + qtyDifference = qtyCount.subtract(qtyBook); + valueDifference = countValue.subtract(bookValue); + + Object[] data = {barcode, productName, qtyFormatter.valueToString(qtyCsv), qtyFormatter.valueToString(qtyBook), qtyFormatter.valueToString(qtyCount), formatter.valueToString(bookValue), formatter.valueToString(countValue), qtyFormatter.valueToString(qtyDifference), formatter.valueToString(valueDifference)}; + + reportData.add(data); + } + + // Add Total + Object[] totalValue = {"TOTAL"," ", qtyFormatter.valueToString(qtyCsvTotal) ,qtyFormatter.valueToString(qtyBookTotal), qtyFormatter.valueToString(qtyCountTotal), formatter.valueToString(valueBookTotal), formatter.valueToString(valueCountTotal), qtyFormatter.valueToString(qtyCountTotal.subtract(qtyBookTotal)), formatter.valueToString(valueCountTotal.subtract(valueBookTotal))}; + reportData.add(totalValue); + + return reportData; + } + + public static InventoryCartBean addItemsFromCsv(Properties ctx, FormFile file, InventoryLineBean ibean, InventoryCartBean cartBean, String trxName) throws NumberFormatException, ProductAlreadyExistException,BarcodeAlreadyExistsException, OperationException + { + + InputStream is = null; + BufferedInputStream bis = null; + BufferedReader reader = null; + + ArrayList ilBean = new ArrayList(); + + StringBuffer csv = new StringBuffer(); + StringBuffer importProductEx = new StringBuffer(); + try + { + is = file.getInputStream(); + bis = new BufferedInputStream(is); + reader = new BufferedReader(new InputStreamReader(bis)); + + String s = null; + Integer lineNumber = 0; + String barcode = null; + String qty=null; + + BigDecimal qtyCsv = new BigDecimal(0); + + ArrayList uomErrorList = new ArrayList(); + + boolean isProductImported = true; + String filename = ""; + + while((s=reader.readLine())!=null && s.trim().length()>0) + { + lineNumber++; + StringTokenizer st = new StringTokenizer(s,","); + + ibean = new InventoryLineBean(); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + trx.start(); + try + { + barcode = st.nextToken(); + barcode = barcode.replaceAll("\"",""); + qty=st.nextToken(); + qty=qty.replaceAll("\"",""); + qtyCsv = new BigDecimal(qty); + + } + catch (NoSuchElementException e) + { + // TODO: handle exception + throw new ImportProductException("An error occurred while passing the data in the file."); + } + + ProductBean product = POSProductManager.getProduct(ctx, barcode, trxName); + + ibean.setProductId(product.getProductId()); + ibean.setBarCode(barcode); + ibean.setProductName(product.getProductName()); + ibean.setDescription(product.getDescription()); + ibean.setUom(product.getUom()); + ibean.setQtyCount(qtyCsv); + ibean.setQtyCsv(qtyCsv); + ibean.setQtyBook(product.getQtyOnHand()); + ibean.setPriceListId(product.getPriceListId()); + + ilBean.add(ibean); + trx.commit(); + + cartBean = StockManager.addToInventoryCart(ctx, ibean, cartBean, false , true); + } + catch (OperationException e) + { + trx.rollback(); + importProductEx = importProductEx.append("
    Product with barcode: "+ barcode + " at line " + lineNumber + " not imported. ").append(e.getMessage()); + isProductImported = false; + csv.append(s).append("\"\n"); + } + finally + { + trx.close(); + } + + } + + if (isProductImported == false) + { + filename = RandomStringGenerator.randomstring() + ".csv"; + String filepath = ReportManager.getReportPath(filename); + try + { + FileWriter writer = new FileWriter(filepath); + writer.write(csv.toString()); + writer.flush(); + writer.close(); + } + catch (IOException e1) + { + throw new OperationException(e1); + } + throw new ProductNotImportedException(filename+importProductEx.toString()); + } + } + catch (FileNotFoundException e) + { + e.printStackTrace(); + } + catch (IOException e) + { + e.printStackTrace(); + } + finally + { + if (is != null) + { + try + { + is.close(); + } + catch(Exception ex) + {} + } + + if (bis != null) + { + try + { + bis.close(); + } + catch(Exception ex) + {} + } + + if (reader != null) + { + try + { + reader.close(); + } + catch(Exception ex) + {} + } + } + + return cartBean; + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/stock/InventoryManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/stock/InventoryManager.java new file mode 100644 index 0000000000..10bb5e46c7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/stock/InventoryManager.java @@ -0,0 +1,788 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 4, 2006 by alok + */ + + +package org.posterita.businesslogic.stock; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Properties; + +import javax.swing.text.NumberFormatter; + +import org.compiere.model.MDocType; +import org.compiere.model.MInventory; +import org.compiere.model.MInventoryLine; +import org.compiere.model.MPInstance; +import org.compiere.model.MProduct; +import org.compiere.model.MProductPrice; +import org.compiere.model.MUOM; +import org.compiere.process.DocumentEngine; +import org.compiere.process.InventoryCountCreate; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.beans.InventoryBean; +import org.posterita.beans.InventoryLineBean; +import org.posterita.beans.ProductBean; +import org.posterita.businesslogic.POSProductManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.exceptions.CannotCreateInventoryLineException; +import org.posterita.exceptions.NoCheckBoxSelectedException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; + + +public class InventoryManager +{ + private static final int CREATE_INVENTORY_COUNT_LIST_PROCESS=289; + + public static MInventory createInventory(Properties ctx,String description,String trxName) throws OperationException + { + MInventory inventory = new MInventory(ctx,0,trxName); + MDocType[] docTypes= MDocType.getOfDocBaseType(ctx,MDocType.DOCBASETYPE_MaterialPhysicalInventory); + if(docTypes.length>1) + throw new OperationException("More than one document type for Physical Inventory"); + + inventory.setC_DocType_ID(docTypes[0].get_ID()); + inventory.setM_Warehouse_ID(POSTerminalManager.getWarehouseId(ctx)); + if(description!=null) + inventory.setDescription(description); + + PoManager.save(inventory); + return inventory; + + } + + /** + * Add Inventory Line + * @param ctx + * @param inventoryId + * @param productId + * @param qtyCount + * @param updateCount + * @param trxName + * @return + * @throws OperationException + */ + public static boolean addInventoryLine(Properties ctx, Integer inventoryId,Integer productId, BigDecimal qtyCsv, BigDecimal qtyCount, boolean updateCount,String trxName) throws OperationException + { + if(productId == null || productId.intValue()==0) + { + throw new ProductNotFoundException("product not available"); + } + + MProduct product = new MProduct(ctx,productId.intValue(),trxName); + if(product.getProductType().equalsIgnoreCase(MProduct.PRODUCTTYPE_Service)) + { + throw new CannotCreateInventoryLineException("product is a service, cannot add to inventory"); + } + MInventory inventory = new MInventory(ctx,inventoryId,trxName); + MInventoryLine inventoryLine[]=inventory.getLines(true); + boolean added=true; + if(inventoryLine.length>0) + { + for(int i=0;i 1) + { + throw new OperationException("More that one inventory lines found matching criteria"); + } + else + { + return inventoryLines[0]; + } + + } + + public static void addAllProductsInventoryLine(Properties ctx, Integer inventoryId,String trxName) throws OperationException + { + + MPInstance instance = new MPInstance(ctx,CREATE_INVENTORY_COUNT_LIST_PROCESS,inventoryId.intValue()); + instance.save(); + ProcessInfo poInfo = new ProcessInfo("Create Inventory Count List",CREATE_INVENTORY_COUNT_LIST_PROCESS); + // poInfo.setParameter(param); + poInfo.setRecord_ID(inventoryId.intValue()); + poInfo.setAD_Process_ID(CREATE_INVENTORY_COUNT_LIST_PROCESS); + poInfo.setAD_PInstance_ID(instance.get_ID()); + InventoryCountCreate countCreate = new InventoryCountCreate(); + Trx trx = Trx.get(trxName, false); + boolean success = countCreate.startProcess(ctx,poInfo,trx); + if(success==false) + throw new OperationException("Problem encountered while creating inventory"); + } + + + public static ArrayList getInventoryLines(Properties ctx,int inventoryId) throws OperationException + { + + MInventory inventory = new MInventory(ctx,inventoryId,null); + MInventoryLine inventoryLine[]=inventory.getLines(true); + + ArrayList countList = new ArrayList(); + + InventoryLineBean bean=null; + BigDecimal bookQtyValue=null; + BigDecimal countQtyValue=null; + + for(int i=0;i list=new ArrayList(); + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean=new InventoryBean(); + + bean.setInventoryId(rs.getInt(1)); + bean.setInventoryNo(rs.getString(2)); + bean.setMovementDate(rs.getString(3)); + bean.setDocStatus(rs.getString(5)); + bean.setDescription(rs.getString(4)); + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch (SQLException e) + { + + } + + } + return list; + + } + + public static ArrayList viewInventoryHistory(Properties ctx, int adOrgId, int productId, Timestamp fromDate, Timestamp toDate, String trxName) throws OperationException + { + + String sql = "SELECT inv.M_Inventory_ID, inv.documentNo, inv.movementDate, inv.description, inv.docStatus" + + " FROM M_Inventory inv INNER JOIN m_inventoryline invl ON"+ + " inv.M_Inventory_ID = invl.M_Inventory_ID WHERE"+ + " invl.M_Product_ID = "+ productId +" AND"+ + " inv.AD_Client_ID = "+Env.getAD_Client_ID(ctx)+" AND"+ + " inv.AD_Org_ID = "+ adOrgId+ " AND"+ + " inv.movementDate BETWEEN " + DB.TO_DATE(fromDate, false) + " AND " + DB.TO_DATE(toDate, false); + + PreparedStatement pstmt = DB.prepareStatement(sql,trxName); + ResultSet rs = null; + InventoryBean bean=null; + + ArrayList list=new ArrayList(); + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean=new InventoryBean(); + + bean.setInventoryId(rs.getInt(1)); + bean.setInventoryNo(rs.getString(2)); + bean.setMovementDate(rs.getString(3)); + bean.setDocStatus(rs.getString(5)); + bean.setDescription(rs.getString(4)); + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + close(pstmt, rs); + } + return list; + + } + + private static void close(PreparedStatement pstmt, ResultSet rs) throws OperationException + { + if (pstmt!=null) + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + throw new OperationException("Could not close prepared statement" , ex); + } + finally + { + pstmt = null; + } + } + if (rs != null) + { + try + { + rs.close(); + } + catch (Exception ex) + { + throw new OperationException("Could not close result set", ex); + } + finally + { + rs = null; + } + } + } + + public static String getInventoryDocStatus(Properties ctx,int inventoryId) + { + MInventory inventory = new MInventory(ctx,inventoryId,null); + return inventory.getDocStatus(); + + } + + + private static void updateCountQty(Properties ctx,int inventoryID) + { + String sql = "update M_INVENTORYLINE set QTYCOUNT=1 where M_INVENTORYLINE_ID="+ + "(select max(M_INVENTORYLINE_ID) from M_INVENTORYLINE where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ + " and M_INVENTORY_ID="+inventoryID+")"; + DB.executeUpdate(sql, null); + } + + public static String createCSVForInventory(Properties ctx,ArrayList list) throws OperationException + { + Object[] columns = null; + ArrayList objectList = new ArrayList(); + Object[] header =new Object[]{"Name","Barcode","QtyBook","QtyCount","Book Qty Value","Count Qty Value"}; + objectList.add(header); + + double sumQtyBook = 0.0d; + double sumQtyCount = 0.0d; + double sumBookQtyValue = 0.0d; + double sumCountQtyValue = 0.0d; + + for(InventoryBean bean : list) + { + columns = new Object[]{ + bean.getProductName(), + bean.getBarCode(), + bean.getQtyBook(), + bean.getQtyCount(), + bean.getBookQtyValue(), + bean.getCountQtyValue() + }; + objectList.add(columns); + + sumQtyBook += bean.getQtyBook().doubleValue(); + sumQtyCount += bean.getQtyCount().doubleValue(); + sumBookQtyValue += bean.getBookQtyValue().doubleValue(); + sumCountQtyValue += bean.getCountQtyValue().doubleValue(); + } + Object[] total = new Object[]{ + "Total", + " ", + new Double(sumQtyBook), + new Double(sumQtyCount), + new Double(sumBookQtyValue), + new Double(sumCountQtyValue) + }; + objectList.add(total); + + return CSVReportManager.generateCSVReport(ctx,objectList); + } + + public static void deleteInventory(Properties ctx,int inventoryId) + { + MInventory inventory = new MInventory(ctx,inventoryId,null); + inventory.delete(true); + } + + public static void deleteInventoryLine(Properties ctx,int inventoryId,int M_INVENTORYLINE_ID) + { + String sql="delete from M_INVENTORYLine where M_INVENTORYLINE_ID="+M_INVENTORYLINE_ID+ + " and M_INVENTORY_ID="+inventoryId+ + " and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + + DB.executeUpdate(sql,null); + } + + + public static MInventory mergeInventory(Properties ctx,InventoryBean bean,String trxName) throws OperationException + { + if(bean.getInventoryIds()==null || bean.getInventoryIds().length==0) + { + throw new NoCheckBoxSelectedException("Please select an Inventory"); + } + + MInventory inventory=createInventory(ctx,"Combined created on "+new Timestamp(System.currentTimeMillis()),trxName); + + for(int i = 0; i < bean.getInventoryIds().length; i++) + { + MInventory existingInv = new MInventory(ctx, bean.getInventoryIds()[i],trxName); + + MInventoryLine [] line = existingInv.getLines(true); + + for( int j = 0 ; j< line.length ; j++) + { + addInventoryLine(ctx, inventory.get_ID(),line[j].getProduct().get_ID(), line[j].getQtyCsv(), line[j].getQtyCount(), true, trxName); + } + + existingInv.processIt(DocumentEngine.ACTION_Void); + PoManager.save(existingInv); + } + + return inventory; + } + + + private static ArrayList getProductsNotScanned(Properties ctx, int inventoryId) throws OperationException + { + String sql = "select pr.m_product_id " + + "from M_PRODUCT pr" + + " where not Exists" + + "(select * from m_inventory inv,M_INVENTORYLINE invl" + + " where inv.m_inventory_id=" +inventoryId+ + " and inv.m_inventory_id=invl.m_inventory_id" + + " and invl.m_product_id=pr.m_product_id) " + + // Fix: Cannot do inventory on product that has no storage yet (i.e: No PO/SO) + " and Exists (select * from M_Storage s where s.M_Product_ID=pr.M_Product_ID) " + + "and pr.isactive='Y'" + + " and pr.AD_CLIENT_ID = "+Env.getAD_Client_ID(ctx)+ + " and pr.productType='"+MProduct.PRODUCTTYPE_Item+"'"; + + + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + ArrayList list = new ArrayList(); + + try + { + ResultSet rs = pstmt.executeQuery(); + while(rs.next()) + { + list.add(Integer.valueOf(rs.getInt(1))); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (SQLException e) + { + + } + } + + return list; + } + + + //------------------------------------------------------------------------------------------// + + public static ArrayList getInventoryReportData(Properties ctx, int inventoryId, String trxName) throws OperationException, SQLException, ParseException + { + ArrayList reportData = new ArrayList(); + NumberFormatter qtyformatter = new NumberFormatter(new DecimalFormat("0")); + NumberFormatter valueformatter = new NumberFormatter(new DecimalFormat("0.00")); + + MInventory inventory = new MInventory(ctx,inventoryId,null); + MInventoryLine inventoryLine[]=inventory.getLines(true); + + String productName = null; + BigDecimal qtyBook = Env.ZERO; + BigDecimal qtyCount = Env.ZERO; + BigDecimal bookValue = Env.ZERO; + BigDecimal countValue = Env.ZERO; + BigDecimal qtyBookTotal = Env.ZERO; + BigDecimal qtyCountTotal = Env.ZERO; + BigDecimal valueBookTotal = Env.ZERO; + BigDecimal valueCountTotal = Env.ZERO; + BigDecimal qtyDifference = Env.ZERO; + BigDecimal valueDifference = Env.ZERO; + + + for(int i=0;i list=new ArrayList(); + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean=new InventoryBean(); + + bean.setInventoryId(rs.getInt(1)); + bean.setInventoryNo(rs.getString(2)); + bean.setMovementDate(rs.getString(3)); + bean.setDocStatus(rs.getString(5)); + bean.setDescription(rs.getString(4)); + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch (SQLException e) + { + + } + + } + return list; + + } + + public static ArrayList searchProductInInventory(Properties ctx, Integer productId, String barcode) throws OperationException + { + StringBuffer sql = new StringBuffer(); + + sql.append(" select inv.m_inventory_id, inv.documentno, to_char(inv.movementdate,'dd/Mon/yyyy'), inv.description, inv.docstatus"); + sql.append(" from m_inventory inv"); + sql.append(" inner join m_inventoryline invl on invl.m_inventory_id = inv.m_inventory_id"); + sql.append(" where inv.AD_CLIENT_ID=").append(Env.getAD_Client_ID(ctx)); + sql.append(" and inv.ad_org_id=").append(Env.getAD_Org_ID(ctx)); + sql.append(" and invl.m_product_id ="); + + + if(productId != null) + { + sql.append(productId); + } + + if(barcode != null) + { + ProductBean pBean = POSProductManager.getProduct(ctx, barcode, null); + sql.append(pBean.getProductId()); + } + + sql.append(" order by DOCUMENTNO desc"); + + PreparedStatement pstmt = DB.prepareStatement(sql.toString(),null); + + InventoryBean bean=null; + + ArrayList list=new ArrayList(); + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean=new InventoryBean(); + + bean.setInventoryId(rs.getInt(1)); + bean.setInventoryNo(rs.getString(2)); + bean.setMovementDate(rs.getString(3)); + bean.setDocStatus(rs.getString(5)); + bean.setDescription(rs.getString(4)); + list.add(bean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + + pstmt.close(); + } + catch (SQLException e) + { + + } + + } + return list; + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/stock/MMovementManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/stock/MMovementManager.java new file mode 100644 index 0000000000..0bc2286ffa --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/stock/MMovementManager.java @@ -0,0 +1,1405 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on May 22, 2006 by alok + */ +package org.posterita.businesslogic.stock; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.swing.text.NumberFormatter; + +import org.apache.ecs.xhtml.div; +import org.apache.ecs.xhtml.input; +import org.apache.ecs.xhtml.table; +import org.apache.ecs.xhtml.td; +import org.apache.ecs.xhtml.th; +import org.apache.ecs.xhtml.tr; +import org.compiere.model.MDocType; +import org.compiere.model.MGLCategory; +import org.compiere.model.MLocation; +import org.compiere.model.MLocator; +import org.compiere.model.MMovement; +import org.compiere.model.MMovementConfirm; +import org.compiere.model.MMovementLine; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MOrgInfo; +import org.compiere.model.MPriceList; +import org.compiere.model.MProduct; +import org.compiere.model.MProductPrice; +import org.compiere.model.MStorage; +import org.compiere.model.MWarehouse; +import org.compiere.process.DocAction; +import org.compiere.process.DocumentEngine; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.TangoColors; +import org.posterita.beans.ItemBean; +import org.posterita.beans.MMovementCartBean; +import org.posterita.beans.PaymentDetailsBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.beans.StockMovementBean; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.PaymentManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.WarehouseManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.lib.UdiConstants; +import org.posterita.util.PoManager; +/** + * manager for moving product between warehouses and locators + * @author sendy + * + */ +public class MMovementManager +{ + /** + * Create New Inventory Move (Material Movement) + * @param ctx + * @param description + * @param trxName + * @return MMovement + * @throws OperationException + */ + public static MMovement createInventoryMove(Properties ctx,String description,String trxName) throws OperationException + { + MMovement mmovement = new MMovement(ctx, 0, trxName); + mmovement.setDescription(description); + // Set Material Movement Document + int docTypeId = getDocType(ctx, "Inter Branch Transfer"); + mmovement.setC_DocType_ID(docTypeId); + + PoManager.save(mmovement); + return mmovement; + + } + + /** + * Get Document Type + * @param ctx + * @param name + * @return + * @throws OperationException + */ + private static int getDocType(Properties ctx, String name) throws OperationException + { + if (name == null) + { + return 0; + } + + int[] docTypesMM = MDocType.getAllIDs(MDocType.Table_Name, "AD_Client_ID = "+ Env.getAD_Client_ID(ctx)+ " AND docBaseType = '" + MDocType.DOCBASETYPE_MaterialMovement + "' AND name = '" + name +"'", null); + + int docType_Id = 0; + int[] glc = MGLCategory.getAllIDs(MGLCategory.Table_Name, "AD_Client_ID = "+ Env.getAD_Client_ID(ctx)+" AND name = 'Material Management'", null); + + if (glc.length == 0) + { + throw new OperationException("gl category does not exist"); + + } + if (glc.length > 1) + { + throw new OperationException("more than one gl category found"); + } + + int gl_catId = glc[0]; + if (docTypesMM.length == 0) + { + MDocType docType = new MDocType(ctx, 0 ,null); + docType.setAD_Org_ID(0); + docType.setName(name); + docType.setPrintName(name); + docType.setGL_Category_ID(gl_catId); + docType.setDocBaseType(MDocType.DOCBASETYPE_MaterialMovement); + docType.setIsInTransit(true); + docType.save(); + docType_Id = docType.getC_DocType_ID(); + } + else if (docTypesMM.length> 1) + { + throw new OperationException("Error while getting document type for material movement"); + } + + else + { + docType_Id = docTypesMM[0]; + } + + return docType_Id; + } + + /** + * Check Locator + * @param locatorFrom + * @param locatorTo + * @throws OperationException + */ + private static void checkLocator(int locatorFrom, int locatorTo) throws OperationException + { + if (locatorFrom == 0 || locatorTo == 0) + { + throw new OperationException("No warehouse locators defined"); + } + + if (locatorFrom == locatorTo) + { + throw new OperationException("Organisation from cannot be equal to Organisation To!"); + } + + } + + /** + * Get Locator + * @param ctx + * @param adClientId + * @param org + * @param trxName + * @return + */ + private static int getLocator(Properties ctx, int adClientId, MOrg org, String trxName) + { + MOrgInfo orgInfo = org.getInfo(); + + int warehouseId = orgInfo.getM_Warehouse_ID(); + + int[] locator = MLocator.getAllIDs(MLocator.Table_Name, "AD_Client_ID = "+ adClientId + + " AND AD_Org_ID = " + org.getAD_Org_ID() + + " AND M_Warehouse_ID = " + warehouseId, trxName); + + if (locator.length == 0) + { + return 0; + } + + else + { + return locator[0]; + } + + } + + /** + * Create Or Update Material Movement Line + * @param ctx + * @param movementId + * @param productId + * @param qtyToMove + * @param fromLocatorId + * @param toLocatorId + * @param trxName + * @return + * @throws OperationException + */ + public static boolean createOrUpdateMaterialMovementLine(Properties ctx, int movementId, int productId, BigDecimal qtyToMove, int fromLocatorId, int toLocatorId, String trxName) throws OperationException + { + if (trxName == null) + { + throw new OperationException("transaction cannot be null while creating a material movement line"); + } + + if (movementId < 1) + { + throw new OperationException("movement Id is mandatory"); + } + + if(productId ==0) + { + throw new ProductNotFoundException("product not available"); + } + + MProduct product = new MProduct(ctx, productId, trxName); + if(product.getProductType().equalsIgnoreCase(MProduct.PRODUCTTYPE_Service)) + { + throw new OperationException("product is a service, cannot add to stock transfer"); + } + + checkLocator(fromLocatorId, toLocatorId); + + MMovement movement = new MMovement(ctx, movementId, trxName); + MMovementLine[] movementLine = movement.getLines(true); + boolean added = true; + + if(movementLine.length>0) + { + for(int i=0;i getAvailableProducts(Properties ctx, int orgId, String productName, + String description, String barcode, String trxName) throws ProductNotFoundException + { + + ArrayList productList = new ArrayList(); + StringBuffer sql = new StringBuffer("SELECT s.M_Product_ID FROM M_Storage s INNER JOIN M_Product p on ") + .append("s.M_Product_ID = p.M_Product_ID WHERE s.AD_Client_ID = ? AND s.AD_Org_ID = ? "); + + ArrayList list = new ArrayList(); + if (productName!=null && !"".equals(productName)) + { + sql.append(" AND lower(p.name) like lower(%?%)"); + list.add(productName); + } + if (description!=null && !"".equals(description)) + { + sql.append(" AND lower(p.description) like " +"(%?%)"); + list.add(description); + } + if (barcode!=null && !"".equals(barcode)) + { + sql.append(" AND p.upc = ?"); + list.add(barcode); + } + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement (sql.toString(), trxName); + pstmt.setInt(1, Env.getAD_Client_ID(ctx)); + pstmt.setInt(2, orgId); + + for (int i = 0; i convertToBeanList(Properties ctx, ArrayList prodList, HashMap stockProductList, ArrayList product, int preOrgFromId, int orgFromId, int orgToId, String trxName) throws OperationException + { + MOrg orgFrom = MOrg.get(ctx, orgFromId); + MOrgInfo orgInfo = orgFrom.getInfo(); + int warehouseId = orgInfo.getM_Warehouse_ID(); + + MOrg orgTo = MOrg.get(ctx, orgToId); + + if (orgFromId != preOrgFromId) + { + if (prodList != null) + { + prodList.clear(); + } + preOrgFromId = orgFromId; + } + + Iterator prodIter = product.iterator(); + while (prodIter.hasNext()) + { + StockMovementBean stockBean = new StockMovementBean(); + MProduct prod = prodIter.next(); + + if (!stockProductList.containsKey(prod.getM_Product_ID())) + { + stockBean = getStockMovementBean(ctx, 0, prod, orgFrom, orgTo, Env.ZERO); + } + + prodList.add(stockBean); + stockProductList.put(prod.getM_Product_ID(), stockBean); + } + return prodList; + } + + /** + * + * @param ctx + * @param movementLineId + * @param product + * @param orgFrom + * @param orgTo + * @param qtyToMove + * @return + * @throws OperationException + */ + public static StockMovementBean getStockMovementBean(Properties ctx, int movementLineId, MProduct product, + MOrg orgFrom, MOrg orgTo, BigDecimal qtyToMove) throws OperationException + { + StockMovementBean stockBean = new StockMovementBean(); + + int movementId = 0; + BigDecimal qtyAvailable = Env.ZERO; + String documentNo = ""; + String docStatus = ""; + int lineNo = 0; + + if (product == null) + { + throw new OperationException("product cannot be null"); + } + if (orgFrom == null || orgTo == null) + { + throw new OperationException("organisations cannot be null"); + } + + MWarehouse warehouseFrom = MWarehouse.get(ctx, orgFrom.getInfo().getM_Warehouse_ID()); + MLocator fromLoc = MLocator.get(ctx, warehouseFrom.get_ID(), warehouseFrom.getName()+" Locator", "0", "0", "0"); + qtyAvailable = MStorage.getQtyAvailable(warehouseFrom.get_ID(), fromLoc.getM_Locator_ID(), product.getM_Product_ID(), + 0, null); + + MMovementLine movementLine = new MMovementLine(ctx, movementLineId, null); + if (movementLineId != 0) + { + movementId = movementLine.getM_Movement_ID(); + fromLoc = MLocator.get(ctx,movementLine.getM_Locator_ID()); + orgFrom = MOrg.get(ctx, fromLoc.getAD_Org_ID()); + + MLocator toLoc = MLocator.get(ctx,movementLine.getM_LocatorTo_ID()); + orgTo = MOrg.get(ctx, toLoc.getAD_Org_ID()); + + qtyToMove = movementLine.getMovementQty(); + + MMovement movement = new MMovement(ctx, movementLine.getM_Movement_ID(), null); + documentNo = movement.getDocumentNo(); + docStatus = movement.getDocStatus(); + lineNo = movementLine.getLine(); + } + stockBean.setMovementId(movementId); + stockBean.setMovementLineId(movementLineId); + stockBean.setLineNo(lineNo); + stockBean.setDocumentNo(documentNo); + stockBean.setDocStatus(docStatus); + stockBean.setProductId(product.getM_Product_ID()); + stockBean.setProductName(product.getName()); + stockBean.setOrgFromName(orgFrom.getName()); + stockBean.setOrgToName(orgTo.getName()); + stockBean.setIsActive(product.isActive()); + stockBean.setDescription(product.getDescription()); + stockBean.setBarCode(product.getUPC()); + stockBean.setQtyOnHand(qtyAvailable); + stockBean.setQtyToMove(Env.ZERO); + stockBean.setOrgFromId(orgFrom.get_ID()); + stockBean.setOrgToId(orgTo.get_ID()); + stockBean.setUom(product.getUOMSymbol()); + stockBean.setQuantity(qtyToMove); + return stockBean; + } + + /** + * + * @param productId + * @param stockProductList + * @return + */ + public static StockMovementBean getStockBean(int productId , HashMap stockProductList) + { + if (stockProductList != null) + { + if (stockProductList.containsKey(productId)) + { + return stockProductList.get(productId); + } + } + + return null; + + } + + /** + * + * @param ctx + * @param movementId + * @return + * @throws OperationException + */ + public static ArrayList getMovementLines(Properties ctx, int movementId) throws OperationException + { + MMovement movement = new MMovement(ctx, movementId, null); + ArrayList movementLines = new ArrayList(); + + MMovementLine[] lines = movement.getLines(true); + + for (MMovementLine line : lines) + { + StockMovementBean bean = new StockMovementBean(); + int locFromId = line.getM_Locator_ID(); + int locToId = line.getM_LocatorTo_ID(); + MLocator locFrom = MLocator.get(ctx, locFromId); + MLocator locTo = MLocator.get(ctx, locToId); + int orgFromId = locFrom.getAD_Org_ID(); + int orgToId = locTo.getAD_Org_ID(); + + MOrg orgFrom = MOrg.get(ctx, orgFromId); + MOrg orgTo = MOrg.get(ctx, orgToId); + + bean = getStockMovementBean(ctx, line.get_ID(), line.getProduct(), orgFrom, orgTo, null); + + movementLines.add(bean); + } + return movementLines; + } + + /** + * + * @param ctx + * @param orgFromId + * @param docStatus + * @param docNo + * @param fromDate + * @param toDate + * @return + * @throws OperationException + */ + public static ArrayList getMovementByOrgFrom(Properties ctx, int orgFromId, String docStatus, String docNo, Timestamp fromDate, Timestamp toDate) throws OperationException + { + ArrayList list = new ArrayList(); + int adClientId = Env.getAD_Client_ID(ctx); + + int docTypeId = getDocType(ctx, "Inter Branch Transfer"); + + StringBuffer sql = new StringBuffer("SELECT DISTINCT(mm.M_Movement_ID) from M_Movement mm INNER JOIN " + + "(M_MovementLine ml INNER JOIN M_Locator lc ON ml.M_Locator_ID = lc.M_Locator_ID) " + + "ON mm.M_Movement_ID = ml.M_Movement_ID WHERE mm.C_DocType_ID = ? " + + "AND mm.AD_Client_ID = ? AND lc.AD_Org_ID = ? "); + + + if (docStatus != null) + { + sql = sql.append(" AND mm.DocStatus = '" + docStatus + "'"); + } + + if (docNo != null) + { + if (docNo.indexOf('%') != -1) + { + sql = sql.append(" AND mm.DocumentNo LIKE '" + docNo + "'"); + } + else + { + sql = sql.append(" AND mm.DocumentNo LIKE '%" + docNo + "%'"); + } + } + + if (fromDate != null && toDate != null) + { + sql = sql.append(" AND mm.movementDate >= " + + DB.TO_DATE(fromDate, true) +" AND mm.movementDate <= " + DB.TO_DATE(toDate, true)); + } + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sql.toString(), null); + pstmt.setInt(1, docTypeId); + pstmt.setInt(2, adClientId); + pstmt.setInt(3, orgFromId); + + rs = pstmt.executeQuery(); + while (rs.next()) + { + int movementId = rs.getInt(1); + + MMovement movement = new MMovement(ctx, movementId, null); + StockMovementBean bean = new StockMovementBean(); + bean.setIsActive(movement.isActive()); + bean.setMovementId(movementId); + bean.setDescription(movement.getDescription()); + bean.setDocStatus(movement.getDocStatus()); + MDocType dt = MDocType.get(ctx, movement.getC_DocType_ID()); + bean.setDocumentType(dt.getName()); + bean.setDocumentNo(movement.getDocumentNo()); + MOrg org = MOrg.get(ctx, movement.getAD_Org_ID()); + bean.setOrgName(org.getName()); + String isApproved = movement.isApproved()? "Y":"N"; + bean.setIsApproved(isApproved); + bean.setMovementDate(String.valueOf(movement.getMovementDate())); + + list.add(bean); + } + } + catch (SQLException e) + { + + } + finally + { + DB.close(rs, pstmt); + rs=null; + pstmt=null; + } + + return list; + } + + /** + * + * @param ctx + * @param orgId + * @param type + * @param productId + * @param fromDate + * @param toDate + * @return + * @throws OperationException + */ + public static ArrayList getMMovement(Properties ctx, String orgId, String type, int productId, Timestamp fromDate, Timestamp toDate) throws OperationException + { + ArrayList list = new ArrayList(); + int adClientId = Env.getAD_Client_ID(ctx); + + int docTypeId = getDocType(ctx, "Inter Branch Transfer"); + + StringBuffer sql = new StringBuffer("SELECT mm.M_Movement_ID, lc.AD_Org_Id from M_Movement mm INNER JOIN "); + if ("1".equals(type)) + { + sql.append("(M_MovementLine ml INNER JOIN M_Locator lc ON ml.M_LocatorTo_ID = lc.M_Locator_ID) "); + } + if ("2".equals(type)) + { + sql.append("(M_MovementLine ml INNER JOIN M_Locator lc ON ml.M_Locator_ID = lc.M_Locator_ID) "); + } + + sql.append("ON mm.M_Movement_ID = ml.M_Movement_ID WHERE ml.M_Product_ID = "+ productId + + " AND mm.AD_Client_ID = "+adClientId+" AND lc.AD_Org_ID =" + orgId + + " AND mm.DocStatus IN ('CO','CL')"); + + + if (fromDate != null && toDate != null) + { + sql = sql.append(" AND mm.MovementDate BETWEEN " + DB.TO_DATE(fromDate, false) + + " AND " + DB.TO_DATE(toDate, false)); + } + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + pstmt = DB.prepareStatement(sql.toString(), null); + rs = pstmt.executeQuery(); + while (rs.next()) + { + int movementId = rs.getInt(1); + int org_Id = rs.getInt(2); + MOrg organisation = MOrg.get(ctx, org_Id); + + MMovement movement = new MMovement(ctx, movementId, null); + StockMovementBean bean = new StockMovementBean(); + bean.setOrgName(organisation.getName()); + bean.setIsActive(movement.isActive()); + bean.setMovementId(movementId); + bean.setDescription(movement.getDescription()); + bean.setDocStatus(movement.getDocStatus()); + MDocType dt = MDocType.get(ctx, movement.getC_DocType_ID()); + bean.setDocumentType(dt.getName()); + bean.setDocumentNo(movement.getDocumentNo()); + String isApproved = movement.isApproved()? "Y":"N"; + bean.setIsApproved(isApproved); + bean.setMovementDate(String.valueOf(movement.getMovementDate())); + + list.add(bean); + } + } + catch (SQLException e) + { + throw new OperationException("could not execute query"+ e); + } + finally + { + DB.close(rs, pstmt); + rs=null; + pstmt=null; + } + + return list; + } + + /** + * + * @param ctx + * @param orgToId + * @param trxName + * @return + */ + public static ArrayList getMoveConfirmByOrgTo(Properties ctx, int orgToId, String trxName) + { + + int adClientId = Env.getAD_Client_ID(ctx); + + MDocType[] docTypes = MDocType.getOfDocBaseType(ctx, MDocType.DOCBASETYPE_MaterialMovement); + int c_doctype_id = 0; + + for(MDocType docType:docTypes) + { + if ("Inter Branch Transfer".equals(docType.getName())) + { + c_doctype_id = docType.getC_DocType_ID(); + } + } + String sql = "SELECT DISTINCT(mc.M_MovementConfirm_ID) FROM M_MovementConfirm mc INNER JOIN (M_Movement mm INNER JOIN " + + "(M_MovementLine ml INNER JOIN M_Locator lc ON ml.M_LocatorTo_ID = lc.M_Locator_ID)" + + "ON mm.M_Movement_ID = ml.M_Movement_ID) ON mc.M_Movement_ID = mm.M_Movement_ID WHERE " + + "mm.C_DocType_ID = ? AND mm.AD_Client_ID = ? AND lc.AD_Org_ID = ?"; + + PreparedStatement pstmt = null; + ResultSet rs = null; + ArrayList m_list = new ArrayList(); + try + { + pstmt = DB.prepareStatement(sql, trxName); + pstmt.setInt(1, c_doctype_id); + pstmt.setInt(2, adClientId); + pstmt.setInt(3, orgToId); + + rs = pstmt.executeQuery(); + + while (rs.next()) + { + int moveConfirmId = rs.getInt(1); + StockMovementBean bean = new StockMovementBean(); + + MMovementConfirm moveConfirm = new MMovementConfirm(ctx, moveConfirmId, trxName); + int movementId = moveConfirm.getM_Movement_ID(); + MMovement movement = new MMovement(ctx, movementId, trxName); + MMovementLine[] lines = movement.getLines(true); + if (lines.length > 0) + { + int locatorId = lines[0].getM_Locator_ID(); + MLocator loc = MLocator.get(ctx, locatorId); + MOrg org = MOrg.get(ctx, loc.getAD_Org_ID()); + bean.setOrgFromName(org.getName()); + } + bean.setMovementId(movementId); + bean.setMoveConfirmId(moveConfirmId); + bean.setIsActive(moveConfirm.isActive()); + bean.setDocStatus(moveConfirm.getDocStatus()); + bean.setDocumentNo(movement.getDocumentNo()); + bean.setMovementDate(String.valueOf(movement.getMovementDate())); + m_list.add(bean); + } + } + catch (SQLException e) + { + + } + finally + { + DB.close(rs, pstmt); + rs=null; + pstmt=null; + } + + return m_list; + } + + /** + * + * @param ctx + * @param moveConfirmId + * @param trxName + * @throws OperationException + */ + public static void completeMoveConfirm(Properties ctx, int moveConfirmId, + String trxName) throws OperationException + { + + MMovementConfirm moveConfirm = new MMovementConfirm(ctx, moveConfirmId, trxName); + String docStatus = moveConfirm.getDocStatus(); + int movementId = moveConfirm.getM_Movement_ID(); + + + if (!docStatus.equals(DocAction.STATUS_Drafted) || docStatus.equals(DocAction.STATUS_InProgress)) + { + throw new OperationException("material movement document status invalid"); + } + + moveConfirm.setDocStatus(DocumentEngine.STATUS_Completed); + moveConfirm.setDocAction(DocumentEngine.ACTION_Close); + moveConfirm.completeIt(); + moveConfirm.save(); + + MMovement movement = new MMovement(ctx, movementId, trxName); + movement.setIsApproved(true); + movement.save(); + } + + /** + * + * @param ctx + * @param list + * @param moveConfirmId + * @return + */ + public static ArrayList getConfirmList(Properties ctx, + ArrayList list, int moveConfirmId) + { + Iterator iter = list.iterator(); + while (iter.hasNext()) + { + StockMovementBean bean = iter.next(); + int movId = bean.getMoveConfirmId(); + if (movId == moveConfirmId) + { + MMovementConfirm mvConfirm = new MMovementConfirm(ctx, moveConfirmId, null); + bean.setDocStatus(mvConfirm.getDocStatus()); + } + } + return list; + } + + /** + * + * @param ctx + * @param list + * @param movementId + * @return + */ + public static ArrayList getMoveList(Properties ctx, + ArrayList list, int movementId) + { + if (list != null) + { + Iterator iter = list.iterator(); + while (iter.hasNext()) + { + StockMovementBean bean = iter.next(); + int movId = bean.getMovementId(); + + if (movId == movementId) + { + MMovement movement = new MMovement(ctx, movId, null); + bean.setDocStatus(movement.getDocStatus()); + } + } + } + return list; + } + + /** + * + * @param ctx + * @param movementId + * @return + */ + public static StockMovementBean getBean(Properties ctx, int movementId) + { + MMovement movement = new MMovement(ctx, movementId, null); + MMovementLine[] lines = movement.getLines(true); + + MLocator locFrom = new MLocator(ctx,lines[0] .getM_Locator_ID(), null); + MLocator locTo = new MLocator(ctx, lines[0].getM_LocatorTo_ID(), null); + + MOrg orgFrom = MOrg.get(ctx, locFrom.getAD_Org_ID()); + MOrg orgTo = MOrg.get(ctx, locTo.getAD_Org_ID()); + + MOrgInfo orgFromInfo = orgFrom.getInfo(); + MOrgInfo orgToInfo = orgTo.getInfo(); + + MLocation locationFrom = MLocation.get(ctx, orgFromInfo.getC_Location_ID(), null); + MLocation locationTo = MLocation.get(ctx, orgToInfo.getC_Location_ID(), null); + + StockMovementBean bean = new StockMovementBean(); + + String addressFrom = locationFrom.getAddress1() == null? "":locationFrom.getAddress1(); + String addressTo = locationTo.getAddress1() == null? "":locationTo.getAddress1(); + + bean.setAddress1(addressFrom); + bean.setAddress2(addressTo); + bean.setDocStatus(movement.getDocStatus()); + bean.setDocumentNo(movement.getDocumentNo()); + bean.setMovementDate(movement.getMovementDate().toString()); + bean.setOrgFromName(orgFrom.getName()); + bean.setOrgToName(orgTo.getName()); + + return bean; + + } + + /** + * + * @param ctx + * @param qtyToMove + * @param index + * @param salesPriceListId + * @param list + * @return + * @throws OperationException + */ + public static BigDecimal setQtyToMove(Properties ctx, BigDecimal qtyToMove, Integer index, Integer salesPriceListId, ArrayList list) throws OperationException + { + qtyToMove = qtyToMove == null? Env.ZERO : qtyToMove; + + if (index == null) + { + throw new OperationException("stock index is null"); + } + + StockMovementBean bean = list.get(index); + + BigDecimal salesPriceList = Env.ZERO; + if (salesPriceListId == 0) + { + salesPriceListId = POSTerminalManager.getSOPriceListId(ctx); + } + + MPriceList priceList = MPriceList.get(ctx, salesPriceListId, null); + MProductPrice productPrice = MProductPrice.get(ctx, + PriceListManager.getPriceListVersionID(ctx, salesPriceListId, null), bean.getProductId(), null); + if (productPrice != null) + { + salesPriceList = productPrice.getPriceList(); + } + BigDecimal stockValue = salesPriceList.multiply(qtyToMove); + bean.setStockValue(stockValue); + bean.setQtyToMove(qtyToMove); + return stockValue; + } + + //***********************************************************************************************// + + /** + * Get Stock Transfer Cart in HTML + * @param itemList + * @param ctx + * @return + * @throws ParseException + * @throws OperationException + */ + private static String getMMovementCartAsHTML(ArrayList itemList, Properties ctx) throws ParseException, OperationException + { + NumberFormatter formatter = new NumberFormatter(new DecimalFormat("0.00")); + + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + String currSymbol = PriceListManager.getCurrency(ctx, priceListId); + + BigDecimal totalQty = Env.ZERO; + BigDecimal totalValue = Env.ZERO; + + String[] headers = {"Product Name","Description","Barcode","UOM", "Qty Available", "No of Pack", "Qty To Move", "Stock Value"}; + table tbl = new table("0", "0", "0", "100%", ""); + tbl.setID("cart"); + tbl.setBgColor(TangoColors.ALUMINIUM_2); + + BigDecimal qty = Env.ZERO; + BigDecimal stockValue = Env.ZERO; + + tr headerRow = new tr(); + headerRow.setClass("itemTitleList"); + + + for(String header : headers) + { + th h = new th(header); + headerRow.addElement(h); + } + + tbl.addElement(headerRow); + + //add body + int count = 0; + + if(itemList != null) + for(ItemBean bean : itemList) + { + count ++; + + tr dataRow = new tr(); + + if(count % 2 == 0) + { + dataRow.setClass("evenRow"); + } + else + { + dataRow.setClass("oddRow"); + } + dataRow.setID("row" + count); + dataRow.addAttribute("productId", bean.getProductId().toString()); + dataRow.addAttribute("qty", bean.getQtyToMove().toString()); + dataRow.addAttribute("unitsPerPack", bean.getUnitsPerPack().toString()); + qty = bean.getQtyToMove(); + stockValue = bean.getStockValue(); + + input packSize = new input("text", "packSize" + count, bean.getNoOfPack()); + packSize.setID("packSize" + count); + packSize.setSize(10); + + totalQty = totalQty.add(qty); + totalValue = totalValue.add(stockValue); + String[] columnData = { + bean.getProductName(), + bean.getDescription(), + bean.getBarCode(), + bean.getUom(), + bean.getQtyBook().toString(), + packSize.toString(), + bean.getQtyToMove().toString(), + bean.getStockValue().toString() + }; + + for(int i=0; iTOTAL STOCK TO BE TRANSFERED:  ").setColSpan("6")); + footerRow.addElement(new td(new div(totalQty.toString()).setID("cartTotal"))); + footerRow.addElement(new td(new div(totalValue.toString()).setID("totalStockValue"))); + + tbl.addElement(footerRow); + + + return tbl.toString(); + } + + + /** + * Get Stock Transfer Cart in HTML + * @param request + * @return + * @throws ParseException + * @throws OperationException + */ + public static String getMMovementCartAsHTML(HttpServletRequest request) throws ParseException, OperationException + { + //add body + ArrayList itemList = (ArrayList) request.getSession().getAttribute(Constants.MMOVEMENT_CART_ITEMS); + Properties ctx = TmkJSPEnv.getCtx(request); + return getMMovementCartAsHTML(itemList, ctx); + } + + /** + * Clear Stock Transfer Cart + * @param request + */ + public static void clearCart(Properties ctx, HttpServletRequest request) + { + request.setAttribute("qtyTotal", null); + request.setAttribute("grandTotal", null); + + Env.setContext(ctx, Constants.MMOVEMENT_ID, ""); + request.getSession().removeAttribute(Constants.DOC_NO); + request.getSession().removeAttribute(Constants.DOC_STATUS); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.MMOVEMENT_ID); + request.getSession().removeAttribute(Constants.MMOVEMENT_CART); + request.getSession().removeAttribute(Constants.MMOVEMENT_CART_ITEMS); + + } + + /** + * Set the no of pack + * @param ctx + * @param itemBean + * @throws OperationException + */ + public static void setNoOfPack(Properties ctx, ItemBean itemBean) throws OperationException + { + //Load Product + MProduct product = new MProduct(ctx, itemBean.getProductId(),null); + + // Calculate no of pack + BigDecimal UnitsPerPack = new BigDecimal(product.getUnitsPerPack()); + BigDecimal noOfPack = itemBean.getQtyToMove().divide(UnitsPerPack, BigDecimal.ROUND_UP); + itemBean.setNoOfPack(noOfPack.intValue()); + + } + + /** + * Delete Movement line + * @param ctx + * @param movementId + */ + public static void deleteMovementLine(Properties ctx, int movementLineId) + { + // Load Movement lines and force delete + MMovementLine movementLine = new MMovementLine(ctx, movementLineId, null); + movementLine.delete(true, null); + } + + /** + * Delete Movement Lines + * @param ctx + * @param movementId + */ + public static void deleteMovementLines(Properties ctx,int movementId) + { + String sql="delete from M_MovementLine where " + + " M_Movement_Id="+movementId+ + " and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + + DB.executeUpdate(sql,null); + } + + /** + * view Inventory Move (Material Movement) History + * @param ctx + * @return list of inventory move + * @throws OperationException + */ + public static ArrayList viewMMovementHistory(Properties ctx, String docStatus, Integer month, Integer year) throws OperationException + { + + ArrayList stockMovementList = new ArrayList(); + StockMovementBean stockMovementBean = null; + + /** + * SQL FOR MOVEMENT HISTORY + */ + StringBuffer sql = new StringBuffer(); + sql.append(" SELECT M_MOVEMENT_ID") + .append(" FROM M_MOVEMENT ") + .append(" WHERE AD_CLIENT_ID = ").append(Env.getAD_Client_ID(ctx)) + .append(" AND AD_ORG_ID = ").append(Env.getAD_Org_ID(ctx)); + + if (docStatus != null) + { + sql = sql.append(" and docstatus='").append(docStatus).append("'"); + } + + if (month != null) + { + String mm = String.valueOf(month); + if (mm.length() == 1) + { + mm = "0" + mm; + } + + sql = sql.append( " AND TO_CHAR(MOVEMENTDATE, 'mm')= '").append(mm).append("'"); + } + + if (year != null) + { + sql = sql.append(" AND TO_CHAR(MOVEMENTDATE, 'yyyy') ='").append(year).append("'"); + } + + sql.append(" ORDER BY DOCUMENTNO DESC "); + + PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null); + + try + { + ResultSet rs = pstmt.executeQuery(); + + while(rs.next()) + { + stockMovementBean = new StockMovementBean(); + stockMovementBean.setMovementId(rs.getInt(1)); + + MMovement mmovement = new MMovement(ctx, stockMovementBean.getMovementId(), null); + + stockMovementBean.setIsActive(mmovement.isActive()); + stockMovementBean.setDocumentNo(mmovement.getDocumentNo()); + + MDocType docType = new MDocType(ctx, mmovement.getC_DocType_ID(), null); + String documentType = docType.getName() ; + stockMovementBean.setDocumentType(documentType); + + stockMovementBean.setMovementDate(mmovement.getMovementDate().toString()); + stockMovementBean.setDescription(mmovement.getDescription()); + stockMovementBean.setDocStatus(mmovement.getDocStatus()); + + if(mmovement.isApproved() == true) + { + stockMovementBean.setIsApproved("Y"); + } + else + { + stockMovementBean.setIsApproved("N"); + } + + stockMovementList.add(stockMovementBean); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (SQLException e) + { + + } + + } + + return stockMovementList; + } + + /** + * Delete Inventory Move + * @param ctx + * @param movementId + */ + public static void deleteInventoryMove(Properties ctx, int movementId) + { + MMovement movement = new MMovement(ctx, movementId, null); + movement.delete(true); + } + + /** + * Get existing materital movement + * @param ctx + * @param movementId + * @param priceListId + * @return + * @throws OperationException + */ + public static MMovementCartBean getMMovementCartBean(Properties ctx, int movementId, int priceListId) throws OperationException + { + ItemBean bean = null; + ArrayList items = new ArrayList(); + + MMovement movement = new MMovement(ctx, movementId, null); + MMovementLine[] movementLine = movement.getLines(true); + + for (MMovementLine line : movementLine) + { + MProduct product = new MProduct(ctx, line.getM_Product_ID(), null); + + bean = new ItemBean(); + bean.setProductId(product.getM_Product_ID()); + bean.setProductName(product.getName()); + bean.setDescription(product.getDescription()); + bean.setQtyToMove(line.getMovementQty()); + bean.setUnitsPerPack(product.getUnitsPerPack()); + setNoOfPack(ctx, bean); + + int warehouseId = WarehouseManager.getDefaultWarehouse(ctx).getM_Warehouse_ID(); + MLocator locator = MLocator.get(ctx, warehouseId, "", "0", "0", "0"); + BigDecimal qtyAvailable = MStorage.getQtyAvailable(warehouseId, locator.get_ID(), product.getM_Product_ID(), 0, null); + + bean.setQtyBook(qtyAvailable); + + items.add(bean); + } + + + StockManager.setMMovementItemCosts(ctx, priceListId, items, false); + + MMovementCartBean cartBean = new MMovementCartBean(); + cartBean.setItems(items); + + return cartBean; + } + + public static String getMMovementCartFromInventoryMove(Properties ctx, int movementId, String trxName) throws OperationException, ParseException + { + int priceListId = PriceListManager.getDefaultPriceListId(ctx, false); + MMovementCartBean bean = getMMovementCartBean(ctx, movementId, priceListId); + return getMMovementCartAsHTML(bean.getItems(), ctx); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/stock/StockList.java b/posterita/posterita/src/main/org/posterita/businesslogic/stock/StockList.java new file mode 100644 index 0000000000..ba5734c061 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/stock/StockList.java @@ -0,0 +1,69 @@ +package org.posterita.businesslogic.stock; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.util.Env; +import org.posterita.beans.StockMovementBean; +import org.posterita.exceptions.OperationException; + +public class StockList +{ + private ArrayList products; + private BigDecimal noOfProducts = Env.ZERO; + private Properties ctx = null; + + public StockList(Properties ctx) + { + this.ctx = ctx; + products = new ArrayList(); + } + + public void addMovementLine(StockMovementBean bean) + { + noOfProducts = noOfProducts.add(Env.ONE); + + products.add(bean); + } + + public void removeMovementLine(StockMovementBean bean) + { + products.remove(bean); + noOfProducts = noOfProducts.subtract(Env.ONE); + } + + public void clear() + { + products.clear(); + noOfProducts = Env.ZERO; + } + + public BigDecimal getNoOfProducts() + { + return noOfProducts; + } + + public ArrayList getStockProducts() throws OperationException + { + ArrayList productList = new ArrayList(); + StockMovementBean bean = null; + + Iterator iter = products.iterator(); + + while (iter.hasNext()) + { + bean = iter.next(); + + productList.add(bean); + } + + return productList; + } + + public boolean hasProduct(StockMovementBean stock) + { + return products.contains(stock); + } +} diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/stock/StockManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/stock/StockManager.java new file mode 100644 index 0000000000..5b205d8a65 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/businesslogic/stock/StockManager.java @@ -0,0 +1,1499 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Aug 19, 2005 by alok + * + */ +package org.posterita.businesslogic.stock; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Iterator; +import java.util.Properties; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.poi.hssf.dev.BiffViewer; +import org.compiere.model.MAttribute; +import org.compiere.model.MBPartner; +import org.compiere.model.MLocator; +import org.compiere.model.MPOS; +import org.compiere.model.MPriceList; +import org.compiere.model.MPriceListVersion; +import org.compiere.model.MProduct; +import org.compiere.model.MProductPrice; +import org.compiere.model.MStorage; +import org.compiere.model.MTax; +import org.compiere.model.MTaxCategory; +import org.compiere.model.MUOM; +import org.compiere.model.MWarehouse; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.Constants; +import org.posterita.beans.AttributeValuesPair; +import org.posterita.beans.InventoryBean; +import org.posterita.beans.InventoryCartBean; +import org.posterita.beans.InventoryLineBean; +import org.posterita.beans.ItemBean; +import org.posterita.beans.MMovementCartBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.ProductBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.beans.StockMovementBean; +import org.posterita.businesslogic.AttributeValuesManager; +import org.posterita.businesslogic.POSProductManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.StoreManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.administration.TaxManager; +import org.posterita.businesslogic.administration.WarehouseManager; +import org.posterita.core.utils.FormatBigDecimal; +import org.posterita.exceptions.DiscountLimitException; +import org.posterita.exceptions.InputQuantityLessThanZeroException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.exceptions.QuantityNotAvailableException; +import org.posterita.exceptions.TotalQuantityLessThanZeroException; +import org.posterita.exceptions.UOMValuePrecisionNotValidException; +import org.posterita.lib.UdiConstants; + + +public class StockManager +{ + + public static Comparator getDistinctByAttributeComparator(Properties ctx, int attributeID) + { + final MAttribute attribute = new MAttribute(ctx, attributeID, null); + Comparator c = new Comparator() + { + + public int compare(ProductBean o1, ProductBean o2) + { + ProductBean bean1 = (ProductBean) o1; + ProductBean bean2 = (ProductBean) o2; + + KeyNamePair attributeValuePair1 = (KeyNamePair) bean1.getAttributeValuesMap().get(attribute.getName()); + KeyNamePair attributeValuePair2 = (KeyNamePair) bean2.getAttributeValuesMap().get(attribute.getName()); + + + Integer attributeValueID1 = Integer.valueOf(attributeValuePair1.getKey()); + Integer attributeValueID2 = Integer.valueOf(attributeValuePair2.getKey()); + return (attributeValueID1.compareTo(attributeValueID2)); + } + + }; + + return c; + + } + + + public static ShoppingCartBean addToCart(Properties ctx,OrderLineBean bean, ShoppingCartBean cartBean, String backOrder) throws OperationException + { + validateInputQuantity(ctx,bean, backOrder); + + Integer priceListId = bean.getPriceListId(); + if(priceListId == null) + { + priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + } + + ArrayList oldItems; + if (cartBean == null) + { + cartBean = new ShoppingCartBean(); + String currency = PriceListManager.getCurrency(ctx, priceListId); + cartBean.setCurrency(currency); + oldItems = new ArrayList(); + } + else + { + oldItems = cartBean.getItems(); + } + + ArrayList itemsToBeAdded = getItems(ctx, bean, backOrder); + + oldItems = addToItemList(oldItems, itemsToBeAdded,true); + setPOSItemPrices(ctx, priceListId, oldItems, true); + + cartBean.setItems(oldItems); + cartBean.setTotalPrice(setGrandTotal(oldItems)); + cartBean.setPricelistId(priceListId); + + return cartBean; + } + + + public static BigDecimal setGrandTotal(ArrayList items) + { + Iterator iter = items.iterator(); + + BigDecimal grandTotalPrice = new BigDecimal(0); + + while (iter.hasNext()) + { + ItemBean bean = (ItemBean) iter.next(); + + grandTotalPrice = grandTotalPrice.add(bean.getPrice()); + } + + return FormatBigDecimal.currency(grandTotalPrice); + } + + @SuppressWarnings("unchecked") + public static ShoppingCartBean addToPOSCart(Properties ctx,OrderLineBean bean, ShoppingCartBean cartBean,boolean isSales,boolean ifAdd) + throws OperationException,ProductNotFoundException,ProductNotOnPriceListException, + UOMValuePrecisionNotValidException + { + //setPrice for the items + + ArrayList oldItems; + if (cartBean == null) + { + cartBean = new ShoppingCartBean(); + oldItems = new ArrayList(); + } + else + { + oldItems = cartBean.getItems(); + } + + ArrayList oldItemsClone = (ArrayList)oldItems.clone(); + + ArrayList itemsToBeAdded = getPOSItems(ctx, bean); + oldItems = addToItemList(oldItemsClone, itemsToBeAdded,ifAdd); + // need to take into account business partner price list + + Integer priceListId = bean.getPriceListId(); + Integer bpartnerId = bean.getBpartnerId(); + if (priceListId == null && bpartnerId != null) + { + MBPartner bpartner = MBPartner.get(ctx, bpartnerId); + priceListId = bpartner.getM_PriceList_ID(); + } + + oldItems = setPOSItemPrices(ctx, priceListId, oldItems, isSales); + cartBean.setItems(oldItems); + cartBean.setTotalPrice(setGrandTotal(oldItems)); + cartBean.setPricelistId(priceListId); + + return cartBean; + } + + public static ArrayList setItemPrices(Properties ctx, ArrayList items) throws OperationException + { + +// UDIMPriceListVersion udiSalesPriceListVersion = (UDIMPriceListVersion) GenericSystemObjectsFactory.getFactoryInstance().get(ctx, GenericSystemObjectsFactory.SALES_PRICELV_ID); + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + MPriceList priceList = MPriceList.get(ctx, priceListId, null); + int priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null); + Iterator iter = items.iterator(); + + ItemBean bean; + BigDecimal pricePerUnit; + BigDecimal totalPrice; + + while (iter.hasNext()) + { + bean = (ItemBean) iter.next(); + + pricePerUnit = ProductManager.getListPrice(ctx, priceListVersionId, bean.getProductId(), priceList.isSOPriceList(), null); + + totalPrice = pricePerUnit.multiply(new BigDecimal(bean.getQty().intValue())); + + totalPrice = FormatBigDecimal.currency(totalPrice); + + bean.setActualPrice(pricePerUnit); + bean.setPrice(totalPrice); + } + + return items; + } + + public static ArrayList setPOSItemPrices(Properties ctx, ArrayList items,boolean isSales) throws ProductNotOnPriceListException,OperationException + { + ArrayList list = setPOSItemPrices(ctx, 0, items, isSales); + + return list; + } + + + public static ArrayList setPOSItemPrices(Properties ctx, int priceListId, ArrayList items,boolean isSales) throws ProductNotOnPriceListException,OperationException + { + if (items == null || items.size() == 0) + { + return items; + } + + if (priceListId == 0) + { + priceListId = POSTerminalManager.getPriceListId(ctx, isSales); + } + + MPriceList priceList = MPriceList.get(ctx, priceListId, null); + int precision = MPriceList.getStandardPrecision(ctx, priceListId); + int priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null); + + Iterator iter = items.iterator(); + + ItemBean bean; + + Boolean isTaxIncluded = priceList.isTaxIncluded(); + BigDecimal listPrice = Env.ZERO; + BigDecimal limitPrice = Env.ZERO; + BigDecimal actualPrice = Env.ZERO; + + BigDecimal lineQty = Env.ZERO; + BigDecimal actualLineInclTotalPrice = Env.ZERO; + BigDecimal lineTotalTax = Env.ZERO; + BigDecimal lineUnitTax = Env.ZERO; + BigDecimal lineInclLimitPrice = Env.ZERO; + + BigDecimal orderInclTotal = Env.ZERO; + BigDecimal orderTaxTotal = Env.ZERO; + BigDecimal orderPriceLimitTotal = Env.ZERO; + + BigDecimal qtyTotal= Env.ZERO; + + while (iter.hasNext()) + { + bean = (ItemBean) iter.next(); + MProduct product = new MProduct(ctx,bean.getProductId(),null); + MProductPrice price = MProductPrice.get(ctx, priceListVersionId, bean.getProductId(), null); + if (price == null) + { + throw new ProductNotOnPriceListException(""+updateProductLink(ctx,bean.getProductId())); + } + + listPrice = price.getPriceList(); + limitPrice = price.getPriceLimit(); + bean.setListPrice(listPrice); + + lineQty = bean.getQty(); + BigDecimal lineTotal = listPrice.multiply(lineQty); + + int[] taxIds = MTax.getAllIDs(MTax.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_TAXCATEGORY_ID=" +product.getC_TaxCategory_ID() + " and isActive='Y'",null); + if (taxIds == null || taxIds.length == 0) + { + throw new OperationException("no tax Category for the product, or it has been set inactive"); + } + + MTax tax = new MTax(ctx,taxIds[0],null); + lineTotalTax = tax.calculateTax(lineTotal, isTaxIncluded, 12); + BigDecimal taxMulFactor = (tax.getRate().divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP)).add(Env.ONE); + + bean.setIsTaxIncluded(isTaxIncluded); + + BigDecimal discountedLineInclUnitPrice = Env.ZERO; + BigDecimal discountPercentOnLine = Env.ZERO; + BigDecimal discountedLineTotal = Env.ZERO; + bean.setDiscountedLinePrice(listPrice); + + if (bean.getIsDiscountOnInclUnitPrice()) + { + discountedLineInclUnitPrice = bean.getDiscountedInclUnitPrice().setScale(2, BigDecimal.ROUND_HALF_UP); + bean.setDiscountedLinePrice(discountedLineInclUnitPrice); + } + else if (bean.getIsDiscountOnPercentage()) + { + discountPercentOnLine = bean.getDiscountPercent(); + } + else if (bean.getIsDiscountOnTotal()) + { + discountedLineTotal = bean.getPrice(); + } + + if (discountPercentOnLine != null && !discountPercentOnLine.equals(Env.ZERO)) + { + BigDecimal discFactor = (Env.ONEHUNDRED.subtract(discountPercentOnLine)).divide(Env.ONEHUNDRED, 12, RoundingMode.HALF_DOWN); + actualLineInclTotalPrice = (lineTotal).multiply(discFactor).setScale(2, RoundingMode.HALF_UP); + + } + else if (discountedLineInclUnitPrice != null && !discountedLineInclUnitPrice.equals(Env.ZERO)) + { + if(isTaxIncluded) + { + actualLineInclTotalPrice = ((discountedLineInclUnitPrice.multiply(taxMulFactor)).setScale(2, BigDecimal.ROUND_HALF_UP)).multiply(lineQty); + } + else + { + actualLineInclTotalPrice = (discountedLineInclUnitPrice.multiply(lineQty)).setScale(2, BigDecimal.ROUND_HALF_UP); + } + } + else + { + actualLineInclTotalPrice = lineTotal; + } + + actualPrice = actualLineInclTotalPrice.divide(lineQty).setScale(2, RoundingMode.HALF_UP); + lineUnitTax = tax.calculateTax(actualPrice, isTaxIncluded, 12).setScale(2, RoundingMode.HALF_UP); + lineTotalTax = lineUnitTax.multiply(lineQty); + + if (isTaxIncluded) + { + BigDecimal unitExclPrice = (actualPrice.subtract(lineUnitTax)).setScale(precision, RoundingMode.HALF_DOWN); + bean.setUnitPrice(unitExclPrice); + bean.setInclPrice(actualPrice); + + lineInclLimitPrice = limitPrice; + bean.setPriceLimit(lineInclLimitPrice); + } + else + { + BigDecimal unitInclPrice = (actualPrice.add(lineUnitTax)).setScale(precision, RoundingMode.HALF_DOWN); + bean.setInclPrice(unitInclPrice); + bean.setUnitPrice(actualPrice); + + actualLineInclTotalPrice = (actualLineInclTotalPrice.add(lineTotalTax)).setScale(precision, RoundingMode.HALF_DOWN); + lineInclLimitPrice = limitPrice.add(tax.calculateTax(limitPrice, false, 12)); + bean.setPriceLimit(lineInclLimitPrice.setScale(precision, RoundingMode.HALF_DOWN)); + } + + bean.setPrice(actualLineInclTotalPrice); + bean.setTaxAmt(lineTotalTax.setScale(precision, RoundingMode.HALF_DOWN)); + bean.setTaxRate(tax.getRate()); + bean.setUom(product.getUOMSymbol()); + + orderTaxTotal = orderTaxTotal.add(lineTotalTax).setScale(precision, RoundingMode.HALF_DOWN); + orderInclTotal = orderInclTotal.add(actualLineInclTotalPrice).setScale(precision, RoundingMode.HALF_DOWN); + orderPriceLimitTotal = orderPriceLimitTotal.add(lineInclLimitPrice.multiply(bean.getQty())); + qtyTotal = qtyTotal.add(bean.getQty()); + + bean.setPriceTotal(orderInclTotal); + bean.setTaxTotal(orderTaxTotal); + bean.setgrandTotal(orderInclTotal); + bean.setQtyTotal(qtyTotal); + bean.setPriceLimitTotal(orderPriceLimitTotal); + } + + return items; + } + + public static ArrayList getItems(Properties ctx, OrderLineBean bean, String backOrder) throws OperationException + { + ArrayList orderLines = bean.getOrderLineList(); + + Iterator iter = orderLines.iterator(); + + OrderLineBean orderLineBean; + + ItemBean itemBean; + ArrayList items = new ArrayList(); + + while (iter.hasNext()) + { + orderLineBean = (OrderLineBean) iter.next(); + + itemBean = new ItemBean(); + itemBean.setProductId(orderLineBean.getProductId()); + itemBean.setDescription(ProductManager.getProductName(ctx, orderLineBean.getProductId().intValue())); + itemBean.setQty(orderLineBean.getQuantity()); + itemBean.setBackOrder(backOrder); + + if (orderLineBean.getQuantity().intValue() != 0) + items.add(itemBean); + } + + return items; + } + + public static ArrayList getPOSItems(Properties ctx, OrderLineBean orderLineBean) + throws OperationException,ProductNotFoundException,UOMValuePrecisionNotValidException + { + + ItemBean itemBean; + ArrayList items = new ArrayList(); + int productId = 0; + + if (orderLineBean.getProductId()==null) + { + productId = getProductIdFromBarCode(ctx,orderLineBean.getBarCode()); + orderLineBean.setProductId(Integer.valueOf(productId)); + } + else + { + productId = orderLineBean.getProductId(); + } + + MProduct product = MProduct.get(ctx, productId); + if (product.get_ID() == 0 || product.isActive()==false) + { + throw new ProductNotFoundException("product not found or is either deActivated"); + } + + if (orderLineBean.getQuantity()==null) + { + orderLineBean.setQuantity(Env.ONE); + } + + BigDecimal qty = orderLineBean.getQuantity(); + String barcode = product.getUPC(); + String name = product.getName(); + String description = product.getDescription(); + int uomPrecision = validateProductUOMQuantityPrecision(ctx, productId, qty); + + itemBean = new ItemBean(); + itemBean.setProductId(productId); + itemBean.setProductName(name); + itemBean.setBarCode(barcode); + itemBean.setPriceListId(orderLineBean.getPriceListId()); + itemBean.setDescription(description); + itemBean.setQty(orderLineBean.getQuantity().setScale(uomPrecision)); + itemBean.setIsDiscountOnInclUnitPrice(false); + itemBean.setIsDiscountOnPercentage(false); + itemBean.setIsDiscountOnTotal(false); + itemBean.setDiscountedLinePrice(Env.ZERO); + items.add(itemBean); + + return items; + } + + + public static ArrayList addToItemList(ArrayList items, ArrayList itemsToBeAdded, boolean ifAdd) throws ProductNotOnPriceListException, OperationException + { + Iterator iter = itemsToBeAdded.iterator(); + ItemBean itemBean; + + ItemBean foundItemBean; + while (iter.hasNext()) + { + itemBean = (ItemBean) iter.next(); + + foundItemBean = findItem(itemBean, items); + + if (foundItemBean == null) + items.add(itemBean); + else + { + itemBean.updateQuantity(foundItemBean, itemBean,ifAdd); + BigDecimal finalQty=foundItemBean.getQty(); + + if(Env.ZERO.compareTo(finalQty) == 0) + deleteItemFromList(items,foundItemBean.getProductId()); + } + } + + return items; + } + + + public static ArrayList deleteItemFromList(ArrayList items, Integer productId) throws ProductNotOnPriceListException, OperationException + { + ItemBean itemBean = new ItemBean(); + + itemBean.setProductId(productId); + items.remove(itemBean); + + + + return items; + } + + + + public static ItemBean findItem(ItemBean queryItemBean, ArrayList items) + { + int indexOfFound = items.indexOf(queryItemBean); + + if (indexOfFound == -1) + return null; + + ItemBean found = (ItemBean) items.get(indexOfFound); + + return found; + } + + public static InventoryCartBean findInventoryLine(InventoryCartBean queryItemBean, ArrayList items) + { + int indexOfFound = items.indexOf(queryItemBean); + + if (indexOfFound == -1) + return null; + + InventoryCartBean found = (InventoryCartBean) items.get(indexOfFound); + + return found; + } + + + @SuppressWarnings("unchecked") + public static ArrayList deleteItemFromPOSList(Properties ctx,ArrayList items, Integer productId,boolean isSales) throws ProductNotOnPriceListException, OperationException + { + ItemBean itemBean = new ItemBean(); + + itemBean.setProductId(productId); + items.remove(itemBean); + + setPOSItemPrices(ctx,items,true); + + return items; + } + + public static ArrayList updateItemFromPOSList(Properties ctx, Integer priceListId, ArrayList items, Integer productId, BigDecimal quantity) throws ProductNotOnPriceListException, OperationException + { + + if (items == null) + { + return items; + } + + ItemBean itemBean = new ItemBean(); + itemBean.setProductId(productId); + + + int index = items.indexOf(itemBean); + + if(index != -1) + { + itemBean = (ItemBean) items.get(index); + + if(quantity.doubleValue() == 0.0d) + { + items.remove(index); + } + else + { + itemBean.setQty(quantity); + } + + setPOSItemPrices(ctx,priceListId, items, true); + } + + return items; + } + + public static ArrayList updateItemFromInventoryList(Properties ctx, Integer priceListId, ArrayList items, Integer productId, Integer quantity) throws ProductNotOnPriceListException, OperationException + { + + if (items == null) + { + return items; + } + + ItemBean itemBean = new ItemBean(); + itemBean.setProductId(productId); + + + int index = items.indexOf(itemBean); + + if(index != -1) + { + itemBean = (ItemBean) items.get(index); + + if(quantity.intValue() == 0) + { + items.remove(index); + } + else + { + itemBean.setQtyCount(new BigDecimal(quantity.intValue())); + } + + setInventoryItemPrices(ctx,priceListId, items, true); + } + + return items; + } + + + public static ArrayList updateItemFromMMovementList(Properties ctx, Integer priceListId, ArrayList items, Integer productId, Integer quantity) throws ProductNotOnPriceListException, OperationException + { + + if (items == null) + { + return items; + } + + ItemBean itemBean = new ItemBean(); + itemBean.setProductId(productId); + + + int index = items.indexOf(itemBean); + + if(index != -1) + { + itemBean = (ItemBean) items.get(index); + + if(quantity.intValue() == 0) + { + items.remove(index); + } + else + { + itemBean.setQtyToMove(new BigDecimal(quantity.intValue())); + } + + setMMovementItemCosts(ctx, priceListId, items, false); + } + + return items; + } + + public static ArrayList updateNoOfPack(Properties ctx, Integer priceListId, ArrayList items, Integer productId, Integer noOfPack) throws ProductNotOnPriceListException, OperationException + { + + if (items == null) + { + return items; + } + + ItemBean itemBean = new ItemBean(); + itemBean.setProductId(productId); + + + int index = items.indexOf(itemBean); + + if(index != -1) + { + itemBean = (ItemBean) items.get(index); + + if(noOfPack.intValue() == 0) + { + items.remove(index); + } + else + { + itemBean.setNoOfPack(noOfPack); + } + + } + + return items; + } + + public static boolean validateInputQuantity(Properties ctx,OrderLineBean bean, String backOrder) throws OperationException + { + + boolean valid = checkForNegativeQuantity(ctx, bean); + + if (!valid) + throw new InputQuantityLessThanZeroException("Please enter a quantity greater than 0"); + + boolean totalQtyValid = checkTotalQuantityGreaterThanZero(ctx,bean); + + if(!totalQtyValid) + throw new TotalQuantityLessThanZeroException("Please enter a quantity per Size!"); + + validateAvailableStock(ctx, bean, backOrder); + + return true; + } + + public static void validateAvailableStock(Properties ctx, OrderLineBean bean, String backOrder) throws OperationException + { + //Here we are assuming that if backOrder is null + //then we take it as NO. + //Normally what I have understood from previous discussions + //we should always display all products that are available + //In some way it means that we have to take it as NO when backOrder is null + if (backOrder == null) + backOrder = Constants.YES_CHAR; + + if (backOrder.equals(Constants.YES_CHAR)) + return; + + ArrayList orderLineList = bean.getOrderLineList(); + + Iterator iter = orderLineList.iterator(); + + OrderLineBean bean2; + boolean isInstock; + while (iter.hasNext()) + { + bean2 = (OrderLineBean) iter.next(); + isInstock = isInstock(ctx, bean2); + + if (!isInstock) + { + QuantityNotAvailableException exception = new QuantityNotAvailableException(); + MProduct product = new MProduct(ctx, bean2.getProductId().intValue(), null); + AttributeValuesPair pair = AttributeValuesManager.retrieveAttributeValues(ctx, product.getM_AttributeSetInstance_ID()); + exception.setMessage(pair.getSizeAttributeValue().getName()); + throw exception; + } + + } + } + + + private static boolean checkForNegativeQuantity(Properties ctx, OrderLineBean bean) + { + ArrayList orderLines = bean.getOrderLineList(); + + Iterator iter = orderLines.iterator(); + + OrderLineBean orderLineBean; + + while (iter.hasNext()) + { + orderLineBean = (OrderLineBean) iter.next(); + + if (orderLineBean.getQuantity().intValue() < 0) + return false; + + } + + return true; + } + + private static boolean checkTotalQuantityGreaterThanZero(Properties ctx, OrderLineBean bean) + { + ArrayList orderLines = bean.getOrderLineList(); + + Iterator iter = orderLines.iterator(); + + OrderLineBean orderLineBean; + + int totalQuantity = 0; + + while (iter.hasNext()) + { + orderLineBean = (OrderLineBean) iter.next(); + + totalQuantity = totalQuantity + orderLineBean.getQuantity().intValue(); + } + + if (totalQuantity == 0) + return false; + + return true; + } + + private static boolean isInstock(Properties ctx, OrderLineBean bean) throws OperationException + { + int posteritaWarehouseIds[] = MWarehouse.getAllIDs(MWarehouse.Table_Name, " ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id=" + Env.getAD_Org_ID(ctx), null); + + if (posteritaWarehouseIds.length == 0) + throw new OperationException("No warehouse found"); + + if (posteritaWarehouseIds.length > 1) + throw new OperationException("Expected one warehouse for organisation Tamak but got " + posteritaWarehouseIds.length); + + MWarehouse warehouse = new MWarehouse(ctx, posteritaWarehouseIds[0], null); + + MLocator defaultWarehouseLocator = warehouse.getDefaultLocator(); + + int qtyAvailable = getQtyAvailable(ctx, bean.getProductId().intValue(), defaultWarehouseLocator.get_ID()); + + int qtyEntered = bean.getQuantity().intValue(); + + if (qtyEntered > qtyAvailable) + return false; + + return true; + } + + private static int getQtyAvailable(Properties ctx, int productId, int locatorId) throws OperationException + { + String sql = "select sum(qtyonhand) from m_storage" + + " where m_product_id=" + productId + + " and m_locator_id=" + locatorId + + " and qtyreserved=0" + + " and ad_client_id=" + Env.getAD_Client_ID(ctx) + + " and ad_org_id=" + Env.getAD_Org_ID(ctx); + + PreparedStatement ps = DB.prepareStatement(sql, null); + ResultSet rs = null; + + int qtyAvailable = 0; + try + { + rs = ps.executeQuery(); + + while (rs.next()) + { + qtyAvailable = rs.getInt(1); + } + + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + ps.close(); + } + catch (SQLException e1) + { + throw new OperationException(e1); + } + + ps = null; + } + + return qtyAvailable; + } + + + public static ArrayList getDistinctByDescription(Properties ctx, ArrayList productList) + { + Comparator c = new Comparator() + { + + public int compare(ProductBean o1, ProductBean o2) + { + ProductBean bean1 = (ProductBean) o1; + ProductBean bean2 = (ProductBean) o2; + + return (bean1.getDescription().compareToIgnoreCase(bean2.getDescription())); + } + + }; + + TreeSet set = new TreeSet(c); + set.addAll(productList); + + ArrayList distinctBy = new ArrayList(set); + + return distinctBy; + } + + public static String setBackOrderFilter(Properties ctx, String sql, String backOrder) + { + if (backOrder.equals("N")) + sql = sql +" and s.qtyonhand > s.qtyreserved"; + + return sql; + } + + + public static int getProductIdFromBarCode(Properties ctx,String barCode) throws OperationException + { + String sql = "select m_product_id from m_product where UPC='"+barCode+"'" + +" and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + int productId=0; + + try + { + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + { + productId=rs.getInt(1); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + //begin e-evolution is necessary find also search key + if (productId == 0) + { + sql = "select m_product_id from m_product where value='"+barCode+"'" + +" and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); + + System.out.println("BarCode: " + barCode); + + pstmt = DB.prepareStatement(sql, null); + + try + { + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + { + productId=rs.getInt(1); + } + rs.close(); + } + catch (SQLException e) + { + throw new OperationException(e); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + } + //end e-evolution is necessary find also search key + + return productId; + } + + private static String updateProductLink(Properties ctx,int productId) + { + + String link = "" + + "here" + + ""; + String str = " Click " + + link + + " to update the product"; + + return str; + + } + + public static int validateProductUOMQuantityPrecision(Properties ctx, Integer productId, BigDecimal qty) throws UOMValuePrecisionNotValidException + { + int enteredPrecision = getQtyPrecision(qty); + + MProduct product = new MProduct(ctx,productId,null); + int uomPrecision = MUOM.getPrecision(ctx, product.getC_UOM_ID()); + + // validate UOM precision and quantity precision + if ( enteredPrecision > uomPrecision) + { + throw new UOMValuePrecisionNotValidException( + "The precision entered for the quantity field of the product: '"+product.getName() + + "' should not be greater than " + uomPrecision); + } + + return uomPrecision; + } + + public static int getQtyPrecision(BigDecimal qty) + { + int enteredPrecision = 0; + int position = 0; + int count = 0; + + String s = qty.toString(); + + + position = s.indexOf('.') + 1; // position of decimal point + + if (position > 0) + { + int i = s.length() - 1; + + while (s.charAt(i) == '0') // count no of trailing zeroes (to be removed) + { + count++; + i--; + } + + enteredPrecision = s.length() - position - count; + } + + return enteredPrecision; + } + + public static ArrayList getInventoryLines(Properties ctx, InventoryLineBean bean) + throws OperationException,ProductNotFoundException,UOMValuePrecisionNotValidException + { + + ItemBean itemBean; + ArrayList lines = new ArrayList(); + int productId = 0; + + if (bean.getProductId()==null) + { + productId = getProductIdFromBarCode(ctx,bean.getBarCode()); + bean.setProductId(Integer.valueOf(productId)); + } + else + { + productId = bean.getProductId(); + } + + MProduct product = MProduct.get(ctx, productId); + if (product.get_ID() == 0 || product.isActive()==false) + { + throw new ProductNotFoundException("product not found or is either deActivated"); + } + + if(bean.getQtyCsv() == null) + { + bean.setQtyCsv(Env.ZERO); + } + + if(bean.getQtyCount() == null) + { + bean.setQtyCount(Env.ONE); + } + + BigDecimal qty = bean.getQtyCount(); + String barcode = product.getUPC(); + String name = product.getName(); + String description = product.getDescription(); + int uomPrecision = validateProductUOMQuantityPrecision(ctx, productId, qty); + + ProductBean pBean = POSProductManager.getProduct(ctx, barcode, null); + + itemBean = new ItemBean(); + itemBean.setProductId(productId); + itemBean.setProductName(name); + itemBean.setBarCode(barcode); + itemBean.setPriceListId(bean.getPriceListId()); + itemBean.setDescription(description); + itemBean.setQtyCount((bean.getQtyCount().setScale(uomPrecision))); + itemBean.setQtyBook(pBean.getQtyOnHand()); + itemBean.setQtyCsv(bean.getQtyCsv()); + + lines.add(itemBean); + + return lines; + } + + public static ArrayList addToInventoryList(ArrayList items, ArrayList itemsToBeAdded, boolean ifAdd) throws ProductNotOnPriceListException, OperationException + { + Iterator iter = itemsToBeAdded.iterator(); + ItemBean itemBean; + + ItemBean foundItemBean; + while (iter.hasNext()) + { + itemBean = (ItemBean) iter.next(); + + foundItemBean = findItem(itemBean, items); + + if (foundItemBean == null) + items.add(itemBean); + else + { + itemBean.updateQuantityCount(foundItemBean, itemBean,ifAdd); + int finalQty=foundItemBean.getQtyCount().intValue(); + + itemBean.updateQuantityCsv(foundItemBean, itemBean,ifAdd); + int finalQtycsv=foundItemBean.getQtyCsv().intValue(); + + if(finalQty==0) + deleteItemFromList(items,foundItemBean.getProductId()); + } + + + } + + return items; + } + + public static ArrayList setInventoryItemPrices(Properties ctx, int priceListId, ArrayList items,boolean isSales) throws ProductNotOnPriceListException,OperationException + { + if (items == null || items.size() == 0) + { + return items; + } + + if (priceListId == 0) + { + priceListId = POSTerminalManager.getPriceListId(ctx, isSales); + } + + int precision = MPriceList.getStandardPrecision(ctx, priceListId); + + + int priceListVersionId = 0; + priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null); + //UDIMPriceListVersion udiSalesPriceListVersion = (UDIMPriceListVersion) GenericSystemObjectsFactory.getFactoryInstance().get(ctx, GenericSystemObjectsFactory.SALES_PRICELV_ID); + Iterator iter = items.iterator(); + + ItemBean bean; + BigDecimal priceStd = Env.ZERO; + BigDecimal priceList = Env.ZERO; + BigDecimal priceLimit = Env.ZERO; + BigDecimal totalPrice = Env.ZERO; + BigDecimal totalTax = Env.ZERO; + BigDecimal discount = Env.ZERO; + + BigDecimal total = Env.ZERO; + BigDecimal taxTotal = Env.ZERO; + BigDecimal priceTotal = Env.ZERO; + BigDecimal qtyTotal= Env.ZERO; + + while (iter.hasNext()) + { + bean = (ItemBean) iter.next(); + + int product_id = bean.getProductId(); + + MProductPrice price = MProductPrice.get(ctx, priceListVersionId, product_id, null); + + if (price == null) + { + throw new ProductNotOnPriceListException(""+updateProductLink(ctx,bean.getProductId())); + } + + priceStd = price.getPriceStd(); + priceList = price.getPriceList(); + priceLimit = price.getPriceLimit(); + + /*if(priceList.doubleValue() != 0.0) + { + discount = priceStd.subtract(priceList) + .multiply(new BigDecimal(100)) + .divide(priceList, precision, BigDecimal.ROUND_HALF_UP); + }*/ + + + MProduct product = new MProduct(ctx,bean.getProductId(),null); + + int [] taxIds = MTax.getAllIDs(MTax.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_TAXCATEGORY_ID=" +product.getC_TaxCategory_ID() + " and isActive='Y'",null); + if(taxIds == null || taxIds.length == 0) + { + throw new OperationException("no tax Category for the product, or it has been set inactive"); + } + + MTax tax = new MTax(ctx,taxIds[0],null); + BigDecimal taxAmt = tax.calculateTax(priceList,false,4); + + bean.setUnitPrice(priceList); + bean.setDiscountPercent(discount); + + totalPrice = priceList.multiply(bean.getQtyCount()); + totalPrice = totalPrice.setScale(precision, RoundingMode.HALF_UP); + totalTax = taxAmt.multiply(bean.getQtyCount()); + totalTax = totalTax.setScale(precision, RoundingMode.HALF_UP); + bean.setStandardPrice(totalPrice); + bean.setTaxAmt(totalTax); + bean.setUom(product.getUOMSymbol()); + bean.setPrice(totalPrice.add(totalTax)); + bean.setActualPrice(totalPrice.add(totalTax)); //initially price and the actual price are same + + priceTotal = priceTotal.add(totalPrice); + priceTotal = priceTotal.setScale(precision, RoundingMode.HALF_UP); + + BigDecimal priceLimitTotal = Env.ZERO; + + priceLimitTotal = priceLimitTotal.add(priceLimit.multiply(bean.getQtyCount())); + taxAmt = tax.calculateTax(priceLimitTotal,false,4); + priceLimitTotal = priceLimitTotal.add(taxAmt); + priceLimitTotal = priceLimitTotal.setScale(precision, RoundingMode.HALF_UP); + + taxTotal = taxTotal.add(totalTax); + taxTotal = taxTotal.setScale(precision, RoundingMode.HALF_UP); + total = total.add(totalPrice.add(totalTax)); + total = total.setScale(precision, RoundingMode.HALF_UP); + qtyTotal = qtyTotal.add(bean.getQtyCount()); + + bean.setPriceTotal(priceTotal); + bean.setTaxTotal(taxTotal); + bean.setgrandTotal(total); + bean.setQtyTotal(qtyTotal); + + } + + return items; + } + + public static InventoryCartBean addToInventoryCart(Properties ctx,InventoryLineBean bean, InventoryCartBean cartBean,boolean isSales,boolean ifAdd) + throws OperationException,ProductNotFoundException,ProductNotOnPriceListException, + UOMValuePrecisionNotValidException + { + //setPrice for the items + + ArrayList oldItems; + if (cartBean == null) + { + cartBean = new InventoryCartBean(); + oldItems = new ArrayList(); + } + else + { + oldItems = cartBean.getItems(); + } + + ArrayList oldItemsClone = (ArrayList)oldItems.clone(); + ArrayList itemsToBeAdded = getInventoryLines(ctx, bean); + oldItems = addToInventoryList(oldItemsClone, itemsToBeAdded,ifAdd); + // need to take into account business partner price list + + Integer priceListId = bean.getPriceListId(); + + if(priceListId == null || priceListId == 0) + { + priceListId = POSTerminalManager.getPriceListId(ctx, isSales); + } + + oldItems = setInventoryItemPrices(ctx, priceListId, oldItems, isSales); + cartBean.setItems(oldItems); + cartBean.setTotalPrice(setGrandTotal(oldItems)); + cartBean.setPricelistId(priceListId); + + return cartBean; + } + + + /** + * Add To movement Cart (Stock Transfer Cart) + * @param ctx + * @param bean + * @param cartBean + * @param isSales + * @param ifAdd + * @return + * @throws OperationException + * @throws ProductNotFoundException + * @throws ProductNotOnPriceListException + */ + public static MMovementCartBean addToMovementCart(Properties ctx,StockMovementBean bean, MMovementCartBean cartBean, boolean isSales, boolean ifAdd) throws OperationException,ProductNotFoundException,ProductNotOnPriceListException + { + //setPrice for the items + + ArrayList oldItems; + if (cartBean == null) + { + cartBean = new MMovementCartBean(); + oldItems = new ArrayList(); + } + else + { + oldItems = cartBean.getItems(); + } + + ArrayList oldItemsClone = (ArrayList)oldItems.clone(); + ArrayList itemsToBeAdded = getMMovementItems(ctx, bean); + oldItems = addToMMovementList(ctx, oldItemsClone, itemsToBeAdded,ifAdd); + // need to take into account business partner price list + + Integer priceListId = POSTerminalManager.getPriceListId(ctx, isSales); + + oldItems = setMMovementItemCosts(ctx, priceListId, oldItems, isSales); + cartBean.setItems(oldItems); + cartBean.setPricelistId(priceListId); + + return cartBean; + } + + /** + * Get Movement Items + * @param ctx + * @param bean + * @return + * @throws OperationException + * @throws ProductNotFoundException + */ + public static ArrayList getMMovementItems(Properties ctx, StockMovementBean bean) throws OperationException,ProductNotFoundException + { + + ItemBean itemBean; + ArrayList stockItems = new ArrayList(); + int productId = 0; + + if (bean.getProductId()==null) + { + productId = getProductIdFromBarCode(ctx,bean.getBarCode()); + bean.setProductId(Integer.valueOf(productId)); + } + else + { + productId = bean.getProductId(); + } + + MProduct product = MProduct.get(ctx, productId); + if (product.get_ID() == 0 || product.isActive()==false) + { + throw new ProductNotFoundException("product not found or is either deActivated"); + } + + if(bean.getQtyToMove() == null) + { + bean.setQtyToMove(Env.ONE); + } + + if(bean.getNoOfPack() == null) + { + bean.setNoOfPack(1); + } + + BigDecimal qty = bean.getQtyToMove(); + int noOfPack = bean.getNoOfPack(); + String barcode = product.getUPC(); + String name = product.getName(); + String description = product.getDescription(); + int uomPrecision = validateProductUOMQuantityPrecision(ctx, productId, qty); + + int warehouseId = WarehouseManager.getDefaultWarehouse(ctx).getM_Warehouse_ID(); + MLocator locator = MLocator.get(ctx, warehouseId, "", "0", "0", "0"); + BigDecimal qtyAvailable = MStorage.getQtyAvailable(warehouseId, locator.get_ID(), productId, 0, null); + + itemBean = new ItemBean(); + itemBean.setProductId(productId); + itemBean.setProductName(name); + itemBean.setBarCode(barcode); + itemBean.setUnitsPerPack(product.getUnitsPerPack()); + itemBean.setDescription(description); + itemBean.setUom(product.getUOMSymbol()); + itemBean.setQtyToMove(qty); + itemBean.setNoOfPack(noOfPack); + itemBean.setQtyBook(qtyAvailable); + + stockItems.add(itemBean); + + return stockItems; + } + + /** + * Add Items to Movement List + * @param ctx + * @param items + * @param itemsToBeAdded + * @param ifAdd + * @return + * @throws ProductNotOnPriceListException + * @throws OperationException + */ + public static ArrayList addToMMovementList(Properties ctx, ArrayList items, ArrayList itemsToBeAdded, boolean ifAdd) throws ProductNotOnPriceListException, OperationException + { + Iterator iter = itemsToBeAdded.iterator(); + ItemBean itemBean; + + ItemBean foundItemBean; + while (iter.hasNext()) + { + itemBean = (ItemBean) iter.next(); + + foundItemBean = findItem(itemBean, items); + + if (foundItemBean == null) + items.add(itemBean); + else + { + itemBean.updateQuantityToMove(foundItemBean, itemBean,ifAdd); + int finalQty=foundItemBean.getQtyToMove().intValue(); + + if(finalQty==0) + { + deleteItemFromList(items,foundItemBean.getProductId()); + } + else + { + // set the no of pack + MMovementManager.setNoOfPack(ctx, foundItemBean); + } + } + + + } + + return items; + } + + /** + * Set Movement Items Costs + * @param ctx + * @param priceListId + * @param items + * @param isSales + * @return + * @throws ProductNotOnPriceListException + * @throws OperationException + */ + public static ArrayList setMMovementItemCosts(Properties ctx, int priceListId, ArrayList items,boolean isSales) throws ProductNotOnPriceListException,OperationException + { + if (items == null || items.size() == 0) + { + return items; + } + + if (priceListId == 0) + { + priceListId = POSTerminalManager.getPriceListId(ctx, isSales); + } + + int precision = MPriceList.getStandardPrecision(ctx, priceListId); + MPriceList ppriceList = new MPriceList(ctx, priceListId, null); + + int priceListVersionId = 0; + priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null); + + Iterator iter = items.iterator(); + + ItemBean bean; + BigDecimal priceStd = Env.ZERO; + + while (iter.hasNext()) + { + bean = (ItemBean) iter.next(); + + int product_id = bean.getProductId(); + + MProductPrice price = MProductPrice.get(ctx, priceListVersionId, product_id, null); + + if (price == null) + { + throw new ProductNotOnPriceListException(""+updateProductLink(ctx,bean.getProductId())); + } + + priceStd = price.getPriceStd().setScale(2, BigDecimal.ROUND_HALF_UP); + + MProduct product = new MProduct(ctx,bean.getProductId(),null); + int warehouseId = WarehouseManager.getDefaultWarehouse(ctx).getM_Warehouse_ID(); + MLocator locator = MLocator.get(ctx, warehouseId, "", "0", "0", "0"); + BigDecimal qtyAvailable = MStorage.getQtyAvailable(warehouseId, locator.get_ID(), bean.getProductId(), 0, null); + + if(bean.getQtyToMove().compareTo(qtyAvailable) == -1) + { + BigDecimal noOfPack = bean.getQtyToMove().divide(new BigDecimal(product.getUnitsPerPack()), BigDecimal.ROUND_DOWN); + bean.setNoOfPack(noOfPack.intValue()); + } + + int [] taxIds = MTax.getAllIDs(MTax.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and C_TAXCATEGORY_ID=" +product.getC_TaxCategory_ID() + " and isActive='Y'",null); + if(taxIds == null || taxIds.length == 0) + { + throw new OperationException("no tax Category for the product, or it has been set inactive"); + } + + MTax tax = new MTax(ctx,taxIds[0],null); + BigDecimal taxMul = (tax.getRate().add(Env.ONEHUNDRED)).divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_EVEN); + + BigDecimal stockValue = Env.ZERO; + + if(ppriceList.isTaxIncluded()) + { + stockValue = priceStd.multiply(bean.getQtyToMove()); + } + else + { + stockValue = (priceStd.multiply(bean.getQtyToMove())).multiply(taxMul); + } + + bean.setStockValue(stockValue); + + } + + return items; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/cashType/UDICashType.java b/posterita/posterita/src/main/org/posterita/cashType/UDICashType.java new file mode 100644 index 0000000000..7c24eb5329 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/cashType/UDICashType.java @@ -0,0 +1,33 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 17-Mar-2006 + */ + + +package org.posterita.cashType; + + +public interface UDICashType +{ + + public String getCashType(); + + +} diff --git a/posterita/posterita/src/main/org/posterita/cashType/UDICashTypes.java b/posterita/posterita/src/main/org/posterita/cashType/UDICashTypes.java new file mode 100644 index 0000000000..3b5f36693d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/cashType/UDICashTypes.java @@ -0,0 +1,78 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 17-Mar-2006 + */ + + +package org.posterita.cashType; + + + +public class UDICashTypes +{ + private UDICashTypes() + { + + } + + public static UDICashType GENERAL_RECEIPTS = new GeneralReceipts(); + + public static UDICashType GENERAL_EXPENSE = new GeneralExpense(); + + public static UDICashType INVOICE = new Invoice(); + + public static UDICashType BANK_ACCOUNT_TRANSFER = new BankAccountTransfer(); + + + + public static class GeneralReceipts implements UDICashType + { + public String getCashType() + { + return "General Receipts"; + } + } + + + public static class GeneralExpense implements UDICashType + { + public String getCashType() + { + return "General Expense"; + } + } + + public static class Invoice implements UDICashType + { + public String getCashType() + { + return "Invoice"; + } + } + + public static class BankAccountTransfer implements UDICashType + { + public String getCashType() + { + return "Bank Account Transfer"; + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/AbstractChart.java b/posterita/posterita/src/main/org/posterita/core/AbstractChart.java new file mode 100644 index 0000000000..0ce7f14561 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/AbstractChart.java @@ -0,0 +1,211 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 12-Jul-2006 15:56:26 by praveen + * + */ + +package org.posterita.core; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.jfree.chart.ChartRenderingInfo; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.entity.StandardEntityCollection; + +import org.posterita.exceptions.OperationException; + +public abstract class AbstractChart +{ + protected String title = ""; + protected String subtitle = null; + protected String xLabel = ""; + protected String yLabel = ""; + protected boolean showLegend = true; + protected boolean showTooltip = true; + protected boolean showLabels = false; + protected ChartRenderingInfo renderingInfo = new ChartRenderingInfo(new StandardEntityCollection()); + protected JFreeChart chart = null; + + public abstract JFreeChart createChart() throws OperationException ; + + public abstract void getDataSetFromSQL(String sql) throws OperationException ; + + public String saveChartAsPNG(String filePath,int width,int height) throws OperationException + { + try { + ChartUtilities.saveChartAsPNG(new File(filePath),getChart(),width,height,renderingInfo); + return filePath; + } catch (IOException e) { + throw new OperationException("Problem occured while saving chart.",e); + } + } + + public String saveChartAsJPEG(String filePath,int width,int height) throws OperationException + { + try { + ChartUtilities.saveChartAsJPEG(new File(filePath),getChart(),width,height,renderingInfo); + return filePath; + } catch (IOException e) { + throw new OperationException("Problem occured while saving chart.",e); + } + } + + public void writeChartAsPNG(OutputStream outputStream,int width,int height) throws OperationException + { + try { + ChartUtilities.writeChartAsPNG(outputStream,getChart(),width,height,renderingInfo); + } catch (IOException e) { + throw new OperationException("Problem occured while write chart.",e); + } + } + + public void writeChartAsJPEG(OutputStream outputStream,int width,int height) throws OperationException + { + try { + ChartUtilities.writeChartAsJPEG(outputStream,getChart(),width,height,renderingInfo); + } catch (IOException e) { + throw new OperationException("Problem occured while write chart.",e); + } + } + + public String getImageMap(String imageMapName) throws OperationException + { + try { + StringWriter stringWriter = new StringWriter(); + PrintWriter printWriter = new PrintWriter(stringWriter); + ChartUtilities.writeImageMap(printWriter, imageMapName, renderingInfo,false); + printWriter.flush(); + + String imageMap = stringWriter.getBuffer().toString(); + return imageMap; + } catch (IOException e) { + throw new OperationException("Problem occured while writing imagemap",e); + } + } + + public void writeImageMap(OutputStream outputStream,String imageMapName) throws OperationException + { + PrintWriter printWriter = new PrintWriter(outputStream); + try { + ChartUtilities.writeImageMap(printWriter, imageMapName, renderingInfo,false); + printWriter.flush(); + printWriter.close(); + } catch (IOException e) { + throw new OperationException("Problem occured while writing imagemap",e); + } + } + + public String saveImageMap(String imageMapPath) throws OperationException + { + String fileSeparator = System.getProperty("file.separator"); + int index = imageMapPath.lastIndexOf(fileSeparator)+1; + String imageMapName = imageMapPath.substring(index); + + try { + FileOutputStream fos = new FileOutputStream(new File(imageMapPath)); + PrintWriter printWriter = new PrintWriter(fos); + ChartUtilities.writeImageMap(printWriter, imageMapName, renderingInfo,false); + printWriter.flush(); + fos.close(); + + return imageMapName; + } catch (IOException e) { + throw new OperationException("Problem occured while writing imagemap",e); + } + } + + public boolean isShowLegend() { + return showLegend; + } + + public void setShowLegend(boolean showLegend) { + this.showLegend = showLegend; + } + + public boolean isShowTooltip() { + return showTooltip; + } + + public void setShowTooltip(boolean showTooltip) { + this.showTooltip = showTooltip; + } + + public String getSubtitle() { + return subtitle; + } + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getXLabel() { + return xLabel; + } + + public void setXLabel(String label) { + xLabel = label; + } + + public String getYLabel() { + return yLabel; + } + + public void setYLabel(String label) { + yLabel = label; + } + + public boolean isShowLabels() { + return showLabels; + } + + public void setShowLabels(boolean showLabels) { + this.showLabels = showLabels; + } + + public ChartRenderingInfo getRenderingInfo() { + return renderingInfo; + } + + public void setRenderingInfo(ChartRenderingInfo renderingInfo) { + this.renderingInfo = renderingInfo; + } + + public JFreeChart getChart() throws OperationException { + + if(chart==null) + createChart(); + + return chart; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/AbstractParser.java b/posterita/posterita/src/main/org/posterita/core/AbstractParser.java new file mode 100644 index 0000000000..d0f75c658b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/AbstractParser.java @@ -0,0 +1,95 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 12-Jul-2006 16:05:22 by praveen + * + */ + +package org.posterita.core; + +import org.posterita.exceptions.OperationException; + + + +/** + * @author vikram + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ + + +public abstract class AbstractParser +{ + protected static final String START_TAG = "<"; + protected static final String END_TAG = ">"; + protected static final String START_COMMENT = ""; + + protected String removeTag(String strData, String startTagData, String endTagData) throws OperationException + { + int startTag; + int endTag; + startTag = strData.indexOf(startTagData); + endTag = strData.indexOf(endTagData); + + if (startTag == -1) + { + throw new OperationException("No startTag found"); + } + + if (endTag == -1) + { + throw new OperationException("No endTag found"); + } + if (startTag > endTag) + { + throw new OperationException("startTag greater than endTag found"); + } + String beginning; + String end; + + beginning = strData.substring(0, startTag +startTagData.length()-1); + end = strData.substring(endTag +startTagData.length()); + strData = beginning.concat(end); + + return strData; + } + + protected String removeTags(String str) throws OperationException + { + while (str.indexOf(START_TAG) != -1) + { + str = removeTag(str, START_TAG, END_TAG); + } + + return str; + } + + + protected String removeComments(String str) throws OperationException + { + while (str.indexOf(START_COMMENT) != -1) + { + str = removeTag(str, START_COMMENT, END_COMMENT); + } + + return str; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/BarChart.java b/posterita/posterita/src/main/org/posterita/core/BarChart.java new file mode 100644 index 0000000000..02c0798b58 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/BarChart.java @@ -0,0 +1,174 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 12-Jul-2006 16:05:22 by praveen + * + */ + +package org.posterita.core; + +import java.sql.SQLException; + +import org.compiere.util.DB; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.renderer.category.BarRenderer; +import org.jfree.chart.renderer.category.CategoryItemRenderer; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.category.DefaultCategoryDataset; +import org.jfree.data.jdbc.JDBCCategoryDataset; + +import org.posterita.exceptions.OperationException; + +public class BarChart extends AbstractChart +{ + public static final String CHART_TYPE = "BarChart"; + public static final PlotOrientation VERTICAL = PlotOrientation.VERTICAL; + public static final PlotOrientation HORIZONTAL = PlotOrientation.HORIZONTAL; + public static final int BARCHART_FLAT = 1; + public static final int BARCHART_3D = 2; + + private DefaultCategoryDataset dataset = null; + private PlotOrientation orientation = VERTICAL; + private int type = BARCHART_FLAT; + private double maximumBarWidth = 0.1d; + private boolean integerTickUnits = false; + + public BarChart(){}; + + public BarChart(DefaultCategoryDataset dataset,String title) + { + this.dataset = dataset; + this.title = title; + + } + + public BarChart(DefaultCategoryDataset dataset,String title,String xLabel,String yLabel) + { + this.dataset = dataset; + this.title = title; + this.xLabel = xLabel; + this.yLabel = yLabel; + } + + public JFreeChart createChart() throws OperationException + { + if(dataset==null) + { + throw new OperationException("Cannot create Bar chart: cause -> dataset empty!"); + } + + switch (type) { + case BARCHART_FLAT: + chart = ChartFactory.createBarChart(title,xLabel,yLabel,dataset,orientation,showLegend,showTooltip,true); + break; + + case BARCHART_3D: + chart = ChartFactory.createBarChart3D(title,xLabel,yLabel,dataset,orientation,showLegend,showTooltip,true); + break; + + default: + throw new OperationException("Invalid barchart type! Can only be BarChart.BARCHART_FLAT or BarChart.BARCHART_3D"); + } + + //setting subtitle + if(subtitle!=null) + { + TextTitle title = new TextTitle(subtitle); + chart.addSubtitle(title); + } + + CategoryPlot plot = chart.getCategoryPlot(); + NumberAxis axis = (NumberAxis) plot.getRangeAxis(); + + //setting tickUnits + if(integerTickUnits) + axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); + + BarRenderer barRender = (BarRenderer) plot.getRenderer(); + barRender.setMaximumBarWidth(maximumBarWidth); + + //displaying labels + if(showLabels) + { + CategoryItemRenderer itemRender = plot.getRenderer(); + itemRender.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); + itemRender.setItemLabelsVisible(true); + } + + return chart; + } + + public DefaultCategoryDataset getDataset() { + return dataset; + } + + public void setDataset(DefaultCategoryDataset dataset) { + this.dataset = dataset; + } + + public PlotOrientation getOrientation() { + return orientation; + } + + public void setOrientation(PlotOrientation orientation) { + this.orientation = orientation; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public double getMaximumBarWidth() { + return maximumBarWidth; + } + + public void setMaximumBarWidth(double maximumBarWidth) { + this.maximumBarWidth = maximumBarWidth; + } + + public boolean isIntegerTickUnits() { + return integerTickUnits; + } + + public void setIntegerTickUnits(boolean integerTickUnits) { + this.integerTickUnits = integerTickUnits; + } + + public void getDataSetFromSQL(String sql) throws OperationException + { + JDBCCategoryDataset jdbcDataset = new JDBCCategoryDataset(DB.getConnectionRO()); + + try + { + jdbcDataset.executeQuery(sql); + this.dataset = jdbcDataset; + } catch (SQLException e) { + throw new OperationException(e); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/BarLabelGenerator.java b/posterita/posterita/src/main/org/posterita/core/BarLabelGenerator.java new file mode 100644 index 0000000000..d9072aa2b1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/BarLabelGenerator.java @@ -0,0 +1,49 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 29-Aug-2006 16:39:33 by praveen + * + */ + +package org.posterita.core; + +import java.util.Map; + +import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; +import org.jfree.data.category.CategoryDataset; + +public class BarLabelGenerator extends StandardCategoryItemLabelGenerator +{ + /** + * + */ + private static final long serialVersionUID = 1L; + Map labelMap = null; + + public BarLabelGenerator(Map labelMap) + { + this.labelMap = labelMap; + } + + public String generateLabel(CategoryDataset arg0, int arg1, int arg2) + { + return super.generateLabel(arg0, arg1, arg2); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/CheckDuplicateEntities.java b/posterita/posterita/src/main/org/posterita/core/CheckDuplicateEntities.java new file mode 100644 index 0000000000..a2608281d9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/CheckDuplicateEntities.java @@ -0,0 +1,178 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 01-Aug-2005 by alok + * + */ +package org.posterita.core; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Properties; + +import org.compiere.util.DB; +import org.compiere.util.Env; + + + + +public class CheckDuplicateEntities +{ + + public static boolean checkDuplicateName(Properties ctx,String name,String tableName) + { + boolean existName = false; + + String sql = " select name from "+tableName + + " where upper(name) = upper('"+name+"')" + + " and AD_CLIENT_ID = "+ Env.getAD_Client_ID(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + existName = true; + } + + rs.close(); + } + catch(SQLException e) + { + e.printStackTrace(); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return existName; + + } + + public static boolean checkDuplicateBPName(Properties ctx,String name,String name2,String tableName) + { + boolean existName = false; + String sql; + + if (name2 != null) + sql = " select name, name2 from "+tableName + + " where upper(name) = upper('"+name+"')" + + " and upper(name2) = upper('" + name2 + "')" + + " and ad_org_id = " + Env.getAD_Org_ID(ctx) + + " and AD_CLIENT_ID = "+ Env.getAD_Client_ID(ctx); + else + sql = " select name, name2 from "+tableName + + " where upper(name) = upper('"+name+"')" + + " and upper(name2) is null" + + " and ad_org_id = " + Env.getAD_Org_ID(ctx) + + " and AD_CLIENT_ID = "+ Env.getAD_Client_ID(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + existName = true; + } + + rs.close(); + } + catch(SQLException e) + { + e.printStackTrace(); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception e) + {} + + pstmt = null; + } + + return existName; + + } + + public static boolean checkDuplicateChequeNo(Properties ctx,String chequeNo,String tableName) + { + boolean existCheque = false; + + String sql = " select CHEQUENO from "+tableName + + " where upper(CHEQUENO) = upper('"+chequeNo+"')" + + " and AD_CLIENT_ID = "+ Env.getAD_Client_ID(ctx); + + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + ResultSet rs = null; + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + existCheque = true; + } + + rs.close(); + } + catch(SQLException e) + { + e.printStackTrace(); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return existCheque; + + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/Configuration.java b/posterita/posterita/src/main/org/posterita/core/Configuration.java new file mode 100644 index 0000000000..7d08a925db --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/Configuration.java @@ -0,0 +1,310 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Apr 9, 2008 11:07:09 AM by praveen + * + */ + +package org.posterita.core; + +import java.util.logging.Level; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.compiere.util.CLogger; +import org.posterita.Constants; + +public class Configuration +{ + public static final String IS_QUICK_SALES = "configuration.isQuickSales"; + public static final String IS_CUSTOMER_COMPULSORY = "configuration.isCustomerCompulsory"; + public static final String ALLOW_CREDIT_SALES = "configuration.allowCreditSales"; + public static final String ALLOW_CUSTOMER_RETURN_ORDER = "configuration.allowCustomerReturnOrder"; + public static final String ALLOW_INVOKE_CUSTOMER_RETURN_ORDER = "configuration.allowInvokeCustomerReturnOrder"; + public static final String PAYMENT_RULE = "configuration.paymentRule"; + public static final String SEARCH_PRODUCT_BY = "configuration.searchProductBy"; + + public static final String BARCODE = "barcode"; + public static final String DESCRIPTION = "description"; + public static final String PRODUCT_NAME = "productQuery"; + + private static CLogger log = CLogger.getCLogger(Configuration.class); + + private boolean isQuickSales = true; + private boolean isCustomerCompulsory = false; + private boolean allowCreditSales = true; + private boolean allowCustomerReturnOrder = true; + private boolean allowInvokeCustomerReturnOrder = true; + private String paymentRule = "cash"; + private String searchProductBy = BARCODE; + private String orderType; + private int priceListId; + private boolean isSOTrx; + + public boolean getIsSOTrx() + { + return isSOTrx; + } + + public void setIsSOTrx(boolean isSOTrx) + { + this.isSOTrx = isSOTrx; + } + + public int getPriceListId() + { + return priceListId; + } + + public void setPriceListId(int priceListId) + { + this.priceListId = priceListId; + } + + public String getOrderType() + { + return orderType; + } + + public void setOrderType(String orderType) + { + this.orderType = orderType; + } + + public Configuration() + { + //do nothing + } + + public static Configuration getConfiguration(HttpServletRequest request) + { + Configuration config = null; + config = (Configuration) request.getSession().getAttribute(Constants.CONFIGURATION); + + if(config == null) + { + config = new Configuration(); + config.load(request); + + request.getSession().setAttribute(Constants.CONFIGURATION, config); + } + + return config; + } + + /** + * Loads configuration from cookie + * @param request + */ + public void load(HttpServletRequest request) + { + //TODO refactor load configuration from role + + Cookie[] cookies = request.getCookies(); + if(cookies != null && cookies.length > 0) + { + for(Cookie cookie : cookies) + { + String name = cookie.getName(); + String value = cookie.getValue(); + + if(name.startsWith("configuration.")) + { + if(IS_QUICK_SALES.equalsIgnoreCase(name)) + { + try + { + isQuickSales = Boolean.parseBoolean(value); + } + catch(Exception e) + { + log.log(Level.WARNING, "Invalid value for: "+ IS_QUICK_SALES +" Using default: " + isQuickSales, e); + } + } + + if(IS_CUSTOMER_COMPULSORY.equalsIgnoreCase(name)) + { + try + { + isCustomerCompulsory = Boolean.parseBoolean(value); + } + catch(Exception e) + { + log.log(Level.WARNING, "Invalid value for: "+ IS_CUSTOMER_COMPULSORY +" Using default: " + isCustomerCompulsory, e); + } + } + + if(ALLOW_CREDIT_SALES.equalsIgnoreCase(name)) + { + try + { + allowCreditSales = Boolean.parseBoolean(value); + } + catch(Exception e) + { + log.log(Level.WARNING, "Invalid value for: "+ ALLOW_CREDIT_SALES +" Using default: " + allowCreditSales, e); + } + } + + if(ALLOW_CUSTOMER_RETURN_ORDER.equalsIgnoreCase(name)) + { + try + { + allowCustomerReturnOrder = Boolean.parseBoolean(value); + } + catch(Exception e) + { + log.log(Level.WARNING, "Invalid value for: "+ ALLOW_CUSTOMER_RETURN_ORDER +" Using default: " + allowCustomerReturnOrder, e); + } + } + + if(ALLOW_INVOKE_CUSTOMER_RETURN_ORDER.equalsIgnoreCase(name)) + { + try + { + allowInvokeCustomerReturnOrder = Boolean.parseBoolean(value); + } + catch(Exception e) + { + log.log(Level.WARNING, "Invalid value for: "+ ALLOW_INVOKE_CUSTOMER_RETURN_ORDER +" Using default: " + allowInvokeCustomerReturnOrder, e); + } + } + + if(PAYMENT_RULE.equalsIgnoreCase(name)) + { + if(value.equalsIgnoreCase(Constants.PAYMENT_RULE_CASH)|| + value.equalsIgnoreCase(Constants.PAYMENT_RULE_CARD)|| + value.equalsIgnoreCase(Constants.PAYMENT_RULE_CHEQUE)|| + value.equalsIgnoreCase(Constants.PAYMENT_RULE_MIXED)) + { + paymentRule = value; + } + else + { + log.log(Level.WARNING, "Invalid value for: "+ PAYMENT_RULE +" Using default: " + paymentRule); + } + } + + if(SEARCH_PRODUCT_BY.equalsIgnoreCase(name)) + { + if(value.equalsIgnoreCase("barcode")|| + value.equalsIgnoreCase("name")|| + value.equalsIgnoreCase("description")) + { + searchProductBy = value; + } + else + { + log.log(Level.WARNING, "Invalid value for: "+ SEARCH_PRODUCT_BY +" Using default: " + searchProductBy); + } + } + + } + } + } + + } + + /** + * Save default configuration in cookies + * @param request + */ + public void save(HttpServletResponse response) + { + String[][] nameValues = { + { IS_QUICK_SALES, isQuickSales + "" }, + { IS_CUSTOMER_COMPULSORY, isCustomerCompulsory + "" }, + { ALLOW_CREDIT_SALES, allowCreditSales + "" }, + { ALLOW_CUSTOMER_RETURN_ORDER, allowCustomerReturnOrder + "" }, + { ALLOW_INVOKE_CUSTOMER_RETURN_ORDER, allowInvokeCustomerReturnOrder + "" }, + { PAYMENT_RULE, paymentRule }, + { SEARCH_PRODUCT_BY, searchProductBy } + }; + + for (int i = 0; i < nameValues.length; i++) + { + String[] namevalue = nameValues[i]; + String name = namevalue[0]; + String value = namevalue[1]; + + Cookie cookie = new Cookie(name, value); + cookie.setMaxAge(60*60*24*365); + + response.addCookie(cookie); + } + } + + public boolean isQuickSales() { + return isQuickSales; + } + + public void setQuickSales(boolean isQuickSales) { + this.isQuickSales = isQuickSales; + } + + public boolean isCustomerCompulsory() { + return isCustomerCompulsory; + } + + public void setCustomerCompulsory(boolean isCustomerCompulsory) { + this.isCustomerCompulsory = isCustomerCompulsory; + } + + public boolean isAllowCreditSales() { + return allowCreditSales; + } + + public void setAllowCreditSales(boolean allowCreditSales) { + this.allowCreditSales = allowCreditSales; + } + + public boolean isAllowCustomerReturnOrder() { + return allowCustomerReturnOrder; + } + + public void setAllowCustomerReturnOrder(boolean allowCustomerReturnOrder) { + this.allowCustomerReturnOrder = allowCustomerReturnOrder; + } + + public boolean isAllowInvokeCustomerReturnOrder() { + return allowInvokeCustomerReturnOrder; + } + + public void setAllowInvokeCustomerReturnOrder( + boolean allowInvokeCustomerReturnOrder) { + this.allowInvokeCustomerReturnOrder = allowInvokeCustomerReturnOrder; + } + + public String getPaymentRule() { + return paymentRule; + } + + public void setPaymentRule(String paymentRule) { + this.paymentRule = paymentRule; + } + + public String getSearchProductBy() { + return searchProductBy; + } + + public void setSearchProductBy(String searchProductBy) { + this.searchProductBy = searchProductBy; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/ContextId.java b/posterita/posterita/src/main/org/posterita/core/ContextId.java new file mode 100644 index 0000000000..43844daa22 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/ContextId.java @@ -0,0 +1,65 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 26, 2006 + */ + + +package org.posterita.core; + +import java.util.Properties; + + +public class ContextId +{ + Properties ctx; + int id; + Object bean; + + public ContextId(Properties ctx, int id) + { + + this.ctx = ctx; + this.id = id; + } + + public Properties getCtx() { + return ctx; + } + + public void setCtx(Properties ctx) { + this.ctx = ctx; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public Object getBean() { + return bean; + } + + public void setBean(Object bean) { + this.bean = bean; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/CrossTabReportGenerator.java b/posterita/posterita/src/main/org/posterita/core/CrossTabReportGenerator.java new file mode 100644 index 0000000000..aa14078563 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/CrossTabReportGenerator.java @@ -0,0 +1,254 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Feb 24, 2006 by praveen + * + */ +package org.posterita.core; + +import java.awt.Color; +import java.util.Iterator; + +import org.posterita.exceptions.OperationException; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Element; +import com.lowagie.text.Image; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; + + +public class CrossTabReportGenerator extends PDFReportGenerator +{ + + protected void writeDocument(Document document) throws OperationException + { + try + { + int noOfRows = dataSource.size(); + String longestText = ""; + int columnCount = 0; + + Object[] obj = null; + + Object[] header = (Object[]) dataSource.get(0); + columnCount = header.length; + + PdfPTable table = new PdfPTable(columnCount); + table.setWidthPercentage(100); + table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); + table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); + table.getDefaultCell().setPaddingBottom(5); + table.getDefaultCell().setPaddingTop(5); + + + //adding the headers + for(int i = 0; i < columnCount; i++) + { + if(i==0) + { + longestText = header[i].toString(); + table.addCell(new Paragraph(header[i].toString())); + } + else + { + Image img = getTextAsImage(header[i].toString()); + img.setRotationDegrees(90); + img.setAlignment(Image.ALIGN_BOTTOM); + + PdfPCell cell = new PdfPCell(img); + cell.setPadding(4); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setVerticalAlignment(Element.ALIGN_BOTTOM); + //cell.setBackgroundColor(new Color(0, 0, 255)); + + table.addCell(cell); + } + } + + + + //adding the data + for(int j = 1; j < noOfRows; j++) + { + obj = (Object[]) dataSource.get(j); + + + for(int k = 0; k < columnCount; k++) + { + if(k==0) + { + String text = obj[0].toString(); + + if(new Chunk(text,HEADER_FONT).getWidthPoint() > new Chunk(longestText,HEADER_FONT).getWidthPoint()) + { + longestText = text; + } + + + Chunk txtck = new Chunk(obj[0].toString(),HEADER_FONT); + PdfPCell cell = new PdfPCell(new Paragraph(txtck)); + + if(j == noOfRows - 1) + { + cell.setBackgroundColor(new Color(170,170,170)); + } + + cell.setHorizontalAlignment(Element.ALIGN_LEFT); + cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setPaddingBottom(5); + cell.setPaddingTop(5); + cell.setPaddingLeft(5); + + table.addCell(cell); + } + else + { + Chunk txtck = new Chunk(obj[k].toString(),DATA_FONT); + + if(k == columnCount-1) + { + PdfPCell cell = new PdfPCell(new Paragraph(txtck)); + cell.setBackgroundColor(new Color(170,170,170)); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setPaddingBottom(5); + cell.setPaddingTop(5); + + table.addCell(cell); + } + else + { + PdfPCell cell = new PdfPCell(new Paragraph(txtck)); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setPaddingBottom(5); + cell.setPaddingTop(5); + + if(j == noOfRows - 1) + { + cell.setBackgroundColor(new Color(170,170,170)); + } + + table.addCell(cell); + } + } + + } + + } + + //setting table width + Chunk dataChk = new Chunk("9999",DATA_FONT); + Chunk headerChk = new Chunk(longestText,HEADER_FONT); + + float dataChkLength = dataChk.getWidthPoint() + 2*CELLPADDING ; + float headerChkLength = headerChk.getWidthPoint() + 2*CELLPADDING; + + float tableWidth = headerChkLength + dataChkLength*columnCount; + float actualTableWidth = document.getPageSize().width() - 2*MARGIN; + + float columnWidth = dataChkLength; + + if(tableWidth < actualTableWidth) + { + columnWidth = (actualTableWidth - headerChkLength)/(columnCount - 1); + } + + + float[] widths = new float[columnCount]; + widths[0] = headerChkLength + 2*CELLPADDING; + + for(int i=1; i longestText.length()) + { + longestText = header; + } + } + + + //setting the table width + Chunk dataChk = new Chunk("9999",DATA_FONT); + Chunk headerChk = new Chunk(longestText,HEADER_FONT); + + float dataChkLength = dataChk.getWidthPoint() + 2*CELLPADDING ; + float headerChkLength = headerChk.getWidthPoint() + 2*CELLPADDING; + + float tableWidth = headerChkLength + dataChkLength*columnCount; + + float actualTableWidth = document.getPageSize().width() - 2*MARGIN; + //float actualTableHeight = document.getPageSize().height() - 2*MARGIN; + + //if the table size is greater than that of the page we should + //scale the page + + if(tableWidth > actualTableWidth) + { + float documentWidth = document.getPageSize().width(); + float documentHeight = document.getPageSize().height(); + + float newDocumentWidth = tableWidth + 2*MARGIN; + float newDocumentHeight = (documentHeight * newDocumentWidth)/documentWidth; + + return new Rectangle(newDocumentWidth,newDocumentHeight); + } + + return document.getPageSize(); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/DocStatusMap.java b/posterita/posterita/src/main/org/posterita/core/DocStatusMap.java new file mode 100644 index 0000000000..6f6afe11b9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/DocStatusMap.java @@ -0,0 +1,55 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 17, 2005 by din + */ + +package org.posterita.core; + +import java.util.LinkedHashMap; + +import org.compiere.process.DocAction; + +public class DocStatusMap +{ + static LinkedHashMap docStatusMap; + + public static LinkedHashMap getDocStatusMap() + { + return docStatusMap; + } + + + static + { + docStatusMap = new LinkedHashMap(); + docStatusMap.put(DocAction.STATUS_Approved,"Approved"); + docStatusMap.put(DocAction.STATUS_Closed,"Closed"); + docStatusMap.put(DocAction.STATUS_Completed,"Completed"); + docStatusMap.put(DocAction.STATUS_Drafted,"Drafted"); + docStatusMap.put(DocAction.STATUS_InProgress,"In Progress"); + docStatusMap.put(DocAction.STATUS_Invalid,"Invalid"); + docStatusMap.put(DocAction.STATUS_NotApproved,"Not Approved"); + docStatusMap.put(DocAction.STATUS_Reversed,"Reserved"); + docStatusMap.put(DocAction.STATUS_Unknown,"UnKnown"); + docStatusMap.put(DocAction.STATUS_Voided,"Voided"); + docStatusMap.put(DocAction.STATUS_WaitingConfirmation,"Waiting Confirmation"); + docStatusMap.put(DocAction.STATUS_WaitingPayment,"Waiting Payment"); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/EmailValidator.java b/posterita/posterita/src/main/org/posterita/core/EmailValidator.java new file mode 100644 index 0000000000..04b7adb676 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/EmailValidator.java @@ -0,0 +1,171 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 12-Jul-2006 16:05:22 by praveen + * + */ + + +package org.posterita.core; + +public class EmailValidator +{ + public static boolean isValidEmail(String theEmail) + { + if(theEmail == null) + return false; + + else if(theEmail.length() == 0) + return false; + + else if(theEmail.length() > 78) // email addresses must fit on one line + return false; + + else + { + // if last character is a period, remove it + if(theEmail.charAt(theEmail.length()-1) == '.') + theEmail = theEmail.substring(0, theEmail.length() -1); + + //check for presence of "at" sign + int atIndex = theEmail.indexOf('@'); + + if(atIndex < 0) return false; + + //check for valid characters in the mailbox portion of the address + String mailbox = theEmail.substring(0, atIndex); + + if(mailbox == null || mailbox.length() == 0) + return false; + + else + { + int oldDotIndex = 0; + int dotEnd = mailbox.indexOf('.', oldDotIndex); + boolean done = false; + do + { + //cannot have 2 dots in a row + if(dotEnd == oldDotIndex) + return false; + + if(dotEnd < 0) + { + dotEnd = mailbox.length(); + done = true; + } + + for(int i = oldDotIndex; i < dotEnd; i++) + { + char cur = mailbox.charAt(i); + + if(!Character.isLetter(cur) && + !Character.isDigit(cur) && + cur != '!' && cur != '#' && + cur != '$' && cur != '%' && + cur != '&' && cur != '\'' && + cur != '*' && cur != '+' && + cur != '-' && cur != '/' && + cur != '=' && cur != '?' && + cur != '^' && cur != '_' && + cur != '`' && cur != '{' && + cur != '|' && cur != '}' && + cur != '~') + return false; + } + + oldDotIndex = dotEnd+1; + dotEnd = mailbox.indexOf('.', oldDotIndex+1); + } + while(!done); + } + + //check for a valid domain name + String domain = theEmail.substring(atIndex+1); + + if(domain == null || domain.length() == 0) + return false; + + else + { + //domains are divided into groups separated by dots + int oldDotIndex = 0; + int dotEnd = domain.indexOf('.', oldDotIndex); + + if(dotEnd < 0) + return false; + + + do + { + //cannot have 2 dots in a row + if(oldDotIndex == dotEnd) + return false; + + //first character must be letter or digit + if(!Character.isLetter(domain.charAt(oldDotIndex)) && + !Character.isDigit(domain.charAt(oldDotIndex))) + return false; + + //middle characters can be digits, letters, or hyphens + for(int i = oldDotIndex+1; i < dotEnd - 1; i++) + { + char cur = domain.charAt(i); + + if(!Character.isLetter(cur) && + !Character.isDigit(cur) && + cur != '-') + return false; + } + + //last character must be a letter or digit + if(!Character.isLetter(domain.charAt(dotEnd - 1)) && + !Character.isDigit(domain.charAt(dotEnd - 1))) + return false; + + oldDotIndex = dotEnd+1; + dotEnd = domain.indexOf('.', oldDotIndex+1); + } + + while(dotEnd > 0); + + //check the last part of the domain + String ext = domain.substring(oldDotIndex); + + if(ext == null || ext.length() == 0) + return false; + + else if(ext.length() < 2 || ext.length() > 4) + return false; + + else + { + for(int i = 0; i < ext.length(); i++) + { + if(!Character.isLetter(ext.charAt(i)) && + !Character.isDigit(ext.charAt(i))) + return false; + } + } + + } + } + return true; + } // end isValidEmail + +} diff --git a/posterita/posterita/src/main/org/posterita/core/FactoryPropertiesManager.java b/posterita/posterita/src/main/org/posterita/core/FactoryPropertiesManager.java new file mode 100644 index 0000000000..5a1786f513 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/FactoryPropertiesManager.java @@ -0,0 +1,50 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 24-Jun-2005 by alok + * + */ +package org.posterita.core; + +import org.posterita.factory.DBPropertiesManager; +import org.posterita.factory.WebProperties; + + + +public class FactoryPropertiesManager +{ + private FactoryPropertiesManager() + { + + } + + private static WebProperties singleton; + + public static WebProperties getProperty() + { + if (singleton == null) + singleton = new DBPropertiesManager(); + + return singleton; + } + + protected String getFileName() + { + return "Factory"; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/FileManager.java b/posterita/posterita/src/main/org/posterita/core/FileManager.java new file mode 100644 index 0000000000..cb16b9ef03 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/FileManager.java @@ -0,0 +1,274 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.core; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.util.KeyNamePair; + +import org.posterita.beans.AttributeValuesPair; +import org.posterita.beans.InventoryBean; +import org.posterita.beans.ProductBean; +import org.posterita.businesslogic.stock.InventoryManager; +import org.posterita.exceptions.BarcodeAlreadyExistsException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductAlreadyExistException; + +public class FileManager +{ + public static final String FILE_PATH_SEPARATOR = System.getProperty("file.separator"); + + public static void createFile(String filename) throws IOException + { + File newFile = new File(filename); + + File parentFile = newFile.getParentFile(); + + if(!parentFile.exists()) + parentFile.mkdirs(); + if (!newFile.exists()) + newFile.createNewFile(); + + + } + + + public static void write(String filename, String content, boolean cond) throws IOException + { + createFile(filename); + + + //BufferedWriter bw = null; + + + FileOutputStream out = new FileOutputStream(filename, cond); + OutputStreamWriter wr = new OutputStreamWriter(out,"ISO-8859-1"); + + + wr.write(content); + + wr.flush(); + + wr.close(); + + } + + public static ArrayList read(InputStream is) throws IOException + { + String delimiter = ","; + String line; + ProductBean bean; + AttributeValuesPair pair = null; + ArrayList list = new ArrayList(); + + InputStreamReader isr = new InputStreamReader(is); + BufferedReader bf = new BufferedReader(isr); + line = bf.readLine(); + String model; + String colour; + String transmission; + String year; + String strProductid; + String serno; + String engineNo; + while ((line = bf.readLine())!=null) + { + + bean = new ProductBean(); + ArrayList tokens = tokenize(line,delimiter); + strProductid = tokens.get(0).toString(); + bean.setProductId(Integer.valueOf(strProductid)); + + model = tokens.get(1).toString(); + KeyNamePair knpModel = new KeyNamePair(1,model); + + + transmission = tokens.get(2).toString(); + KeyNamePair knpTransmission = new KeyNamePair(2,transmission); + + colour = tokens.get(3).toString(); + KeyNamePair knpColour = new KeyNamePair(3,colour); + + year = tokens.get(4).toString();; + KeyNamePair knpYear = new KeyNamePair(4,year); + + pair = new AttributeValuesPair(); + pair.setModelAttributeValue(knpModel); + pair.setTransmissionAttributeValue(knpTransmission); + pair.setColourAttributeValue(knpColour); + pair.setYearAttributeValue(knpYear); + bean.setAttributeValuesPair(pair); + + + serno = tokens.get(5).toString();; + engineNo = tokens.get(6).toString();; + bean.setSerno(serno); + bean.setEngineNo(engineNo); + list.add(bean); + } + + bf.close(); + isr.close(); + return list; + + } + + public static ArrayList tokenize(String str, String delimiter) + { + ArrayList list = Interpreter.interprete(str,delimiter); + + return list; + } + + public static void write(InputStream content, String fileTarget) throws IOException + { + createFile(fileTarget); + + FileOutputStream streamOut = new FileOutputStream(fileTarget); + + int bytesRead = 0; + + byte[] buffer = new byte[8192]; + while((bytesRead = content.read(buffer,0,8192))!=-1) + { + streamOut.write(buffer,0,bytesRead); + } + + streamOut.close(); + content.close(); + } + + public static void copy(File src, File dst) throws IOException + { + InputStream in = new FileInputStream(src); + OutputStream out = new FileOutputStream(dst); + + // Transfer bytes from in to out + byte[] buf = new byte[1024]; + int len; + + while ((len = in.read(buf)) > 0) + { + out.write(buf, 0, len); + } + + in.close(); + out.close(); + } + + public static ArrayList readLines(File file) throws OperationException + { + BufferedReader bufferedReader = null; + + if(file == null) + throw new OperationException("File cannot be null"); + if(!file.exists()) + throw new OperationException("File does not exist, file: " + file.getAbsolutePath()); + if(file.isDirectory()) + throw new OperationException("File cannot be a directory, file: " + file.getAbsolutePath()); + + ArrayList readLines = new ArrayList(); + + try + { + FileReader fileInReader = new FileReader(file); + bufferedReader = new BufferedReader(fileInReader); + String line; + while((line = bufferedReader.readLine()) != null) + readLines.add(line); + + return readLines; + } + catch(FileNotFoundException ex) + { + throw new OperationException("File not found exception, file: " + file.getAbsolutePath(), ex); + } + catch(IOException ex) + { + throw new OperationException("IOException while reading file: " + file.getAbsolutePath(), ex); + } + finally + { + if (bufferedReader != null) + { + try + { + bufferedReader.close(); + } + catch(Exception e) + {} + } + } + + } + + public static void moveFile(File from, File to) throws OperationException + { + if (from.getAbsolutePath().equals(to.getAbsolutePath())) + return; + + if(!from.exists()) + throw new OperationException("From file does not exist"); + if(from.isDirectory()) + throw new OperationException("From file cannot be a directory"); + + if(to.exists()) + throw new OperationException("To file already exists"); + + try + { + InputStream in = new FileInputStream(from); + OutputStream out = new FileOutputStream(to); + + // Transfer bytes from in to out + byte[] buf = new byte[1024]; + int len; + + while ((len = in.read(buf)) > 0) + { + out.write(buf, 0, len); + } + + in.close(); + out.close(); + + if (!from.delete()) + throw new OperationException("Cannot delete from file: " + from.getAbsolutePath()); + } + catch(IOException ex) + { + throw new OperationException("Could not move file, from: " + from.getAbsolutePath() + " and to: " + to.getAbsolutePath()); + } + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/FilePropertiesManager.java b/posterita/posterita/src/main/org/posterita/core/FilePropertiesManager.java new file mode 100644 index 0000000000..3f7e6d9090 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/FilePropertiesManager.java @@ -0,0 +1,125 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.core; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.MissingResourceException; +import java.util.Properties; +import java.util.ResourceBundle; + +import org.posterita.beans.MessageBean; +import org.posterita.exceptions.OperationException; +import org.posterita.factory.WebProperties; +import org.posterita.lib.PropertiesConstant; +import org.posterita.util.PathInfo; + + +public abstract class FilePropertiesManager implements WebProperties +{ + protected static final String propertiesFileDirectory = "/WEB-INF/src/"; + protected ResourceBundle bundle; + + protected abstract String getFileName(); + + public synchronized void put(Properties ctx, String key, String value) throws OperationException + { + Object obj = new MessageBean(); + + ClassLoader loader = obj.getClass().getClassLoader(); + + InputStream stream = loader.getResourceAsStream("posterita.properties"); + + Properties prop2 = new Properties(); + try + { + prop2.load(stream); + } + catch (IOException e) + { + throw new OperationException(e.getMessage()); + } + + String absoluteFilePath = prop2.getProperty(PropertiesConstant.UDI_HOME) + propertiesFileDirectory + getFileName() + ".properties"; + + File file = new File(absoluteFilePath); + + InputStream is = null; + OutputStream os = null; + Properties prop = new Properties(); + try + { + is = new FileInputStream(file); + prop.load(is); + prop.put(key,value); + os = new FileOutputStream(file); + prop.store(os,getFileName()); + os.flush(); + os.close(); + } + catch(IOException ioException) + { + throw new OperationException(ioException.getMessage()); + } + finally + { + try + { + if( is != null) + { + is.close(); + } + if( os != null) + { + os.close(); + } + } + catch(Exception ex) + {} + } + + bundle = ResourceBundle.getBundle(getFileName()); + } + + public synchronized String get(Properties ctx, String key) + { + if (bundle == null) + bundle = ResourceBundle.getBundle(getFileName()); + + String value; + if(key.equals(PropertiesConstant.UDI_HOME)) + return PathInfo.PROJECT_HOME; + try + { + value = (String) bundle.getString(key); + } + catch (MissingResourceException e) + { + return null; + } + + return value; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/I18nAdapter.java b/posterita/posterita/src/main/org/posterita/core/I18nAdapter.java new file mode 100644 index 0000000000..caa92c191c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/I18nAdapter.java @@ -0,0 +1,77 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.posterita.core; + +import java.util.Locale; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.tagext.Tag; + +import org.apache.struts.Globals; +import org.displaytag.localization.I18nResourceProvider; +import org.displaytag.localization.LocaleResolver; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; + +public class I18nAdapter implements I18nResourceProvider, LocaleResolver +{ + + public String getResource(String resourceKey, String defaultValue, + Tag tag, PageContext pageContext) + { + Properties ctx = TmkJSPEnv.getCtx((HttpServletRequest)pageContext.getRequest()); + + String key = resourceKey; + + if (key == null) + { + key = defaultValue; + } + + ElementBean msgBean = ElementManager.getMsg(ctx, key); + return msgBean.getName(); + } + + /** + * @see LocaleResolver#resolveLocale(HttpServletRequest) + */ + public Locale resolveLocale(HttpServletRequest request) + { + Locale userLocale = null; + HttpSession session = request.getSession(false); + + if (session != null) + { + userLocale = (Locale) session.getAttribute(Globals.LOCALE_KEY); + } + + if (userLocale == null) + { + userLocale = request.getLocale(); + } + + return userLocale; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/ImageServer.java b/posterita/posterita/src/main/org/posterita/core/ImageServer.java new file mode 100644 index 0000000000..cffb111628 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/ImageServer.java @@ -0,0 +1,129 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 14, 2006 by praveen + * + */ +package org.posterita.core; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Properties; + +import javax.servlet.http.HttpServletResponse; + +import org.compiere.model.MAttachment; +import org.compiere.model.MAttachmentEntry; + +import org.posterita.exceptions.OperationException; +import org.posterita.util.PathInfo; + +public class ImageServer +{ + public static final String DEFAULT_IMAGE_PATH = PathInfo.PROJECT_HOME + "/images/webstore/noimage.jpg"; + + public static boolean sendImage(Properties ctx, int attachment_id, String size, HttpServletResponse response) throws OperationException + { + MAttachment attachment = new MAttachment(ctx,attachment_id,null); + + if(attachment == null) + { + return false; + } + + MAttachmentEntry[] entries = attachment.getEntries(); + MAttachmentEntry entry = null; + + try + { + for(int i=0; i appList = ApplicationManager.getAvailableApplications(); + servlet.getServletContext().setAttribute(Constants.WEB_APPLICATIONS, appList); + } + + + /** + * Clears all the dynamically generated reports + * @param servlet + */ + private void clearReportsDirectory(HttpServlet servlet) + { + /* + ServletContext context = servlet.getServletContext(); + String reportDirectoryPath = context.getRealPath(context.getInitParameter("REPORT_DIRECTORY")); + File reportDirectory = new File(reportDirectoryPath); + + if(reportDirectory.exists()) + { + System.out.println("Cleaning old reports --> "+ reportDirectoryPath); + + File[] files = reportDirectory.listFiles(); + for (File file : files) + { + if(file.isFile()) + file.delete(); + } + + System.out.println("Cleaning process completed successfully."); + } + else + { + System.out.println("Creating report directory."); + if(reportDirectory.mkdirs()) + { + System.out.println("Report directory created successfully."); + } + else + { + System.err.println("Unable to create report directory!"); + } + } + */ + + } + + public void destroy() + { + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/Interpreter.java b/posterita/posterita/src/main/org/posterita/core/Interpreter.java new file mode 100644 index 0000000000..adfa85ad7e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/Interpreter.java @@ -0,0 +1,64 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 29-Jul-2005 by alok + * + */ +package org.posterita.core; + +import java.util.ArrayList; + + +public class Interpreter +{ + public static ArrayList interprete(String initValues, String Delimiter) + { + + int index1; + int index2; + String firstValue; + String finalVal; + ArrayList list = new ArrayList(); + + + initValues = initValues.replaceAll("\"", ""); + for( int i=0;i< initValues.length();i++) + { + index1 = initValues.indexOf(Delimiter); + + firstValue = initValues.substring(index1+1); + + index2 = firstValue.indexOf(Delimiter); + if (index2 >=0) + { + finalVal = initValues.substring(index1+1,index1+index2+1); + initValues=initValues.substring(index1+index2); + list.add(finalVal); + } + + else + { + finalVal = initValues.substring(index1+1); + list.add(finalVal); + break; + } + } + return list; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/JulianDate.java b/posterita/posterita/src/main/org/posterita/core/JulianDate.java new file mode 100644 index 0000000000..02771fc443 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/JulianDate.java @@ -0,0 +1,696 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 29-Jul-2005 by alok + * + */ + +package org.posterita.core; + +import java.sql.Timestamp; +import java.text.*; +import java.util.*; + + + +/** + * A light weight date class stored in julian format. + */ +public class JulianDate implements Comparable +{ + /** + * The end of time. + */ + public static final JulianDate MAX_VALUE = new JulianDate(Integer.MAX_VALUE); + + /** + * Beginning of AD + */ + public static final int INT_REAL_MIN_VALUE = 1721424; + public static final JulianDate MIN_VALUE = new JulianDate(0); + + /** + * Calculator used to convert java.util.Dates. + */ + protected static final GregorianCalendar gc = new GregorianCalendar(); + + /** + * Julian date, defaults to January 1'st, 1970 + */ + protected int julian = 2440588; + + /** + * No argument constructor. + */ + public JulianDate() {} + + /** + * Constructs a date according to the specified year, month, and day. + *

    + * Entering an illegal value (e.g., a 14 for a month, or 31 for the number + * of days in February) results in a date of unpredictable value. + * + * @param year The year expressed as a 4-digit number. For example, 2002 + * @param month The month expressed as an integer between 1 and 12 + * @param day The day of the month, expressed as a number between 1 up to 31 + * + */ + public JulianDate(int year, int month, int day) + { + YMD ymd = new YMD(year, month, day); + + julian = ymd.julian(); + } + + + /** + * Constructs a julian date from a julian date value. + */ + public JulianDate(int julian) + { + this.julian = julian; + } + + /** + * Constructs a julian date from another julian date. + */ + public JulianDate(JulianDate d) + { + julian = d.julian; + } + + /** + * Constructs a julian date from a java date. + */ + public JulianDate(Date date) + { + julian = toJulian(date); + } + + /** + * Compares the current object and the passed-in object for equality. + * + * @param obj the object to compare with the current object. + * @return true if the two objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + try + { + JulianDate d = (JulianDate)obj; + + return (julian == d.julian); + } + catch (Exception ignore) {} + + return false; + } + + /** + * Returns the hash code of this object. + * + * @return the hash code of this object. + */ + public int hashCode() + { + return julian; + } + + /** + * + * Checks if the specified date is eual to this date. + * + * @return true if the specified object equals this object, + * otherwise returns false. + */ + public boolean equals(JulianDate d) + { + return (julian == d.julian); + } + + /** + * Returns the int difference between two julian dates. + * + * @param d the julian date whose value will be subtracted from this date. + * + * @return the difference betwween the julian value of this date and the + * julian value of the specified date. + */ + public int difference(JulianDate d) + { + return (julian - d.julian); + } + + /** + * Returns the julian value of this date. + * + * @return the julian value of this date. + */ + public int getJulian() + { + return julian; + } + + public Integer getJulianInt() + { + return Integer.valueOf(julian); + } + + /** + * Method used to create a timestamp. must have nonjulian time. + * + * @return the mseconds that are in the date(non Julian). + */ + public long getStandardTime() + { + return getJavaDate().getTime(); + } + + /** + * Returns a Long that is the last MSecond Of the Date Object. + * + * @return the last MSecond Of the Date Object. + */ + public long getLastMSDate() + { + JulianDate startOfDayTime = new JulianDate(this.getYear(), this.getMonth(), this.getDay()); + return (startOfDayTime.getStandardTime() + (24 * 60 * 60 * 1000 - 1)); + } + + /** + * Returns the day of the present year in which this date falls. + *

    + * The 1'st of January is day 0. + * + * @return the day of the present year in which this date falls. + */ + public int getDay() + { + YMD ymd = new YMD(julian); + + return ymd.day; + } + + /** + * Returns the month of the present year in which this date falls. + *

    + * January is month 0. + * + * @return the month of the present year in which this date falls. + */ + public int getMonth() + { + YMD ymd = new YMD(julian); + + return ymd.month; + } + + /** + * Returns the year in which this date falls. + * + * @return the year in which this date falls. + */ + public int getYear() + { + YMD ymd = new YMD(julian); + + return ymd.year; + } + + /** + * Checks if this date is on or before the input date. + * + * @return true if this date is on or before the input date, + * false otherwise. + */ + public boolean isOnOrBefore(JulianDate d) + { + return (julian < d.julian || julian == d.julian); + } + + + /** + * Checks if this date is on or after the input date. + * + * @return true if this date is on or after the input date, + * false otherwise. + */ + public boolean isOnOrAfter(JulianDate d) + { + return (julian > d.julian || julian == d.julian); + } + + /** + * Checks if this date is before the input date. + * + * @return true if this date is before the input date, + * false otherwise. + */ + public boolean isBefore(JulianDate d) + { + return (julian < d.julian); + } + + /** + * Checks if this date is after the input date. + * + * @return true if this date is before the input date, + * false otherwise. + */ + public boolean isAfter(JulianDate d) + { + return (julian > d.julian); + } + + /** + * Shifts the adjusted version by the offset, interpreted + * as a number of calendar dates, and sets the unadjusted version to be + * equal to the adjusted version. + * For example, if initially the unadjusted date is December 25, and the + * adjusted date is December 26, then shifting by an shift of 2 + * would cause the adjusted and unadjusted version to be December 28. + * + * @return the shifted date. + */ + public JulianDate shift(int shift) + { + JulianDate date = new JulianDate(this); + + date.julian += shift; + + return date; + } + + /** + * Returns a java.util.Date representation of the adjusted + * version of this. + * + * return a java.util.Date representation of the adjusted + * version of this. + */ + public java.util.Date getJavaDate() + { + return fromJulian(julian); + } + + /** + * Returns a java.sql.Date representation of the unadjusted + * version of this. + * + * @return a java.sql.Date representation of the unadjusted + * version of this. + */ + public java.sql.Date getSqlDate() + { + return new java.sql.Date(getJavaDate().getTime()); + } + + /** + * Returns a java.sql.Date representation of the adjusted + * version of this. + * + * @return a java.sql.Date representation of the adjusted + * version of this. + */ + public java.sql.Date getAdjSqlDate() + { + return new java.sql.Date(getJavaDate().getTime()); + } + + /** + * Add the given number of period units to this date. + */ + public JulianDate add(int units, int amount) + { + JulianDate date = null; + + synchronized (gc) + { + gc.setTime(getJavaDate()); + gc.add(units, amount); + + date = new JulianDate(gc.getTime()); + } + + return date; + } + + /** + * Convert a Java Date to it's Julian equivalent. + * + * @param the specified java date + * @return the corresponding julian value. + */ + protected int toJulian(java.util.Date date) + { + YMD ymd = null; + + synchronized (gc) + { + gc.setTime(date); + + ymd = new YMD(gc.get(GregorianCalendar.YEAR), gc.get(GregorianCalendar.MONTH) + 1, // GC month starts at 0 + gc.get(GregorianCalendar.DAY_OF_MONTH)); + } + + return ymd.julian(); + } + + /** + * Convert a Julian to it's Java Date equivalent. + * + * @param the specified julian value. + * @return the corresponding java date. + */ + protected java.util.Date fromJulian(int julian) + { + YMD ymd = new YMD(julian); + GregorianCalendar cal = new GregorianCalendar(ymd.year, ymd.month - 1, ymd.day); + + return cal.getTime(); + } + + /** + * Returns the day of the week of this date. + * + * @return the day of the week of this date. + */ + public int toDayOfWeek() + { + return new YMD(julian).toDayOfWeek(this); + } + + /** + * Returns a string representation of this object. + * + * @return a string representation of this object. + */ + public String toString() + { + DateFormat shortDF = DateFormat.getDateInstance(DateFormat.SHORT); + + return shortDF.format(fromJulian(julian)); + } + + /** + * Convert between Greogorian dates and Julian dates. + *

    + * Algorithm adapted from Press et al., Numerical Recipes in C, 2nd ed., + * Cambridge University Press 1992 + */ + protected class YMD + { + + /** + * Gregorian day of month (1-31). + */ + int day = 0; + + /** + * Gregorian month of year (1-12). + */ + int month = 0; + + /** + * Gregorian year. + */ + int year = 0; + + YMD(int year, int month, int day) + { + this.year = year; + this.month = month; + this.day = day; + } + + YMD(int julian) + { + if (julian < 0) + { + julian = 0; + + } + + int a = julian; + + if (julian >= 2299161) + { + int jadj = (int)(((float)(julian - 1867216) - 0.25) / 36524.25); + + a += 1 + jadj - (int)(0.25 * jadj); + } + + int b = a + 1524; + int c = (int)(6680.0 + ((float)(b - 2439870) - 122.1) / 365.25); + int d = (int)(365 * c + (0.25 * c)); + int e = (int)((b - d) / 30.6001); + + day = b - d - (int)(30.6001 * e); + month = e - 1; + + if (month > 12) + { + month -= 12; + + } + + year = c - 4715; + + if (month > 2) + { + --year; + + } + + if (year <= 0) + { + --year; + } + } + + int julian() + { + int y = year; + + if (year < 0) + { + y++; + + } + + int m = month; + + if (month > 2) + { + m++; + } + else + { + y--; + m += 13; + } + + int julian = (int)(java.lang.Math.floor(365.25 * y) + java.lang.Math.floor(30.6001 * m) + day + 1720995.0); + + int yearZero = 15 + 31 * (10 + 12 * 1582); + + if (day + 31 * (month + 12 * year) >= yearZero) + { + int jadj = (int)(0.01 * y); + + julian += 2 - jadj + (int)(0.25 * jadj); + } + + return julian; + } + + public final int toDayOfWeek(JulianDate julDate) + { + + long julian = julDate.getDay(); + // If julian is negative, then julian%7 will be negative, so we adjust + // accordingly. We add 1 because Julian day 0 is Monday. + int dayOfWeek = (int)((julian + 1) % 7); + + return dayOfWeek + ((dayOfWeek < 0) ? (7 + Calendar.SUNDAY) : Calendar.SUNDAY); + } + + } + + /** + * Gets the day of week of the julian day, following the Calendar + * convention: + *

  • Calendar.SUNDAY = 1 + *
  • Calendar.MONDAY = 2 + *
  • ... + *
  • Calendar.SATURDAY = 7 + * + * @return gets the day of week of the julian day + */ + public static int getDayOfWeek(int julian) + { + // If julian is negative, then julian%DAYS_IN_WEEK will be negative, so we adjust + // accordingly. We add 1 because Julian day 0 is Monday. + int dayOfWeek = (int)((julian + 1) % DAYS_IN_WEEK); + + return dayOfWeek + ((dayOfWeek < 0) ? (DAYS_IN_WEEK + Calendar.SUNDAY) : Calendar.SUNDAY); + } + + /** + * Number of days in a week. + */ + public static final int DAYS_IN_WEEK = 7; + + /** + * Checks if a year is a leap year. + * + * @param aYear the year to check + * @eturn true if the specified year is a leap year, false otherwise. + */ + public static final boolean isLeapYear(int aYear) + { + return ((aYear % 4 == 0) && ((aYear % 100 != 0) || (aYear % 400 == 0))); + } + + /** + * Checks if the period contains the 29th of February. + * + * @param start the start date of the period + * @param end the end date of the period + * Returns true if the period contains the 29th of February, false otherwise. + */ + public static final boolean containsFebruary29AsAdj(JulianDate start, JulianDate end) + { + int startYear = start.getYear(); + int endYear = end.getYear(); + + if (isLeapYear(startYear)) + { + if (start.isOnOrBefore(new JulianDate(startYear, 2, 29))) + { + if (end.isOnOrAfter(new JulianDate(startYear, 2, 29))) + { + return true; + } + } + } + else if (isLeapYear(endYear)) + { + if (end.isOnOrAfter(new JulianDate(endYear, 2, 29))) + { + if (start.isOnOrBefore(new JulianDate(endYear, 2, 29))) + { + return true; + } + } + } + + return false; + } + + + /** + * Checks if this date is at the end of the month. + * + * Returns true if the date is on the last day of the month, false otherwise. + */ + public boolean isEndOfMonth() + { + return equals(getLastDayOfMonth()); + } + + /** + * Returns the last day of the specified month. + * + * @param aMonth the specified month + * @param aYear the specified year + * @return the last JulianDate of this month. + */ + public static final JulianDate getLastDayOfMonth(int aMonth, int aYear) + { + return getFirstDayOfNextMonth(aMonth, aYear).shift(-1); + } + + /** + * Returns the last day of the month in which this date falls. + * + * @return the last day of the month in which this date falls. + */ + public JulianDate getLastDayOfMonth() + { + return getLastDayOfMonth(this.getMonth(), this.getYear()); + } + + /** + * Returns the day following the specified month. + * + * @param aMonth the soecified month. + * @param aYear the specified year. + * @return the first JulianDate of the next month. + */ + public static final JulianDate getFirstDayOfNextMonth(int aMonth, int aYear) + { + if (aMonth == Calendar.DECEMBER + 1) // Calendar month starts at 0 + { + return new JulianDate(aYear + 1, 1, 1); + } + else + { + return new JulianDate(aYear, aMonth + 1, 1); + } + } + + /** + * Get today as a JulianDate. + * + * @return today as a JulianDate.. + */ + public static final JulianDate getToday() + { + Calendar rightNow = Calendar.getInstance(); + + // Calendar.MONTH starts at 0!! + return new JulianDate(rightNow.get(Calendar.YEAR), + rightNow.get(Calendar.MONTH) + 1, + rightNow.get(Calendar.DAY_OF_MONTH)); + } + + public int compareTo(Object o) + { + JulianDate date = (JulianDate) o; + return this.difference(date); + + } + + + public static Timestamp getTodayDateOnly() + { + Calendar cal = Calendar.getInstance(); + + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp today = new Timestamp(cal.getTimeInMillis()); + + return today; + } + + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/core/KeyNamePairUtil.java b/posterita/posterita/src/main/org/posterita/core/KeyNamePairUtil.java new file mode 100644 index 0000000000..a258159eca --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/KeyNamePairUtil.java @@ -0,0 +1,97 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.core; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.util.DB; +import org.compiere.util.KeyNamePair; + +public class KeyNamePairUtil +{ + public static ArrayList getData(Properties ctx, String tableName, String whereClause) throws SQLException + { + return getData(ctx, tableName, whereClause, null); + } + + public static ArrayList getData(Properties ctx, String tableName, String whereClause, String trxName) throws SQLException + { + + // StringBuffer where = new StringBuffer(); + //StringBuffer from = new StringBuffer(); + + String keyColumn = tableName + "_ID"; + String sql; + + sql = "select name, " + + keyColumn + + " from " + + tableName; + + if (whereClause!=null) + sql = sql + " where " + whereClause+(" order by 1"); + + PreparedStatement pstmt = null; + + pstmt = DB.prepareStatement(sql, trxName); + ResultSet rs; + ArrayList data = new ArrayList(); + KeyNamePair pair; + int key; + String name; + + + try + { + rs = pstmt.executeQuery(); + + while (rs.next()) + { + name = rs.getString(1); + key = rs.getInt(2); + pair = new KeyNamePair(key, name); + data.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw e; + } + finally + { + try + { + pstmt.close(); + } + catch (Exception e) + {} + + pstmt = null; + } + + return data; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/MenuItem.java b/posterita/posterita/src/main/org/posterita/core/MenuItem.java new file mode 100644 index 0000000000..663d7fcf04 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/MenuItem.java @@ -0,0 +1,750 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 25, 2005 by vishee + */ + +package org.posterita.core; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.model.X_U_WebMenu; +import org.posterita.factory.AbstractFactory; +import org.posterita.model.MWebMenu; + +public class MenuItem +{ + + protected String menuLink; + protected MWebMenu menu; + protected ArrayList children; + protected int menuId; + protected boolean available; + + //dangerous constructor since nothing else is initialised. + private MenuItem(int menuId) + { + this.menuId = menuId; + } + + public MenuItem(MWebMenu menu) + { + this.menu = menu; + children = new ArrayList(); + menuLink = menu.getMenuLink(); + menuId = menu.get_ID(); + } + + public ArrayList getSubMenus() + { + return children; + } + + public Iterator getSubMenusIterator() + { + return children.iterator(); + } + + public void addSubMenu(MenuItem subMenu) + { + children.add(subMenu); + } + + public boolean hasSubMenu() + { + return (!children.isEmpty()); + } + + public boolean getHasSubMenu() + { + return (!children.isEmpty()); + } + + public boolean isActive() + { + return menu.isActive(); + } + + public String getImageLink() + { + return menu.getImageLink(); + } + + public String getMenuLink() + { + return menuLink; + } + + public int getMenuId() + { + return menuId; + } + + public String getModule() + { + return menu.getModule(); + } + + public int getParentMenuId() + { + return menu.getParentMenu_ID(); + } + + public String getPosition() + { + return menu.getPosition(); + } + + public void setMenuLink(String link) + { + menuLink = link; + } + + public String getDescription() + { + return menu.getDescription(); + } + + public boolean AmIaParent(int menuId) + { + ArrayList list = getAllChildren(); + MenuItem item = new MenuItem(menuId); + return list.contains(item); + } + + public ArrayList getBreadCrumb(int menuId) + { + ArrayList list = new ArrayList(); + + if (children.size() == 0) + return list; + + Iterator iter = children.iterator(); + + MenuItem me = new MenuItem(menuId); + + while (iter.hasNext()) + { + MenuItem item = (MenuItem) iter.next(); + + if (item.AmIaParent(menuId) || item.equals(me)) + { + list.add(item); + list.addAll(item.getBreadCrumb(menuId)); + } + + } + + return list; + } + + public String convert(int menuId) + { + ArrayList breadCrumb = getBreadCrumb(menuId); + Iterator iter = breadCrumb.iterator(); + + String bread = "\"\"  "; + while(iter.hasNext()) + { + MenuItem item = (MenuItem) iter.next(); + bread = bread + item.getName(); + } + + return bread; + } + + public ArrayList getAllChildren() + { + ArrayList list = new ArrayList(); + + if (children.size() == 0) + return list; + + Iterator iter = children.iterator(); + + while (iter.hasNext()) + { + MenuItem item = (MenuItem) iter.next(); + + ArrayList temp = item.getAllChildren(); + list.add(item); + list.addAll(temp); + } + + return list; + } + + + + + public static MenuItem getDummyMenuItem(Properties ctx) + { + MWebMenu menu = new MWebMenu(ctx, 0, null); + menu.setName("Dummy Root Menu"); + menu.setIsActive(false); + + MenuItem retMenu = new MenuItem(menu); + + return retMenu; + } + + + + public ArrayList getTopMenus() + { + return getMenus(AbstractFactory.MENU_POSITION_TOP); + } + + public ArrayList getLeftMenus() + { + return getMenus(AbstractFactory.MENU_POSITION_LEFT); + + } + + private ArrayList getMenus(String position) + { + ArrayList menuList = new ArrayList(); + + ArrayList menus = children; + + Iterator parentIter = menus.iterator(); + + while(parentIter.hasNext()) + { + MenuItem menuItem = (MenuItem)parentIter.next(); + if(menuItem.getPosition().compareTo(position) == 0) + { + menuList.add(menuItem); + } + } + + return menuList; + } + + // not good. + public ArrayList getSubMenus(int parentId) + { + ArrayList subMenus = new ArrayList(); + + Iterator pIter = children.iterator(); + MenuItem mItem; + + while(pIter.hasNext()) + { + mItem = (MenuItem)pIter.next(); + + if(mItem.getMenuId() == parentId) + { + subMenus = mItem.children; + + return subMenus; + } + } + + return subMenus; + } + + public boolean equals(Object obj) + { + MenuItem item = (MenuItem) obj; + + if ( obj == null) + return false; + + if (this.getMenuId() == item.getMenuId()) + return true; + else + return false; + } + + public boolean isAvailable() + { + return available; + } + + public void setAvailable(boolean available) + { + this.available = available; + } + + + public void setCategory(String category) + { + menu.setCategory(category); + } + + +/* public String getBreadCrumbMenu(Properties ctx, Integer menuId) + { + + if (menuId.intValue() != 0) + { + X_U_WebMenu menu = new X_U_WebMenu(ctx, menuId.intValue(), null); + + breadcrumb = breadcrumb + "" + menu.getName() + ""; + + if (menu.getParentMenu_ID() == 0) + return breadcrumb; + + getBreadCrumbMenu(ctx, Integer.valueOf(menu.getParentMenu_ID())); + } + + return breadcrumb; + } +*/ +/* public static String printTopMenu(MenuItem menuItem) + { + Iterator parentIter = menuItem.getSubMenusIterator(); + String htmlCode = ""; + htmlCode += ""; + MenuItem pItem; + + while(parentIter.hasNext()) + { + pItem = (MenuItem)parentIter.next(); + if(pItem.getPosition() == MenuFactory.MENU_POSITION_TOP) + { + + } + } + + htmlCode += "
    "; + }*/ + +/* private Properties ctx; + private Integer menuId; + private Integer parentMenuId; + private String name; + private String link; + private MenuItem[] children; + private String imageLink; + + private static final String BREAD_CRUMB_DELIMITER = ">"; + + public MenuItem(Properties ctx, Integer menuId) + { + this.ctx = ctx; + this.menuId = menuId; + } + + public String print() throws SystemException + { + MenuItem[] items = getChildren(); + + table table = new table(); + + for (int i = 0; i < items.length; i++) + { + MenuItem item = items[i]; + + tr tr = new tr(); + td td = new td(); + + img img = new img("images/link_icon.gif"); + img.addAttribute("width","15"); + img.addAttribute("height","15"); + img.addAttribute("border","0"); + img.addAttribute("align","absmiddle"); + img.addAttribute("vspace","5"); + + a a; + + //this is a leaf node + if (MenuManager.getChildren(ctx, item.getMenuId()).length == 0) + a = new a(item.getLink()); + else + a = new a(item.getLink() + item.getMenuId()); + + a.setClass("left"); + a.addElement(img); + + img.setTagText("" + item.getName()); + + a.addElement(img); + a.setPrettyPrint(true); + + td.addElement(a); + tr.addElement(td); + + table.addElement(tr); + } + + return table.toString(); + } + + public String getBreadCrumb(Integer menuId) throws SystemException, OperationException + { + MenuItem item = MenuManager.getParent(ctx, menuId); + MenuItem childMenuItm = getMenuItem(menuId); + + if (item == null) + return createBreadCrumb(childMenuItm); + + String breadCrumb = new String(""); + do + { + breadCrumb = createBreadCrumb(item) + BREAD_CRUMB_DELIMITER + breadCrumb; + item = MenuManager.getParent(ctx, item.getMenuId()); + } + while(item!=null); + + return breadCrumb; + + } + + private static String createBreadCrumb(MenuItem item) + { + a a = new a(item.getLink() + item.getMenuId()); + a.setTagText(item.getName()); + return a.toString(); + } + + public MenuItem[] getMenuJSP() throws SystemException + { + this.menuId = null; // make sure to retrieve first level menu + return getChildren(); + } + + public MenuItem[] MenuItems(Integer menuId) throws SystemException + { + return MenuManager.getChildren(ctx, menuId); + } + + private MenuItem getMenuItem(Integer menuItemId) + { + X_U_Menu menu = new X_U_Menu(ctx, menuItemId.intValue(), null); + MenuItem menuItem = new MenuItem(ctx, menuItemId); + menuItem.setLink(menu.getMenuLink()); + menuItem.setName(menu.getName()); + menuItem.setParentMenuId(Integer.valueOf(menu.getParentMenu_ID())); + return menuItem; + } + + + protected MenuItem[] getChildren() throws SystemException + { + if (children != null) + return children; + + MenuItem[] item = MenuManager.getChildren(ctx, menuId); + + children = item; + + return children; + } + + + public Integer getMenuId() + { + return menuId; + } + + public void setMenuId(Integer menuId) + { + this.menuId = menuId; + } + + public String getLink() + { + return link; + } + + public void setLink(String link) + { + this.link = link; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + + public Integer getParentMenuId() + { + return parentMenuId; + } + + public void setParentMenuId(Integer parentMenuId) + { + this.parentMenuId = parentMenuId; + } + + + //Generating menurole + + public static String getMenu(Properties ctx,Integer menuId) throws SystemException, OperationException + { + + String tab = "    "; + + StringBuffer menuStr = new StringBuffer(""); + + StringBuffer whereClause = new StringBuffer("ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id="+ Env.getAD_Org_ID(ctx)); + + // Modification brought due to Organisation type + String orgType = OrganisationManager.getOrganisationType(ctx); + + if(orgType == UdiConstants.ORG_TYPE_WHOLESALER) + whereClause.append(" and IsWholesaler='Y'"); + else if(orgType == UdiConstants.ORG_TYPE_RETAILER) + whereClause.append(" and IsRetailer='Y'"); + + // end modification + + MenuItem menuItem; + + if(menuId == null) + { + whereClause.append(" and parentmenu_id is null"); + } + else + { + whereClause.append(" and parentmenu_id =" + menuId); + + X_U_Menu menu = new X_U_Menu(ctx,menuId.intValue(), null); + + + if((MenuManager.getChildren(ctx,menuId).length == 0) && + (MenuManager.getParent(ctx,menuId) != null)) + { + menuStr.append(""); + menuStr.append(tab + menu.getName()); + menuStr.append(""); + menuStr.append(""); + menuStr.append(""); + } + else + { + menuStr.append(""); + menuStr.append(tab + menu.getName()); + menuStr.append(""); + menuStr.append(" "); + menuStr.append(""); + } + } + + //getting the child menus + int[] childId = X_U_Menu.getAllIDs(X_U_Menu.Table_Name,whereClause.toString(),null); + tab = tab + tab; + + for(int i=0; i 0) + { + img = new img(imageLink); + img.addAttribute("width","48"); + img.addAttribute("height","48"); + img.addAttribute("border","0"); + img.addAttribute("align","absmiddle"); + img.addAttribute("vspace","5"); + img.setTagText("" + item.getName()); + a.addElement(img); + } + else + { + a.setTagText(item.getName()); + } + + a.setPrettyPrint(true); + + td.addElement(a); + td.setHeight(48); + tr.addElement(td); + } + table.setCellPadding(10); + table.setBorder(2); + table.setBorderColor("#CC0000"); + table.setClass("header"); + table.addElement(tr); + return table.toString(); + } + + public String getImageLink() + { + return imageLink; + } + + public void setImageLink(String imageLink) + { + this.imageLink = imageLink; + } +*/ + public String getCategory() + { + //return ElementManager.getMsg(menu.getCtx(),menu.getCategory()).getName(); + return menu.getCategory(); + } + + public String getName() + { + //return ElementManager.getMsg(menu.getCtx(),menu.getName()).getName(); + return menu.getName(); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/NameValuePair.java b/posterita/posterita/src/main/org/posterita/core/NameValuePair.java new file mode 100644 index 0000000000..0b100c6bb7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/NameValuePair.java @@ -0,0 +1,88 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.core; + +import org.compiere.util.NamePair; + + +public class NameValuePair extends NamePair +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Constructor KeyValue Pair - + * @param key Key (-1 is considered as null) + * @param name string representation + */ + public NameValuePair(String name, String value) + { + super(name); + this.value = value; + this.name = name; + } // KeyNamePair + + + private String value; + private String name; + + public String getValue() + { + return value; + } + + + public boolean equals(Object obj) + { + if (obj instanceof NameValuePair) + { + NameValuePair pair = (NameValuePair) obj; + if (pair.getName() != null) + if (pair.getName().equals(name) && pair.getValue().equals(value)) + return true; + + } + return false; + } // equals + + + + public String getID() + { + return name; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public void setValue(String value) + { + this.value = value; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/PDFReportGenerator.java b/posterita/posterita/src/main/org/posterita/core/PDFReportGenerator.java new file mode 100644 index 0000000000..96ef612e2f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/PDFReportGenerator.java @@ -0,0 +1,181 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 1, 2006 by praveen + * + */ +package org.posterita.core; + +import java.awt.Color; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.Properties; + +import org.posterita.exceptions.OperationException; +import org.posterita.lib.PropertiesConstant; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.BaseFont; +import com.lowagie.text.pdf.PdfTemplate; +import com.lowagie.text.pdf.PdfWriter; + +public abstract class PDFReportGenerator +{ + protected float CELLPADDING = 4; + protected float MARGIN = 30f; + + //setting default fonts + protected Font TITLE_FONT = FontFactory.getFont(FontFactory.HELVETICA,18,Font.BOLD,new Color(255,0,0)); + protected Font SUBTITLE_FONT = FontFactory.getFont(FontFactory.HELVETICA,15,Font.BOLD,new Color(255,0,0)); + protected Font HEADER_FONT = FontFactory.getFont(FontFactory.HELVETICA,10,Font.BOLD); + protected Font DATA_FONT = FontFactory.getFont(FontFactory.HELVETICA,10); + + //setting default pagesize + protected Rectangle PAGE_SIZE = PageSize.A4.rotate(); + + protected Image getTextAsImage(String text) throws OperationException + { + try + { + PdfTemplate template = writer.getDirectContent().createTemplate(20, 20); + //BaseFont bf = BaseFont.createFont("Helvetica", "winansi", false); + BaseFont bf = HEADER_FONT.getBaseFont(); + float size = 10; + float width = bf.getWidthPoint(text, size); + template.beginText(); + //template.setRGBColorFillF(1, 1, 1); + template.setFontAndSize(bf, size); + template.setTextMatrix(0, 2); + template.showText(text); + template.endText(); + template.setWidth(width); + template.setHeight(size + 2); + // make an Image object from the template + Image img = Image.getInstance(template); + img.setAlignment(Image.RIGHT | Image.TEXTWRAP); + + return img; + + } + catch (Exception e) + { + throw new OperationException(e); + } + } + + + public String getPDFReport(Properties ctx,ArrayList dataSource) throws OperationException + { + String filename = RandomStringGenerator.randomstring() + ".pdf"; + String dir = UDIFilePropertiesManager.getProperty().get(ctx, PropertiesConstant.UDI_HOME) + "/config/reports/pdf/"; + String filepath = dir + filename; + + //Generatting report + + //Initialising the datasource + this.dataSource = dataSource; + + if(dataSource == null) + throw new OperationException("Cannot generate report! Cause: empty datasource"); + + Rectangle dimension = getDocumentDimension(); + Document document = new Document(dimension,MARGIN,MARGIN,MARGIN,MARGIN); + + try + { + writer = PdfWriter.getInstance(document, new FileOutputStream(filepath)); + writer.setPageEvent(new PDFReportPageEventHelper()); + + document.open(); + + //Add the title part + Paragraph title = new Paragraph(); + Paragraph subTitle = new Paragraph(); + + + if(reportTitle != null) + { + title.add(new Chunk(reportTitle,TITLE_FONT)); + title.setAlignment(Element.ALIGN_CENTER); + document.add(title); + } + + if(reportSubTitle != null) + { + subTitle.add(new Chunk(reportSubTitle,SUBTITLE_FONT)); + subTitle.setAlignment(Element.ALIGN_CENTER); + document.add(subTitle); + } + + if((reportSubTitle != null)||(reportTitle != null)) + { + document.add(new Paragraph(" ")); + } + + writeDocument(document); + + document.close(); + writer.close(); + + + return "config/report/pdf/" + filename; + } + catch (Exception e) + { + throw new OperationException(e); + } + + } + + public String getReportSubTitle() + { + return reportSubTitle; + } + + public void setReportSubTitle(String reportSubTitle) + { + this.reportSubTitle = reportSubTitle; + } + + public String getReportTitle() + { + return reportTitle; + } + + public void setReportTitle(String reportTitle) + { + this.reportTitle = reportTitle; + } + + + protected abstract void writeDocument(Document document) throws OperationException; + protected abstract Rectangle getDocumentDimension(); + + protected ArrayList dataSource = null; + protected PdfWriter writer = null; + private String reportTitle = null; + private String reportSubTitle = null; + +} diff --git a/posterita/posterita/src/main/org/posterita/core/PDFReportPageEventHelper.java b/posterita/posterita/src/main/org/posterita/core/PDFReportPageEventHelper.java new file mode 100644 index 0000000000..e862c7db05 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/PDFReportPageEventHelper.java @@ -0,0 +1,107 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 1, 2006 by praveen + * + */ +package org.posterita.core; + +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import com.lowagie.text.Document; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfPageEventHelper; +import com.lowagie.text.pdf.PdfTemplate; +import com.lowagie.text.pdf.PdfWriter; + +/** + * This class extends the page event handler that displays the + * header and footer. + */ +public class PDFReportPageEventHelper extends PdfPageEventHelper +{ + protected PdfPTable table; + protected PdfTemplate tpl; + protected String dateAndTime; + + protected static final Font PAGE_FOOTER_FONT = FontFactory.getFont(FontFactory.HELVETICA,10,Font.BOLD); + protected static final float MARGIN = 30f; + + public void onOpenDocument(PdfWriter writer, Document document) + { + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + dateAndTime = sdf.format(Calendar.getInstance().getTime()); + + table = new PdfPTable(2); + tpl = writer.getDirectContent().createTemplate(100, 100); + tpl.setBoundingBox(new Rectangle(-20, -20, 100, 100)); + + } + + public void onEndPage(PdfWriter writer, Document document) + { + PdfContentByte cb = writer.getDirectContent(); + cb.saveState(); + // write the headertable + table.setTotalWidth(document.right() - document.left()); + table.writeSelectedRows(0, -1, document.left(), document.getPageSize().height() - 50, cb); + // compose the footer + String text = "Page " + writer.getPageNumber() + " of "; + float textSize = PAGE_FOOTER_FONT.getBaseFont().getWidthPoint(text, 10); + float textBase = document.bottom() - 20; + cb.beginText(); + cb.setFontAndSize(PAGE_FOOTER_FONT.getBaseFont(), 10); + + float adjust = PAGE_FOOTER_FONT.getBaseFont().getWidthPoint("0", 10); + cb.setTextMatrix(document.right() - textSize - adjust, textBase); + cb.showText(text); + cb.endText(); + cb.addTemplate(tpl, document.right() - adjust, textBase); + + cb.saveState(); + + text = "Report Generated on : " + dateAndTime; + + textSize = PAGE_FOOTER_FONT.getBaseFont().getWidthPoint(text, 10); + textBase = document.bottom() - 20; + cb.beginText(); + cb.setFontAndSize(PAGE_FOOTER_FONT.getBaseFont(), 10); + + adjust = PAGE_FOOTER_FONT.getBaseFont().getWidthPoint("0", 10); + cb.setTextMatrix(MARGIN, textBase); + cb.showText(text); + cb.endText(); + + cb.saveState(); + + } + + public void onCloseDocument(PdfWriter writer, Document document) { + tpl.beginText(); + tpl.setFontAndSize(PAGE_FOOTER_FONT.getBaseFont(), 10); + tpl.setTextMatrix(0, 0); + tpl.showText("" + (writer.getPageNumber() - 1)); + tpl.endText(); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/PieChart.java b/posterita/posterita/src/main/org/posterita/core/PieChart.java new file mode 100644 index 0000000000..7eae18b472 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/PieChart.java @@ -0,0 +1,108 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 12-Jul-2006 17:18:07 by praveen + * + */ + +package org.posterita.core; + +import java.sql.SQLException; + +import org.compiere.util.DB; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.general.DefaultPieDataset; +import org.jfree.data.jdbc.JDBCPieDataset; + +import org.posterita.exceptions.OperationException; + +public class PieChart extends AbstractChart +{ + public static final String CHART_TYPE = "PieChart"; + public static final int PIE_FLAT = 1; + public static final int PIE_3D = 2; + + private DefaultPieDataset dataset = null; + private int type = PIE_FLAT; + + public PieChart(){}; + + public PieChart(DefaultPieDataset dataset,String title) + { + this.dataset = dataset; + this.title = title; + + } + + public JFreeChart createChart() throws OperationException + { + if(dataset==null) + { + throw new OperationException("Cannot create Pie chart: cause -> dataset empty!"); + } + + + switch (type) { + case PIE_FLAT: + chart = ChartFactory.createPieChart(title,dataset,showLegend,showTooltip,true); + break; + + case PIE_3D: + chart = ChartFactory.createPieChart3D(title,dataset,showLegend,showTooltip,true); + break; + + default: + throw new OperationException("Invalid Piechart type! Can only be Piechart.PIE_FLAT or Piechart.PIE_3D"); + } + + //setting subtitle + if(subtitle!=null) + { + TextTitle title = new TextTitle(subtitle); + chart.addSubtitle(title); + } + + return chart; + + } + + public void getDataSetFromSQL(String sql) throws OperationException + { + + JDBCPieDataset jdbcDataset = new JDBCPieDataset(DB.getConnectionRO()); + + try + { + jdbcDataset.executeQuery(sql); + this.dataset = jdbcDataset; + } catch (SQLException e) { + throw new OperationException(e); + } + } + + public DefaultPieDataset getDataset() { + return dataset; + } + + public void setDataset(DefaultPieDataset dataset) { + this.dataset = dataset; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/PieLabelGenerator.java b/posterita/posterita/src/main/org/posterita/core/PieLabelGenerator.java new file mode 100644 index 0000000000..d4d6d19e83 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/PieLabelGenerator.java @@ -0,0 +1,49 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 29-Aug-2006 13:54:31 by praveen + * + */ + +package org.posterita.core; + +import java.util.Map; + +import org.jfree.chart.labels.StandardPieSectionLabelGenerator; +import org.jfree.data.general.PieDataset; + +public class PieLabelGenerator extends StandardPieSectionLabelGenerator +{ + /** + * + */ + private static final long serialVersionUID = 1L; + Map labelMap = null; + + public PieLabelGenerator(Map labelMap) + { + this.labelMap = labelMap; + } + + public String generateSectionLabel(PieDataset arg0, Comparable arg1) + { + return ""+labelMap.get(arg1); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/PrintOrderApplet.java b/posterita/posterita/src/main/org/posterita/core/PrintOrderApplet.java new file mode 100644 index 0000000000..a0519bb412 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/PrintOrderApplet.java @@ -0,0 +1,360 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 17-Nov-2006 10:46:34 by praveen + * + */ + +package org.posterita.core; + +import java.applet.Applet; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.net.URL; +import java.net.URLConnection; + +import javax.print.DocFlavor; +import javax.print.DocPrintJob; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.SimpleDoc; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JTextField; + +import org.jpedal.PdfDecoder; + +/** + * Modifications: Added pdf printing capability + * @author ashley + */ +public class PrintOrderApplet extends Applet implements Runnable, ItemListener +{ + private static final long serialVersionUID = 1L; + /** Printer Name **/ + private String printerName = null; + /** Print Data **/ + private byte[] _printData = null; + private String _dataURL = null; + private String _dataContentType = null; + private JComboBox cmbPrintServices; + private PrintService pServices[]; + private JTextField txtUrl; + + /** + * Initialise the applet and the print services + * @see java.applet.Applet#init() + */ + public void init() + { + pServices = getPrintServices(); + cmbPrintServices = new JComboBox(); + cmbPrintServices.setSize(100, 20); + cmbPrintServices.addItemListener(this); + + for (int i = 0; i < pServices.length; i++) + { + cmbPrintServices.addItem(pServices[i].getName()); + } + + add(cmbPrintServices); + + if(pServices.length == 0l) + { + cmbPrintServices.addItem("No Printers found on the system"); + } + + JLabel lbl = new JLabel(); + add(lbl); + + txtUrl = new JTextField(40); + add(txtUrl); + + JButton btn = new JButton("Print"); + btn.addActionListener( + new ActionListener(){ + public void actionPerformed(ActionEvent e) + { + String url = txtUrl.getText(); + printURL(url); + }} + ); + + add(btn); + } + + /** + * Triggered when printer is changed + * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) + */ + public void itemStateChanged(ItemEvent e) + { + String pName = (String)e.getItem(); + if (e.getStateChange() == ItemEvent.SELECTED) + { + this.printerName = pName; + } + } + + /** + * Launch printing in a thread + * @see java.lang.Runnable#run() + */ + public void run() + { + PrintService printService = getPrintService(printerName); + + if (printService == null) + { + System.out.println("Could not get printer with name: " + printerName); + System.out.println("Taking default print service"); + printService = getDefaultPrintService(); + } + + if (printService == null) + { + System.out.println("No printers found"); + return; + } + + boolean isDataReady = loadPrintData(); + + if(isDataReady) + { + printData(printService); + } + else + { + System.out.println("Unable to print data."); + } + } + + /** + * Removes network protocol from printer name (Java problem) + * @param name Name of printer + * @return Name trimmed from Network protocol + */ + private String getValidatedPrinterName(String name) + { + if (name == null || name.length() == 0) + { + return name; + } + + if (name.startsWith("IPP") || name.startsWith("Win32")) + { + int index = name.indexOf(":"); + name = name.substring(index + 1, name.length()); + name = name.trim(); + } + return name; + } + + /** + * Get the system's print service by name + * @param name Name of Printer + * @return PrintService with the + */ + private PrintService getPrintService(String name) + { + PrintService pService = null; + if (name == null || name.trim().length() == 0) + { + return null; + } + + name = getValidatedPrinterName(name); + PrintService pServices[] = getPrintServices(); + for (int i = 0; i < pServices.length; i++) + { + String pServiceName = pServices[i].getName(); + pServiceName = getValidatedPrinterName(pServiceName); + if (name.equalsIgnoreCase(pServiceName)) + { + pService = pServices[i]; + break; + } + } + return pService; + } + + /** + * Get the system's default print service + * @return Default PrintService + */ + private PrintService getDefaultPrintService() + { + return PrintServiceLookup.lookupDefaultPrintService(); + } + + /** + * Get all the print services available on the system + * @return System available Print Services + */ + private PrintService[] getPrintServices() + { + if (pServices != null && pServices.length > 0) + { + return pServices; + } + + return PrintServiceLookup.lookupPrintServices(null, null); + } + + /** + * Retrieves the data from URL Provided + * @return true if loading of data successful + */ + private boolean loadPrintData() + { + try + { + URL url = new URL(_dataURL); + + System.out.println("Connecting to :" + _dataURL); + + URLConnection conn = url.openConnection(); + _dataContentType = conn.getContentType(); + + BufferedInputStream bis = new BufferedInputStream(conn.getInputStream()); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + System.out.println("Reading ......"); + + byte[] buf = new byte[1024]; + int len; + + while ((len = bis.read(buf)) > 0) + { + bos.write(buf, 0, len); + } + bis.close(); + + bos.flush(); + bos.close(); + + System.out.println("Reading completed successfully"); + + _printData = bos.toByteArray(); + + } + catch (Exception e) + { + e.printStackTrace(); + return false; + } + + return true; + } + + /** + * Sends the data to the print service based on the content type of the data + * @param printService Printer on which to print + * @return true if print command sent successfully + */ + private boolean printData(PrintService printService) + { + try + { + SimpleDoc doc; + + System.out.println("Printing data as:" + _dataContentType); + + //Print data as byte or PDF + if(_dataContentType.equalsIgnoreCase("application/pdf")) + { + PdfDecoder decodePDF = new PdfDecoder(true); + decodePDF.openPdfArray(_printData); + decodePDF.setPagePrintRange(1, decodePDF.getPageCount()); + decodePDF.setUsePDFPaperSize(true); + doc = new SimpleDoc(decodePDF, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null); + } + else + { + doc = new SimpleDoc(_printData, DocFlavor.BYTE_ARRAY.AUTOSENSE, null); + } + + DocPrintJob job = printService.createPrintJob(); + job.print(doc, new HashPrintRequestAttributeSet()); + + System.out.println("Job sent to printer succesfully"); + return true; + } + catch (Exception e) + { + e.printStackTrace(); + return false; + } + } + + /** + * Prints data retrieved from URL + * @param url Data URL + */ + public void printURL(String url) + { + _dataURL = url; + System.out.println("Printing URL: " + url); + Thread thread = new Thread(this); + thread.start(); + } + + /** + * Returns flat string of the printers + * @return All printers available separated by ### + */ + public String getPrintersForJS() + { + if (pServices == null || pServices.length == 0) + { + return "No printers found, check settings"; + } + + String printers = ""; + for (int i = 0; i < pServices.length - 1; i++) + { + printers += pServices[i].getName() + "###"; + } + + printers += pServices[pServices.length - 1]; + + return printers; + } + + /** + * @return the printerName + */ + public String getPrinterName() + { + return printerName; + } + + /** + * @param printerName the printerName to set + */ + public void setPrinterName(String printerName) + { + this.printerName = printerName; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/RandomStringGenerator.java b/posterita/posterita/src/main/org/posterita/core/RandomStringGenerator.java new file mode 100644 index 0000000000..404c0985ac --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/RandomStringGenerator.java @@ -0,0 +1,70 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 29-Jul-2005 by alok + * + */ +package org.posterita.core; + +import java.util.Random; + +/** + * @author jane + * + * To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class RandomStringGenerator +{ + private static Random rn = new Random(); + + private RandomStringGenerator() + { + } + + public static int rand(int lo, int hi) + { + int n = hi - lo + 1; + int i = rn.nextInt() % n; + if (i < 0) + i = -i; + return lo + i; + } + + @SuppressWarnings("deprecation") + public static String randomstring(int lo, int hi) + { + int n = rand(lo, hi); + byte b[] = new byte[n]; + for (int i = 0; i < n; i++) + b[i] = (byte)rand('a', 'z'); + return new String(b, 0); + } + + public static String randomstring() + { + return randomstring(5, 25); + } + + + + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/Range.java b/posterita/posterita/src/main/org/posterita/core/Range.java new file mode 100644 index 0000000000..6bbd2047db --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/Range.java @@ -0,0 +1,81 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 29-Jul-2005 by alok + * + */ + +package org.posterita.core; + +import java.io.Serializable; + + +public class Range implements Serializable +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + Comparable minValue; + Comparable maxValue; + + public Range(Comparable minValue, Comparable maxValue) + { + setMinValue(minValue); + setMaxValue(maxValue); + } + + public Comparable getMinValue() + { + return minValue; + } + + public void setMinValue(Comparable minValue) + { + this.minValue = minValue; + } + + public Comparable getMaxValue() + { + return maxValue; + } + + public void setMaxValue(Comparable maxValue) + { + this.maxValue = maxValue; + } + /** + * @value + * @return return true if the value is found in between the minimum value + * and the maximum value, else return false; + */ + @SuppressWarnings("unchecked") + public boolean isInRange(Comparable value) + { + if(value == null) + return false; + if((minValue == null || value.compareTo(minValue)>=0) && + (maxValue == null || value.compareTo(maxValue)<=0)) + return true; + + return false; + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/ReadKiaDemoData.java b/posterita/posterita/src/main/org/posterita/core/ReadKiaDemoData.java new file mode 100644 index 0000000000..54f5da2d13 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/ReadKiaDemoData.java @@ -0,0 +1,444 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ +package org.posterita.core; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.StringTokenizer; + + +public class ReadKiaDemoData +{ + private static String DELIMITER = ","; + public static void main(String args[]) throws IOException + { + ArrayList list = readNatisFile("/home/vickram/Documents/natisFile.csv"); + ArrayList models = readModels("/home/vickram/Documents/modelMatch.csv"); + list = processNatisUploads(list, models); + write(list, "/home/vickram/Documents/processed.csv"); + } + + public static ArrayList readNatisFile(String filename) throws FileNotFoundException + { + FileInputStream fis = new FileInputStream(filename); + + ArrayList list = new ArrayList(); + + String unitNo; + String vinNo; + String natisModelNo; + String natisModelDesc; + String engineNo; + String mainColorCode; + String noOfWheels; + String tare; + String enginePower; + String engineCapacity; + String year; + String countryCode; + String shippingInvoiceNo; + String colorCodeHex; + String colourName; + String eta; + String price; + + KiaNatisProductBean bean; + + InputStreamReader isr = null; + BufferedReader bf = null; + + String line; + try + { + isr = new InputStreamReader(fis); + bf = new BufferedReader(isr); + StringTokenizer tokenizer; + + while ((line = bf.readLine())!=null) + { + tokenizer = new StringTokenizer(line, ","); + + unitNo = tokenizer.nextToken(); + vinNo = tokenizer.nextToken(); + natisModelNo = tokenizer.nextToken(); + natisModelDesc = tokenizer.nextToken(); + engineNo = tokenizer.nextToken(); + mainColorCode = tokenizer.nextToken(); + noOfWheels = tokenizer.nextToken(); + tare = tokenizer.nextToken(); + enginePower = tokenizer.nextToken(); + engineCapacity = tokenizer.nextToken(); + year = tokenizer.nextToken(); + countryCode = tokenizer.nextToken(); + shippingInvoiceNo = tokenizer.nextToken(); + colorCodeHex = tokenizer.nextToken(); + colourName = tokenizer.nextToken(); + eta = tokenizer.nextToken(); + eta = "12252005"; + price = tokenizer.nextToken(); + + engineNo = engineNo.replaceAll(" ", ""); + bean = new ReadKiaDemoData().new KiaNatisProductBean(); + bean.setUnitNo(unitNo); + bean.setVinNo(vinNo); + bean.setNatisModelNo(natisModelNo); + bean.setNatisModelDesc(natisModelDesc); + bean.setEngineNo(engineNo); + bean.setMainColorCode(mainColorCode); + bean.setNoOfWheels(noOfWheels); + bean.setTare(tare); + bean.setEnginePower(enginePower); + bean.setEngineCapacity(engineCapacity); + bean.setYear(year); + bean.setCountryCode(countryCode); + bean.setShippingInvoiceNo(shippingInvoiceNo); + bean.setColorCodeHex(colorCodeHex); + bean.setColourName(colourName); + bean.setEta(eta); + bean.setPrice(price); + list.add(bean); + + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + finally + { + try + { + if ( isr != null) + { + isr.close(); + } + if ( bf != null) + { + bf.close(); + } + } + catch(Exception ex) + {} + } + + return list; + } + + public static ArrayList readModels(String filename) throws FileNotFoundException + { + FileInputStream fis = new FileInputStream(filename); + + ArrayList list = new ArrayList(); + + String model; + String modelNo; + String modelDerivative; + + + KiaNatisProductBean bean; + + InputStreamReader isr = null; + BufferedReader bf = null; + + String line; + try + { + isr = new InputStreamReader(fis); + bf = new BufferedReader(isr); + StringTokenizer tokenizer; + + while ((line = bf.readLine())!=null) + { + tokenizer = new StringTokenizer(line, ","); + + model = tokenizer.nextToken(); + modelNo = tokenizer.nextToken(); + modelDerivative = tokenizer.nextToken(); + + bean = new ReadKiaDemoData().new KiaNatisProductBean(); + bean.setModel(model); + bean.setNatisModelNo(modelNo); + bean.setModelDerivative(modelDerivative); + list.add(bean); + + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + finally + { + try + { + if (fis != null) + { + fis.close(); + } + if (isr != null) + { + isr.close(); + } + if( bf != null) + { + bf.close(); + } + } + catch(Exception ex) + {} + } + + return list; + } + + + class KiaNatisProductBean + { + String unitNo; + String vinNo; + String natisModelNo; + String natisModelDesc; + String engineNo; + String mainColorCode; + String noOfWheels; + String tare; + String enginePower; + String engineCapacity; + String year; + String countryCode; + String shippingInvoiceNo; + String colorCodeHex; + String colourName; + String eta; + String price; + String model; + String modelDerivative; + + + public String getModel() { + return model; + } + public void setModel(String model) { + this.model = model; + } + public String getModelDerivative() { + return modelDerivative; + } + public void setModelDerivative(String modelDerivative) { + this.modelDerivative = modelDerivative; + } + public String getColorCodeHex() { + return colorCodeHex; + } + public void setColorCodeHex(String colorCodeHex) { + this.colorCodeHex = colorCodeHex; + } + public String getColourName() { + return colourName; + } + public void setColourName(String colourName) { + this.colourName = colourName; + } + public String getCountryCode() { + return countryCode; + } + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + public String getEngineCapacity() { + return engineCapacity; + } + public void setEngineCapacity(String engineCapacity) { + this.engineCapacity = engineCapacity; + } + public String getEngineNo() { + return engineNo; + } + public void setEngineNo(String engineNo) { + this.engineNo = engineNo; + } + public String getEnginePower() { + return enginePower; + } + public void setEnginePower(String enginePower) { + this.enginePower = enginePower; + } + public String getEta() { + return eta; + } + public void setEta(String eta) { + this.eta = eta; + } + public String getMainColorCode() { + return mainColorCode; + } + public void setMainColorCode(String mainColorCode) { + this.mainColorCode = mainColorCode; + } + public String getNatisModelDesc() { + return natisModelDesc; + } + public void setNatisModelDesc(String natisModelDesc) { + this.natisModelDesc = natisModelDesc; + } + public String getNatisModelNo() { + return natisModelNo; + } + public void setNatisModelNo(String natisModelNo) { + this.natisModelNo = natisModelNo; + } + public String getNoOfWheels() { + return noOfWheels; + } + public void setNoOfWheels(String noOfWheels) { + this.noOfWheels = noOfWheels; + } + public String getPrice() { + return price; + } + public void setPrice(String price) { + this.price = price; + } + public String getShippingInvoiceNo() { + return shippingInvoiceNo; + } + public void setShippingInvoiceNo(String shippingInvoiceNo) { + this.shippingInvoiceNo = shippingInvoiceNo; + } + public String getTare() { + return tare; + } + public void setTare(String tare) { + this.tare = tare; + } + public String getUnitNo() { + return unitNo; + } + public void setUnitNo(String unitNo) { + this.unitNo = unitNo; + } + public String getVinNo() { + return vinNo; + } + public void setVinNo(String vinNo) { + this.vinNo = vinNo; + } + public String getYear() { + return year; + } + public void setYear(String year) { + this.year = year; + } + + public String toString() + { + String str = unitNo + DELIMITER + + vinNo + DELIMITER + + natisModelNo + DELIMITER + + natisModelDesc + DELIMITER + + engineNo + DELIMITER + + mainColorCode + DELIMITER + + noOfWheels + DELIMITER + + tare + DELIMITER + + enginePower + DELIMITER + + engineCapacity + DELIMITER + + year + DELIMITER + + countryCode + DELIMITER + + shippingInvoiceNo + DELIMITER + + colorCodeHex + DELIMITER + + colourName + DELIMITER + + eta + DELIMITER + + price + DELIMITER + + "" + DELIMITER + //natis registration status + "" + DELIMITER + //order status + ""; //description + return str; + } + } + + public static ArrayList processNatisUploads(ArrayList natisUploads, ArrayList models) + { + Iterator iter = natisUploads.iterator(); + + KiaNatisProductBean bean; + + String match; + while (iter.hasNext()) + { + bean = (KiaNatisProductBean) iter.next(); + match = getModelMatch(bean, models); + bean.setNatisModelDesc(match); + + } + + return natisUploads; + } + + public static String getModelMatch(KiaNatisProductBean bean, ArrayList models) + { + Iterator iter = models.iterator(); + + KiaNatisProductBean model; + + while (iter.hasNext()) + { + model = (KiaNatisProductBean) iter.next(); + + if (matchFound(bean, model)) + return model.getModel(); + } + + return "No match Found"; + + } + + public static boolean matchFound(KiaNatisProductBean bean, KiaNatisProductBean bean2) + { + if (bean.getNatisModelNo().equals(bean2.getNatisModelNo())) + if (bean.getNatisModelDesc().equals(bean2.getModelDerivative())) + return true; + + return false; + } + + public static void write(ArrayList natisModels, String fileName) throws IOException + { + Iterator iter = natisModels.iterator(); + + StringBuffer buffer = new StringBuffer(); + KiaNatisProductBean bean; + while (iter.hasNext()) + { + bean = (KiaNatisProductBean) iter.next(); + buffer.append(bean.toString()); + buffer.append("\n"); + + } + + FileManager.write(fileName, buffer.toString(), false); + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/SessionStorage.java b/posterita/posterita/src/main/org/posterita/core/SessionStorage.java new file mode 100644 index 0000000000..a49405175e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/SessionStorage.java @@ -0,0 +1,514 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 29, 2005 by praveen + * + */ +package org.posterita.core; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.compiere.model.MCountry; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MPOSTerminal; +import org.compiere.model.MStore; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.ValueNamePair; +import org.posterita.Constants; +import org.posterita.beans.AttributeValuesBean; +import org.posterita.beans.FilterBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.PriceListBean; +import org.posterita.beans.ProductAttributeBean; +import org.posterita.beans.ProductInfo; +import org.posterita.beans.ReportBean; +import org.posterita.beans.StockBean; +import org.posterita.beans.UDIPair; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.CurrencyManager; +import org.posterita.businesslogic.HistoryFilterBean; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.performanceanalysis.POSSalesReportManager; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.SystemException; +import org.posterita.lib.UdiConstants; + +public class SessionStorage +{ + + public static void putProductAttributes(HttpServletRequest request, ProductAttributeBean productAttributeBean) + { + //extract parameters from request + //1.attributeSetId + //2.attributeId + request.getSession().setAttribute(Constants.ATTRIBUTE_NAME, productAttributeBean.getAttributes()); + request.getSession().setAttribute(Constants.ATTRIBUTE_SET, productAttributeBean.getAttributeSets()); + request.getSession().setAttribute(Constants.ATTRIBUTE_VALUES, productAttributeBean.getAttributeValues()); + } + + @SuppressWarnings("unchecked") + public static void putTextileProductInfo(HttpServletRequest request, ProductInfo info) + { + //Properties ctx = TmkJSPEnv.getCtx(request); + + TreeSet brandSet = new TreeSet(info.getAttributeValuesBean().getBrand()); + TreeSet modelSet = new TreeSet(info.getAttributeValuesBean().getModel()); + TreeSet designSet = new TreeSet(info.getAttributeValuesBean().getDesign()); + TreeSet colourSet = new TreeSet(info.getAttributeValuesBean().getColour()); + TreeSet sizeSet = new TreeSet(info.getAttributeValuesBean().getSize()); + TreeSet trxSet = new TreeSet(info.getAttributeValuesBean().getTrx()); + TreeSet yearSet = new TreeSet(info.getAttributeValuesBean().getYears()); + + request.getSession().setAttribute(Constants.POS_STOCK,info.getProducts()); + request.getSession().setAttribute(Constants.BRAND_ATTRIBUTE_VALUES, brandSet); + request.getSession().setAttribute(Constants.MODEL_ATTRIBUTE_VALUES, modelSet); + request.getSession().setAttribute(Constants.DESIGN_ATTRIBUTE_VALUES, designSet); + request.getSession().setAttribute(Constants.COLOUR_ATTRIBUTE_VALUES, colourSet); + request.getSession().setAttribute(Constants.SIZE_ATTRIBUTE_VALUES, sizeSet); + request.getSession().setAttribute(Constants.TRX_ATTRIBUTE_VALUES, trxSet); + request.getSession().setAttribute(Constants.YEAR_ATTRIBUTE_VALUES, yearSet); + } + + public static void putWebOrderBean(Properties ctx,HttpServletRequest request, WebDocumentBean bean) throws OperationException + { + request.getSession().setAttribute(Constants.ORDER_LINES,bean.getLines()); + request.getSession().setAttribute(Constants.MORDER, bean.getOrder()); + } + + public static void putHistoryFilterBeans(HttpServletRequest request, ArrayList orderHistory) + { + HistoryFilterBean orderHistoryBeans = new HistoryFilterBean(orderHistory); + + TreeSet bPartners = orderHistoryBeans.getBPartnerList(); + TreeSet docStatus = orderHistoryBeans.getDocStatusList(); + + request.getSession().setAttribute(Constants.BPARTNER, bPartners); + request.getSession().setAttribute(Constants.DOC_STATUS, docStatus); + } + + public static WebDocumentBean getWebOrderBean(Properties ctx, HttpServletRequest request) + { + ArrayList orderLines = (ArrayList) request.getSession().getAttribute(Constants.ORDER_LINES); + + MOrder order = (MOrder) request.getSession().getAttribute(Constants.MORDER); + + WebDocumentBean webOrderBean = new WebDocumentBean(); + webOrderBean.setLines(orderLines); + webOrderBean.setOrder(order); + return webOrderBean; + } + + public static void putPriceList(HttpServletRequest request, ArrayList priceList) + { + AttributeValuesBean attrs = PriceListManager.getAttributeValues(priceList); + + ArrayList modelSet = attrs.getModel(); + ArrayList colourSet = attrs.getColour(); + ArrayList trxSet = attrs.getTrx(); + ArrayList yearSet = attrs.getYears(); + + request.getSession().setAttribute(Constants.PRICE_LIST, priceList); + request.getSession().setAttribute(Constants.MODEL_ATTRIBUTE_VALUES, modelSet); + request.getSession().setAttribute(Constants.COLOUR_ATTRIBUTE_VALUES, colourSet); + request.getSession().setAttribute(Constants.TRX_ATTRIBUTE_VALUES, trxSet); + request.getSession().setAttribute(Constants.YEAR_ATTRIBUTE_VALUES, yearSet); + + } + + @SuppressWarnings({"unchecked","unchecked"}) + public static void putOrderFiltering(Properties ctx, HttpServletRequest request, FilterBean filterBean) + { + ArrayList bpList = (ArrayList) filterBean.getBpList(); + ArrayList docStatusList = (ArrayList) filterBean.getDocStatusList(); + + if ((bpList!=null) && (bpList.size()!=0)) + { + TreeSet bpSet = new TreeSet(bpList); + request.setAttribute(Constants.BPARTNER, bpSet); + } + + if ((docStatusList!=null) && (docStatusList.size()!=0)) + { + TreeSet bpSet = new TreeSet(docStatusList); + request.setAttribute(Constants.DOC_STATUS, bpSet); + } + } + + public static void putSCOrderFiltering(Properties ctx, HttpServletRequest request, FilterBean filterBean) throws OperationException + { + putOrderFiltering(ctx, request, filterBean); + + MOrg myOrg = OrganisationManager.getMyOrg(ctx); + } + + @SuppressWarnings("unchecked") + public static void putPriceListProducts(HttpServletRequest request, ProductInfo info) + { + TreeSet modelSet = new TreeSet(info.getAttributeValuesBean().getModel()); + TreeSet colourSet = new TreeSet(info.getAttributeValuesBean().getColour()); + TreeSet trxSet = new TreeSet(info.getAttributeValuesBean().getTrx()); + TreeSet yearSet = new TreeSet(info.getAttributeValuesBean().getYears()); + + request.getSession().setAttribute(Constants.MODEL_ATTRIBUTE_VALUES, modelSet); + request.getSession().setAttribute(Constants.COLOUR_ATTRIBUTE_VALUES, colourSet); + request.getSession().setAttribute(Constants.TRX_ATTRIBUTE_VALUES, trxSet); + request.getSession().setAttribute(Constants.YEAR_ATTRIBUTE_VALUES, yearSet); + } + + public static void putMenus(Properties ctx, HttpServletRequest request) throws SystemException, OperationException + { + ArrayList menuList = MenuManager.getMenus(ctx, request); + MenuItem menus = MenuManager.buildMenuTree(ctx, menuList); + ArrayList topMenusList = menus.getTopMenus(); + ArrayList leftMenusList = menus.getLeftMenus(); + + request.getSession().setAttribute(Constants.MENUS, menus); + request.getSession().setAttribute(Constants.TOP_MENUS, topMenusList); + request.getSession().setAttribute(Constants.LEFT_MENUS, leftMenusList); + + } + + public static void putOrg(Properties ctx, HttpServletRequest request) + { + MOrg org = new MOrg(ctx, Env.getAD_Org_ID(ctx), null); + + request.getSession().setAttribute(Constants.ORGANISATION, org); + } + + public static void putProductAttributeValueIds(HttpServletRequest request, StockBean bean) + { + request.getSession().setAttribute(Constants.MODEL_ATTRIBUTE_VALUE_ID, bean.getModel()); + request.getSession().setAttribute(Constants.COLOUR_ATTRIBUTE_VALUE_ID, bean.getColour()); + request.getSession().setAttribute(Constants.TRX_ATTRIBUTE_VALUE_ID, bean.getTransmission()); + request.getSession().setAttribute(Constants.YEAR_ATTRIBUTE_VALUE_ID, bean.getYear()); + } + + public static StockBean getProductAttributeValueIds(HttpServletRequest request, StockBean bean) + { + Integer modelAttributeValueId = (Integer) request.getSession().getAttribute(Constants.MODEL_ATTRIBUTE_VALUE_ID); + Integer colourAttributeValueId = (Integer) request.getSession().getAttribute(Constants.COLOUR_ATTRIBUTE_VALUE_ID); + Integer trxAttributeValueId = (Integer) request.getSession().getAttribute(Constants.TRX_ATTRIBUTE_VALUE_ID); + Integer yearAttributeValueId = (Integer) request.getSession().getAttribute(Constants.YEAR_ATTRIBUTE_VALUE_ID); + + bean.setModel(modelAttributeValueId); + bean.setColour(colourAttributeValueId); + bean.setTransmission(trxAttributeValueId); + bean.setYear(yearAttributeValueId); + + return bean; + } + + public static void putOrderInfo(Properties ctx, WebDocumentBean webBean, HttpServletRequest request) + { + request.getSession().setAttribute(Constants.ME_LOCATION, webBean.getMeLocation()); + request.getSession().setAttribute(Constants.YOU_LOCATION, webBean.getYouLocation()); + request.getSession().setAttribute(Constants.YOU_BP_LOCATION, webBean.getYoubpLocation()); + request.getSession().setAttribute(Constants.ME, webBean.getMe()); + request.getSession().setAttribute(Constants.YOU,webBean.getYou()); + request.getSession().setAttribute(Constants.MORDER, webBean.getOrder()); + request.getSession().setAttribute(Constants.MORDER_LINES_COLLECTION,webBean.getLines()); + request.getSession().setAttribute(Constants.SIMPLE_COMMAND,webBean.getSimpleCommand()); + request.getSession().setAttribute(Constants.COMPLEX_COMMAND,webBean.getComplexCommand()); + request.getSession().setAttribute(Constants.WEB_DOCUMENT_HEADER_BEAN, webBean.getHeaderBean()); + request.getSession().setAttribute(Constants.ORDER_TAX,webBean.getTotalTax()); + request.getSession().setAttribute(Constants.TOTAL_LINES,webBean.getTotalLines()); + request.getSession().setAttribute(Constants.GRAND_TOTAL,webBean.getGrandTotal()); + request.getSession().setAttribute(Constants.ALLOCATION,webBean.getAllocations()); + request.getSession().setAttribute(Constants.SALES_REP, webBean.getSalesRep()); + } + + public static void putPOSOrderInfo(Properties ctx,OrderLineBean bean,HttpServletRequest request,String forward) throws OperationException + { + if (forward == null) + throw new OperationException("Invalid forward parameter, it is set to null"); + + if (forward.equals(POSManager.DELETE_POS_ORDERLINE)) + { + Integer posOrderId=(Integer)request.getSession().getAttribute(Constants.CURRENT_POS_ORDER_ID); + MOrder posOrder = new MOrder(ctx, posOrderId, null); + ArrayList POSlist = POSManager.populateOrderLines(ctx,posOrder); + WebDocumentBean POSdocumentBean=POSManager.calculateOrderTotals(POSlist); + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,posOrder.get_ID()); + request.setAttribute(Constants.POS_ORDER_LINES,POSlist); + request.setAttribute(Constants.ORDER_TAX,POSdocumentBean.getTotalTax()); + request.setAttribute(Constants.TOTAL_LINES,POSdocumentBean.getTotalLines()); + request.setAttribute(Constants.GRAND_TOTAL,POSdocumentBean.getGrandTotal()); + } + else if (forward.equals(POSManager.DELETE_PARTIAL_POS_ORDERLINE)) + { + Integer posOrderId=(Integer)request.getSession().getAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + MOrder posOrder = new MOrder(ctx, posOrderId, null); + ArrayList POSlist = POSManager.populateOrderLines(ctx,posOrder); + WebDocumentBean POSdocumentBean=POSManager.calculateOrderTotals(POSlist); + request.getSession().setAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID,posOrder.get_ID()); + request.setAttribute(Constants.PARTIAL_POS_ORDER_LINES,POSlist); + request.setAttribute(Constants.ORDER_TAX,POSdocumentBean.getTotalTax()); + request.setAttribute(Constants.TOTAL_LINES,POSdocumentBean.getTotalLines()); + request.setAttribute(Constants.GRAND_TOTAL,POSdocumentBean.getGrandTotal()); + } + else if (forward.equals(POSManager.DELETE_GOODS_RECEIVE_ORDERLINE)) + { + Integer goodsReceiceNoteId=(Integer)request.getSession().getAttribute(Constants.GOODS_RECEIVE_NOTE_ID); + MOrder goodsReceiveNote = new MOrder(ctx,goodsReceiceNoteId,null); + goodsReceiveNote = new MOrder(ctx, goodsReceiveNote.get_ID(), null); + ArrayList Receivelist = POSManager.populateOrderLines(ctx,goodsReceiveNote); + WebDocumentBean receivedocumentBean=POSManager.calculateOrderTotals(Receivelist); + request.getSession().setAttribute(Constants.GOODS_RECEIVE_NOTE_ID,goodsReceiveNote.get_ID()); + request.setAttribute(Constants.GOODS_RECEIVE_NOTE_LINES,Receivelist); + request.setAttribute(Constants.ORDER_TAX,receivedocumentBean.getTotalTax()); + request.setAttribute(Constants.TOTAL_LINES,receivedocumentBean.getTotalLines()); + request.setAttribute(Constants.GRAND_TOTAL,receivedocumentBean.getGrandTotal()); + } + else if (forward.equals(POSManager.DELETE_CUSTOMER_RETURN_ORDERLINE)) + { + Integer customerReturnOrderId=(Integer)request.getSession().getAttribute(Constants.CUSTOMER_RETURN_ORDER_ID); + MOrder customerReturnOrder=new MOrder(ctx,customerReturnOrderId,null); + ArrayList returnList = POSManager.populateOrderLines(ctx,customerReturnOrder); + WebDocumentBean receivedocumentBean=POSManager.calculateOrderTotals(returnList); + request.getSession().setAttribute(Constants.CUSTOMER_RETURN_ORDER,customerReturnOrder); + request.setAttribute(Constants.CUSTOMER_RETURN_ORDER_LINES,returnList); + request.setAttribute(Constants.ORDER_TAX,receivedocumentBean.getTotalTax()); + request.setAttribute(Constants.TOTAL_LINES,receivedocumentBean.getTotalLines()); + request.setAttribute(Constants.GRAND_TOTAL,receivedocumentBean.getGrandTotal()); + } + else + { + Integer goodsReturnNoteId=(Integer)request.getSession().getAttribute(Constants.GOODS_RETURN_NOTE_ID); + MOrder goodsReturnNote=new MOrder(ctx,goodsReturnNoteId,null); + goodsReturnNote = new MOrder(ctx, goodsReturnNote.get_ID(), null); + ArrayList list = POSManager.populateOrderLines(ctx,goodsReturnNote); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + + request.getSession().setAttribute(Constants.GOODS_RETURN_NOTE,goodsReturnNote); + request.setAttribute(Constants.GOODS_RETURN_NOTE_LINES,list); + request.setAttribute(Constants.ORDER_TAX,documentBean.getTotalTax()); + request.setAttribute(Constants.TOTAL_LINES,documentBean.getTotalLines()); + request.setAttribute(Constants.GRAND_TOTAL,documentBean.getGrandTotal()); + } + } + + public static void putCompleteOrderInfo(Properties ctx,HttpServletRequest request,WebDocumentBean webBean,WebDocumentBean documentBean) + { + request.setAttribute(Constants.ORDER_TAX,documentBean.getTotalTax()); + request.setAttribute(Constants.TOTAL_LINES,documentBean.getTotalLines()); + request.setAttribute(Constants.SUB_TOTAL, documentBean.getSubTotal()); + request.setAttribute(Constants.GRAND_TOTAL,documentBean.getGrandTotal()); + request.getSession().setAttribute(Constants.ME_LOCATION, webBean.getMeLocation()); + request.getSession().setAttribute(Constants.YOU_LOCATION, webBean.getYouLocation()); + request.getSession().setAttribute(Constants.YOU_BP_LOCATION, webBean.getYoubpLocation()); + request.getSession().setAttribute(Constants.ME, webBean.getMe()); + request.getSession().setAttribute(Constants.YOU,webBean.getYou()); + request.getSession().setAttribute(Constants.MORDER, webBean.getOrder()); + request.getSession().setAttribute(Constants.MORDER_LINES_COLLECTION,webBean.getLines()); + request.getSession().setAttribute(Constants.SIMPLE_COMMAND,webBean.getSimpleCommand()); + request.getSession().setAttribute(Constants.COMPLEX_COMMAND,webBean.getComplexCommand()); + request.getSession().setAttribute(Constants.WEB_DOCUMENT_HEADER_BEAN, webBean.getHeaderBean()); + request.getSession().setAttribute(Constants.ORDER_TAX,webBean.getTotalTax()); + request.getSession().setAttribute(Constants.TOTAL_LINES,webBean.getTotalLines()); + request.getSession().setAttribute(Constants.GRAND_TOTAL,webBean.getGrandTotal()); + request.getSession().setAttribute(Constants.ALLOCATION,webBean.getAllocations()); + request.getSession().setAttribute(Constants.SALES_REP, webBean.getSalesRep()); + request.getSession().setAttribute(Constants.DESCRIPTION, webBean.getDescription()); + request.getSession().setAttribute(Constants.PAYMENT_BY_CASH, webBean.getPaymentByCash()); + request.getSession().setAttribute(Constants.PAYMENT_BY_CARD, webBean.getPaymentByCard()); + request.getSession().setAttribute(Constants.PAYMENT_BY_CHEQUE, webBean.getPaymentbyCheque()); + request.setAttribute(Constants.CURRENCY_SYMBOLE,webBean.getCurrencySymbole()); + + } + + + public static void setPOSTerminal(Properties ctx, int terminalId, HttpServletRequest request) throws OperationException + { + Env.setContext(ctx, UdiConstants.TERMINAL_ID, terminalId); + + MPOSTerminal terminal = new MPOSTerminal(ctx, terminalId, null); + + int purchasePList = terminal.getPO_PriceList_ID(); + int purchasePLVersion = PriceListManager.getPriceListVersionID(ctx, purchasePList, null); + + Env.setContext(ctx,UdiConstants.POS_PURCHASE_PL_VERSION,purchasePLVersion); + Env.setContext(ctx,UdiConstants.POS_PURCHASE_PL,purchasePList); + + } + + public static void putSalesGroupFilter(Properties ctx,HttpServletRequest request,ReportBean bean) throws OperationException + { + ArrayList groupList = POSSalesReportManager.getSalesGroupList(ctx,bean); + ArrayList priceQtyFilter = POSSalesReportManager.getPriceQtyFilter(ctx); + + request.getSession().setAttribute(Constants.SALESGROUP_LIST,groupList); + request.getSession().setAttribute(Constants.PRICEQTY_FILTER,priceQtyFilter); + request.getSession().removeAttribute(Constants.REPORT_URL); + } + public static void removeSession(Properties ctx,HttpServletRequest request) + { + //goods Receive Note + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_ID); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.PRESENT_GRN_ORDER); + request.getSession().removeAttribute(Constants.PRESENT_GRN_ORDER_ID); + + //goods return Note + + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_ID); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.PRESENT_GOODS_RET_ORDER); + request.getSession().removeAttribute(Constants.PRESENT_GOODS_RET_ORDER_ID); + + //Customer Return Order + + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_ID); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + + request.getSession().removeAttribute(Constants.ORDER_TYPE); + request.getSession().removeAttribute(Constants.POS_ORDER_DOC_NUMBER); + request.getSession().removeAttribute(Constants.CREDIT_PAYMENT_TERM_ID); + request.getSession().removeAttribute( Constants.PRESENT_CUSTOMER_RET_ORDER ); + request.getSession().removeAttribute( Constants.PRESENT_CUSTOMER_RET_ORDER_ID); + + //pos order + + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.BPARTNER); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_POS_ORDER_ID); + + + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + request.getSession().removeAttribute(Constants.PRESENT_POS_ORDER); + request.getSession().removeAttribute( Constants.PRESENT_POS_ORDER_ID ); + + //credit order + + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.CREDIT_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.CREDIT_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_POS_ORDER_ID); + request.getSession().removeAttribute(Constants.CREDITORDER_BPARTNER); + request.getSession().removeAttribute(Constants.SHIPMENT_REQUIRED); + request.getSession().removeAttribute(Constants.TO_BE_SHIPPED); + request.getSession().removeAttribute(Constants.CREDITORDER_BPARTNER); + request.getSession().removeAttribute( Constants.PRESENT_CREDIT_ORDER ); + request.getSession().removeAttribute( Constants.PRESENT_CREDIT_ORDER_ID); + + request.getSession().removeAttribute(Constants.ORDER_TYPE); + request.getSession().removeAttribute(Constants.POS_ORDER_DOC_NUMBER); + } + + public static void putCountriesAndCurrencies(Properties ctx, HttpServletRequest request) throws OperationException + { + try + { + ArrayList countriesKNPair = KeyNamePairUtil.getData(ctx, MCountry.Table_Name, "IsActive='Y'"); + ArrayList currenciesKNPair = CurrencyManager.getAllCurrencies(); + + request.getSession().setAttribute(Constants.COUNTRIES, countriesKNPair); + request.getSession().setAttribute(Constants.CURRENCIES, currenciesKNPair); + } + catch (SQLException e) + { + throw new OperationException(e); + } + } + + public static void putStoreName(Properties ctx, HttpServletRequest request) + { + MStore store = MStore.get(ctx, Env.getContextAsInt(ctx, UdiConstants.WSTORE_CTX_PARAM)); + + if (store == null) + request.getSession().setAttribute(Constants.APP_NAME, ""); + else + request.getSession().setAttribute(Constants.APP_NAME, store.getName()); + } + + public static void putLoginSession(Properties ctx, HttpServletRequest request, HttpServletResponse response, int terminalId) throws OperationException + { + setPOSTerminal(ctx, terminalId, request); + POSTerminalManager.setTerminalInCookie(response, terminalId); + String currSymboleSales = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + String currSymbolePurchase = POSTerminalManager.getDefaultPurchaseCurrency(ctx).getCurSymbol(); + request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales); + request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE_PURCHASE,currSymbolePurchase); + request.getSession().setAttribute(Constants.USER_ORGS,OrganisationManager.getUserOrgPairs(ctx)); + request.getSession().setAttribute(Constants.USER_ORGS_STOCK, OrganisationManager.getUserOrgPairs(ctx, false)); + putCountriesAndCurrencies(ctx, request); + putStoreName(ctx, request); + putPriceLists(ctx, request); + + // Terminal Transfer values + ValueNamePair noTransfer = new ValueNamePair("", ""); + ValueNamePair bankAccountTransfer = new ValueNamePair(MPOSTerminal.CASHBOOKTRANSFERTYPE_BankAccount, "Bank Account"); + ValueNamePair cashbookTransfer = new ValueNamePair(MPOSTerminal.CASHBOOKTRANSFERTYPE_CashBook, "Cashbook"); + ArrayList terminalTransferList = new ArrayList(); + terminalTransferList.add(noTransfer); + terminalTransferList.add(bankAccountTransfer); + terminalTransferList.add(cashbookTransfer); + request.getSession().setAttribute(Constants.TERMINAL_TRANSFER_TYPE, terminalTransferList); + } + + public static void putPriceLists(Properties ctx, HttpServletRequest request) throws OperationException + { + int soPriceListId = POSTerminalManager.getSOPriceListId(ctx); + int poPriceListId = POSTerminalManager.getPOPriceListId(ctx); + int warehouseId = POSTerminalManager.getWarehouseId(ctx); + Env.setContext(ctx, UdiConstants.PRICELIST_CTX_PARAM, soPriceListId); + Env.setContext(ctx, UdiConstants.WAREHOUSE_CTX_PARAM, warehouseId); + + ArrayList activeSalesPriceLists = PriceListManager.getPriceLists(ctx,0,"",true,null,null,true,null); + ArrayList salesPriceListsKNP = PriceListManager.getKeyNamePair(ctx, activeSalesPriceLists); + + ArrayList activePurchasePriceLists = PriceListManager.getPriceLists(ctx,0,"",true,null,null,false,null); + ArrayList purchasePriceListsKNP = PriceListManager.getKeyNamePair(ctx, activePurchasePriceLists); + + ArrayList activePriceLists = PriceListManager.getPriceLists(ctx, 0, "", true, null, null, null, null); + ArrayList priceListsKNP = PriceListManager.getKeyNamePair(ctx, activePriceLists); + + request.getSession().setAttribute(Constants.USER_SALES_PRICE_LISTS, salesPriceListsKNP); + request.getSession().setAttribute(Constants.USER_PURCHASE_PRICE_LISTS, purchasePriceListsKNP); + request.getSession().setAttribute(Constants.USER_PRICE_LISTS, priceListsKNP); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/SimpleCalendarDate.java b/posterita/posterita/src/main/org/posterita/core/SimpleCalendarDate.java new file mode 100644 index 0000000000..cefc49cb08 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/SimpleCalendarDate.java @@ -0,0 +1,90 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 29-Jul-2005 by alok + * + */ + +package org.posterita.core; + +/* + * This class is used for formatting purposes only + * @author vishee + * + * To change the template for this generated type comment go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +public class SimpleCalendarDate +{ + private String year; + private String month; + private String day; + + + public SimpleCalendarDate(String day, String month, String year) + { + this.day = day; + this.month = month; + this.year = year; + } + + + + /** + * @return Returns the day. + */ + public String getDay() + { + return day; + } + /** + * @param day The day to set. + */ + public void setDay(String day) + { + this.day = day; + } + /** + * @return Returns the month. + */ + public String getMonth() + { + return month; + } + /** + * @param month The month to set. + */ + public void setMonth(String month) + { + this.month = month; + } + /** + * @return Returns the year. + */ + public String getYear() + { + return year; + } + /** + * @param year The year to set. + */ + public void setYear(String year) + { + this.year = year; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/SimpleReportGenerator.java b/posterita/posterita/src/main/org/posterita/core/SimpleReportGenerator.java new file mode 100644 index 0000000000..2740a52e76 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/SimpleReportGenerator.java @@ -0,0 +1,178 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 6, 2006 by praveen + * + */ +package org.posterita.core; + +import java.util.Iterator; + +import org.posterita.exceptions.OperationException; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; + +public class SimpleReportGenerator extends PDFReportGenerator +{ + private PdfPTable table = null; + float[] columnWidth = null; + + public SimpleReportGenerator() + { + this.PAGE_SIZE = PageSize.A4.rotate(); + } + + protected void writeDocument(Document document) throws OperationException + { + int columnCount = 0; + + Object[] obj = null; + + Iterator iter = dataSource.iterator(); + + try + { + if(iter.hasNext()) + { + obj = (Object[]) iter.next(); + + columnCount = obj.length; + + table = new PdfPTable(columnCount); + + + for(int i = 0; i < columnCount; i++) + { + Paragraph p = new Paragraph(new Chunk(obj[i].toString(),HEADER_FONT)); + PdfPCell cell = new PdfPCell(p); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + + table.addCell(cell); + } + + //table.endHeaders(); + } + + while(iter.hasNext()) + { + obj = (Object[]) iter.next(); + + + for(int i = 0; i < columnCount; i++) + { + Paragraph p = new Paragraph(new Chunk(obj[i].toString(),HEADER_FONT)); + PdfPCell cell = new PdfPCell(p); + + table.addCell(cell); + } + } + + table.setWidths(columnWidth); + document.add(table); + } + catch (Exception e) + { + throw new OperationException(e); + } + } + + + protected Rectangle getDocumentDimension() + { + if(dataSource == null) return PAGE_SIZE; + + Iterator iter = dataSource.iterator(); + + int columnCount = 0; + + Object[] obj = null; + + if(iter.hasNext()) + { + obj = (Object[]) iter.next(); + + columnCount = obj.length; + columnWidth = new float[columnCount]; + + for(int i = 0; i < columnCount; i++) + { + columnWidth[i] = new Chunk(obj[i].toString(),HEADER_FONT).getWidthPoint(); + } + } + + while(iter.hasNext()) + { + obj = (Object[]) iter.next(); + + columnCount = obj.length; + + for(int i = 0; i < columnCount; i++) + { + if(obj[i] == null)obj[i] = ""; + + float dataWidth = new Chunk(obj[i].toString(),DATA_FONT).getWidthPoint(); + + if(dataWidth > columnWidth[i])columnWidth[i] = dataWidth; + } + } + + + float tableWidth = 0.0f; + + for(int j=0; j actualTableWidth) + { + float documentWidth = PAGE_SIZE.width(); + float documentHeight = PAGE_SIZE.height(); + + float newDocumentWidth = tableWidth + 2*MARGIN; + float newDocumentHeight = (documentHeight * newDocumentWidth)/documentWidth; + + return new Rectangle(newDocumentWidth,newDocumentHeight); + } + else + { + float scaleFactor = (actualTableWidth * tableWidth)/tableWidth; + + for(int k=0; k reportData = null; + private table tbl = new table(); + + private boolean sortable = false; + private String id = null; + private String[] headerStyle = null; + private String style = null; + private String title = null; + private String subtitle = null; + private Timestamp fromDate = null; + private Timestamp toDate = null; + + + public TabularReport(ArrayList reportData) + { + this.reportData = reportData; + } + + public TabularReport() + { + + } + + public void createReport() throws OperationException + { + + tbl = new table(); + tbl.addAttribute("border","0"); + tbl.addAttribute("width","100%"); + tbl.addAttribute("class","main"); + + td tdtitle = new td("" + title + ""); + td tdsubtitle = new td("" + subtitle + ""); + + tbl.addElement( + new tr().addElement(tdtitle.addAttribute("align","center")) + ); + + tbl.addElement( + new tr().addElement(tdsubtitle.addAttribute("align","center")) + ); + + tbl.addElement(new td(" ")); + + //////////////////////////////////////////////////////////////////////// + table displaytbl = new table(); + + if(reportData==null) + { + throw new OperationException("Cannot create tabular report: cause -> dataset empty!"); + } + + id = RandomStringGenerator.randomstring(); + + displaytbl.addAttribute("border","1"); + //displaytbl.addAttribute("width","100%"); + + String styleClass = (style == null) ? "" : style; + if(isSortable()) + { + styleClass = styleClass + " sortable"; + } + displaytbl.addAttribute("class",styleClass.trim()); + displaytbl.addAttribute("id",id); + + Iterator iter = reportData.iterator(); + Object[] headers = iter.next(); + + int columnCount = headers.length; + + tr r = new tr(); + + for(int i=0;i i)) + { + String style = headerStyle[i]+""; + h.addAttribute("class",style); + } + + r.addElement(h); + } + + displaytbl.addElement(r); + + int count = 0; + String[] s = {"label","contentname"}; + String tdStyle = ""; + + while(iter.hasNext()) + { + count++; + + tdStyle = s[count%2]; + + Object[] data = iter.next(); + tr rr = new tr(); + + for(int i=0;i" + title + ""); + td tdsubtitle = new td("" + subtitle + ""); + + tbl.addElement( + new tr().addElement(tdtitle.addAttribute("align","center")) + ); + + tbl.addElement( + new tr().addElement(tdsubtitle.addAttribute("align","center")) + ); + + tbl.addElement(new td(" ")); + + //////////////////////////////////////////////////////////////////////// + table displaytbl = new table(); + + if(reportData==null) + { + throw new OperationException("Cannot create tabular report: cause -> dataset empty!"); + } + + id = RandomStringGenerator.randomstring(); + + displaytbl.addAttribute("border","1"); + //displaytbl.addAttribute("width","100%"); + + String styleClass = (style == null) ? "" : style; + if(isSortable()) + { + styleClass = styleClass + " sortable"; + } + displaytbl.addAttribute("class",styleClass.trim()); + displaytbl.addAttribute("id",id); + + Iterator iter = reportData.iterator(); + Object[] headers = iter.next(); + + int columnCount = headers.length; + + tr r = new tr(); + + for(int i=0;i i)) + { + String style = headerStyle[i]+""; + h.addAttribute("class",style); + } + + r.addElement(h); + } + + displaytbl.addElement(r); + + int count = 0; + String[] s = {"label","contentname"}; + String tdStyle = ""; + int size = reportData.size(); + + + while(iter.hasNext()) + { + count++; + + tdStyle = s[count%2]; + + Object[] data = iter.next(); + + tr rr = new tr(); + for(int i=0;i2) + { + cellData = "" + data[i] + ""; + } + else + { + if (count == 1) + { + cellData = "" + data[i] + ""; + } + else + { + cellData = "" + data[i] + ""; + } + } + } + td d = new td(cellData); + d.addAttribute("class",tdStyle); + + rr.addElement(d); + } + + displaytbl.addElement(rr); + } + //////////////////////////////////////////////////////////////////////// + tbl.addElement(new tr().addElement(new td().addElement(displaytbl))); + } + + public void createReport(String action, Integer productId) throws OperationException + { + tbl = new table(); + tbl.addAttribute("border","0"); + tbl.addAttribute("width","100%"); + tbl.addAttribute("class","main"); + + td tdtitle = new td("" + title + ""); + td tdsubtitle = new td("" + subtitle + ""); + + tbl.addElement( + new tr().addElement(tdtitle.addAttribute("align","center")) + ); + + tbl.addElement( + new tr().addElement(tdsubtitle.addAttribute("align","center")) + ); + + tbl.addElement(new td(" ")); + + //////////////////////////////////////////////////////////////////////// + table displaytbl = new table(); + + if(reportData==null) + { + throw new OperationException("Cannot create tabular report: cause -> dataset empty!"); + } + + id = RandomStringGenerator.randomstring(); + + displaytbl.addAttribute("border","1"); + //displaytbl.addAttribute("width","100%"); + + String styleClass = (style == null) ? "" : style; + if(isSortable()) + { + styleClass = styleClass + " sortable"; + } + displaytbl.addAttribute("class",styleClass.trim()); + displaytbl.addAttribute("id",id); + + Iterator iter = reportData.iterator(); + Object[] headers = iter.next(); + + int columnCount = headers.length; + + tr r = new tr(); + + for(int i=0;i i)) + { + String style = headerStyle[i]+""; + h.addAttribute("class",style); + } + + r.addElement(h); + } + + displaytbl.addElement(r); + + int count = 0; + String[] s = {"label","contentname"}; + String tdStyle = ""; + + int size = reportData.size(); + while(iter.hasNext()) + { + + tdStyle = s[count%2]; + + Object[] data = iter.next(); + tr rr = new tr(); + + String date = data[0].toString(); + String month = ""; + String[] dateSplit = date.split(" "); + + + if (dateSplit != null) + { + month= dateSplit[0]; + } + DateFormatSymbols dfs = new DateFormatSymbols(Locale.ENGLISH); + int mon = 0; + int yr = 0; + + if (count < size-1) + { + yr = Integer.parseInt(dateSplit[1]); + + String[] monthName = dfs.getMonths(); + for (int i = 0; i" + data[i] + ""; + } + if (i == 2 && ! (qty == 0f)) + { + cellData = "" + data[i] + ""; + } + if (i == 3) + { + cellData = "" + data[i] + ""; + } + } + + td d = new td(cellData); + d.addAttribute("class",tdStyle); + + rr.addElement(d); + displaytbl.addElement(rr); + } + count++; + + } + + //////////////////////////////////////////////////////////////////////// + tbl.addElement(new tr().addElement(new td().addElement(displaytbl))); + + } + + public String createPDFReport() throws DocumentException, FileNotFoundException + { + String filename = RandomStringGenerator.randomstring() + ".pdf"; + String filepath = ReportManager.getReportPath(filename); + + FileOutputStream fos = new FileOutputStream(filepath); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, fos); + + document.open(); + + Font style1 = new Font(Font.HELVETICA, 16.0f, Font.BOLD); + Font style2 = new Font(Font.HELVETICA, 12.0f); + //write content + Paragraph p = new Paragraph(new Chunk(title, style1)); + p.setAlignment(Element.ALIGN_CENTER); + document.add(p); + + p = new Paragraph(new Chunk(subtitle, style2)); + p.setAlignment(Element.ALIGN_CENTER); + document.add(p); + + p = new Paragraph("\n\n"); + document.add(p); + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + for(Object[] row : reportData) + { + for(Object data : row) + { + PdfPCell cell = new PdfPCell(new Phrase(data.toString())); + table.addCell(cell); + } + } + + document.add(table); + document.close(); + + + return filename; + } + + public byte[] getPDFData() throws DocumentException + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, bos); + + document.open(); + + // Font Syle + Font style1 = new Font(Font.TIMES_ROMAN, 12.0f, Font.BOLD); + Font style2 = new Font(Font.TIMES_ROMAN, 8.0f, Font.BOLD); + Font style3 = new Font(Font.TIMES_ROMAN, 8.0f); + Font style4 = new Font(Font.TIMES_ROMAN, 9.0f, Font.BOLD); + float[] widths = { 2f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f}; + + // Table header + PdfPTable mytable = new PdfPTable(7); + mytable.setTotalWidth(widths); + mytable.setWidthPercentage(100f); + PdfPCell header = new PdfPCell(new Paragraph(getTitle() + "\n" + getSubtitle(), style1)); + header.setColspan(7); + header.setHorizontalAlignment(Element.ALIGN_CENTER); + header.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(header); + + // Table sub header + PdfPCell subheader = new PdfPCell(); + subheader = new PdfPCell(new Paragraph("")); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("QUANTITY", style2)); + subheader.setColspan(2); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("VALUE (Excl. VAT)", style2)); + subheader.setColspan(2); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("DISCREPANCY", style2)); + subheader.setColspan(2); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + // Rows Header + PdfPCell rowHeader = new PdfPCell(new Paragraph("PRODUCT NAME",style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("BOOK", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("COUNT", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("BOOK", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("COUNT", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("QTY", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("VALUE", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + document.add(mytable); + + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + + table.setTotalWidth(widths); + table.setWidthPercentage(100f); + for(Object[] row : reportData) + { + + for(Object data : row) + { + PdfPCell dataCell = new PdfPCell(new Phrase(data.toString(), style3)); + table.addCell(dataCell); + } + } + + document.add(table); + document.close(); + + return bos.toByteArray(); + } + + /** + * Get Selling Items Data + * @return + * @throws DocumentException + * @throws OperationException + */ + public byte[] getSellingItemsData() throws DocumentException, OperationException + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, bos); + + document.open(); + + // Font Syle + Font style1 = new Font(Font.TIMES_ROMAN, 12.0f, Font.BOLD); + Font style2 = new Font(Font.TIMES_ROMAN, 8.0f, Font.BOLD); + Font style3 = new Font(Font.TIMES_ROMAN, 8.0f); + Font style4 = new Font(Font.TIMES_ROMAN, 9.0f, Font.BOLD); + Font style5 = new Font(Font.TIMES_ROMAN, 6.0f); + float[] widths = { 2f, 0.5f, 0.5f, 1.0f}; + + // Table header + PdfPTable mytable = new PdfPTable(4); + mytable.setTotalWidth(widths); + mytable.setWidthPercentage(100f); + PdfPCell header = new PdfPCell(new Paragraph(new Chunk(getTitle(), style1) + "\n" + new Chunk(getSubtitle(), style2) + "\n", style1)); + header.setColspan(4); + header.setHorizontalAlignment(Element.ALIGN_CENTER); + header.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(header); + + //Date Header + PdfPCell dateHeader = new PdfPCell(new Paragraph("From : " + new Chunk(TimestampConvertor.convertTimeStampToFyracleDate(fromDate), style1), style1)); + dateHeader.setColspan(1); + dateHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + dateHeader.setBackgroundColor(Color.GRAY); + dateHeader.setBorderColor(Color.WHITE); + mytable.addCell(dateHeader); + + dateHeader = new PdfPCell(new Paragraph("To : " +new Chunk(TimestampConvertor.convertTimeStampToFyracleDate(toDate), style1), style1)); + dateHeader.setColspan(3); + dateHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + dateHeader.setBackgroundColor(Color.GRAY); + dateHeader.setBorderColor(Color.WHITE); + mytable.addCell(dateHeader); + + // Info Header + PdfPCell infoHeader = new PdfPCell(new Paragraph("ALL VALUES ARE EXCLUSIVE OF VAT - SALES FIGURES ARE TAKEN AFTER DISCOUNT", style5)); + infoHeader.setColspan(4); + infoHeader.setHorizontalAlignment(Element.ALIGN_CENTER); + infoHeader.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(infoHeader); + + // Rows Header + PdfPCell rowHeader = new PdfPCell(new Paragraph("PRODUCT NAME",style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + + rowHeader = new PdfPCell(new Paragraph("QTY", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("VALUE", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("SUPPLIER", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + document.add(mytable); + + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + + table.setTotalWidth(widths); + table.setWidthPercentage(100f); + for(Object[] row : reportData) + { + + for(Object data : row) + { + PdfPCell dataCell = new PdfPCell(new Phrase(data.toString(), style3)); + table.addCell(dataCell); + } + } + + document.add(table); + document.close(); + + return bos.toByteArray(); + } + + /** + * Get Stock Enquiry Report Data + * @return + * @throws DocumentException + * @throws OperationException + */ + public byte[] getStockEnquiryData() throws DocumentException, OperationException + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, bos); + + document.open(); + + // Font Syle + Font style1 = new Font(Font.TIMES_ROMAN, 12.0f, Font.BOLD); + Font style2 = new Font(Font.TIMES_ROMAN, 8.0f, Font.BOLD); + Font style3 = new Font(Font.TIMES_ROMAN, 8.0f); + Font style4 = new Font(Font.TIMES_ROMAN, 7.0f, Font.BOLD); + Font style5 = new Font(Font.TIMES_ROMAN, 6.0f); + float[] widths = { 1f, 2f, 0.5f, 0.5f, 0.5f, 0.5f }; + + // Table header + PdfPTable mytable = new PdfPTable(6); + mytable.setTotalWidth(widths); + mytable.setWidthPercentage(100f); + PdfPCell header = new PdfPCell(new Paragraph(new Chunk(title, style1) + "\n" + new Chunk(subtitle, style2) + "\n", style1)); + header.setColspan(6); + header.setHorizontalAlignment(Element.ALIGN_CENTER); + header.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(header); + + //Date Header + PdfPCell dateHeader = new PdfPCell(new Paragraph("From : " + new Chunk(TimestampConvertor.convertTimeStampToFyracleDate(fromDate), style1), style1)); + dateHeader.setColspan(2); + dateHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + dateHeader.setBackgroundColor(Color.GRAY); + dateHeader.setBorderColor(Color.WHITE); + mytable.addCell(dateHeader); + + dateHeader = new PdfPCell(new Paragraph("To : " + new Chunk(TimestampConvertor.convertTimeStampToFyracleDate(toDate), style1), style1)); + dateHeader.setColspan(4); + dateHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + dateHeader.setBackgroundColor(Color.GRAY); + dateHeader.setBorderColor(Color.WHITE); + mytable.addCell(dateHeader); + + // Info Header + PdfPCell infoHeader = new PdfPCell(new Paragraph("ALL VALUES ARE EXCLUSIVE OF VAT & BASED ON PURCHASE PRICES", style5)); + infoHeader.setColspan(6); + infoHeader.setHorizontalAlignment(Element.ALIGN_CENTER); + infoHeader.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(infoHeader); + + // Rows Header + PdfPCell rowHeader = new PdfPCell(new Paragraph("BARCODE",style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("PRODUCT NAME", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + + rowHeader = new PdfPCell(new Paragraph("Opening Stock Qty", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("Opening Stock Value", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("Closing Stock Qty", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("Closing Stock Value", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + document.add(mytable); + + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + + table.setTotalWidth(widths); + table.setWidthPercentage(100f); + for(Object[] row : reportData) + { + + for(Object data : row) + { + PdfPCell dataCell = new PdfPCell(new Phrase(data.toString(), style3)); + table.addCell(dataCell); + } + } + + document.add(table); + document.close(); + + return bos.toByteArray(); + } + + public byte[] getInventoryData() throws DocumentException + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, bos); + + document.open(); + + // Font Syle + Font style1 = new Font(Font.TIMES_ROMAN, 12.0f, Font.BOLD); + Font style2 = new Font(Font.TIMES_ROMAN, 8.0f, Font.BOLD); + Font style3 = new Font(Font.TIMES_ROMAN, 8.0f); + Font style4 = new Font(Font.TIMES_ROMAN, 8.0f, Font.BOLD); + float[] widths = { 1f, 1f, 0.55f, 0.55f, 0.55f, 1f, 1f, 1f, 1f}; + + // Table header + PdfPTable mytable = new PdfPTable(9); + mytable.setTotalWidth(widths); + mytable.setWidthPercentage(100f); + PdfPCell header = new PdfPCell(new Paragraph(getTitle() + "\n" + getSubtitle(), style1)); + header.setColspan(9); + header.setHorizontalAlignment(Element.ALIGN_CENTER); + header.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(header); + + // Table sub header + PdfPCell subheader = new PdfPCell(); + subheader = new PdfPCell(new Paragraph("")); + subheader.setColspan(2); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("QUANTITY", style2)); + subheader.setColspan(3); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("VALUE (Excl. VAT)", style2)); + subheader.setColspan(2); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("DIFFERENCE", style2)); + subheader.setColspan(2); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + // Rows Header + PdfPCell rowHeader = new PdfPCell(new Paragraph("BARCODE",style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("PRODUCT", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + + rowHeader = new PdfPCell(new Paragraph("CSV", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("BOOK", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("COUNT", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("BOOK", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("COUNT", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("QUANTITY", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("VALUE (Excl. VAT)", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + document.add(mytable); + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + + table.setTotalWidth(widths); + table.setWidthPercentage(100f); + for(Object[] row : reportData) + { + + for(Object data : row) + { + PdfPCell dataCell = new PdfPCell(new Phrase(data.toString(), style3)); + table.addCell(dataCell); + } + } + + document.add(table); + document.close(); + + return bos.toByteArray(); + } + + public String toString() + { + return tbl.toString(); + } + + public void getDataFromSQL(Properties ctx,String sql) throws OperationException + { + reportData = ReportManager.getReportData(ctx,sql); + } + + public ArrayList getReportData() { + return reportData; + } + + public void setReportData(ArrayList reportData) { + this.reportData = reportData; + } + + public table getTable() { + return tbl; + } + + public String[] getHeaderStyle() { + return headerStyle; + } + + public void setHeaderStyle(String[] headerStyle) { + this.headerStyle = headerStyle; + } + + public boolean isSortable() { + return sortable; + } + + public void setSortable(boolean sortable) { + this.sortable = sortable; + } + + public String getStyle() { + return style; + } + + public void setStyle(String style) { + this.style = style; + } + + public String getSubtitle() { + return subtitle; + } + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Timestamp getFromDate() { + return fromDate; + } + + public void setFromDate(Timestamp fromDate) { + this.fromDate = fromDate; + } + + public Timestamp getToDate() { + return toDate; + } + + public void setToDate(Timestamp toDate) { + this.toDate = toDate; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/TabularReport2.java b/posterita/posterita/src/main/org/posterita/core/TabularReport2.java new file mode 100644 index 0000000000..d10b77bd01 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/TabularReport2.java @@ -0,0 +1,472 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 31-Jul-2006 12:07:35 by praveen + * + */ + +package org.posterita.core; + +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.apache.ecs.xhtml.table; +import org.apache.ecs.xhtml.td; +import org.apache.ecs.xhtml.th; +import org.apache.ecs.xhtml.tr; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.exceptions.OperationException; + +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; + +public class TabularReport2 +{ + private ArrayList reportData = null; + private table tbl = new table(); + + private boolean sortable = false; + private String id = null; + private String[] headerStyle = null; + private String style = null; + private String title = null; + private String subtitle = null; + private Timestamp fromDate = null; + private Timestamp toDate = null; + private boolean isSalesReport = false; + private boolean fullDetails = false; + + public TabularReport2(ArrayList reportData) + { + this.reportData = reportData; + } + + public TabularReport2() + { + + } + + public void createReport() throws OperationException + { + + tbl = new table(); + tbl.addAttribute("border","0"); + tbl.addAttribute("width","100%"); + tbl.addAttribute("class","main"); + + td tdtitle = new td("" + title + ""); + td tdsubtitle = new td("" + subtitle + ""); + + tbl.addElement( + new tr().addElement(tdtitle.addAttribute("align","center")) + ); + + tbl.addElement( + new tr().addElement(tdsubtitle.addAttribute("align","center")) + ); + + tbl.addElement(new td(" ")); + + //////////////////////////////////////////////////////////////////////// + table displaytbl = new table(); + + if(reportData==null) + { + throw new OperationException("Cannot create tabular report: cause -> dataset empty!"); + } + + id = RandomStringGenerator.randomstring(); + + displaytbl.addAttribute("border","1"); + //displaytbl.addAttribute("width","100%"); + + String styleClass = (style == null) ? "" : style; + if(isSortable()) + { + styleClass = styleClass + " sortable"; + } + displaytbl.addAttribute("class",styleClass.trim()); + displaytbl.addAttribute("id",id); + + Iterator iter = reportData.iterator(); + Object[] headers = iter.next(); + + int columnCount = headers.length; + + tr r = new tr(); + + for(int i=0;i i)) + { + String style = headerStyle[i]+""; + h.addAttribute("class",style); + } + + r.addElement(h); + } + + displaytbl.addElement(r); + + int count = 0; + String[] s = {"label","contentname"}; + String tdStyle = ""; + + String date1 = ""; + String date2 = ""; + String temp1 = ""; + String temp2 = ""; + + while(iter.hasNext()) + { + count++; + + tdStyle = s[count%2]; + + Object[] data = iter.next(); + tr rr = new tr(); + + if (count == 1) + { + temp1 = data[0].toString(); + } + if (count == reportData.size() - 2) + { + temp2 = data[0].toString(); + } + date2 = date1 = data[0].toString(); + + if(count == reportData.size()-1) + { + date1 = temp1; + date2 = temp2; + } + + for(int i=0;i0 && i<5) + { + if (data[i]!=null) + { + qty = Double.valueOf(data[i].toString()); + } + if (qty != 0.0) + { + cellData = "" + data[i] + ""; + } + } + + + td d = new td(cellData); + + if(count == reportData.size()-1) + { + d.setAlign("left"); + } + + d.addAttribute("class",tdStyle); + + rr.addElement(d); + } + + displaytbl.addElement(rr); + } + //////////////////////////////////////////////////////////////////////// + tbl.addElement(new tr().addElement(new td().addElement(displaytbl))); + + } + + public void createReport(String action) throws OperationException + { + tbl = new table(); + tbl.addAttribute("border","0"); + tbl.addAttribute("width","100%"); + tbl.addAttribute("class","main"); + + td tdtitle = new td("" + title + ""); + td tdsubtitle = new td("" + subtitle + ""); + + tbl.addElement( + new tr().addElement(tdtitle.addAttribute("align","center")) + ); + + tbl.addElement( + new tr().addElement(tdsubtitle.addAttribute("align","center")) + ); + + tbl.addElement(new td(" ")); + + //////////////////////////////////////////////////////////////////////// + table displaytbl = new table(); + + if(reportData==null) + { + throw new OperationException("Cannot create tabular report: cause -> dataset empty!"); + } + + id = RandomStringGenerator.randomstring(); + + displaytbl.addAttribute("border","1"); + //displaytbl.addAttribute("width","100%"); + + String styleClass = (style == null) ? "" : style; + if(isSortable()) + { + styleClass = styleClass + " sortable"; + } + displaytbl.addAttribute("class",styleClass.trim()); + displaytbl.addAttribute("id",id); + + Iterator iter = reportData.iterator(); + Object[] headers = iter.next(); + + int columnCount = headers.length; + + tr r = new tr(); + + for(int i=0;i i)) + { + String style = headerStyle[i]+""; + h.addAttribute("class",style); + } + + r.addElement(h); + } + + displaytbl.addElement(r); + + int count = 0; + String[] s = {"label","contentname"}; + String tdStyle = ""; + + while(iter.hasNext()) + { + count++; + + tdStyle = s[count%2]; + + Object[] data = iter.next(); + tr rr = new tr(); + + for(int i=0;i 0 && i < 5) + { + cellData = " getReportData() { + return reportData; + } + + public void setReportData(ArrayList reportData) { + this.reportData = reportData; + } + + public table getTable() { + return tbl; + } + + public String[] getHeaderStyle() { + return headerStyle; + } + + public void setHeaderStyle(String[] headerStyle) { + this.headerStyle = headerStyle; + } + + public boolean isSortable() { + return sortable; + } + + public void setSortable(boolean sortable) { + this.sortable = sortable; + } + + public String getStyle() { + return style; + } + + public void setStyle(String style) { + this.style = style; + } + + public String getSubtitle() { + return subtitle; + } + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Timestamp getFromDate() { + return fromDate; + } + + public void setFromDate(Timestamp fromDate) { + this.fromDate = fromDate; + } + + public Timestamp getToDate() { + return toDate; + } + + public void setToDate(Timestamp toDate) { + this.toDate = toDate; + } + + public boolean isSalesReport() + { + return isSalesReport; + } + + public void setSalesReport(boolean isSalesReport) + { + this.isSalesReport = isSalesReport; + } + + public boolean isFullDetails() + { + return fullDetails; + } + + public void setFullDetails(boolean fullDetails) + { + this.fullDetails = fullDetails; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/TabularReportMerge.java b/posterita/posterita/src/main/org/posterita/core/TabularReportMerge.java new file mode 100644 index 0000000000..d3293199ea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/TabularReportMerge.java @@ -0,0 +1,633 @@ +package org.posterita.core; + +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 31-Jul-2006 12:07:35 by praveen + * + */ + +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.apache.ecs.xhtml.div; +import org.apache.ecs.xhtml.table; +import org.apache.ecs.xhtml.td; +import org.apache.ecs.xhtml.th; +import org.apache.ecs.xhtml.tr; +import org.posterita.Constants; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.exceptions.OperationException; + +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; + +public class TabularReportMerge +{ + private ArrayList reportData = null; + private table bigTable; + private div contain; + private tr bigRow; + private boolean sortable = false; + private String id = null; + private String[] headerStyle = null; + private String style = null; + private String title = null; + private String subtitle = null; + private Timestamp fromDate = null; + private Timestamp toDate = null; + private int screenWidth = 1024; + public TabularReportMerge(ArrayList reportData) + { + this.reportData = reportData; + } + + public TabularReportMerge(String title, int colspan) + { + bigTable = new table(); + bigRow = new tr(); + setTitle(title, colspan); + bigTable.addElement(bigRow); + contain = new div(); + contain.setStyle("width:" + screenWidth + ";overflow:auto;"); + contain.addElement(bigTable); + } + + public void createReport(ArrayList reportData, int type, String subtitle) throws OperationException + { + table tbl = new table(); + tbl.addAttribute("border","0"); + tbl.addAttribute("width","100%"); + tbl.addAttribute("class","main"); + + + td tdsubtitle = new td("" + subtitle + ""); + + + + tbl.addElement( + new tr().addElement(tdsubtitle.addAttribute("align","center")) + ); + + tbl.addElement(new td(" ")); + + //////////////////////////////////////////////////////////////////////// + table displaytbl = new table(); + + if(reportData==null) + { + throw new OperationException("Cannot create tabular report: cause -> dataset empty!"); + } + + id = RandomStringGenerator.randomstring(); + + displaytbl.addAttribute("border","1"); + //displaytbl.addAttribute("width","100%"); + + String styleClass = (style == null) ? "" : style; + if(isSortable()) + { + styleClass = styleClass + " sortable"; + } + displaytbl.addAttribute("class",styleClass.trim()); + displaytbl.addAttribute("id",id); + + Iterator iter = reportData.iterator(); + Object[] headers = iter.next(); + + int columnCount = headers.length; + + tr r = new tr(); + + for(int i=0;i i)) + { + String style = headerStyle[i]+""; + h.addAttribute("class",style); + } + + r.addElement(h); + } + + displaytbl.addElement(r); + + int count = 0; + String[] s = {"label","contentname"}; + String tdStyle = ""; + + while(iter.hasNext()) + { + count++; + + tdStyle = s[count%2]; + + Object[] data = iter.next(); + tr rr = new tr(); + String productName=""; + for(int i=0;i" + data[i] + ""; + } + else if (type == Constants.STOCK_TYPE) + { + total = "" + data[i] + ""; + } + d = new td(total); + } + d.addAttribute("class",tdStyle); + + rr.addElement(d); + } + + displaytbl.addElement(rr); + } + //////////////////////////////////////////////////////////////////////// + tbl.addElement(new tr().addElement(new td().addElement(displaytbl))); + + bigRow.addElement(new td().addElement(tbl)); + + } + + public String createPDFReport() throws DocumentException, FileNotFoundException + { + String filename = RandomStringGenerator.randomstring() + ".pdf"; + String filepath = ReportManager.getReportPath(filename); + + FileOutputStream fos = new FileOutputStream(filepath); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, fos); + + document.open(); + + Font style1 = new Font(Font.HELVETICA, 16.0f, Font.BOLD); + Font style2 = new Font(Font.HELVETICA, 12.0f); + //write content + Paragraph p = new Paragraph(new Chunk(title, style1)); + p.setAlignment(Element.ALIGN_CENTER); + document.add(p); + + p = new Paragraph(new Chunk(subtitle, style2)); + p.setAlignment(Element.ALIGN_CENTER); + document.add(p); + + p = new Paragraph("\n\n"); + document.add(p); + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + for(Object[] row : reportData) + { + for(Object data : row) + { + PdfPCell cell = new PdfPCell(new Phrase(data.toString())); + table.addCell(cell); + } + } + + document.add(table); + document.close(); + + + return filename; + } + + public byte[] getPDFData() throws DocumentException + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, bos); + + document.open(); + + // Font Syle + Font style1 = new Font(Font.TIMES_ROMAN, 12.0f, Font.BOLD); + Font style2 = new Font(Font.TIMES_ROMAN, 8.0f, Font.BOLD); + Font style3 = new Font(Font.TIMES_ROMAN, 8.0f); + Font style4 = new Font(Font.TIMES_ROMAN, 9.0f, Font.BOLD); + float[] widths = { 2f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f}; + + // Table header + PdfPTable mytable = new PdfPTable(7); + mytable.setTotalWidth(widths); + mytable.setWidthPercentage(100f); + PdfPCell header = new PdfPCell(new Paragraph(new Chunk(title, style1) + "\n" + new Chunk(subtitle, style2) + "\n", style1)); + header.setColspan(7); + header.setHorizontalAlignment(Element.ALIGN_CENTER); + header.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(header); + + // Table sub header + PdfPCell subheader = new PdfPCell(); + subheader = new PdfPCell(new Paragraph("")); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("QUANTITY", style2)); + subheader.setColspan(2); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("VALUE (Excl. VAT)", style2)); + subheader.setColspan(2); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + subheader = new PdfPCell(new Paragraph("DISCREPANCY", style2)); + subheader.setColspan(2); + subheader.setHorizontalAlignment(Element.ALIGN_CENTER); + mytable.addCell(subheader); + + // Rows Header + PdfPCell rowHeader = new PdfPCell(new Paragraph("PRODUCT NAME",style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("BOOK", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("COUNT", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("BOOK", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("COUNT", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("QTY", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("VALUE", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + document.add(mytable); + + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + + table.setTotalWidth(widths); + table.setWidthPercentage(100f); + for(Object[] row : reportData) + { + + for(Object data : row) + { + PdfPCell dataCell = new PdfPCell(new Phrase(data.toString(), style3)); + table.addCell(dataCell); + } + } + + document.add(table); + document.close(); + + return bos.toByteArray(); + } + + /** + * Get Selling Items Data + * @return + * @throws DocumentException + * @throws OperationException + */ + public byte[] getSellingItemsData() throws DocumentException, OperationException + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, bos); + + document.open(); + + // Font Syle + Font style1 = new Font(Font.TIMES_ROMAN, 12.0f, Font.BOLD); + Font style2 = new Font(Font.TIMES_ROMAN, 8.0f, Font.BOLD); + Font style3 = new Font(Font.TIMES_ROMAN, 8.0f); + Font style4 = new Font(Font.TIMES_ROMAN, 9.0f, Font.BOLD); + Font style5 = new Font(Font.TIMES_ROMAN, 6.0f); + float[] widths = { 2f, 0.5f, 0.5f, 1.0f}; + + // Table header + PdfPTable mytable = new PdfPTable(4); + mytable.setTotalWidth(widths); + mytable.setWidthPercentage(100f); + PdfPCell header = new PdfPCell(new Paragraph(new Chunk(title, style1) + "\n" + new Chunk(subtitle, style2) + "\n", style1)); + header.setColspan(4); + header.setHorizontalAlignment(Element.ALIGN_CENTER); + header.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(header); + + //Date Header + PdfPCell dateHeader = new PdfPCell(new Paragraph("From : " + new Chunk(TimestampConvertor.convertTimeStamp(fromDate, TimestampConvertor.DEFAULT_DATE_PATTERN1), style1), style1)); + dateHeader.setColspan(1); + dateHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + dateHeader.setBackgroundColor(Color.GRAY); + dateHeader.setBorderColor(Color.WHITE); + mytable.addCell(dateHeader); + + dateHeader = new PdfPCell(new Paragraph("To : " + new Chunk(TimestampConvertor.convertTimeStamp(toDate, TimestampConvertor.DEFAULT_DATE_PATTERN1), style1), style1)); + dateHeader.setColspan(3); + dateHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + dateHeader.setBackgroundColor(Color.GRAY); + dateHeader.setBorderColor(Color.WHITE); + mytable.addCell(dateHeader); + + // Info Header + PdfPCell infoHeader = new PdfPCell(new Paragraph("ALL VALUES ARE EXCLUSIVE OF VAT - SALES FIGURES ARE TAKEN AFTER DISCOUNT", style5)); + infoHeader.setColspan(4); + infoHeader.setHorizontalAlignment(Element.ALIGN_CENTER); + infoHeader.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(infoHeader); + + // Rows Header + PdfPCell rowHeader = new PdfPCell(new Paragraph("PRODUCT NAME",style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + + rowHeader = new PdfPCell(new Paragraph("QTY", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("VALUE", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("SUPPLIER", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + document.add(mytable); + + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + + table.setTotalWidth(widths); + table.setWidthPercentage(100f); + for(Object[] row : reportData) + { + + for(Object data : row) + { + PdfPCell dataCell = new PdfPCell(new Phrase(data.toString(), style3)); + table.addCell(dataCell); + } + } + + document.add(table); + document.close(); + + return bos.toByteArray(); + } + + /** + * Get Stock Enquiry Report Data + * @return + * @throws DocumentException + * @throws OperationException + */ + public byte[] getStockEnquiryData() throws DocumentException, OperationException + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, bos); + + document.open(); + + // Font Syle + Font style1 = new Font(Font.TIMES_ROMAN, 12.0f, Font.BOLD); + Font style2 = new Font(Font.TIMES_ROMAN, 8.0f, Font.BOLD); + Font style3 = new Font(Font.TIMES_ROMAN, 8.0f); + Font style4 = new Font(Font.TIMES_ROMAN, 7.0f, Font.BOLD); + Font style5 = new Font(Font.TIMES_ROMAN, 6.0f); + float[] widths = { 1f, 2f, 0.5f, 0.5f, 0.5f, 0.5f }; + + // Table header + PdfPTable mytable = new PdfPTable(6); + mytable.setTotalWidth(widths); + mytable.setWidthPercentage(100f); + PdfPCell header = new PdfPCell(new Paragraph(new Chunk(title, style1) + "\n" + new Chunk(subtitle, style2) + "\n", style1)); + header.setColspan(6); + header.setHorizontalAlignment(Element.ALIGN_CENTER); + header.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(header); + + //Date Header + PdfPCell dateHeader = new PdfPCell(new Paragraph("From : " + new Chunk(TimestampConvertor.convertTimeStamp(fromDate, TimestampConvertor.DEFAULT_DATE_PATTERN1), style1), style1)); + dateHeader.setColspan(2); + dateHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + dateHeader.setBackgroundColor(Color.GRAY); + dateHeader.setBorderColor(Color.WHITE); + mytable.addCell(dateHeader); + + dateHeader = new PdfPCell(new Paragraph("To : " + new Chunk(TimestampConvertor.convertTimeStamp(toDate, TimestampConvertor.DEFAULT_DATE_PATTERN1), style1), style1)); + dateHeader.setColspan(4); + dateHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + dateHeader.setBackgroundColor(Color.GRAY); + dateHeader.setBorderColor(Color.WHITE); + mytable.addCell(dateHeader); + + // Info Header + PdfPCell infoHeader = new PdfPCell(new Paragraph("ALL VALUES ARE EXCLUSIVE OF VAT & BASED ON PURCHASE PRICES", style5)); + infoHeader.setColspan(6); + infoHeader.setHorizontalAlignment(Element.ALIGN_CENTER); + infoHeader.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); + mytable.addCell(infoHeader); + + // Rows Header + PdfPCell rowHeader = new PdfPCell(new Paragraph("BARCODE",style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("PRODUCT NAME", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + + rowHeader = new PdfPCell(new Paragraph("Opening Stock Qty", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("Opening Stock Value", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("Closing Stock Qty", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + rowHeader = new PdfPCell(new Paragraph("Closing Stock Value", style4)); + rowHeader.setHorizontalAlignment(Element.ALIGN_LEFT); + mytable.addCell(rowHeader); + + document.add(mytable); + + + Object[] headers = reportData.get(0); + + PdfPTable table = new PdfPTable(headers.length); + + table.setTotalWidth(widths); + table.setWidthPercentage(100f); + for(Object[] row : reportData) + { + + for(Object data : row) + { + PdfPCell dataCell = new PdfPCell(new Phrase(data.toString(), style3)); + table.addCell(dataCell); + } + } + + document.add(table); + document.close(); + + return bos.toByteArray(); + } + + public String toString() + { + return contain.toString(); + } + + public void getDataFromSQL(Properties ctx,String sql) throws OperationException + { + reportData = ReportManager.getReportData(ctx,sql); + } + + public ArrayList getReportData() { + return reportData; + } + + public void setReportData(ArrayList reportData) { + this.reportData = reportData; + } + + public table getTable() { + return bigTable; + } + + public String[] getHeaderStyle() { + return headerStyle; + } + + public void setHeaderStyle(String[] headerStyle) { + this.headerStyle = headerStyle; + } + + public boolean isSortable() { + return sortable; + } + + public void setSortable(boolean sortable) { + this.sortable = sortable; + } + + public String getStyle() { + return style; + } + + public void setStyle(String style) { + this.style = style; + } + + public String getSubtitle() { + return subtitle; + } + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title, int colspan) + { + td tdtitle = new td("" + title + ""); + tdtitle.addAttribute("colspan", colspan+""); + tr trow = new tr(); + bigTable.addElement( + new tr().addElement(tdtitle.addAttribute("align","center")) + ); + } + + public Timestamp getFromDate() { + return fromDate; + } + + public void setFromDate(Timestamp fromDate) { + this.fromDate = fromDate; + } + + public Timestamp getToDate() { + return toDate; + } + + public void setToDate(Timestamp toDate) { + this.toDate = toDate; + } + + +} + diff --git a/posterita/posterita/src/main/org/posterita/core/TestStockInquiry.java b/posterita/posterita/src/main/org/posterita/core/TestStockInquiry.java new file mode 100644 index 0000000000..117493fe74 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/TestStockInquiry.java @@ -0,0 +1,25 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ +package org.posterita.core; + + +public class TestStockInquiry { + +} diff --git a/posterita/posterita/src/main/org/posterita/core/ThumbnailGenerator.java b/posterita/posterita/src/main/org/posterita/core/ThumbnailGenerator.java new file mode 100644 index 0000000000..00e746c0db --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/ThumbnailGenerator.java @@ -0,0 +1,137 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 14, 2006 by praveen + * + */ +package org.posterita.core; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.awt.image.ConvolveOp; +import java.awt.image.Kernel; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import javax.imageio.ImageIO; +import javax.swing.ImageIcon; + +import org.posterita.exceptions.ThumbnailGenerationException; + +public class ThumbnailGenerator +{ + public static byte[] getThumbnail(byte[] data, double scaleFactor) throws ThumbnailGenerationException + { + if(data == null) + throw new ThumbnailGenerationException("Imag data cannot be null"); + Image input = new ImageIcon(data).getImage(); + int imgWidth = input.getWidth(null); + int imgHeight = input.getHeight(null); + + int scaledWidth = (int)((double)imgWidth * scaleFactor); + int scaledHeight = (int)((double)imgHeight * scaleFactor); + + return getThumbnail(data, scaledWidth, scaledHeight); + } + + public static byte[] getSquareThumbnail(byte[] data, int size) throws ThumbnailGenerationException + { + Image input = new ImageIcon(data).getImage(); + int imgWidth = input.getWidth(null); + int imgHeight = input.getHeight(null); + + int thumbWidth; + int thumbHeight; + + if(imgWidth > imgHeight) + { + double scale = ((double)size/(double)imgWidth); + thumbWidth = size; + thumbHeight = (int)(scale * (double)imgHeight); + } + else + { + double scale = ((double)size/(double)imgHeight); + thumbHeight = size; + thumbWidth = (int)(scale * (double)imgWidth); + } + + return getThumbnail(data, thumbWidth, thumbHeight); + } + + static String THUMBEXT = "jpg"; + // Original Code: http://blogs.cocoondev.org/mpo/archives/003584.html + public static byte[] getThumbnail(byte data[], int maxSize) throws ThumbnailGenerationException + { + Image i = new ImageIcon(data).getImage(); + + int iWidth = i.getWidth(null); + int iHeight = i.getHeight(null); + if (iWidth > iHeight) + return getThumbnail(data, maxSize,(maxSize*iHeight)/iWidth); + else + return getThumbnail(data, (maxSize*iWidth)/iHeight,maxSize); + } + + public static byte[] getThumbnail(byte data[], int width, int height) throws ThumbnailGenerationException + { + try + { + Image i = new ImageIcon(data).getImage(); + + Image resizedImage = i.getScaledInstance(width, height, Image.SCALE_SMOOTH); + + // This code ensures that all the + // pixels in the image are loaded. + Image temp = new ImageIcon(resizedImage).getImage(); + // Create the buffered image. + BufferedImage bufferedImage = new BufferedImage(temp.getWidth(null), temp.getHeight(null), BufferedImage.TYPE_INT_RGB); + // Copy image to buffered image. + Graphics g = bufferedImage.createGraphics(); + // Clear background and paint the image. + g.setColor(Color.white); + g.fillRect(0, 0, temp.getWidth(null),temp.getHeight(null)); + g.drawImage(temp, 0, 0, null); + g.dispose(); + + // soften + float softenFactor = 0.01f; + float[] softenArray = {0, softenFactor, 0, softenFactor, 1-(softenFactor*4), softenFactor, 0, softenFactor, 0}; + Kernel kernel = new Kernel(3, 3, softenArray); + ConvolveOp cOp = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null); + bufferedImage = cOp.filter(bufferedImage, null); + + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + BufferedOutputStream bufOutStream = new BufferedOutputStream(outStream); + ImageIO.write(bufferedImage, THUMBEXT, bufOutStream); + + bufOutStream.flush(); + byte retData[] = outStream.toByteArray(); + bufOutStream.close(); + outStream.close(); + return retData; + } + catch(IOException ex) + { + throw new ThumbnailGenerationException("Could not generate thumbnail", ex); + } + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/TimeSeriesChart.java b/posterita/posterita/src/main/org/posterita/core/TimeSeriesChart.java new file mode 100644 index 0000000000..3bc7c19b4d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/TimeSeriesChart.java @@ -0,0 +1,256 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 13-Jul-2006 09:59:29 by praveen + * + */ + +package org.posterita.core; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; + +import org.compiere.util.DB; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.labels.StandardXYItemLabelGenerator; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.time.Day; +import org.jfree.data.time.TimeSeries; +import org.jfree.data.time.TimeSeriesCollection; + +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.exceptions.OperationException; + +/** + * @author praveen + * + */ +public class TimeSeriesChart extends AbstractChart +{ + public static final String CHART_TYPE = "TimeSeries"; + + TimeSeriesCollection dataset = null; + boolean showShapes = false; + + public TimeSeriesChart(){}; + + public TimeSeriesChart(TimeSeriesCollection dataset,String title) + { + this.dataset = dataset; + this.title = title; + } + + public TimeSeriesChart(TimeSeriesCollection dataset,String title,String xLabel,String yLabel) + { + this.dataset = dataset; + this.title = title; + this.xLabel = xLabel; + this.yLabel = yLabel; + } + + public JFreeChart createChart() throws OperationException + { + if(dataset == null) + { + throw new OperationException("Cannot create Time series chart: cause -> dataset null!"); + } + + chart = ChartFactory.createTimeSeriesChart(title,xLabel,yLabel,dataset,showLegend,showTooltip,false); + + if(showShapes) + { + XYPlot plot = (XYPlot) chart.getPlot(); + XYLineAndShapeRenderer render = (XYLineAndShapeRenderer) plot.getRenderer(); + render.setBaseShapesVisible(true); + } + + //setting subtitle + if(subtitle!=null) + { + TextTitle title = new TextTitle(subtitle); + chart.addSubtitle(title); + } + + //displaying labels + if(showLabels) + { + XYPlot plot = (XYPlot) chart.getPlot(); + XYLineAndShapeRenderer render = (XYLineAndShapeRenderer) plot.getRenderer(); + render.setItemLabelGenerator(new StandardXYItemLabelGenerator()); + render.setItemLabelsVisible(true); + } + + return chart; + + } + + /** + * Takes a sql as input and generates a Timeseries that is added to + * the dataset. + * Note: The sql must return 3 columns only Series, date & value + * Column 1: Type -> String + * Column 2: Type -> String or Date. For String the format must be as dd-MM-yyyy + * Column 3: Type -> BigDecimal + * + * @param sql + */ + public void getDataSetFromSQL(String sql) throws OperationException + { + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + ArrayList dataSource = ReportManager.getReportData(pstmt); + int count = 0; + + String seriesName = null; + TimeSeries series = null; + BigDecimal value = null; + int day = 0; + int month = 0; + int year = 0; + + TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection(); + + for (Object[] data : dataSource) + { + if(data.length!=3) + throw new OperationException("Unable to generate timeseries. Cause:Invalid sql, the return resultset must have 3 columns only"); + + count++; + if(count==1) + { + continue; + } + + seriesName = (String)data[0]; + String date = (String)data[1]; + value = (BigDecimal) data[2]; + String s[] = date.split("-"); + + if(s.length!=3) + throw new OperationException("Unable to generate timeseries. " + + "Cause:Invalid date format, the date returned should have the following format 'DD-MM-YYYY'"); + + SimpleDateFormat sdf = new SimpleDateFormat(); + Calendar cal = Calendar.getInstance(); + Date d = null; + + try + { + sdf.applyPattern("DD-MM-YYYY"); + d = sdf.parse(date); + } + catch (ParseException e1) + { + try + { + sdf.applyPattern("DD-MMM-YYYY"); + d = sdf.parse(date); + } + catch (ParseException e) + { + throw new OperationException("Unable to generate timeseries. " + + "Cause:Invalid date format, the date returned should have one of the following formats 'DD-MM-YYYY' or 'DD-MMM-YYYY'",e); + } + } + + + cal.setTime(d); + + day = cal.get(Calendar.DATE); + month = cal.get(Calendar.MONTH) + 1; + year = cal.get(Calendar.YEAR); + + + series = timeSeriesCollection.getSeries(seriesName); + + if(series == null) + { + series = new TimeSeries(seriesName,Day.class); + series.add(new Day(day,month,year),value); + + timeSeriesCollection.addSeries(series); + } + else + { + series.add(new Day(day,month,year),value); + }//if + + }//for + + dataset = timeSeriesCollection; + } + + public void getTimeSeriesFromSQL(String sql,String key) throws OperationException + { + PreparedStatement pstmt = DB.prepareStatement(sql,null); + + ArrayList dataSource = ReportManager.getReportData(pstmt); + TimeSeries series = new TimeSeries(key,Day.class); + int count = 0; + + for (Object[] data : dataSource) + { + if(data.length != 2) + throw new OperationException("Unable to generate timeseries. Cause:Invalid sql, the return resultset must have 2 columns only"); + + count++; + if(count==1)continue; + + series.add(new Day((Date)data[0]),(BigDecimal)data[1]); + } + + pstmt = null; + addSeries(series); + } + + + public void addSeries(TimeSeries series) + { + if(dataset==null) + dataset = new TimeSeriesCollection(); + + dataset.addSeries(series); + } + + public TimeSeriesCollection getDataset() { + return dataset; + } + + public void setDataset(TimeSeriesCollection dataset) { + this.dataset = dataset; + } + + public boolean isShowShapes() { + return showShapes; + } + + public void setShowShapes(boolean showShapes) { + this.showShapes = showShapes; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/TimestampConvertor.java b/posterita/posterita/src/main/org/posterita/core/TimestampConvertor.java new file mode 100644 index 0000000000..8db3d6e2c9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/TimestampConvertor.java @@ -0,0 +1,294 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 29-Jul-2005 by alok + * + */ + +package org.posterita.core; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.posterita.exceptions.InvalidDateTimeException; +import org.posterita.exceptions.OperationException; + +public class TimestampConvertor +{ + + public static final String XML_DATE_PATTERN = "yyyy-MM-dd HH:mm:ss.S"; + public static final String DEFAULT_DATE_PATTERN1 = "dd/MM/yyyy HH:mm:ss"; + public static final String DEFAULT_DATE_PATTERN2 = "dd-MMM-yyyy HH:mm:ss"; + public static final String FYRACLE_DATETIME_PATTERN = "MM-dd-yyyy HH:mm:ss"; + public static final String FYRACLE_DATE_PATTERN = "MM-dd-yyyy"; + public static final String FYRACLEDB_DATETIME_PATTERN = "dd-MM-yyyy HH:mm:ss"; + public static final String NORM_DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm"; + public static final String FLAT_DATE_PATTERN = "ddMMyyyy"; + public static final String REPORTS_DATE_PATTERN = "dd-MMM-yyyy HH:mm:ss"; + public static final String SYNC_DATE_TIME = "yyyy-MM-dd HH:mm"; + public static final String BIRTH_DATE = "dd/MM/yyyy"; + + public static Timestamp getTimestamp(String timeStr) throws OperationException + { + SimpleDateFormat sFormat = new SimpleDateFormat(XML_DATE_PATTERN); + + Date date = null; + try + { + date = sFormat.parse(timeStr); + } + catch (ParseException e) + { + throw new OperationException("Cannot convert to timestamp!" + timeStr); + } + + Timestamp stamp = new Timestamp(date.getTime()); + + return stamp; + + } + + public static Timestamp getTimestamp(String timeStr, String format) throws InvalidDateTimeException + { + SimpleDateFormat sFormat = new SimpleDateFormat(format); + + if(timeStr == null || timeStr.length() == 0) + throw new InvalidDateTimeException("String length is invalid"); + + Date date = null; + try + { + date = sFormat.parse(timeStr); + } + catch (ParseException e) + { + throw new InvalidDateTimeException("Cannot convert to timestamp!" + timeStr); + } + + Timestamp stamp = new Timestamp(date.getTime()); + + return stamp; + } + public static Timestamp getTimestampForSync(String timeStr) throws InvalidDateTimeException + { + return getTimestamp(timeStr, SYNC_DATE_TIME); + } + + public static Timestamp getTimestampFromFlatString(String timeStr) throws OperationException, InvalidDateTimeException + { + return getTimestamp(timeStr, FLAT_DATE_PATTERN); + } + + public static String getCurrentDateTime() + { + SimpleDateFormat sFormat = new SimpleDateFormat(NORM_DATE_TIME_PATTERN); + + Date now = new Date(); + + String strDate = sFormat.format(now); + + return strDate; + } + + /** + * @return Current date and time + */ + public static Timestamp getCurrentDateTimeTimestamp() + { + return new Timestamp(System.currentTimeMillis()); + } + + /** + * @return Current Date only + * @throws OperationException + */ + public static Timestamp getCurrentDateTimestamp() throws OperationException + { + // Does not clear hour + /*Calendar cal = Calendar.getInstance(); + cal.clear(Calendar.MILLISECOND); + cal.clear(Calendar.SECOND); + cal.clear(Calendar.MINUTE); + cal.clear(Calendar.HOUR);*/ + + try + { + Date now = new Date(); + SimpleDateFormat sFormat = new SimpleDateFormat(FLAT_DATE_PATTERN); + + String d = sFormat.format(now); + + Date nDate = sFormat.parse(d); + + return new Timestamp(nDate.getTime()); + } + catch(ParseException ex) + { + throw new OperationException("Could not retrieve current date"); + } + } + + + + public static String convertTimeStampToFyracle(String timeStr) throws OperationException + { + if(timeStr == null || timeStr.trim().length() == 0) + throw new OperationException("Time string cannot be null"); + + if(timeStr.length() < 8) + throw new OperationException("Time string is invalid, Time String: " + timeStr); + + int ind = timeStr.indexOf("-"); + if(ind != 2) + throw new OperationException("Time string is not good, Time String: " + timeStr); + + String timeStrSub = timeStr.substring(ind + 1); + + int ind2 = timeStrSub.indexOf("-"); + + if(ind2 == 2) + return convertTimeStampToFyracle(timeStr, DEFAULT_DATE_PATTERN1); + else if(ind2 == 3) + return convertTimeStampToFyracle(timeStr, DEFAULT_DATE_PATTERN2); + else + throw new OperationException("Time string is not valid, Time String: " + timeStr); + } + + public static String convertTimeStampToFyracle(String timeStr, String pattern) throws OperationException + { + SimpleDateFormat sFormat = new SimpleDateFormat(pattern); + SimpleDateFormat tFormat = new SimpleDateFormat(FYRACLE_DATETIME_PATTERN); + + Date date = null; + + try + { + date = sFormat.parse(timeStr); + String retVal = tFormat.format(date); + return retVal; + } + catch(ParseException ex) + { + throw new OperationException("Cannot convert to timestamp!" + timeStr); + } + } + + public static String changeTimestampPattern(String timeStr, String fromPattern, String toPattern) throws OperationException + { + SimpleDateFormat sFormat = new SimpleDateFormat(fromPattern); + SimpleDateFormat tFormat = new SimpleDateFormat(toPattern); + + Date date = null; + + try + { + date = sFormat.parse(timeStr); + String retVal = tFormat.format(date); + return retVal; + } + catch(ParseException ex) + { + throw new OperationException("Cannot convert to timestamp!" + timeStr); + } + } + + public static String convertTimeStampToFyracleDate(Timestamp tStamp) throws OperationException + { + SimpleDateFormat tFormat = new SimpleDateFormat(FYRACLE_DATE_PATTERN); + + try + { + String retVal = tFormat.format(tStamp); + return retVal; + } + catch(Exception ex) + { + throw new OperationException("Cannot convert to timestamp!" + tStamp.toString()); + } + } + + public static String convertTimeStamp(Timestamp time, String format) throws OperationException + { + try + { + SimpleDateFormat dateFormat = new SimpleDateFormat(format); + + String formatted = dateFormat.format(time); + return formatted; + } + catch (Exception e) + { + throw new OperationException("Cannot convert to timestamp!" + time.toString()); + } + } + + public static String reportTimeStampToFyracle(String timeStr) throws OperationException + { + SimpleDateFormat sFormat = new SimpleDateFormat(REPORTS_DATE_PATTERN); + SimpleDateFormat tFormat = new SimpleDateFormat(FYRACLEDB_DATETIME_PATTERN); + + Date date = null; + + try + { + date = sFormat.parse(timeStr); + String retVal = tFormat.format(date); + return retVal; + } + catch(ParseException ex) + { + throw new OperationException("Cannot convert to timestamp!" + timeStr); + } + } + + /** + * Format Timestamp according to default pattern + * @see DEFAULT_DATE_PATTERN1 + * @param timestamp + * @return formatted timestamp + */ + public static String format(Timestamp timestamp) + { + return format(timestamp, DEFAULT_DATE_PATTERN1); + } + + /** + * Format a Timestamp according to the pattern provided + * @param timestamp + * @param pattern + * @return Formated string for the Timestamp + */ + public static String format(Timestamp timestamp, String pattern) + { + if (timestamp == null) + { + throw new IllegalArgumentException("Timestamp cannot be null"); + } + + if (pattern == null) + { + throw new IllegalArgumentException("Pattern cannot be null"); + } + + SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); + return dateFormat.format(timestamp); + } +} + \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/core/TmkJSPEnv.java b/posterita/posterita/src/main/org/posterita/core/TmkJSPEnv.java new file mode 100644 index 0000000000..1d4580f7a2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/TmkJSPEnv.java @@ -0,0 +1,63 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.core; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; + +import org.compiere.util.Env; +import org.compiere.wstore.JSPEnv; +import org.posterita.exceptions.TMKRuntimeException; +import org.posterita.lib.UdiConstants; + +/** + * JSP Environment Utilities + * + * @author Jorg Janke + * @version $Id: TmkJSPEnv.java,v 1.2 2006/12/15 06:32:14 vishee Exp $ + */ +public class TmkJSPEnv +{ + public static Properties getCtx(HttpServletRequest request) + { + Properties ctx = JSPEnv.getCtx(request); + + String user_org = Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + + if ((user_org == null) || (user_org.equals(""))) //FIXME + { + Env.setContext(ctx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM, Env.getAD_Org_ID(ctx)); + } + + try //Required since our friend Jorg hardcoded 30 mins in JSPEnv.java + { + request.getSession().setMaxInactiveInterval(5*60*60); // 5 Hours + } + catch(Exception ex) + { + throw new TMKRuntimeException("Could not figure the application type for the current session"); + } + + return ctx; + + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/TrxPrefix.java b/posterita/posterita/src/main/org/posterita/core/TrxPrefix.java new file mode 100644 index 0000000000..001faf50bf --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/TrxPrefix.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 02-Dec-2005 + */ + + +package org.posterita.core; + + +public class TrxPrefix +{ + private static int count=0; + + public static synchronized String getPrefix() + { + count++; + return "POSTERITA"+count + "_" + System.currentTimeMillis(); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/UDIFilePropertiesManager.java b/posterita/posterita/src/main/org/posterita/core/UDIFilePropertiesManager.java new file mode 100644 index 0000000000..3603f22a9a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/UDIFilePropertiesManager.java @@ -0,0 +1,49 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 13-Oct-2005 + */ + + +package org.posterita.core; + +public class UDIFilePropertiesManager extends FilePropertiesManager +{ + static UDIFilePropertiesManager singleton; + + private UDIFilePropertiesManager() + { + + } + + public static UDIFilePropertiesManager getProperty() + { + if (singleton ==null) + singleton = new UDIFilePropertiesManager(); + + return singleton; + } + + protected String getFileName() + { + return "Udi"; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/UDIMap.java b/posterita/posterita/src/main/org/posterita/core/UDIMap.java new file mode 100644 index 0000000000..003bbf161b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/UDIMap.java @@ -0,0 +1,49 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 15, 2005 by praveen + * + */ +package org.posterita.core; + +import java.util.HashMap; + +import org.compiere.process.DocAction; + +public class UDIMap +{ + public static final HashMap docStatusMap; + + static + { + docStatusMap = new HashMap(); + docStatusMap.put(DocAction.STATUS_Approved,"Approved"); + docStatusMap.put(DocAction.STATUS_Completed,"Completed"); + docStatusMap.put(DocAction.STATUS_Closed,"Closed"); + docStatusMap.put(DocAction.STATUS_Drafted,"Drafted"); + docStatusMap.put(DocAction.STATUS_InProgress,"InProgress"); + docStatusMap.put(DocAction.STATUS_Invalid,"Invalid"); + docStatusMap.put(DocAction.STATUS_NotApproved,"Not Approved"); + docStatusMap.put(DocAction.STATUS_Reversed,"Reversed"); + docStatusMap.put(DocAction.STATUS_Unknown,"UnKnown"); + docStatusMap.put(DocAction.STATUS_Voided,"Voided"); + docStatusMap.put(DocAction.STATUS_WaitingConfirmation,"Waiting Confirmation"); + docStatusMap.put(DocAction.STATUS_WaitingPayment,"Waiting payment"); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/UDIPair.java b/posterita/posterita/src/main/org/posterita/core/UDIPair.java new file mode 100644 index 0000000000..1699a09786 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/UDIPair.java @@ -0,0 +1,65 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.core; + +public class UDIPair implements Comparable +{ + private Integer ID; + private String value; + + public UDIPair(Integer ID, String value) + { + this.ID = ID; + this.value = value; + } + + public Integer getID() + { + return ID; + } + + public void setID(Integer id) + { + ID = id; + } + + public String getValue() + { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public int compareTo(Object o) + { + UDIPair pair = (UDIPair) o; + + return this.getValue().compareTo(pair.getValue()); + } + + public String toString() + { + String str ="ID:" +getID() + " Value:" +getValue(); + return str; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/UDIPropertiesManager.java b/posterita/posterita/src/main/org/posterita/core/UDIPropertiesManager.java new file mode 100644 index 0000000000..6d1de2729f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/UDIPropertiesManager.java @@ -0,0 +1,53 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 24-Jun-2005 by alok + * + */ +package org.posterita.core; + +import org.posterita.factory.DBPropertiesManager; +import org.posterita.factory.WebProperties; + +public class UDIPropertiesManager +{ + private static WebProperties singleton; + + private UDIPropertiesManager() + { + + } + + public static WebProperties getProperty() + { + if (singleton ==null) + singleton = new DBPropertiesManager(); + + + + return singleton; + } + + protected String getFileName() + { + + return "Udi"; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/UpdateUsers.java b/posterita/posterita/src/main/org/posterita/core/UpdateUsers.java new file mode 100644 index 0000000000..b73d06d212 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/UpdateUsers.java @@ -0,0 +1,60 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.core; + +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.Adempiere; +import org.compiere.model.MBPartner; +import org.compiere.model.MUser; +import org.compiere.util.CLogMgt; +import org.compiere.util.Env; + + +public class UpdateUsers { + + public static void main(String[] args) + { + Adempiere.startup(true); + CLogMgt.initialize(true); + CLogMgt.setLevel(Level.OFF); + + Properties ctx = Env.getCtx(); + Env.setContext(ctx, "#AD_Client_ID", "" + 1001932); + + int userIds[] = MUser.getAllIDs(MUser.Table_Name, " ad_client_id=1001932", null); + + MUser user; + MBPartner partner; + for (int i = 0; i < userIds.length; i++) + { + user = new MUser(ctx, userIds[i], null); + + if (user.getC_BPartner_ID()!=0) + { + partner = new MBPartner(ctx, user.getC_BPartner_ID(), null); + user.setName(partner.getName()); + user.save(); + } + + } + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/WebFacade.java b/posterita/posterita/src/main/org/posterita/core/WebFacade.java new file mode 100644 index 0000000000..56b9c54770 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/WebFacade.java @@ -0,0 +1,26 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.core; + + +public class WebFacade +{ + +} diff --git a/posterita/posterita/src/main/org/posterita/core/action/ClientAction.java b/posterita/posterita/src/main/org/posterita/core/action/ClientAction.java new file mode 100644 index 0000000000..8115a3336d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/action/ClientAction.java @@ -0,0 +1,127 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 30, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.core.action; + +import java.io.File; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MCountry; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.Constants; +import org.posterita.beans.UserBean; +import org.posterita.businesslogic.CurrencyManager; +import org.posterita.businesslogic.POSClientManager; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.bean.ClientBean; +import org.posterita.exceptions.ClientAlreadyExistException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.UserRegistrationForm; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +import com.sun.corba.se.impl.orbutil.closure.Constant; + +public class ClientAction extends BaseDispatchAction +{ + + public static final String INIT_CREATE_CLIENT = "initCreateClient"; + public ActionForward initCreateClient(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx = Env.getCtx(); //--> Not using TmkJSPEnv because it may be that no store is defined + ArrayList countriesKNPair = KeyNamePairUtil.getData(ctx, MCountry.Table_Name, "IsActive='Y'"); + ArrayList currenciesKNPair = CurrencyManager.getAllCurrencies(); + + request.getSession().setAttribute(Constants.COUNTRIES, countriesKNPair); + request.getSession().setAttribute(Constants.CURRENCIES, currenciesKNPair); + + return mapping.findForward(INIT_CREATE_CLIENT); + } + + public static final String CREATE_CLIENT = "createClient"; + public ActionForward createClient(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + DefaultForm df = (DefaultForm)form; + + ClientBean clientBean = (ClientBean)df.getBean(); + + UserBean userBean = new UserBean(); + userBean.setName(clientBean.getUsername()); + userBean.setAddress1(clientBean.getAddress1()); + userBean.setCity(clientBean.getCity()); + userBean.setCountryId(clientBean.getCountryId()); + userBean.setEmail(clientBean.getEmail()); + request.getSession().setAttribute(Constants.USER_BEAN, userBean); + + /*request.setAttribute(Constants.EMAIL, clientBean.getEmail()); + request.setAttribute(Constants.USERNAME, clientBean.getUsername()); + request.setAttribute(Constants.ADDRESS1, clientBean.getAddress1()); + request.setAttribute(Constants.CITY, clientBean.getCity()); + request.setAttribute(Constants.COUNTRY_ID, clientBean.getCountryId());*/ + + + if (clientBean.getFile() == null) + { + clientBean.setFile(df.getFile()); + } + + if(!clientBean.getPassword().equals(clientBean.getConfirmPassword())) + { + postGlobalError("error.wrong.password.matching", request); + return mapping.getInputForward(); + } + + String storeContext; + try + { + storeContext = POSClientManager.createClient(clientBean); + } + catch(ClientAlreadyExistException ex) + { + postGlobalError("error.client.alreadyexist", request); + return mapping.getInputForward(); + } + catch(OperationException ex) + { + postGlobalError("error.client.create", ex.getMessage(), request); + return mapping.getInputForward(); + } + + String contextPath = "/RegisterUserAction.do?action=initRegisterUser"; + /*String contextPath = "/SetApplicationParametersAction.do?action=setApplicationParameters&applicationName=" + storeContext;*/ + return new ActionForward(contextPath); + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/action/login/GenericLoginAction.java b/posterita/posterita/src/main/org/posterita/core/action/login/GenericLoginAction.java new file mode 100644 index 0000000000..272831ca67 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/action/login/GenericLoginAction.java @@ -0,0 +1,45 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.core.action.login; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.struts.login.LoginAction; + +public class GenericLoginAction extends LoginAction +{ + + public ActionForward success(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + + return super.success(mapping, form, request, response); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/bean/ClientBean.java b/posterita/posterita/src/main/org/posterita/core/bean/ClientBean.java new file mode 100644 index 0000000000..62a423bf8d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/bean/ClientBean.java @@ -0,0 +1,173 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 30, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.core.bean; + +import org.apache.struts.upload.FormFile; +import org.posterita.beans.UDIBean; + +public class ClientBean extends UDIBean +{ + public String getClientName() + { + return clientName; + } + + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getAddress1() + { + return address1; + } + + public void setAddress1(String address1) + { + this.address1 = address1; + } + + public Integer getCountryId() + { + return countryId; + } + + public void setCountryId(Integer countryId) + { + this.countryId = countryId; + } + + public Integer getCurrencyId() + { + return currencyId; + } + + public void setCurrencyId(Integer currencyId) + { + this.currencyId = currencyId; + } + + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getOrgName() + { + return orgName; + } + + public void setOrgName(String orgName) + { + this.orgName = orgName; + } + + public String getPostalAddress() + { + return postalAddress; + } + + public void setPostalAddress(String postalAddress) + { + this.postalAddress = postalAddress; + } + + public String getConfirmPassword() + { + return confirmPassword; + } + + public void setConfirmPassword(String confirmPassword) + { + this.confirmPassword = confirmPassword; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getUserPIN() + { + return userPIN; + } + + public void setUserPIN(String userPIN) + { + this.userPIN = userPIN; + } + + public String getRoleName() + { + return roleName; + } + + public void setRoleName(String roleName) + { + this.roleName = roleName; + } + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getCity() + { + return city; + } + + public void setCity(String city) + { + this.city = city; + } + + public FormFile getFile() + { + return file; + } + public void setFile(FormFile file) + { + this.file = file; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/bean/ElementBean.java b/posterita/posterita/src/main/org/posterita/core/bean/ElementBean.java new file mode 100644 index 0000000000..38eb4a3688 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/bean/ElementBean.java @@ -0,0 +1,87 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Nov 15, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.core.bean; + +public class ElementBean +{ + protected String name; + protected String columnName; + protected String printName; + protected String description; + protected String help; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getColumnName() + { + return columnName; + } + + public void setColumnName(String columnName) + { + this.columnName = columnName; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getHelp() + { + return help; + } + + public void setHelp(String help) + { + this.help = help; + } + + public String getPrintName() + { + return printName; + } + + public void setPrintName(String printName) + { + this.printName = printName; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/businesslogic/ElementManager.java b/posterita/posterita/src/main/org/posterita/core/businesslogic/ElementManager.java new file mode 100644 index 0000000000..5336bd0c3b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/businesslogic/ElementManager.java @@ -0,0 +1,217 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Nov 15, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.core.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Language; +import org.compiere.util.Msg; + +import org.posterita.lib.UdiConstants; +import org.posterita.core.bean.ElementBean; + +public class ElementManager +{ + protected transient static final CLogger log = CLogger.getCLogger (ElementManager.class); + private static ElementBean getUnknownElementBean(Properties ctx, String columnName) + { + ElementBean elementBean = new ElementBean(); + elementBean.setColumnName(columnName); + elementBean.setDescription("Undefined column with name: " + columnName); + elementBean.setHelp(elementBean.getDescription()); + elementBean.setName(columnName); + elementBean.setPrintName(columnName); + return elementBean; + } + + private static String getElement_TrlSql(Properties ctx, String columnName) + { + String language = Env.getContext(ctx, UdiConstants.LANGUAGE_CTX_PARAM); + + if (language == null || language.trim().length() == 0) + { + language = Language.AD_Language_en_US; + } + + String tableName = "AD_Element"; + StringBuffer whereClause = new StringBuffer("ColumnName='"); + whereClause.append(columnName); + whereClause.append("' "); + + if (!language.equals(Language.AD_Language_en_US)) + { + tableName = "AD_Element_Trl"; + whereClause = new StringBuffer(); + whereClause.append("AD_Element_ID= (select AD_Element_ID from AD_Element where ColumnName='" + columnName + "')"); + whereClause.append(" and AD_Language='"); + whereClause.append(language); + whereClause.append("'"); + } + + StringBuffer sql = new StringBuffer(); + sql.append("Select ColumnName, Name, PrintName, Description, Help from "); + sql.append(tableName); + sql.append(" where "); + sql.append(whereClause); + + return sql.toString(); + } + + public static String getMsg_trlSql(Properties ctx, String text) + { + String language = Env.getContext(ctx, UdiConstants.LANGUAGE_CTX_PARAM); + + if (language == null || language.trim().length() == 0) + { + language = Language.AD_Language_en_US; + } + + String tableName = "AD_Message"; + StringBuffer whereClause = new StringBuffer("value='"); + whereClause.append(text); + whereClause.append("' "); + + if (!language.equals(Language.AD_Language_en_US)) + { + tableName = "AD_Element_Trl"; + whereClause = new StringBuffer(); + whereClause.append("AD_Message_ID= (select AD_Message_ID from AD_Message where value='"); + whereClause.append(text); + whereClause.append("')"); + whereClause.append(" and AD_Language='"); + whereClause.append(language); + whereClause.append("'"); + } + + StringBuffer sql = new StringBuffer(); + sql.append("Select Value, MsgText, MsgText, MsgTip, MsgTip from "); + sql.append(tableName); + sql.append(" where "); + sql.append(whereClause); + + return sql.toString(); + } + + private static ElementBean getTrl(String sql) + { + PreparedStatement pstmt = DB.prepareStatement(sql, null); + + ElementBean retElementBean = null; + try + { + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) + { + retElementBean = new ElementBean(); + retElementBean.setColumnName(rs.getString(1)); + retElementBean.setName(rs.getString(2)); + retElementBean.setPrintName(rs.getString(3)); + retElementBean.setDescription(rs.getString(4)); + retElementBean.setHelp(rs.getString(5)); + } + else + { + return null; + } + rs.close(); + } + catch (Exception ex) + { + log.severe("Could retrieve element translation with sql: " + sql); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex){} + } + + return retElementBean; + } + + public static ElementBean getMsg1(Properties ctx, String text) + { + ElementBean elementBean = null; + + elementBean = getTrl(getElement_TrlSql(ctx, text)); + + if (elementBean == null) + { + elementBean = getTrl(getMsg_trlSql(ctx, text)); + } + + if (elementBean == null) + { + elementBean = getUnknownElementBean(ctx, text); + } + + return elementBean; + } + + public static ElementBean getMsg(Properties ctx, String text) + { + String language = Env.getContext(ctx, UdiConstants.LANGUAGE_CTX_PARAM); + + if (language == null || language.trim().length() == 0) + { + language = Language.AD_Language_en_US; + } + + String msg = Msg.getElement(language, text, true); + + if (msg == null || msg == "") + { + msg = Msg.translate(language, text); + } + + if (msg == null || msg == "") + { + msg = text; + } + + int ind = msg.indexOf(Env.NL); + if (ind != -1) + msg = msg.substring(0, ind); + + ElementBean elementBean = new ElementBean(); + elementBean.setColumnName(text); + elementBean.setDescription(msg); + elementBean.setHelp(msg); + elementBean.setName(msg); + elementBean.setPrintName(msg); + + return elementBean; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/businesslogic/ImportManager.java b/posterita/posterita/src/main/org/posterita/core/businesslogic/ImportManager.java new file mode 100644 index 0000000000..6a090c0d6c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/businesslogic/ImportManager.java @@ -0,0 +1,108 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +/** + @author ashley + */ + +package org.posterita.core.businesslogic; + +import java.io.File; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import org.compiere.impexp.ImpFormat; +import org.compiere.process.ImportAccount; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.util.Trx; + +import org.posterita.businesslogic.ProcessManager; +import org.posterita.core.FileManager; +import org.posterita.exceptions.OperationException; + +public class ImportManager +{ + public static int importFile(Properties ctx, File impFile, String importFormat, String trxName) throws OperationException + { + if(impFile == null) + throw new OperationException("File to import cannot be null"); + if(!impFile.exists() || impFile.isDirectory()) + throw new OperationException("File does not exist or it is a directory, file: " + impFile); + if(importFormat == null || importFormat.trim().length() == 0) + throw new OperationException("Import format cannot be null"); + + ImpFormat impFormat = ImpFormat.load(importFormat); + + if(impFormat == null) + throw new OperationException("Could not load import format: " + importFormat); + + ArrayList fileLinesList = FileManager.readLines(impFile); + + Iterator fileLinesIter = fileLinesList.iterator(); + + int importedLines = 0; + while(fileLinesIter.hasNext()) + { + String line = fileLinesIter.next(); + if(impFormat.updateDB(ctx, line, trxName)) + importedLines++; + } + + return importedLines; + } + + public static void importAccounting(Properties ctx, int clientId, int elementId, boolean updateDefaultAccounts, boolean createNewCombination, boolean deleteOldImported, String trxName) throws OperationException + { + ImportAccount impAccount = new ImportAccount(); + int accountImportProcessId = ProcessManager.getProcessId(ImportAccount.class); + + String updDefAccts = (updateDefaultAccounts) ? "Y" : "N"; + String crNewCombinations = (createNewCombination) ? "Y" : "N"; + String delOldImp = (deleteOldImported) ? "Y" : "N"; + + ProcessInfo processInfo = new ProcessInfo("Import accounts", accountImportProcessId); + + ProcessInfoParameter clientParam = new ProcessInfoParameter("AD_Client_ID", new BigDecimal(clientId), new BigDecimal(clientId), "Client", "Client"); + ProcessInfoParameter elementParam = new ProcessInfoParameter("C_Element_ID", new BigDecimal(elementId), new BigDecimal(elementId), "Element", "Element"); + ProcessInfoParameter updDefAcctsParam = new ProcessInfoParameter("UpdateDefaultAccounts", updDefAccts, updDefAccts, "Update Default Accounts", "Update Default Accounts"); + ProcessInfoParameter createNewCombinationParam = new ProcessInfoParameter("CreateNewCombination", crNewCombinations, crNewCombinations, "Create New Combination", "Create New Combination"); + ProcessInfoParameter deleteOldParam = new ProcessInfoParameter("DeleteOldImported", delOldImp, delOldImp, "Delete Old Imported", "Delete Old Imported"); + + ProcessInfoParameter parameters[] = new ProcessInfoParameter[5]; + parameters[0] = clientParam; + parameters[1] = elementParam; + parameters[2] = updDefAcctsParam; + parameters[3] = createNewCombinationParam; + parameters[4] = deleteOldParam; + + processInfo.setParameter(parameters); + + Trx trx = null; + + if(trxName != null) + trx = Trx.get(trxName, false); + + if(!impAccount.startProcess(ctx, processInfo, trx)) + throw new OperationException("Could not run import accounting process"); + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/exception/FileOpException.java b/posterita/posterita/src/main/org/posterita/core/exception/FileOpException.java new file mode 100644 index 0000000000..119003bbb1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/exception/FileOpException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +package org.posterita.core.exception; + +public class FileOpException extends Exception +{ + private static final long serialVersionUID = 1L; + + public FileOpException(String msg) + { + super(msg); + } + + public FileOpException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/exception/IOOperationException.java b/posterita/posterita/src/main/org/posterita/core/exception/IOOperationException.java new file mode 100644 index 0000000000..ec46611784 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/exception/IOOperationException.java @@ -0,0 +1,46 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +/** + @author ashley + */ + +package org.posterita.core.exception; + +import org.posterita.exceptions.OperationException; + +public class IOOperationException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public IOOperationException(String msg) + { + super(msg); + } + + public IOOperationException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/form/ClientForm.java b/posterita/posterita/src/main/org/posterita/core/form/ClientForm.java new file mode 100644 index 0000000000..6ae9f6ba25 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/form/ClientForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 30, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.core.form; + +import org.posterita.struts.core.DefaultForm; +import org.posterita.core.bean.ClientBean; + +public class ClientForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public ClientForm() + { + this.setBean(new ClientBean()); + this.addRequiredFields(new String[]{"clientName", "address1", "countryId", "currencyId", "email", "orgName", "postalAddress", "confirmPassword", "password", "userPIN", "roleName", "username", "city","file"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/install/EnvSettings.java b/posterita/posterita/src/main/org/posterita/core/install/EnvSettings.java new file mode 100644 index 0000000000..62c7036bce --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/install/EnvSettings.java @@ -0,0 +1,151 @@ +package org.posterita.core.install; + +import java.io.File; +import java.net.InetAddress; +import java.net.UnknownHostException; + +import org.posterita.core.exception.FileOpException; + +public class EnvSettings +{ + public static boolean DEBUG = true; + public static final double JAVA_VERSION_1_5 = 1.5; + + public static final String PATH_SEPARATOR = System.getProperty("file.separator"); + + public static final String JAVA_HOME = "JAVA_HOME"; + public static final String COMPIERE_WEBSTORES = "COMPIERE_WEBSTORES"; + public static final String COMPIERE_DB_USER = "COMPIERE_DB_USER"; + public static final String COMPIERE_DB_NAME = "COMPIERE_DB_NAME"; + public static final String COMPIERE_DB_SYSTEM = "COMPIERE_DB_SYSTEM"; + public static final String COMPIERE_DB_PASSWORD = "COMPIERE_DB_PASSWORD"; + public static final String COMPIERE_HOME = "COMPIERE_HOME"; + public static final String COMPIERE_APPS_SERVER = "COMPIERE_APPS_SERVER"; + public static final String COMPIERE_WEB_ALIAS = "COMPIERE_WEB_ALIAS"; + public static final String COMPIERE_DB_TYPE = "COMPIERE_DB_TYPE"; + public static final String COMPIERE_DB_PORT = "COMPIERE_DB_PORT"; + public static final String COMPIERE_DB_SERVER = "COMPIERE_DB_SERVER"; + public static final String COMPIERE_DB_URL = "COMPIERE_DB_URL"; + public static final String COMPIERE_MAIL_SERVER = "COMPIERE_MAIL_SERVER"; + public static final String COMPIERE_APPS_DEPLOY = "COMPIERE_APPS_DEPLOY"; + public static final String COMPIERE_KEYSTORE = "COMPIERE_KEYSTORE"; + + public static final String TEMP_DIR = "TempDir"; + public static final String CONNECTION = "Connection"; + + public static final String OS_WINDOWS = "Windows"; + public static final String OS_LINUX = "Linux"; + + public static File getJDKHomeDir() throws FileOpException + { + String javaHome = System.getProperty("java.home"); + + if(javaHome.endsWith("jre")) // Implies running from JRE found within JDK Folder + { + int jInd = javaHome.lastIndexOf("jre"); + javaHome = javaHome.substring(0, jInd - 1); + } + + int index = javaHome.lastIndexOf(PATH_SEPARATOR); + index = index + 1; + + if(isOSWindows()) + { + javaHome = javaHome.toLowerCase(); + int pInd = javaHome.indexOf("progra~1"); + if(pInd > 0) + javaHome = javaHome.replaceAll("progra~1", "program files"); + } + + String jreFolder = javaHome.substring(index); + String jdkFolder = jreFolder.replaceAll("jre", "jdk"); + + File jdkDir = new File(javaHome.substring(0, index) + jdkFolder); + if(!jdkDir.exists()) + throw new FileOpException("JDK Folder does not exists, file: " + jdkDir.getAbsolutePath()); + if(!jdkDir.isDirectory()) + throw new FileOpException("Path is not a directory, file: " + jdkDir.getAbsolutePath()); + + return jdkDir; + } + + public static File getUserDesktopDir() throws FileOpException + { + String userHome = System.getProperty("user.home"); + + String desktopDirPath = userHome + PATH_SEPARATOR + "Desktop"; + + File desktopDir = new File(desktopDirPath); + + if(!(desktopDir.exists() && desktopDir.isDirectory())) + throw new FileOpException("Could not locate desktop directory"); + + return desktopDir; + } + + public static File getTempDir() throws FileOpException + { + String tempDirPath = System.getProperty("java.io.tmpdir"); + + File tempDir = new File(tempDirPath); + + if(!(tempDir.exists() && tempDir.isDirectory())) + throw new FileOpException("Could not locate Temporary Directory"); + + return tempDir; + } + + public static String getJavaMajorVersion() + { + String javaVersion = System.getProperty("java.version"); + javaVersion = javaVersion.substring(0, 3); + + return javaVersion; + } + + public static boolean isJavaVersionOk() + { + boolean versionOk = false; + + String javaVersion = getJavaMajorVersion(); + try + { + double version = Double.parseDouble(javaVersion); + if(version >= 1.5) + versionOk = true; + } + catch(NumberFormatException ex) + { + versionOk = false; + } + return versionOk; + } + + public static File getWorkingDir() + { + String workingDir = System.getProperty("user.dir"); + + return new File(workingDir); + } + + public static String getHostName() throws UnknownHostException + { + InetAddress iAdd = InetAddress.getLocalHost(); + return iAdd.getHostName(); + } + + public static String getHostAddress() throws UnknownHostException + { + InetAddress iAdd = InetAddress.getLocalHost(); + return iAdd.getHostAddress(); + } + + public static boolean isOSWindows() + { + String osName = System.getProperty("os.name"); + if(osName.startsWith(OS_WINDOWS)) + return true; + else + return false; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/install/POSInstall.java b/posterita/posterita/src/main/org/posterita/core/install/POSInstall.java new file mode 100644 index 0000000000..5e141453c8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/install/POSInstall.java @@ -0,0 +1,423 @@ +package org.posterita.core.install; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.net.UnknownHostException; +import java.util.Enumeration; +import java.util.Properties; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import org.posterita.core.exception.FileOpException; + +public class POSInstall +{ + public static final boolean DEBUG = true; + private static final String DB_TYPE_ORACLE = "oracle"; +// private static final String DB_TYPE_FIREBIRD = "firebird"; + + private static final String DEFAULT_DB_NAME = "tmkpos"; + private static final String DB_PASSWORD = "compiere"; +// private static final String DB_SYSTEM_PASSWORD = "compiere"; + + private static final String START_SERVER_LINK_FILE = "Start Tamak ICT POS Server.lnk"; + private static final String STOP_SERVER_LINK_FILE = "Stop Tamak ICT POS Server.lnk"; + + private static final String INSTALLATIONSRC = "Compiere2"; + + private static final String INSTALLATION_PATH = "c:\\"; + private static final String FILE_SRC_DIR = "bin"; + + + private static void writeStream(File outFile, InputStream inStream) throws FileOpException + { + try + { + FileOutputStream fileOutStream = new FileOutputStream(outFile); + BufferedOutputStream bufferedOutStream = new BufferedOutputStream(fileOutStream); + BufferedInputStream bufferedInStream = new BufferedInputStream(inStream); + + byte buffer[] = new byte[1024]; + int read = -1; + + while((read = bufferedInStream.read(buffer)) != -1) + bufferedOutStream.write(buffer, 0, read); + bufferedOutStream.flush(); + bufferedOutStream.close(); + bufferedInStream.close(); + } + catch(IOException ex) + { + throw new FileOpException("Could not write file: " + outFile.getAbsolutePath(), ex); + } + } + + public static String getFileAsString(File inFile) throws FileOpException + { + try + { + FileInputStream fileInStream = new FileInputStream(inFile); + BufferedInputStream bufferedInStream = new BufferedInputStream(fileInStream); + ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream(); + + byte buffer[] = new byte[1024]; + int read; + + while((read = bufferedInStream.read(buffer)) != -1) + { + byteArrayOutStream.write(buffer, 0, read); + } + + byteArrayOutStream.flush(); + + String data = new String(byteArrayOutStream.toByteArray()); + byteArrayOutStream.close(); + bufferedInStream.close(); + fileInStream.close(); + + return data; + } + catch(IOException ex) + { + throw new FileOpException("Could not read file: " + inFile.getAbsolutePath(), ex); + } + + } + + public static void install(File srcFile, String installationPath) throws FileOpException + { + try + { + ZipFile zipFile = new ZipFile(srcFile); + + Enumeration zipEntryEnum = zipFile.entries(); + + while(zipEntryEnum.hasMoreElements()) + { + ZipEntry zipEntry = (ZipEntry)zipEntryEnum.nextElement(); + + if(zipEntry.isDirectory()) + { + File file = new File(installationPath + zipEntry.getName()); + if(DEBUG) + System.out.println("Creating directory: " + file.getAbsolutePath()); + if(!file.mkdirs()) + throw new FileOpException("Could not creat directory: " + file.getAbsolutePath()); + } + else + { + File file = new File(installationPath + zipEntry.getName()); + if(DEBUG) + System.out.println("Creating file: " + file.getAbsolutePath()); + InputStream inStream = zipFile.getInputStream(zipEntry); + writeStream(file, inStream); + inStream.close(); + } + } + } + catch(IOException ex) + { + throw new FileOpException("Could not create installation files", ex); + } + } + + /*private static void uninstall(File path) + { + File files[] = path.listFiles(); + + for(int i = 0; i < files.length; i++) + { + if(files[i].isDirectory()) + uninstall(files[i]); + else + files[i].delete(); + } + path.delete(); + }*/ + + private static void changeCompiereEnvSettings(File compEnvFile, File compHomeDir, String dbName, String dbType, String webstores) throws FileOpException + { + if(!(compEnvFile.exists() && compEnvFile.isFile())) + throw new FileOpException("Could not locate Compiere Environment settings, " + compEnvFile.getAbsolutePath()); + + Properties props = new Properties(); + FileInputStream fis = null; + FileOutputStream fileOutStream = null; + + try + { + fis = new FileInputStream(compEnvFile); + props.load(fis); + String hostName = EnvSettings.getHostName(); + + props.setProperty(EnvSettings.COMPIERE_APPS_SERVER, hostName); + props.setProperty(EnvSettings.COMPIERE_DB_SERVER, hostName); + props.setProperty(EnvSettings.COMPIERE_MAIL_SERVER, hostName); + props.setProperty(EnvSettings.COMPIERE_WEB_ALIAS, hostName); + + String jdbcConnString = ""; + if(dbType.equals(DB_TYPE_ORACLE)) + jdbcConnString = "jdbc:oracle:thin:@" + hostName + ":1521:" + dbName; + + props.setProperty(EnvSettings.COMPIERE_DB_URL, jdbcConnString); + props.setProperty(EnvSettings.COMPIERE_HOME, compHomeDir.getAbsolutePath()); + props.setProperty(EnvSettings.JAVA_HOME, EnvSettings.getJDKHomeDir().getAbsolutePath()); + props.setProperty(EnvSettings.COMPIERE_DB_TYPE, dbType); + props.setProperty(EnvSettings.COMPIERE_DB_NAME, dbName); + + String deployFolder = compHomeDir.getAbsolutePath() + + EnvSettings.PATH_SEPARATOR + "jboss" + + EnvSettings.PATH_SEPARATOR + "server" + + EnvSettings.PATH_SEPARATOR + "compiere" + + EnvSettings.PATH_SEPARATOR + "deploy"; + props.setProperty(EnvSettings.COMPIERE_APPS_DEPLOY, deployFolder); + props.setProperty(EnvSettings.COMPIERE_WEBSTORES, webstores); + + fileOutStream = new FileOutputStream(compEnvFile); + String comments = "Compiere"; + + String keystorePath = compHomeDir.getAbsolutePath() + "\\keystore\\myKeystore"; + + props.setProperty(EnvSettings.COMPIERE_KEYSTORE, keystorePath); + + props.store(fileOutStream, comments); + } + catch(IOException ex) + { + throw new FileOpException("Could not read Compiere Environment settings, " + compEnvFile.getAbsolutePath(), ex); + } + finally + { + if(fis != null) + { + try + { + fis.close(); + } + catch(Exception ex) + {} + } + + if (fileOutStream != null) + { + try + { + fileOutStream.close(); + } + catch(Exception e) + {} + } + } + } + + private static void changeEnviromentBatFile(File compEnvFile, String compHome) throws FileOpException + { + String envTemplateBatFilePath = compHome + EnvSettings.PATH_SEPARATOR + "utils" + EnvSettings.PATH_SEPARATOR + "myEnvironmentTemplate.bat"; + String oldEnvBatFilePath = compHome + EnvSettings.PATH_SEPARATOR + "utils" + EnvSettings.PATH_SEPARATOR + "myEnvironment.bat"; + FileInputStream fis = null; + + try + { + File oldEnvBatFile = new File(oldEnvBatFilePath); + oldEnvBatFile.delete(); + + Properties props = new Properties(); + fis = new FileInputStream(compEnvFile); + props.load(fis); + + String data = getFileAsString(new File(envTemplateBatFilePath)); + + Enumeration keysEnum = props.keys(); + while(keysEnum.hasMoreElements()) + { + String key = (String)keysEnum.nextElement(); + String value = (String)props.get(key); + + value = value.replaceAll("\\\\", "\\\\\\\\"); + + String fileKey = "@" + key + "@"; + data = data.replaceAll(fileKey, value); + } + + File newEnvBatFile = new File(oldEnvBatFilePath); + FileWriter fileWriter = new FileWriter(newEnvBatFile); + fileWriter.write(data); + fileWriter.flush(); + fileWriter.close(); + } + catch(IOException ex) + { + throw new FileOpException("Could not create environment settings bat file", ex); + } + + finally + { + if (fis != null) + { + try + { + fis.close(); + } + catch(Exception ex) + {} + } + } + + } + + private static void changeCompiereSettings(File compPropsFile, String dbType, String dbName) throws FileOpException + { + Properties props = new Properties(); + String dbTypeName = ""; + String dbPort = ""; + FileInputStream fis = null; + FileOutputStream fos = null; + + if(DB_TYPE_ORACLE.equals(dbType)) + { + dbTypeName = "Oracle"; + dbPort = "1521"; + } + else + { + dbTypeName = "Firebird"; + dbPort = "3050"; + } + + try + { + fis = new FileInputStream(compPropsFile); + props.load(fis); + + props.setProperty(EnvSettings.TEMP_DIR, EnvSettings.getTempDir().getAbsolutePath()); + String hostName = EnvSettings.getHostName(); + String connUrl = "xyzCConnection[name=" + + hostName + "{" + hostName + "-" + dbName + "-" + DB_PASSWORD + + "},AppsHost=" + hostName + ",AppsPort=1099,Profile=L,type=" + + dbTypeName + ",DBhost=" + hostName + ",DBport=" + dbPort + ",DBname=" + + dbName + ",BQ=false,FW=false,FWhost=,FWport=1630,UID=compiere,PWD=compiere]"; + props.setProperty(EnvSettings.CONNECTION, connUrl); + + fos = new FileOutputStream(compPropsFile); + props.store(fos, ""); + } + catch(IOException ex) + { + throw new FileOpException("Could not read data from properties file: " + compPropsFile.getAbsolutePath(), ex); + } + finally + { + if (fis != null) + { + try + { + fis.close(); + } + catch(Exception e) + {} + } + + if (fos != null) + { + try + + { + fos.close(); + } + catch(Exception e) + {} + } + } + } + + + private static void changeSettings(String installedPath) throws FileOpException + { + File compiereEnvProperties = new File(installedPath + EnvSettings.PATH_SEPARATOR + "CompiereEnv.properties"); + File compiereEnvPropertiesSave = new File(installedPath + EnvSettings.PATH_SEPARATOR + "CompiereEnv.properties.save"); + File compiereProperties = new File(installedPath + EnvSettings.PATH_SEPARATOR + "Compiere.properties"); + File compierePropertiesSave = new File(installedPath + EnvSettings.PATH_SEPARATOR + "Compiere.properties.save"); + changeCompiereEnvSettings(compiereEnvProperties, new File(installedPath), DEFAULT_DB_NAME, DB_TYPE_ORACLE, ""); + changeCompiereEnvSettings(compiereEnvPropertiesSave, new File(installedPath), DEFAULT_DB_NAME, DB_TYPE_ORACLE, ""); + changeCompiereSettings(compiereProperties, DB_TYPE_ORACLE, DEFAULT_DB_NAME); + changeCompiereSettings(compierePropertiesSave, DB_TYPE_ORACLE, DEFAULT_DB_NAME); + changeEnviromentBatFile(compiereEnvProperties, installedPath); + } + + private static void createShortcutFile() throws FileOpException, UnknownHostException + { + String desktop = EnvSettings.getUserDesktopDir().getAbsolutePath(); + String hostAddress = EnvSettings.getHostAddress(); + String shortcutFilePath = desktop + EnvSettings.PATH_SEPARATOR + "Tamak ICT POS.url"; + File outFile = new File(shortcutFilePath); + + try + { + FileWriter fileWriter = new FileWriter(outFile); + fileWriter.write("[InternetShortcut]\r\n"); + fileWriter.write("URL=http://" + hostAddress + "/posterita/" + "\r\n"); + fileWriter.flush(); + fileWriter.close(); + } + catch(IOException ex) + { + throw new FileOpException("Could not write url shortcut"); + } + + } + + private static void createShortcuts(String installedPath) throws FileOpException, UnknownHostException + { + String desktopPath = EnvSettings.getUserDesktopDir().getAbsolutePath(); + String startSeverLink = installedPath + EnvSettings.PATH_SEPARATOR + START_SERVER_LINK_FILE; + String deskStartServerLink = desktopPath + EnvSettings.PATH_SEPARATOR + START_SERVER_LINK_FILE; + String stopSeverLink = installedPath + EnvSettings.PATH_SEPARATOR + STOP_SERVER_LINK_FILE; + String deskStopServerLink = desktopPath + EnvSettings.PATH_SEPARATOR + STOP_SERVER_LINK_FILE; + + try + { + writeStream(new File(deskStartServerLink), new FileInputStream(startSeverLink)); + writeStream(new File(deskStopServerLink), new FileInputStream(stopSeverLink)); + createShortcutFile(); + } + catch(FileNotFoundException ex) + { + throw new FileOpException("Could not write shortcuts", ex); + } + } + + private static void installTamakICTPOS() throws FileOpException, UnknownHostException + { + String workingDir = EnvSettings.getWorkingDir().getAbsolutePath(); + + String srcFile = workingDir + EnvSettings.PATH_SEPARATOR + FILE_SRC_DIR + EnvSettings.PATH_SEPARATOR + INSTALLATIONSRC; + String installationPath = INSTALLATION_PATH; + install(new File(srcFile), installationPath); + String installedPath = installationPath + INSTALLATIONSRC; + changeSettings(installedPath); + createShortcuts(installedPath); + } + + public static void main(String args[]) + { + try + { + installTamakICTPOS(); + System.out.println("Installation successfull"); + } + catch(Exception ex) + { + System.out.println("Installation failed: " + ex.getMessage()); + if(DEBUG) + ex.printStackTrace(); + } + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/utils/DisplayReportServlet.java b/posterita/posterita/src/main/org/posterita/core/utils/DisplayReportServlet.java new file mode 100644 index 0000000000..390124de27 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/utils/DisplayReportServlet.java @@ -0,0 +1,95 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 03-Aug-2006 14:29:15 by praveen + * + */ + +package org.posterita.core.utils; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.compiere.util.MimeType; + +import org.posterita.businesslogic.performanceanalysis.ReportManager; + +public class DisplayReportServlet extends HttpServlet +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException + { + String reportURI = request.getRequestURI(); + int index = reportURI.lastIndexOf("/"); + String reportName = reportURI.substring(index+1); + + String reportPath = ReportManager.getReportPath(reportName); + + File f = new File(reportPath); + + if(!f.exists()) + { + throw new ServletException("Unable to load " + reportName + ". Cause file not found."); + } + + String mimeType = null; + mimeType = MimeType.getMimeType(reportName); + + try + { + response.setContentType(mimeType); + + FileInputStream fis = new FileInputStream(f); + BufferedInputStream bis = new BufferedInputStream(fis); + BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); + + //Transfer bytes from bis to bos + byte[] buf = new byte[1024]; + int len; + while ((len = bis.read(buf)) > 0) + { + bos.write(buf, 0, len); + } + bis.close(); + + bos.flush(); + bos.close(); + + } + catch (Exception e) + { + throw new ServletException(e); + } + } + + public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException + { + doGet(request,response); + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/utils/Encrypter.java b/posterita/posterita/src/main/org/posterita/core/utils/Encrypter.java new file mode 100644 index 0000000000..75e7a2b436 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/utils/Encrypter.java @@ -0,0 +1,61 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.core.utils; + +import org.posterita.core.Range; +import org.posterita.exceptions.EncryptionException; + +public class Encrypter +{ + + public static String encrypt(String str, int fromFirst, int toLast) throws EncryptionException + { + if (toLast < fromFirst) + throw new EncryptionException("To range cannot be less than from range!"); + + int strLength = str.length(); + + Range range = new Range(0, strLength); + + + if (!range.isInRange(fromFirst) || !range.isInRange(toLast)) + throw new EncryptionException("Cannot do encryption for " + str + " as the characters to encode are not in the range provided: " + fromFirst + " - " + toLast); + + String firstUnEncryptedCharacters = str.substring(0, fromFirst); + String lastUnEncryptedCharacters = str.substring(toLast, strLength); + + //String encryptedString = firstUnEncryptedCharacters; + StringBuffer encryptedString = new StringBuffer(); + encryptedString.append(firstUnEncryptedCharacters); + + + for (int i = 0; i < toLast-fromFirst; i++) + { + encryptedString.append("X"); + } + + encryptedString.append(lastUnEncryptedCharacters); + + + return encryptedString.toString(); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/utils/FormatBigDecimal.java b/posterita/posterita/src/main/org/posterita/core/utils/FormatBigDecimal.java new file mode 100644 index 0000000000..3e63f544d5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/utils/FormatBigDecimal.java @@ -0,0 +1,46 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.core.utils; + +import java.math.BigDecimal; + +public class FormatBigDecimal +{ + public static BigDecimal currency(BigDecimal bd) + { + return bd.setScale(2, BigDecimal.ROUND_HALF_UP); + } + + public static BigDecimal currency1(BigDecimal bd) + { + return bd.setScale(2, BigDecimal.ROUND_HALF_DOWN); + } + + public static BigDecimal currency(double d) + { + BigDecimal bd = new BigDecimal(d).setScale(2, BigDecimal.ROUND_HALF_UP); + return bd; + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/core/utils/IOUtil.java b/posterita/posterita/src/main/org/posterita/core/utils/IOUtil.java new file mode 100644 index 0000000000..f2f38d8e08 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/utils/IOUtil.java @@ -0,0 +1,88 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.core.utils; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; + +import org.posterita.core.exception.IOOperationException; + +public class IOUtil +{ + + public static byte[] getByteArray(InputStream inStream) throws IOOperationException + { + try + { + BufferedInputStream bufferedInStream = new BufferedInputStream(inStream); + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + BufferedOutputStream bufferedOutStream = new BufferedOutputStream(outStream); + byte buffer[] = new byte[1024]; + int read = 0; + while((read = bufferedInStream.read(buffer)) != -1) + { + bufferedOutStream.write(buffer, 0, read); + } + + bufferedOutStream.flush(); + byte retData[] = outStream.toByteArray(); + bufferedOutStream.close(); + bufferedInStream.close(); + outStream.close(); + return retData; + } + catch(IOException ex) + { + throw new IOOperationException("Could not get data from InputStream", ex); + } + } + + public static StringBuffer getContent(Reader reader, String newLineChar) throws IOOperationException + { + try + { + StringBuffer retDataBuffer = new StringBuffer(1000); + BufferedReader bufferedReader = new BufferedReader(reader); + + String line; + + while((line = bufferedReader.readLine()) != null) + retDataBuffer.append(line + newLineChar); + + return retDataBuffer; + } + catch(IOException ex) + { + throw new IOOperationException("Could not read data from reader", ex); + } + + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/utils/MonthConverter.java b/posterita/posterita/src/main/org/posterita/core/utils/MonthConverter.java new file mode 100644 index 0000000000..aefc6c12e9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/utils/MonthConverter.java @@ -0,0 +1,76 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.core.utils; + +public class MonthConverter +{ + + public static String getMonth(Integer month) + { + + switch (month) + { + + case 1: + return "January"; + + case 2: + return "February"; + + case 3: + return "March"; + + case 4: + return "April"; + + case 5: + return "May"; + + case 6: + return "June"; + + case 7: + return "July"; + + case 8: + return "August"; + + case 9: + return "September"; + + case 10: + return "October"; + + case 11: + return "November"; + + case 12: + return "December"; + + + default: + return "January"; + } + + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/core/utils/NumberUtil.java b/posterita/posterita/src/main/org/posterita/core/utils/NumberUtil.java new file mode 100644 index 0000000000..09ba0c91ee --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/utils/NumberUtil.java @@ -0,0 +1,20 @@ +package org.posterita.core.utils; + +public class NumberUtil +{ + public static boolean isSquareNumber(int x) + { + return isSquareNumber((double)x); + } + + public static boolean isSquareNumber(double x) + { + double num = Math.sqrt(x); + int iNum = (int)num; + + if((double)iNum == num) + return true; + else + return false; + } +} diff --git a/posterita/posterita/src/main/org/posterita/core/utils/SimpleEmailLayout.java b/posterita/posterita/src/main/org/posterita/core/utils/SimpleEmailLayout.java new file mode 100644 index 0000000000..ba81d180e0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/core/utils/SimpleEmailLayout.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2004 Kaizensoft Ltd. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Kaizensoft Ltd. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Kaizensoft. + * + * KAIZENSOFT MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. KAIZENSOFT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Created on Nov 22, 2004 + */ + +package org.posterita.core.utils; + + +public class SimpleEmailLayout +{ + + public static final String header = + + "" + + "" + + "Email" + + ""+ + + "" + + "" + + "" + + "" + + "" + + + "" + + "" + + ""; + + public static final String contentSection = + + "" + + "" + + "" + + + "" + + "" + + "" + + + "" + + "" + + "" + + + "" + + "" + + "" + + "
    " + + "" + + "\"Tamak" + + "" + + + ""; + + + public static final String closeHeaderTitle = + "" + + "
    " + + " " + + "
    " + + "" + + "" + + "" + + "" + + "
    " + + ""; + + public static final String separator = closeHeaderTitle + contentSection; + + public static final String openTagTR = ""; + public static final String closeTagTR = ""; + public static final String openTagTD = ""; + + public static final String openTagFontWhite = ""; + public static final String closeTagFont = ""; + public static final String openTagFont = ""; + + + + public static final String openTagTR_TD = + openTagTR + + openTagTD + + "" ; + + public static final String closeTagTD_TR = + "" + + closeTagTD + + closeTagTR; + + public static final String space = + "" + + "" + + ""; + + public static final String closeAndStartTagTR_TD = closeTagTD_TR + openTagTR_TD; + + public static final String closeTagTR_space_StartTagTR = closeTagTD_TR + space + openTagTR_TD; + + + public static final String footer(String str) + { + + String footer = "
    "; + public static final String closeTagTD = "
    " + + " " + + "
    " + + "
    " + + "
    " + + "" + str + "" + + "
    " + + "" + + "Tamak.com" + + "" + + "
    " + + "" + + ""; + + return footer; + } + + public static final String openInnerTable() + { + String startInnerTable = openTagTR_TD + ""; + + return startInnerTable; + } + + + public static final String closeInnerTable() + { + String closeInnerTable = "
    " + closeTagTD_TR; + + return closeInnerTable; + } + + public static final String innerTableHeader(String[] args) + { + StringBuffer strBuffer = new StringBuffer(); + + strBuffer.append(""); + + + for (int i = 0; i < args.length; i++) + { + String field = args[i]; + + strBuffer.append( + SimpleEmailLayout.openTagTD + + SimpleEmailLayout.openTagFontWhite + field + SimpleEmailLayout.closeTagFont + + SimpleEmailLayout.closeTagTD); + } + + + strBuffer.append(SimpleEmailLayout.closeTagTR); + + return strBuffer.toString(); + } + + public static final String innerTableRow(String[] args) + { + StringBuffer strBuffer = new StringBuffer(); + + strBuffer.append(""); + + for (int i = 0; i < args.length; i++) + { + String field = args[i]; + + strBuffer.append( + SimpleEmailLayout.openTagTD + + SimpleEmailLayout.openTagFont + field + SimpleEmailLayout.closeTagFont + + SimpleEmailLayout.closeTagTD); + } + + strBuffer.append(SimpleEmailLayout.closeTagTR); + + return strBuffer.toString(); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/decorator/HistoryCsvExportWrapper.java b/posterita/posterita/src/main/org/posterita/decorator/HistoryCsvExportWrapper.java new file mode 100644 index 0000000000..10842f2281 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/decorator/HistoryCsvExportWrapper.java @@ -0,0 +1,33 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.posterita.decorator; + +import org.posterita.beans.POSHistoryBean; + +public class HistoryCsvExportWrapper extends HistoryWrapper +{ + public String getLinkPartnerName() + { + POSHistoryBean bean = (POSHistoryBean) this.getCurrentRowObject(); + + return bean.getPartnerName(); + } +} diff --git a/posterita/posterita/src/main/org/posterita/decorator/HistoryPdfExportWrapper.java b/posterita/posterita/src/main/org/posterita/decorator/HistoryPdfExportWrapper.java new file mode 100644 index 0000000000..39a78e9ef6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/decorator/HistoryPdfExportWrapper.java @@ -0,0 +1,25 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.decorator; + +public class HistoryPdfExportWrapper extends HistoryCsvExportWrapper +{ + +} diff --git a/posterita/posterita/src/main/org/posterita/decorator/HistoryRtfExportWrapper.java b/posterita/posterita/src/main/org/posterita/decorator/HistoryRtfExportWrapper.java new file mode 100644 index 0000000000..7024bea6ad --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/decorator/HistoryRtfExportWrapper.java @@ -0,0 +1,25 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.decorator; + +public class HistoryRtfExportWrapper extends HistoryWrapper +{ + +} diff --git a/posterita/posterita/src/main/org/posterita/decorator/HistoryWrapper.java b/posterita/posterita/src/main/org/posterita/decorator/HistoryWrapper.java new file mode 100644 index 0000000000..9656ac8d39 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/decorator/HistoryWrapper.java @@ -0,0 +1,151 @@ +package org.posterita.decorator; + +import javax.servlet.http.HttpServletRequest; + +import org.compiere.model.MOrder; +import org.compiere.process.DocAction; +import org.compiere.util.Env; +import org.displaytag.decorator.TableDecorator; +import org.posterita.Constants; +import org.posterita.beans.InventoryBean; +import org.posterita.beans.POSHistoryBean; +import org.posterita.businesslogic.POSManager; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; +import org.posterita.lib.UdiConstants; + +public class HistoryWrapper extends TableDecorator +{ + + public String getLinkPartnerName() + { + POSHistoryBean bean = (POSHistoryBean) this.getCurrentRowObject(); + + String url = "POSCustomerAction.do?action=viewPOSCustomer&bpartnerId=" + bean.getBpartnerId(); + + if ("No".equals(bean.getIsCustomer())) + url = "POSVendorAction.do?action=viewVendorDetails1&bpartnerId=" + bean.getBpartnerId(); + + + String urlLink = "" + bean.getPartnerName() + ""; + + return urlLink; + } + + public String getReprint() + { + POSHistoryBean bean = (POSHistoryBean) this.getCurrentRowObject(); + + HttpServletRequest req = (HttpServletRequest) this.getPageContext().getRequest(); + + String printing = POSManager.getDataFromCookie(req, "preference.printing"); + ElementBean msgBean = ElementManager.getMsg(Env.getCtx(), "reprint"); + + String link = "" + + msgBean.getName() + + ""; + + if (printing != null && !printing.equals("")) + { + if ("true".equals(printing)) + { + link = "" + + msgBean.getName() + + ""; + } + } + + return link; + } + + public String getPaymentRule() + { + POSHistoryBean bean = (POSHistoryBean) this.getCurrentRowObject(); + + String paymentRule = bean.getPaymentRule(); + String paymentRuleMsg = ""; + + if (MOrder.PAYMENTRULE_Cash.equals(paymentRule)) + { + paymentRuleMsg = Constants.PAYMENT_RULE_CASH_MSG; + } + else if (MOrder.PAYMENTRULE_CreditCard.equals(paymentRule)) + { + paymentRuleMsg = Constants.PAYMENT_RULE_CARD_MSG; + } + else if (MOrder.PAYMENTRULE_Check.equals(paymentRule)) + { + paymentRuleMsg = Constants.PAYMENT_RULE_CHEQUE_MSG; + } + else if (UdiConstants.PAYMENTRULE_MIXED.equals(paymentRule)) + { + paymentRuleMsg = Constants.PAYMENT_RULE_MIXED_MSG; + } + else if (MOrder.PAYMENTRULE_OnCredit.equals(paymentRule)) + { + paymentRuleMsg = Constants.PAYMENT_RULE_CREDIT_MSG; + } + + ElementBean msgBean = ElementManager.getMsg(Env.getCtx(), paymentRuleMsg); + + return msgBean.getName(); + } + + public String getDocStatus() + { + POSHistoryBean bean = (POSHistoryBean) this.getCurrentRowObject(); + + String docStatus = bean.getDocStatus(); + String docStatusMsg = ""; + + if (DocAction.STATUS_Drafted.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_DRAFTED; + else + if (DocAction.STATUS_InProgress.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_INPROGRESS; + else + if (DocAction.STATUS_Completed.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_COMPLETED; + else + if (DocAction.STATUS_Closed.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_CLOSED; + else + if (DocAction.STATUS_Invalid.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_INVALID; + + ElementBean msgBean = ElementManager.getMsg(Env.getCtx(), docStatusMsg); + return msgBean.getName(); + } + + + public String getDelete() + { + InventoryBean bean = (InventoryBean) this.getCurrentRowObject(); + + String docStatus = bean.getDocStatus(); + + String link = ""; + + if (!DocAction.STATUS_Completed.equals(docStatus)) + { + link = "" + + "Delete" + + ""; + + } + return link; + } + + + public String getInventoryNo() + { + InventoryBean bean = (InventoryBean) this.getCurrentRowObject(); + + String link = "" + + bean.getInventoryNo() + + ""; + + return link; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/decorator/InventoryHistoryWrapper.java b/posterita/posterita/src/main/org/posterita/decorator/InventoryHistoryWrapper.java new file mode 100644 index 0000000000..4fc0856a2f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/decorator/InventoryHistoryWrapper.java @@ -0,0 +1,88 @@ +package org.posterita.decorator; + +import org.compiere.process.DocAction; +import org.compiere.util.Env; +import org.displaytag.decorator.TableDecorator; +import org.posterita.Constants; +import org.posterita.beans.InventoryBean; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; + +public class InventoryHistoryWrapper extends TableDecorator +{ + public String getDocStatus() + { + InventoryBean bean = (InventoryBean) this.getCurrentRowObject(); + + String docStatus = bean.getDocStatus(); + String docStatusMsg = ""; + + if (DocAction.STATUS_Drafted.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_DRAFTED; + else + if (DocAction.STATUS_InProgress.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_INPROGRESS; + else + if (DocAction.STATUS_Completed.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_COMPLETED; + else + if (DocAction.STATUS_Closed.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_CLOSED; + else + if (DocAction.STATUS_Invalid.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_INVALID; + else + if (DocAction.STATUS_Voided.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_VOID; + + ElementBean msgBean = ElementManager.getMsg(Env.getCtx(), docStatusMsg); + return msgBean.getName(); + } + + + public String getDelete() + { + InventoryBean bean = (InventoryBean) this.getCurrentRowObject(); + + String docStatus = bean.getDocStatus(); + + String link = ""; + + if (!DocAction.STATUS_Completed.equals(docStatus) && !DocAction.STATUS_Closed.equals(docStatus)) + { + link = "" + + "Delete" + + ""; + + } + return link; + } + + public String getSelect() + { + InventoryBean bean = (InventoryBean) this.getCurrentRowObject(); + + String docStatus = bean.getDocStatus(); + + String link = ""; + + if (DocAction.STATUS_Drafted.equals(docStatus)) + { + link = ""; + + } + return link; + } + + + public String getInventoryNo() + { + InventoryBean bean = (InventoryBean) this.getCurrentRowObject(); + + String link = "" + + bean.getInventoryNo() + + ""; + + return link; + } +} diff --git a/posterita/posterita/src/main/org/posterita/decorator/InventoryMoveHistoryWrapper.java b/posterita/posterita/src/main/org/posterita/decorator/InventoryMoveHistoryWrapper.java new file mode 100644 index 0000000000..6b9b3357da --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/decorator/InventoryMoveHistoryWrapper.java @@ -0,0 +1,88 @@ +package org.posterita.decorator; + +import org.compiere.process.DocAction; +import org.compiere.util.Env; +import org.displaytag.decorator.TableDecorator; +import org.posterita.Constants; +import org.posterita.beans.StockMovementBean; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; + +public class InventoryMoveHistoryWrapper extends TableDecorator +{ + public String getDocStatus() + { + StockMovementBean bean = (StockMovementBean) this.getCurrentRowObject(); + + String docStatus = bean.getDocStatus(); + String docStatusMsg = ""; + + if (DocAction.STATUS_Drafted.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_DRAFTED; + else + if (DocAction.STATUS_InProgress.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_INPROGRESS; + else + if (DocAction.STATUS_Completed.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_COMPLETED; + else + if (DocAction.STATUS_Closed.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_CLOSED; + else + if (DocAction.STATUS_Invalid.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_INVALID; + else + if (DocAction.STATUS_Voided.equals(docStatus)) + docStatusMsg = Constants.DOC_STATUS_VOID; + + ElementBean msgBean = ElementManager.getMsg(Env.getCtx(), docStatusMsg); + return msgBean.getName(); + } + + public String getDelete() + { + StockMovementBean bean = (StockMovementBean) this.getCurrentRowObject(); + + String docStatus = bean.getDocStatus(); + + String link = ""; + + if (!DocAction.STATUS_Completed.equals(docStatus) && !DocAction.STATUS_Closed.equals(docStatus)) + { + link = "" + + "Delete" + + ""; + + } + return link; + } + + public String getEdit() + { + StockMovementBean bean = (StockMovementBean) this.getCurrentRowObject(); + + String docStatus = bean.getDocStatus(); + + String link = ""; + + if (!DocAction.STATUS_Completed.equals(docStatus)) + { + link = "" + + "Edit" + + ""; + + } + return link; + } + + public String getDocumentNo() + { + StockMovementBean bean = (StockMovementBean) this.getCurrentRowObject(); + + String link = "" + + bean.getDocumentNo() + + ""; + + return link; + } +} diff --git a/posterita/posterita/src/main/org/posterita/decorator/PaymentDecorator.java b/posterita/posterita/src/main/org/posterita/decorator/PaymentDecorator.java new file mode 100644 index 0000000000..44cb9b40ca --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/decorator/PaymentDecorator.java @@ -0,0 +1,50 @@ +package org.posterita.decorator; + +import javax.servlet.jsp.PageContext; + +import org.compiere.model.MOrder; +import org.compiere.util.Env; +import org.displaytag.decorator.DisplaytagColumnDecorator; +import org.displaytag.exception.DecoratorException; +import org.displaytag.properties.MediaTypeEnum; +import org.posterita.Constants; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; +import org.posterita.lib.UdiConstants; + +public class PaymentDecorator implements DisplaytagColumnDecorator +{ + + public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException + { + String paymentRule = (String) columnValue; + + ElementBean bean = ElementManager.getMsg(Env.getCtx(), getPaymentRuleDisplayMessage(paymentRule)); + + return bean.getName(); + } + + + public static String getPaymentRuleDisplayMessage(String paymentRule) + { + if (MOrder.PAYMENTRULE_Cash.equals(paymentRule)) + return Constants.PAYMENT_RULE_CASH_MSG; + else + if (MOrder.PAYMENTRULE_CreditCard.equals(paymentRule)) + return Constants.PAYMENT_RULE_CARD_MSG; + else + if (MOrder.PAYMENTRULE_Check.equals(paymentRule)) + return Constants.PAYMENT_RULE_CHEQUE_MSG; + else + if (UdiConstants.PAYMENTRULE_MIXED.equals(paymentRule)) + return Constants.PAYMENT_RULE_MIXED_MSG; + else + if (MOrder.PAYMENTRULE_OnCredit.equals(paymentRule)) + return Constants.PAYMENT_RULE_CREDIT_MSG; + + return ""; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/doctype/UDIDocSubTypeSO.java b/posterita/posterita/src/main/org/posterita/doctype/UDIDocSubTypeSO.java new file mode 100644 index 0000000000..33535a4a90 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/doctype/UDIDocSubTypeSO.java @@ -0,0 +1,26 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ +package org.posterita.doctype; + +public interface UDIDocSubTypeSO +{ + public String getDocTypeSubSO(); +} diff --git a/posterita/posterita/src/main/org/posterita/doctype/UDIDocSubTypeSOValues.java b/posterita/posterita/src/main/org/posterita/doctype/UDIDocSubTypeSOValues.java new file mode 100644 index 0000000000..fe3427774b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/doctype/UDIDocSubTypeSOValues.java @@ -0,0 +1,123 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ + +package org.posterita.doctype; + +import org.compiere.model.MDocType; + +public class UDIDocSubTypeSOValues +{ + private UDIDocSubTypeSOValues() + { + + } + + + public static UDIDocSubTypeSO DOCTYPESO_OnCreditOrder = new OnCreditOrder(); + public static UDIDocSubTypeSO DOCTYPESO_POSOrder = new POSOrder(); + public static UDIDocSubTypeSO DOCTYPESO_PrepayOrder = new PrepayOrder(); + public static UDIDocSubTypeSO DOCTYPESO_Proposal = new Proposal(); + public static final UDIDocSubTypeSO DOCTYPESO_Quotation = new Quotation(); + public static UDIDocSubTypeSO DOCTYPESO_ReturnMaterial = new ReturnMaterial(); + public static UDIDocSubTypeSO DOCTYPESO_StandardOrder = new StandardOrder(); + public static UDIDocSubTypeSO DOCTYPESO_WarehouseOrder = new WarehouseOrder(); + + public static class OnCreditOrder implements UDIDocSubTypeSO + { + + public String getDocTypeSubSO() + { + return MDocType.DOCSUBTYPESO_OnCreditOrder; + } + + } + + public static class POSOrder implements UDIDocSubTypeSO + { + + public String getDocTypeSubSO() + { + return MDocType.DOCSUBTYPESO_POSOrder; + } + + } + + public static class PrepayOrder implements UDIDocSubTypeSO + { + + public String getDocTypeSubSO() + { + return MDocType.DOCSUBTYPESO_PrepayOrder; + } + + } + + public static class Proposal implements UDIDocSubTypeSO + { + + public String getDocTypeSubSO() + { + return MDocType.DOCSUBTYPESO_Proposal; + } + + } + + public static class Quotation implements UDIDocSubTypeSO + { + + public String getDocTypeSubSO() + { + return MDocType.DOCSUBTYPESO_Quotation; + } + + } + + public static class ReturnMaterial implements UDIDocSubTypeSO + { + + public String getDocTypeSubSO() + { + return MDocType.DOCSUBTYPESO_ReturnMaterial; + } + + } + + public static class StandardOrder implements UDIDocSubTypeSO + { + + public String getDocTypeSubSO() + { + return MDocType.DOCSUBTYPESO_StandardOrder; + } + + } + + public static class WarehouseOrder implements UDIDocSubTypeSO + { + + public String getDocTypeSubSO() + { + return MDocType.DOCSUBTYPESO_WarehouseOrder; + } + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/AllocatedAmtMoreThanOpenAmtException.java b/posterita/posterita/src/main/org/posterita/exceptions/AllocatedAmtMoreThanOpenAmtException.java new file mode 100644 index 0000000000..3e96d1da3c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/AllocatedAmtMoreThanOpenAmtException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ + + +package org.posterita.exceptions; + + +public class AllocatedAmtMoreThanOpenAmtException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public AllocatedAmtMoreThanOpenAmtException(String message) + { + super(message); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/AllocationAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/AllocationAlreadyExistsException.java new file mode 100644 index 0000000000..e87c04d3bc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/AllocationAlreadyExistsException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.exceptions; + + +public class AllocationAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public AllocationAlreadyExistsException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ApplicationException.java b/posterita/posterita/src/main/org/posterita/exceptions/ApplicationException.java new file mode 100644 index 0000000000..1dc5f8b2b4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ApplicationException.java @@ -0,0 +1,49 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.exceptions; + + + +/** + * @author fred + * + *To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class ApplicationException extends Exception +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ApplicationException() + { + super(); + } + + public ApplicationException(String message) + { + super(message); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/AttachmentInvalidException.java b/posterita/posterita/src/main/org/posterita/exceptions/AttachmentInvalidException.java new file mode 100644 index 0000000000..b4094edd1d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/AttachmentInvalidException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Mar 29, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +import org.posterita.exceptions.DataException; + +public class AttachmentInvalidException extends DataException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public AttachmentInvalidException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/AttachmentNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/AttachmentNotFoundException.java new file mode 100644 index 0000000000..cb0be51656 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/AttachmentNotFoundException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 8, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class AttachmentNotFoundException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public AttachmentNotFoundException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/AttributeValueAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/AttributeValueAlreadyExistsException.java new file mode 100644 index 0000000000..aa2c77d09b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/AttributeValueAlreadyExistsException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 3, 2005 by praveen + * + */ +package org.posterita.exceptions; + +public class AttributeValueAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public AttributeValueAlreadyExistsException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/AttributeValuesDifferentException.java b/posterita/posterita/src/main/org/posterita/exceptions/AttributeValuesDifferentException.java new file mode 100644 index 0000000000..af6766413b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/AttributeValuesDifferentException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 17, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class AttributeValuesDifferentException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public AttributeValuesDifferentException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BPGroupException.java b/posterita/posterita/src/main/org/posterita/exceptions/BPGroupException.java new file mode 100644 index 0000000000..bd2d39c825 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BPGroupException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Apr 5, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class BPGroupException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BPGroupException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BPartnerAlreadyExistException.java b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerAlreadyExistException.java new file mode 100644 index 0000000000..86ce0792ab --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerAlreadyExistException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Apr 5, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + + +public class BPartnerAlreadyExistException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BPartnerAlreadyExistException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BPartnerAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerAlreadyExistsException.java new file mode 100644 index 0000000000..e0dd70a7d0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerAlreadyExistsException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 01-Aug-2005 by alok + * + */ +package org.posterita.exceptions; + + +public class BPartnerAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BPartnerAlreadyExistsException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BPartnerException.java b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerException.java new file mode 100644 index 0000000000..09c29d6db5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Apr 17, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class BPartnerException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public BPartnerException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BPartnerInvalidException.java b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerInvalidException.java new file mode 100644 index 0000000000..991cc13d2b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerInvalidException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Mar 29, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +import org.posterita.exceptions.DataException; + +public class BPartnerInvalidException extends DataException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BPartnerInvalidException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BPartnerNoLocationException.java b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerNoLocationException.java new file mode 100644 index 0000000000..20256de4e2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerNoLocationException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Nov 8, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class BPartnerNoLocationException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public BPartnerNoLocationException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BPartnerNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerNotFoundException.java new file mode 100644 index 0000000000..92b717a4dc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerNotFoundException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Apr 17, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + + +public class BPartnerNotFoundException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BPartnerNotFoundException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BPartnerOverCreditLimitException.java b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerOverCreditLimitException.java new file mode 100644 index 0000000000..81f484d04b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BPartnerOverCreditLimitException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 1, 2006 + */ + + +package org.posterita.exceptions; + + +public class BPartnerOverCreditLimitException extends OperationException +{ + + private static final long serialVersionUID = 1L; + + public BPartnerOverCreditLimitException(String exception) + { + super(exception); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BankAlreadyExistException.java b/posterita/posterita/src/main/org/posterita/exceptions/BankAlreadyExistException.java new file mode 100644 index 0000000000..0d16eb05f6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BankAlreadyExistException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 01-Aug-2005 by alok + * + */ +package org.posterita.exceptions; + + +public class BankAlreadyExistException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public BankAlreadyExistException(String exception) + { + super(exception); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BarcodeAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/BarcodeAlreadyExistsException.java new file mode 100644 index 0000000000..afb50bc2f1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BarcodeAlreadyExistsException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 10, 2006 + */ + + +package org.posterita.exceptions; + + +public class BarcodeAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BarcodeAlreadyExistsException(String exception) + { + super(exception); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/BirtEngineException.java b/posterita/posterita/src/main/org/posterita/exceptions/BirtEngineException.java new file mode 100644 index 0000000000..0072b40462 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/BirtEngineException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 17-Aug-2005 by Fred + **/ +package org.posterita.exceptions; + +import org.posterita.exceptions.ApplicationException; + + +public class BirtEngineException extends ApplicationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BirtEngineException(String message) + { + super(message); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CSVDataInvalidException.java b/posterita/posterita/src/main/org/posterita/exceptions/CSVDataInvalidException.java new file mode 100644 index 0000000000..d19aa75d5d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CSVDataInvalidException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Nov 26, 2005 by ashley +* +*/ + +package org.posterita.exceptions; + + +public class CSVDataInvalidException extends DataException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CSVDataInvalidException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CSVFileException.java b/posterita/posterita/src/main/org/posterita/exceptions/CSVFileException.java new file mode 100644 index 0000000000..e5366a71aa --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CSVFileException.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 14-Sep-2005 + */ + + +package org.posterita.exceptions; + + +public class CSVFileException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public CSVFileException(String exception) + { + super(exception); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CanNotAjdustTillException.java b/posterita/posterita/src/main/org/posterita/exceptions/CanNotAjdustTillException.java new file mode 100644 index 0000000000..e3d79424e0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CanNotAjdustTillException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 10, 2006 + */ + + +package org.posterita.exceptions; + + +public class CanNotAjdustTillException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CanNotAjdustTillException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CanNotCloseTillException.java b/posterita/posterita/src/main/org/posterita/exceptions/CanNotCloseTillException.java new file mode 100644 index 0000000000..066f699b8a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CanNotCloseTillException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 3, 2006 + */ + + +package org.posterita.exceptions; + + +public class CanNotCloseTillException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public CanNotCloseTillException(String xception) + { + super(xception); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CanNotCreatePaymentAllocationException.java b/posterita/posterita/src/main/org/posterita/exceptions/CanNotCreatePaymentAllocationException.java new file mode 100644 index 0000000000..294ec79bce --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CanNotCreatePaymentAllocationException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 8, 2006 + */ + + +package org.posterita.exceptions; + + +public class CanNotCreatePaymentAllocationException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CanNotCreatePaymentAllocationException(String message) + { + super(message); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CanNotDeleteOrderException.java b/posterita/posterita/src/main/org/posterita/exceptions/CanNotDeleteOrderException.java new file mode 100644 index 0000000000..dfd6a383aa --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CanNotDeleteOrderException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 20-Feb-2006 + */ + + +package org.posterita.exceptions; + + +public class CanNotDeleteOrderException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CanNotDeleteOrderException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CanNotMoveStockException.java b/posterita/posterita/src/main/org/posterita/exceptions/CanNotMoveStockException.java new file mode 100644 index 0000000000..7adc000681 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CanNotMoveStockException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 08-Feb-2006 + */ + + +package org.posterita.exceptions; + + +public class CanNotMoveStockException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CanNotMoveStockException(String exception) + { + super(exception); + } +} + diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CannotCreateInventoryLineException.java b/posterita/posterita/src/main/org/posterita/exceptions/CannotCreateInventoryLineException.java new file mode 100644 index 0000000000..b959509a3e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CannotCreateInventoryLineException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jan 22, 2007 + */ + + +package org.posterita.exceptions; + + + +public class CannotCreateInventoryLineException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CannotCreateInventoryLineException(String exception) + { + super(exception); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CannotDeactivatePaymentTermException.java b/posterita/posterita/src/main/org/posterita/exceptions/CannotDeactivatePaymentTermException.java new file mode 100644 index 0000000000..10399d89c4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CannotDeactivatePaymentTermException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jan 26, 2007 + */ + + +package org.posterita.exceptions; + + + +public class CannotDeactivatePaymentTermException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CannotDeactivatePaymentTermException(String msg) + { + super(msg); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CannotInactivateProductException.java b/posterita/posterita/src/main/org/posterita/exceptions/CannotInactivateProductException.java new file mode 100644 index 0000000000..80c4df0527 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CannotInactivateProductException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 17, 2006 + */ + + +package org.posterita.exceptions; + + +public class CannotInactivateProductException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CannotInactivateProductException(String exception) + { + super(exception); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CannotInactivateTaxException.java b/posterita/posterita/src/main/org/posterita/exceptions/CannotInactivateTaxException.java new file mode 100644 index 0000000000..381fed3b50 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CannotInactivateTaxException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + + +package org.posterita.exceptions; + + +public class CannotInactivateTaxException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CannotInactivateTaxException(String exception) + { + super(exception); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CashBookAlreadyAssignedException.java b/posterita/posterita/src/main/org/posterita/exceptions/CashBookAlreadyAssignedException.java new file mode 100644 index 0000000000..ea815f940f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CashBookAlreadyAssignedException.java @@ -0,0 +1,32 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.exceptions; + +/** + * @author ashley + * Jun 4, 2008 + */ +public class CashBookAlreadyAssignedException extends OperationException +{ + public CashBookAlreadyAssignedException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ClientAlreadyExistException.java b/posterita/posterita/src/main/org/posterita/exceptions/ClientAlreadyExistException.java new file mode 100644 index 0000000000..191d507790 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ClientAlreadyExistException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 30, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class ClientAlreadyExistException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public ClientAlreadyExistException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CloseStatusNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/CloseStatusNotFoundException.java new file mode 100644 index 0000000000..a1cf09a8d1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CloseStatusNotFoundException.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class CloseStatusNotFoundException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CloseStatusNotFoundException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CreditCardExpiryInvalidException.java b/posterita/posterita/src/main/org/posterita/exceptions/CreditCardExpiryInvalidException.java new file mode 100644 index 0000000000..26419f6c43 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CreditCardExpiryInvalidException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +**/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class CreditCardExpiryInvalidException extends DataException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreditCardExpiryInvalidException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CreditCardNumberException.java b/posterita/posterita/src/main/org/posterita/exceptions/CreditCardNumberException.java new file mode 100644 index 0000000000..db30b15611 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CreditCardNumberException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * +**/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class CreditCardNumberException extends DataException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreditCardNumberException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CreditCardTypeNotSupportedException.java b/posterita/posterita/src/main/org/posterita/exceptions/CreditCardTypeNotSupportedException.java new file mode 100644 index 0000000000..3605a2a8f7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CreditCardTypeNotSupportedException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class CreditCardTypeNotSupportedException extends DataException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreditCardTypeNotSupportedException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CreditCardVVInvalidException.java b/posterita/posterita/src/main/org/posterita/exceptions/CreditCardVVInvalidException.java new file mode 100644 index 0000000000..3a5e5e31ec --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CreditCardVVInvalidException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class CreditCardVVInvalidException extends DataException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreditCardVVInvalidException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/CustomerNotImportedException.java b/posterita/posterita/src/main/org/posterita/exceptions/CustomerNotImportedException.java new file mode 100644 index 0000000000..722470e5f1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/CustomerNotImportedException.java @@ -0,0 +1,24 @@ +package org.posterita.exceptions; + +public class CustomerNotImportedException extends OperationException +{ + public CustomerNotImportedException() + { + super(); + } + + public CustomerNotImportedException(Exception exception) + { + super(exception); + } + + public CustomerNotImportedException(String msg, Exception exception) + { + super(msg, exception); + } + + public CustomerNotImportedException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DataException.java b/posterita/posterita/src/main/org/posterita/exceptions/DataException.java new file mode 100644 index 0000000000..26a1452c55 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DataException.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.exceptions; + + +public class DataException extends ApplicationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public DataException(String msg) + { + super(msg); + } + + public DataException(String message, Exception ex) + { + super(message); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DefaultStoreException.java b/posterita/posterita/src/main/org/posterita/exceptions/DefaultStoreException.java new file mode 100644 index 0000000000..1bd20369f2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DefaultStoreException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 12, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class DefaultStoreException extends ApplicationException +{ + private static final long serialVersionUID = 1L; + + public DefaultStoreException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DeleteAttachmentException.java b/posterita/posterita/src/main/org/posterita/exceptions/DeleteAttachmentException.java new file mode 100644 index 0000000000..1ec70942f5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DeleteAttachmentException.java @@ -0,0 +1,31 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.exceptions; + +public class DeleteAttachmentException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public DeleteAttachmentException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DescriptionNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/DescriptionNotFoundException.java new file mode 100644 index 0000000000..b20d468b97 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DescriptionNotFoundException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 23, 2005 by praveen + * + */ +package org.posterita.exceptions; + +public class DescriptionNotFoundException extends Exception +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public DescriptionNotFoundException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DiscountLimitException.java b/posterita/posterita/src/main/org/posterita/exceptions/DiscountLimitException.java new file mode 100644 index 0000000000..74834a22e5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DiscountLimitException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 19-Oct-2006 11:16:04 by praveen + * + */ + +package org.posterita.exceptions; + +public class DiscountLimitException extends Exception { + + private static final long serialVersionUID = 1L; + + public DiscountLimitException(String msg) + { + super(msg); + } + + public DiscountLimitException(Exception exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DocumentDoesNotBelongToYouException.java b/posterita/posterita/src/main/org/posterita/exceptions/DocumentDoesNotBelongToYouException.java new file mode 100644 index 0000000000..37cbbf0335 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DocumentDoesNotBelongToYouException.java @@ -0,0 +1,14 @@ +package org.posterita.exceptions; + +public class DocumentDoesNotBelongToYouException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public DocumentDoesNotBelongToYouException(String message) + { + super(message); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DuplicatePINException.java b/posterita/posterita/src/main/org/posterita/exceptions/DuplicatePINException.java new file mode 100644 index 0000000000..bb82f3291d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DuplicatePINException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 25, 2006 + */ + + +package org.posterita.exceptions; + + +public class DuplicatePINException extends OperationException +{ + + private static final long serialVersionUID = 1L; + + public DuplicatePINException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DuplicateRoleException.java b/posterita/posterita/src/main/org/posterita/exceptions/DuplicateRoleException.java new file mode 100644 index 0000000000..35170d7ed7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DuplicateRoleException.java @@ -0,0 +1,15 @@ +package org.posterita.exceptions; + +public class DuplicateRoleException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public DuplicateRoleException(String ex) + { + super(ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DuplicateUOMException.java b/posterita/posterita/src/main/org/posterita/exceptions/DuplicateUOMException.java new file mode 100644 index 0000000000..eca882dcd0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DuplicateUOMException.java @@ -0,0 +1,16 @@ +package org.posterita.exceptions; + +public class DuplicateUOMException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public DuplicateUOMException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/DuplicateUserPinException.java b/posterita/posterita/src/main/org/posterita/exceptions/DuplicateUserPinException.java new file mode 100644 index 0000000000..e6e32f4e4f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/DuplicateUserPinException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 6, 2006 + */ + + +package org.posterita.exceptions; + + +public class DuplicateUserPinException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public DuplicateUserPinException(String msg) + { + super(msg); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EMailInvalidException.java b/posterita/posterita/src/main/org/posterita/exceptions/EMailInvalidException.java new file mode 100644 index 0000000000..2fd8cbcca6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EMailInvalidException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Jan 17, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class EMailInvalidException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public EMailInvalidException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EMailMessageException.java b/posterita/posterita/src/main/org/posterita/exceptions/EMailMessageException.java new file mode 100644 index 0000000000..3b33350901 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EMailMessageException.java @@ -0,0 +1,47 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on Jun 1, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class EMailMessageException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public EMailMessageException(String msg) + { + super(msg); + } + + public EMailMessageException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EMailMessageParsingException.java b/posterita/posterita/src/main/org/posterita/exceptions/EMailMessageParsingException.java new file mode 100644 index 0000000000..145702c829 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EMailMessageParsingException.java @@ -0,0 +1,47 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on Jun 5, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class EMailMessageParsingException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public EMailMessageParsingException(String msg) + { + super(msg); + } + + public EMailMessageParsingException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EMailNotSentException.java b/posterita/posterita/src/main/org/posterita/exceptions/EMailNotSentException.java new file mode 100644 index 0000000000..5007734756 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EMailNotSentException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Jan 17, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class EMailNotSentException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public EMailNotSentException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EMailServerConnectionException.java b/posterita/posterita/src/main/org/posterita/exceptions/EMailServerConnectionException.java new file mode 100644 index 0000000000..62d44ea5d7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EMailServerConnectionException.java @@ -0,0 +1,46 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on May 31, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class EMailServerConnectionException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public EMailServerConnectionException(String msg) + { + super(msg); + } + + public EMailServerConnectionException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EMailServerLoginException.java b/posterita/posterita/src/main/org/posterita/exceptions/EMailServerLoginException.java new file mode 100644 index 0000000000..ae6fb0199b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EMailServerLoginException.java @@ -0,0 +1,46 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on May 31, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class EMailServerLoginException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public EMailServerLoginException(String msg) + { + super(msg); + } + + public EMailServerLoginException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EMailServerMessageException.java b/posterita/posterita/src/main/org/posterita/exceptions/EMailServerMessageException.java new file mode 100644 index 0000000000..785b83c98f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EMailServerMessageException.java @@ -0,0 +1,47 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on Jun 1, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class EMailServerMessageException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public EMailServerMessageException(String msg) + { + super(msg); + } + + public EMailServerMessageException(String msg, Exception ex) + { + super(msg, ex); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EmailAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/EmailAlreadyExistsException.java new file mode 100644 index 0000000000..b411cdff59 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EmailAlreadyExistsException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.exceptions; + + +public class EmailAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public EmailAlreadyExistsException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EmailNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/EmailNotFoundException.java new file mode 100644 index 0000000000..3f2cad84a9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EmailNotFoundException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 17-Feb-2005 by fred + * + */ +package org.posterita.exceptions; + + +public class EmailNotFoundException extends ApplicationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EmptyCartException.java b/posterita/posterita/src/main/org/posterita/exceptions/EmptyCartException.java new file mode 100644 index 0000000000..c55a2145e7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EmptyCartException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 8, 2006 + */ + +package org.posterita.exceptions; + +public class EmptyCartException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public EmptyCartException(String string) + { + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/EncryptionException.java b/posterita/posterita/src/main/org/posterita/exceptions/EncryptionException.java new file mode 100644 index 0000000000..1ce7041f31 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/EncryptionException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.exceptions; + +public class EncryptionException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public EncryptionException(String message) + { + super(message); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/FormattingException.java b/posterita/posterita/src/main/org/posterita/exceptions/FormattingException.java new file mode 100644 index 0000000000..28069d0e52 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/FormattingException.java @@ -0,0 +1,85 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ + +package org.posterita.exceptions; + +import org.posterita.formatter.Formatter; + + + +public class FormattingException extends RuntimeException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + private Throwable cause; + private Formatter formatter; + + public FormattingException(String message) + { + super(message); + } + + public FormattingException(String message, Throwable cause) + { + super(message); + + this.cause = cause; + } + + public Formatter getFormatter() + { + return formatter; + } + + public void setFormatter(Formatter formatter) + { + this.formatter = formatter; + } + + public void setCause(Throwable cause) + { + this.cause = cause; + } + + public Throwable getCause() + { + return cause; + } + + public String toString() + { + return super.toString() +(cause == null? "" : "\n Original Cause: \n" + cause.toString()); + } + + public void printStackTrace() + { + super.printStackTrace(); + + if (cause != null) + { + System.out.println("\n Original Cause: \n"); + cause.printStackTrace(); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ImageAttachmentException.java b/posterita/posterita/src/main/org/posterita/exceptions/ImageAttachmentException.java new file mode 100644 index 0000000000..b13eb4e68b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ImageAttachmentException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Mar 29, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class ImageAttachmentException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ImageAttachmentException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ImportFileAlreadyExistException.java b/posterita/posterita/src/main/org/posterita/exceptions/ImportFileAlreadyExistException.java new file mode 100644 index 0000000000..9f26a4e450 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ImportFileAlreadyExistException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Feb 28, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class ImportFileAlreadyExistException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ImportFileAlreadyExistException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ImportFileNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/ImportFileNotFoundException.java new file mode 100644 index 0000000000..a47db3c5b8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ImportFileNotFoundException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Feb 28, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class ImportFileNotFoundException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ImportFileNotFoundException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ImportProductException.java b/posterita/posterita/src/main/org/posterita/exceptions/ImportProductException.java new file mode 100644 index 0000000000..b27fc51f47 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ImportProductException.java @@ -0,0 +1,16 @@ +package org.posterita.exceptions; + +public class ImportProductException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ImportProductException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InputQuantityLessThanZeroException.java b/posterita/posterita/src/main/org/posterita/exceptions/InputQuantityLessThanZeroException.java new file mode 100644 index 0000000000..c0aa3be9a1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InputQuantityLessThanZeroException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.exceptions; + + +public class InputQuantityLessThanZeroException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InputQuantityLessThanZeroException(String exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InsufficientQtyException.java b/posterita/posterita/src/main/org/posterita/exceptions/InsufficientQtyException.java new file mode 100644 index 0000000000..1bfe60930c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InsufficientQtyException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ + + +package org.posterita.exceptions; + + +public class InsufficientQtyException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InsufficientQtyException(String message) + { + super(message); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidAddressException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidAddressException.java new file mode 100644 index 0000000000..b92826841e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidAddressException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 4, 2006 + */ + + +package org.posterita.exceptions; + + +public class InvalidAddressException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidAddressException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidBPartnerException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidBPartnerException.java new file mode 100644 index 0000000000..5265b65930 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidBPartnerException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Apr 5, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class InvalidBPartnerException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidBPartnerException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidBankAccountException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidBankAccountException.java new file mode 100644 index 0000000000..385c001434 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidBankAccountException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 11, 2005 by din + */ + +package org.posterita.exceptions; + +public class InvalidBankAccountException extends ApplicationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidBankAccountException(String message) + { + + super(message); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidBankException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidBankException.java new file mode 100644 index 0000000000..a6d30e4406 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidBankException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 24, 2005 by praveen + * + */ +package org.posterita.exceptions; + +public class InvalidBankException extends ApplicationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidBankException(String message) + { + super(message); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidBarcodeException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidBarcodeException.java new file mode 100644 index 0000000000..2bed731a29 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidBarcodeException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 6, 2006 + */ + + +package org.posterita.exceptions; + + +public class InvalidBarcodeException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + +public InvalidBarcodeException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidConfirmPasswordException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidConfirmPasswordException.java new file mode 100644 index 0000000000..af9be0f748 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidConfirmPasswordException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 6, 2006 + */ + + +package org.posterita.exceptions; + + +public class InvalidConfirmPasswordException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidConfirmPasswordException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidContentTypeException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidContentTypeException.java new file mode 100644 index 0000000000..0c75055d54 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidContentTypeException.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 16, 2006 by praveen + * + */ +package org.posterita.exceptions; + +public class InvalidContentTypeException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidContentTypeException(Exception e) + { + super(e); + } + + public InvalidContentTypeException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidDateTimeException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidDateTimeException.java new file mode 100644 index 0000000000..8f35a5629e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidDateTimeException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class InvalidDateTimeException extends DataException +{ + private static final long serialVersionUID = 1L; + + public InvalidDateTimeException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidEmailException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidEmailException.java new file mode 100644 index 0000000000..ddbb4cd8a2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidEmailException.java @@ -0,0 +1,30 @@ +/* + * Created on 2005/03/11 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.posterita.exceptions; + +/** + * @author jane + * + *To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class InvalidEmailException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public InvalidEmailException(String exception) + { + super(exception); + } + + public InvalidEmailException(String msg, Exception ex) + { + super(msg, ex); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidInvokeOrderStatusException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidInvokeOrderStatusException.java new file mode 100644 index 0000000000..1ef8bc3dd9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidInvokeOrderStatusException.java @@ -0,0 +1,53 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 31-Aug-2006 17:23:19 by praveen + * + */ + +package org.posterita.exceptions; + +public class InvalidInvokeOrderStatusException extends OperationException +{ + private static final long serialVersionUID = 1L; + private String status = null; + + public InvalidInvokeOrderStatusException(String xception,String status) + { + super(xception); + this.status = status; + } + + public InvalidInvokeOrderStatusException(String xception) + { + super(xception); + } + + public InvalidInvokeOrderStatusException(Exception exception) + { + super(exception); + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidMessageStatusException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidMessageStatusException.java new file mode 100644 index 0000000000..1919198ff2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidMessageStatusException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 1, 2005 by din + */ + +package org.posterita.exceptions; + +public class InvalidMessageStatusException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidMessageStatusException(String xception) + { + super(xception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidMonthException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidMonthException.java new file mode 100644 index 0000000000..0a91d6c615 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidMonthException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ +package org.posterita.exceptions; + + +public class InvalidMonthException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidMonthException(String xception) + { + super("Invalid month"); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidNetDaysException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidNetDaysException.java new file mode 100644 index 0000000000..95e129f656 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidNetDaysException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 11, 2006 + */ + + +package org.posterita.exceptions; + + +public class InvalidNetDaysException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + public InvalidNetDaysException(String ex) + { + super(ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrderIDException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrderIDException.java new file mode 100644 index 0000000000..69abe0c5ea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrderIDException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 31-Aug-2006 17:22:39 by praveen + * + */ + +package org.posterita.exceptions; + +public class InvalidOrderIDException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public InvalidOrderIDException(String xception) + { + super(xception); + } + + public InvalidOrderIDException(Exception exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrderTypeException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrderTypeException.java new file mode 100644 index 0000000000..94e8b8f1bf --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrderTypeException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 09-Oct-2006 13:59:43 by praveen + * + */ + +package org.posterita.exceptions; + +public class InvalidOrderTypeException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public InvalidOrderTypeException(){} + + public InvalidOrderTypeException(String message){ + super(message); + } + + public InvalidOrderTypeException(Exception exception){ + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrganisationTypeException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrganisationTypeException.java new file mode 100644 index 0000000000..7ebcaee8de --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidOrganisationTypeException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 14-Sep-2005 by vishee + * + */ + +package org.posterita.exceptions; + +public class InvalidOrganisationTypeException extends ApplicationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidOrganisationTypeException(String message) + { + super(message); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidPINException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidPINException.java new file mode 100644 index 0000000000..4bcd8a0ce1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidPINException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 25, 2006 + */ + + +package org.posterita.exceptions; + + +public class InvalidPINException extends OperationException +{ + + private static final long serialVersionUID = 1L; + + public InvalidPINException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidPasswordLengthException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidPasswordLengthException.java new file mode 100644 index 0000000000..8d5dc91cf5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidPasswordLengthException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 6, 2006 + */ + + +package org.posterita.exceptions; + + +public class InvalidPasswordLengthException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + +public InvalidPasswordLengthException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidPeriodException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidPeriodException.java new file mode 100644 index 0000000000..6b7910f5cf --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidPeriodException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.exceptions; + + +public class InvalidPeriodException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidPeriodException(String xception) + { + super(xception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidProductQuantityException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidProductQuantityException.java new file mode 100644 index 0000000000..69214157a5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidProductQuantityException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.exceptions; + + +public class InvalidProductQuantityException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidProductQuantityException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidRequestUpdateException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidRequestUpdateException.java new file mode 100644 index 0000000000..5eb2466ded --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidRequestUpdateException.java @@ -0,0 +1,46 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on Jun 23, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.DataException; + +public class InvalidRequestUpdateException extends DataException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidRequestUpdateException(String msg) + { + super(msg); + } + + public InvalidRequestUpdateException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidRoleException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidRoleException.java new file mode 100644 index 0000000000..ebddf68dd3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidRoleException.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ +package org.posterita.exceptions; + + +/** + * @author vickram + * + * To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class InvalidRoleException extends ApplicationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidTenderedAmountException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidTenderedAmountException.java new file mode 100644 index 0000000000..94eee71214 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidTenderedAmountException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 4, 2006 + */ + + +package org.posterita.exceptions; + + +public class InvalidTenderedAmountException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidTenderedAmountException(String message) + { + super(message); + } +} + diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidTerminalCashBookException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidTerminalCashBookException.java new file mode 100644 index 0000000000..0ff6bc8f86 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidTerminalCashBookException.java @@ -0,0 +1,32 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.exceptions; + +/** + * @author ashley + * Jun 4, 2008 + */ +public class InvalidTerminalCashBookException extends OperationException +{ + public InvalidTerminalCashBookException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidURLException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidURLException.java new file mode 100644 index 0000000000..9d9cc0e928 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidURLException.java @@ -0,0 +1,42 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on May 31, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.DataException; + +public class InvalidURLException extends DataException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvalidURLException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/InvalidYearException.java b/posterita/posterita/src/main/org/posterita/exceptions/InvalidYearException.java new file mode 100644 index 0000000000..fc7ad9d856 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/InvalidYearException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 9, 2005 by praveen + * + */ +package org.posterita.exceptions; + +public class InvalidYearException extends ApplicationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * + */ + public InvalidYearException(String message) + { + super(message); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/KeywordsRequiredException.java b/posterita/posterita/src/main/org/posterita/exceptions/KeywordsRequiredException.java new file mode 100644 index 0000000000..fe26e2d3aa --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/KeywordsRequiredException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 16, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class KeywordsRequiredException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public KeywordsRequiredException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/LimitPriceViolatedException.java b/posterita/posterita/src/main/org/posterita/exceptions/LimitPriceViolatedException.java new file mode 100644 index 0000000000..e7cd51580c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/LimitPriceViolatedException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jan 9, 2007 + */ + + +package org.posterita.exceptions; + + +public class LimitPriceViolatedException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public LimitPriceViolatedException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/LogoException.java b/posterita/posterita/src/main/org/posterita/exceptions/LogoException.java new file mode 100644 index 0000000000..e170191da5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/LogoException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Sep 22, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class LogoException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public LogoException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/MandatoryException.java b/posterita/posterita/src/main/org/posterita/exceptions/MandatoryException.java new file mode 100644 index 0000000000..6d17b468d2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/MandatoryException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 30, 2006 + */ + + +package org.posterita.exceptions; + + +public class MandatoryException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public MandatoryException(String msg) + { + super(msg); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/MandatoryNameException.java b/posterita/posterita/src/main/org/posterita/exceptions/MandatoryNameException.java new file mode 100644 index 0000000000..a75ef6b107 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/MandatoryNameException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 30, 2006 + */ + + +package org.posterita.exceptions; + + +public class MandatoryNameException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public MandatoryNameException(String msg) + { + super(msg); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoAccessToEditObjectException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoAccessToEditObjectException.java new file mode 100644 index 0000000000..6575dd1ed9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoAccessToEditObjectException.java @@ -0,0 +1,17 @@ +package org.posterita.exceptions; + +public class NoAccessToEditObjectException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public NoAccessToEditObjectException(String msg) + { + super(msg); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoAllocateeInvoiceException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoAllocateeInvoiceException.java new file mode 100644 index 0000000000..0ec57dc200 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoAllocateeInvoiceException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 12, 2006 + */ + + +package org.posterita.exceptions; + + +public class NoAllocateeInvoiceException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public NoAllocateeInvoiceException(String message) + { + super(message); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoCashJournalPresentException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoCashJournalPresentException.java new file mode 100644 index 0000000000..fba12d83aa --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoCashJournalPresentException.java @@ -0,0 +1,32 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.exceptions; + +/** + * @author ashley + * Jun 3, 2008 + */ +public class NoCashJournalPresentException extends OperationException +{ + public NoCashJournalPresentException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoCheckBoxSelectedException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoCheckBoxSelectedException.java new file mode 100644 index 0000000000..965e9104b8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoCheckBoxSelectedException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jan 26, 2007 + */ + + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + + +public class NoCheckBoxSelectedException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public NoCheckBoxSelectedException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoClientFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoClientFoundException.java new file mode 100644 index 0000000000..e9a4889bdd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoClientFoundException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ +package org.posterita.exceptions; + + +public class NoClientFoundException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public NoClientFoundException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoCustomerFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoCustomerFoundException.java new file mode 100644 index 0000000000..84be45a422 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoCustomerFoundException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 14-Dec-2006 13:02:58 by praveen + * + */ + +package org.posterita.exceptions; + +public class NoCustomerFoundException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public NoCustomerFoundException(String xception) + { + super(xception); + } + + public NoCustomerFoundException(Exception xception) + { + super(xception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoLocationFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoLocationFoundException.java new file mode 100644 index 0000000000..7975cb417f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoLocationFoundException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ + +package org.posterita.exceptions; + +public class NoLocationFoundException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public NoLocationFoundException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoOrderLineFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoOrderLineFoundException.java new file mode 100644 index 0000000000..96dafdbd75 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoOrderLineFoundException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 31-Aug-2006 17:21:30 by praveen + * + */ + +package org.posterita.exceptions; + +public class NoOrderLineFoundException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public NoOrderLineFoundException(String xception) + { + super(xception); + } + + public NoOrderLineFoundException(Exception exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoOrderLineSelectedException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoOrderLineSelectedException.java new file mode 100644 index 0000000000..03d172a537 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoOrderLineSelectedException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.exceptions; + + +public class NoOrderLineSelectedException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public NoOrderLineSelectedException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoPaymentAmountException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoPaymentAmountException.java new file mode 100644 index 0000000000..a26e69b9fb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoPaymentAmountException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 22, 2006 + */ + + +package org.posterita.exceptions; + + +public class NoPaymentAmountException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public NoPaymentAmountException(String message) + { + super(message); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoProductImageException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoProductImageException.java new file mode 100644 index 0000000000..9f588d97a6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoProductImageException.java @@ -0,0 +1,11 @@ +package org.posterita.exceptions; + +public class NoProductImageException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public NoProductImageException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoProductSelectedException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoProductSelectedException.java new file mode 100644 index 0000000000..41c65c77d1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoProductSelectedException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 09-Aug-2005 by alok + * + */ +package org.posterita.exceptions; + + +public class NoProductSelectedException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public NoProductSelectedException(String str) + { + super(str); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NoStockAvailableException.java b/posterita/posterita/src/main/org/posterita/exceptions/NoStockAvailableException.java new file mode 100644 index 0000000000..068ee3aa6a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NoStockAvailableException.java @@ -0,0 +1,56 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 26-Sep-2005 + */ + + +package org.posterita.exceptions; + + +public class NoStockAvailableException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + private Object[] args; + + public NoStockAvailableException(String msg) + { + super(msg); + } + + public Object[] getArgs() + { + return args; + } + + + + public void setArgs(Object[] args) + { + this.args = args; + } + + public NoStockAvailableException(Object args[]) + { + setArgs(args); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NotLoggedInException.java b/posterita/posterita/src/main/org/posterita/exceptions/NotLoggedInException.java new file mode 100644 index 0000000000..4f5efb013e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NotLoggedInException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 16-Feb-2005 by fred + * + */ +package org.posterita.exceptions; + +public class NotLoggedInException extends ApplicationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/NullTransferAmountException.java b/posterita/posterita/src/main/org/posterita/exceptions/NullTransferAmountException.java new file mode 100644 index 0000000000..dda3366ee2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/NullTransferAmountException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 14, 2006 + */ + + +package org.posterita.exceptions; + + +public class NullTransferAmountException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + +public NullTransferAmountException(String xception) + { + super(xception); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/OperationException.java b/posterita/posterita/src/main/org/posterita/exceptions/OperationException.java new file mode 100644 index 0000000000..3429376a14 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/OperationException.java @@ -0,0 +1,51 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +package org.posterita.exceptions; + +public class OperationException extends Exception +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public OperationException() + { + + } + + public OperationException(String xception) + { + super(xception); + } + + public OperationException(Exception exception) + { + super(exception); + } + + public OperationException(String msg, Exception exception) + { + super(msg,exception); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/OrganisationAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/OrganisationAlreadyExistsException.java new file mode 100644 index 0000000000..b2831bf7e2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/OrganisationAlreadyExistsException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.exceptions; + + +public class OrganisationAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public OrganisationAlreadyExistsException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/POException.java b/posterita/posterita/src/main/org/posterita/exceptions/POException.java new file mode 100644 index 0000000000..7311dd53ef --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/POException.java @@ -0,0 +1,63 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.exceptions; + +/** + * @author ashley + */ +public class POException extends RuntimeException +{ + private static final long serialVersionUID = 4178407778052352481L; + + /** + * + */ + public POException() + { + super(); + } + + /** + * @param message + * @param cause + */ + public POException(String message, Throwable cause) + { + super(message, cause); + } + + /** + * @param message + */ + public POException(String message) + { + super(message); + } + + /** + * @param cause + */ + public POException(Throwable cause) + { + super(cause); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/POSTerminalException.java b/posterita/posterita/src/main/org/posterita/exceptions/POSTerminalException.java new file mode 100644 index 0000000000..120dd679fd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/POSTerminalException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class POSTerminalException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public POSTerminalException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/PayAmtNotEqualToAllocateAmtException.java b/posterita/posterita/src/main/org/posterita/exceptions/PayAmtNotEqualToAllocateAmtException.java new file mode 100644 index 0000000000..6eb96ae608 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/PayAmtNotEqualToAllocateAmtException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 26, 2006 + */ + + +package org.posterita.exceptions; + + +public class PayAmtNotEqualToAllocateAmtException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public PayAmtNotEqualToAllocateAmtException(String message) + { + super(message); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/PaymentTermAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/PaymentTermAlreadyExistsException.java new file mode 100644 index 0000000000..a0eb290fa5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/PaymentTermAlreadyExistsException.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 1, 2006 + */ + + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + + +public class PaymentTermAlreadyExistsException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public PaymentTermAlreadyExistsException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/PriceListAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/PriceListAlreadyExistsException.java new file mode 100644 index 0000000000..d0483902a6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/PriceListAlreadyExistsException.java @@ -0,0 +1,11 @@ +package org.posterita.exceptions; + +public class PriceListAlreadyExistsException extends OperationException +{ + + public PriceListAlreadyExistsException(String exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ProductAlreadyExistException.java b/posterita/posterita/src/main/org/posterita/exceptions/ProductAlreadyExistException.java new file mode 100644 index 0000000000..b7ce33d666 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ProductAlreadyExistException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 09-Aug-2005 by alok + * + */ +package org.posterita.exceptions; + + +public class ProductAlreadyExistException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductAlreadyExistException(String exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ProductImageInvalidException.java b/posterita/posterita/src/main/org/posterita/exceptions/ProductImageInvalidException.java new file mode 100644 index 0000000000..1b6d596262 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ProductImageInvalidException.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 2, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class ProductImageInvalidException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductImageInvalidException(String msg) + { + super(msg); + } + + public ProductImageInvalidException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ProductInStockException.java b/posterita/posterita/src/main/org/posterita/exceptions/ProductInStockException.java new file mode 100644 index 0000000000..42666b2dea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ProductInStockException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 09-Aug-2005 by alok + * + */ +package org.posterita.exceptions; + + +public class ProductInStockException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductInStockException(String exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ProductNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/ProductNotFoundException.java new file mode 100644 index 0000000000..ae5dca8e64 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ProductNotFoundException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Feb 24, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class ProductNotFoundException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductNotFoundException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ProductNotImportedException.java b/posterita/posterita/src/main/org/posterita/exceptions/ProductNotImportedException.java new file mode 100644 index 0000000000..269d905a07 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ProductNotImportedException.java @@ -0,0 +1,26 @@ +package org.posterita.exceptions; + +public class ProductNotImportedException extends OperationException +{ + + public ProductNotImportedException() + { + super(); + } + + public ProductNotImportedException(Exception exception) + { + super(exception); + } + + public ProductNotImportedException(String msg, Exception exception) + { + super(msg, exception); + } + + public ProductNotImportedException(String exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ProductNotOnPriceListException.java b/posterita/posterita/src/main/org/posterita/exceptions/ProductNotOnPriceListException.java new file mode 100644 index 0000000000..1518325f8b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ProductNotOnPriceListException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on May 30, 2006 + */ + + +package org.posterita.exceptions; + + +public class ProductNotOnPriceListException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductNotOnPriceListException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/QuantityNotAvailableException.java b/posterita/posterita/src/main/org/posterita/exceptions/QuantityNotAvailableException.java new file mode 100644 index 0000000000..267224c0de --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/QuantityNotAvailableException.java @@ -0,0 +1,50 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.exceptions; + + +public class QuantityNotAvailableException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + private String message; + + public QuantityNotAvailableException() + { + + } + + public QuantityNotAvailableException(String exception) + { + super(exception); + } + + public void setMessage(String message) + { + this.message = message; + } + + public String getMessage() + { + return message; + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ReloadFactoryException.java b/posterita/posterita/src/main/org/posterita/exceptions/ReloadFactoryException.java new file mode 100644 index 0000000000..ad6ed267c4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ReloadFactoryException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Nov 14, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class ReloadFactoryException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public ReloadFactoryException(String msg, Exception ex) + { + super(msg, ex); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/RequestOwnerNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/RequestOwnerNotFoundException.java new file mode 100644 index 0000000000..998cd8ed2c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/RequestOwnerNotFoundException.java @@ -0,0 +1,42 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on Jun 26, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class RequestOwnerNotFoundException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public RequestOwnerNotFoundException(String msg) + { + super(msg); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/RoleAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/RoleAlreadyExistsException.java new file mode 100644 index 0000000000..98f7219c1e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/RoleAlreadyExistsException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 14, 2005 by praveen + * + */ +package org.posterita.exceptions; + +public class RoleAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public RoleAlreadyExistsException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/SequenceUpdateException.java b/posterita/posterita/src/main/org/posterita/exceptions/SequenceUpdateException.java new file mode 100644 index 0000000000..29f6881b14 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/SequenceUpdateException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 17, 2006 + */ + + +package org.posterita.exceptions; + + +public class SequenceUpdateException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SequenceUpdateException(String msg) + { + super(msg); + } +} + diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ShipmentAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/ShipmentAlreadyExistsException.java new file mode 100644 index 0000000000..147efe23a2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ShipmentAlreadyExistsException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Sep-2005 by Vishee + * + */ + +package org.posterita.exceptions; + +public class ShipmentAlreadyExistsException extends ApplicationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ShipmentAlreadyExistsException(String message) + { + super(message); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ShipperAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/ShipperAlreadyExistsException.java new file mode 100644 index 0000000000..f46836f76b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ShipperAlreadyExistsException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.exceptions; + + +public class ShipperAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ShipperAlreadyExistsException(String exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/StoreException.java b/posterita/posterita/src/main/org/posterita/exceptions/StoreException.java new file mode 100644 index 0000000000..d0d3bce666 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/StoreException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class StoreException extends OperationException +{ + private static final long serialVersionUID = 1L; + + public StoreException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/SurnameNotPresentException.java b/posterita/posterita/src/main/org/posterita/exceptions/SurnameNotPresentException.java new file mode 100644 index 0000000000..cbeae83506 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/SurnameNotPresentException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 16-Dec-2005 + */ + + +package org.posterita.exceptions; + + +public class SurnameNotPresentException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SurnameNotPresentException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/SystemException.java b/posterita/posterita/src/main/org/posterita/exceptions/SystemException.java new file mode 100644 index 0000000000..f3e1100204 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/SystemException.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +package org.posterita.exceptions; + + +public class SystemException extends Exception +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SystemException(Exception e) + { + super(e); + } + + public SystemException(String xception) + { + super(xception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TMKRuntimeException.java b/posterita/posterita/src/main/org/posterita/exceptions/TMKRuntimeException.java new file mode 100644 index 0000000000..fed6b51a5f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TMKRuntimeException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.exceptions; + + +public class TMKRuntimeException extends RuntimeException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public TMKRuntimeException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TaxNameAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/TaxNameAlreadyExistsException.java new file mode 100644 index 0000000000..644ca5a447 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TaxNameAlreadyExistsException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 28, 2006 + */ + + +package org.posterita.exceptions; + + +public class TaxNameAlreadyExistsException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public TaxNameAlreadyExistsException(String msg) + { + super(msg); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TaxRateAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/TaxRateAlreadyExistsException.java new file mode 100644 index 0000000000..7e206f3571 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TaxRateAlreadyExistsException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 28, 2006 + */ + + +package org.posterita.exceptions; + + +public class TaxRateAlreadyExistsException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public TaxRateAlreadyExistsException(String msg) + { + super(msg); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TaxRateNotDefineException.java b/posterita/posterita/src/main/org/posterita/exceptions/TaxRateNotDefineException.java new file mode 100644 index 0000000000..496a02e515 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TaxRateNotDefineException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 26, 2006 + */ + + +package org.posterita.exceptions; + + +public class TaxRateNotDefineException extends OperationException +{ + + private static final long serialVersionUID = 1L; + + public TaxRateNotDefineException(String exception) + { + super(exception); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TerminalInactivateException.java b/posterita/posterita/src/main/org/posterita/exceptions/TerminalInactivateException.java new file mode 100644 index 0000000000..664e1c017b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TerminalInactivateException.java @@ -0,0 +1,32 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.exceptions; + +/** + * @author ashley + * Jun 4, 2008 + */ +public class TerminalInactivateException extends OperationException +{ + public TerminalInactivateException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TerminalLockedException.java b/posterita/posterita/src/main/org/posterita/exceptions/TerminalLockedException.java new file mode 100644 index 0000000000..5212770291 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TerminalLockedException.java @@ -0,0 +1,37 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.exceptions; + +/** + * @author ashley + * May 30, 2008 + */ +public class TerminalLockedException extends OperationException +{ + public TerminalLockedException(String message) + { + super(message); + } + + public TerminalLockedException(String message, Exception exception) + { + super(message, exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TerminalNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/TerminalNotFoundException.java new file mode 100644 index 0000000000..59fb07a4e9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TerminalNotFoundException.java @@ -0,0 +1,32 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.exceptions; + +/** + * @author Ashley G Ramdass + * Apr 24, 2008 + */ +public class TerminalNotFoundException extends OperationException +{ + public TerminalNotFoundException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/ThumbnailGenerationException.java b/posterita/posterita/src/main/org/posterita/exceptions/ThumbnailGenerationException.java new file mode 100644 index 0000000000..0a66b811fd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/ThumbnailGenerationException.java @@ -0,0 +1,43 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 3, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class ThumbnailGenerationException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ThumbnailGenerationException(String msg) + { + super(msg); + } + + public ThumbnailGenerationException(String msg, Exception ex) + { + super(msg, ex); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TooManyAllocateInvoiceException.java b/posterita/posterita/src/main/org/posterita/exceptions/TooManyAllocateInvoiceException.java new file mode 100644 index 0000000000..ebdb6ebfea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TooManyAllocateInvoiceException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 8, 2006 + */ + + +package org.posterita.exceptions; + + +public class TooManyAllocateInvoiceException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public TooManyAllocateInvoiceException(String message) + { + super(message); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TotalQuantityLessThanZeroException.java b/posterita/posterita/src/main/org/posterita/exceptions/TotalQuantityLessThanZeroException.java new file mode 100644 index 0000000000..532a7f29fd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TotalQuantityLessThanZeroException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.exceptions; + + +public class TotalQuantityLessThanZeroException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public TotalQuantityLessThanZeroException(String exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TrackingNumberNotfoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/TrackingNumberNotfoundException.java new file mode 100644 index 0000000000..a38b0dc048 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TrackingNumberNotfoundException.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 9, 2006 + */ + + +package org.posterita.exceptions; + + +public class TrackingNumberNotfoundException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + +public TrackingNumberNotfoundException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/TransferAmountExceedsTotalAmountException.java b/posterita/posterita/src/main/org/posterita/exceptions/TransferAmountExceedsTotalAmountException.java new file mode 100644 index 0000000000..aaac0aec08 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/TransferAmountExceedsTotalAmountException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 14, 2006 + */ + + +package org.posterita.exceptions; + + +public class TransferAmountExceedsTotalAmountException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public TransferAmountExceedsTotalAmountException(String xception) + { + super(xception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UOMNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/UOMNotFoundException.java new file mode 100644 index 0000000000..2901f58923 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UOMNotFoundException.java @@ -0,0 +1,17 @@ +package org.posterita.exceptions; + + +public class UOMNotFoundException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + public UOMNotFoundException(String str) + { + super(str); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UOMValuePrecisionNotValidException.java b/posterita/posterita/src/main/org/posterita/exceptions/UOMValuePrecisionNotValidException.java new file mode 100644 index 0000000000..a70ba8953e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UOMValuePrecisionNotValidException.java @@ -0,0 +1,21 @@ +package org.posterita.exceptions; + +/** + * This Exception corresponds to the situation where the entered + * value for some field has a precision which exceeds that field's UOM precision. + * + * @author sendy + * + */ +public class UOMValuePrecisionNotValidException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public UOMValuePrecisionNotValidException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UnitNumberAlreadyExistException.java b/posterita/posterita/src/main/org/posterita/exceptions/UnitNumberAlreadyExistException.java new file mode 100644 index 0000000000..ab8c9b2e76 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UnitNumberAlreadyExistException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Jan 16, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class UnitNumberAlreadyExistException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public UnitNumberAlreadyExistException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UnsupportedDatabaseException.java b/posterita/posterita/src/main/org/posterita/exceptions/UnsupportedDatabaseException.java new file mode 100644 index 0000000000..67e27be7a4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UnsupportedDatabaseException.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +public class UnsupportedDatabaseException extends RuntimeException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public UnsupportedDatabaseException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UserAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/UserAlreadyExistsException.java new file mode 100644 index 0000000000..8f431ee3dd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UserAlreadyExistsException.java @@ -0,0 +1,34 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.exceptions; + + +public class UserAlreadyExistsException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public UserAlreadyExistsException(String exception) + { + super(exception); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UserException.java b/posterita/posterita/src/main/org/posterita/exceptions/UserException.java new file mode 100644 index 0000000000..257cc85f73 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UserException.java @@ -0,0 +1,48 @@ +/* +* +* Copyright (c) 2006 Tamak ICT Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on Jun 5, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.exceptions; + +import org.posterita.exceptions.OperationException; + +public class UserException extends OperationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public UserException(String msg) + { + super(msg); + } + + public UserException(String msg, Exception ex) + { + super(msg, ex); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UserInactiveException.java b/posterita/posterita/src/main/org/posterita/exceptions/UserInactiveException.java new file mode 100644 index 0000000000..12ae6a798f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UserInactiveException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 07-Apr-2005 by fred + * + */ +package org.posterita.exceptions; + + +public class UserInactiveException extends ApplicationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UserInvalidException.java b/posterita/posterita/src/main/org/posterita/exceptions/UserInvalidException.java new file mode 100644 index 0000000000..b7911b2677 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UserInvalidException.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Mar 29, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +import org.posterita.exceptions.DataException; + +public class UserInvalidException extends DataException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public UserInvalidException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/UserNotFoundException.java b/posterita/posterita/src/main/org/posterita/exceptions/UserNotFoundException.java new file mode 100644 index 0000000000..95eb36b39a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/UserNotFoundException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 17-Feb-2005 by fred + * + */ +package org.posterita.exceptions; + + +public class UserNotFoundException extends ApplicationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/WarehouseAlreadyExistsException.java b/posterita/posterita/src/main/org/posterita/exceptions/WarehouseAlreadyExistsException.java new file mode 100644 index 0000000000..feb781e945 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/WarehouseAlreadyExistsException.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.exceptions; + + +public class WarehouseAlreadyExistsException extends Exception +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public WarehouseAlreadyExistsException(String exception) + { + super(exception); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/WebstoreOrderProcessingException.java b/posterita/posterita/src/main/org/posterita/exceptions/WebstoreOrderProcessingException.java new file mode 100644 index 0000000000..bd20ea6fce --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/WebstoreOrderProcessingException.java @@ -0,0 +1,36 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Jan 16, 2006 by ashley +* +*/ + +package org.posterita.exceptions; + +public class WebstoreOrderProcessingException extends OperationException +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public WebstoreOrderProcessingException(String msg) + { + super(msg); + } +} diff --git a/posterita/posterita/src/main/org/posterita/exceptions/WrongPasswordException.java b/posterita/posterita/src/main/org/posterita/exceptions/WrongPasswordException.java new file mode 100644 index 0000000000..8d14d0042f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/exceptions/WrongPasswordException.java @@ -0,0 +1,26 @@ +/* + * Created on 2005/03/09 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.posterita.exceptions; + +/** + * @author jane + * + * To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class WrongPasswordException extends ApplicationException +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/factory/AbstractFactory.java b/posterita/posterita/src/main/org/posterita/factory/AbstractFactory.java new file mode 100644 index 0000000000..2a9479216c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/AbstractFactory.java @@ -0,0 +1,242 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 11, 2005 by vishee + */ + +package org.posterita.factory; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Properties; +import java.util.Set; + +import org.compiere.model.PO; +import org.compiere.util.Env; + +import org.posterita.businesslogic.ClientManager; +import org.posterita.core.FactoryPropertiesManager; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ReloadFactoryException; +import org.posterita.lib.UdiConstants; + +public abstract class AbstractFactory +{ + private static final String KEY_SEPARATOR = "_"; + protected HashMap map; + protected static int[] clients; + + public static final String MENU_POSITION_TOP = "TOP"; + public static final String MENU_POSITION_LEFT = "LEFT"; + public static final String MENU_POSITION_RIGHT = "RIGHT"; + public static final String MENU_POSITION_DOWN = "DOWN"; + + + static + { + clients = ClientManager.getAvailableClientIds(); + } + + WebProperties pm = FactoryPropertiesManager.getProperty(); + + protected void initFactory(Properties ctx, AbstractFactory factory) throws OperationException + { + clients = ClientManager.getAvailableClientIds(); + if (Env.getAD_Client_ID(ctx) == 0) //--> Client Independent PO + { + if (factory == null) + { + loadFactory(ctx); + } + else + { + loadFactory(ctx, factory); + } + } + else + { + // Catering for multiple clients. All clients should have factory objects loaded. + for (int i = 0; i < clients.length; i++) + { + Properties nCtx = getCtxClone(ctx, clients[i]); + if (factory == null) + { + loadFactory(nCtx); + } + else + { + loadFactory(nCtx, factory); + } + } + } + } + + protected abstract void loadFactory(Properties ctx) throws OperationException; + + protected abstract void loadFactory(Properties ctx, AbstractFactory factory) throws OperationException; + + public static void reloadFactory(Properties ctx) throws ReloadFactoryException + { + + } + + /*private static Properties getCtxClone(Properties ctx) + { + return getCtxClone(ctx, Env.getAD_Client_ID(ctx)); + }*/ + + private static Properties getCtxClone(Properties ctx, int adClientId) + { + Properties nCtx = (Properties)ctx.clone(); + Env.setContext(nCtx, UdiConstants.CLIENT_ID_CTX_PARAM, adClientId); + Env.setContext(nCtx, UdiConstants.ORG_ID_CTX_PARAM, 0); + Env.setContext(nCtx, UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM, 0); + Env.setContext(nCtx, UdiConstants.USER_ID_CTX_PARAM, 100); + return nCtx; + } + + protected void add(Properties ctx, String key, PO po) throws OperationException + { + if (map == null) + { + map = new HashMap(); + } + + String idStr = pm.get(ctx, key); + + if (idStr == null) + { + po.save(); // UDIPO + pm.put(ctx, key, ""+po.get_ID()); + } + else + { + Class cl; + Class params[]; + Constructor constructor; + Object[] args; + PO loadedPO; + try + { + cl = Class.forName(po.getClass().getName()); + params = new Class[]{Properties.class, int.class, String.class}; + + constructor = cl.getConstructor(params); + args = new Object[]{ctx,Integer.valueOf(idStr),null}; + loadedPO = (PO) constructor.newInstance(args); + setFields(ctx, po, loadedPO); + loadedPO.save(); + } + catch (ClassNotFoundException e) + { + throw new OperationException(e.getMessage()); + } + catch (SecurityException e) + { + throw new OperationException(e.getMessage()); + } + catch (NoSuchMethodException e) + { + throw new OperationException(e.getMessage()); + } + catch (IllegalArgumentException e) + { + throw new OperationException(e.getMessage()); + } + catch (InstantiationException e) + { + throw new OperationException(e.getMessage()); + } + catch (IllegalAccessException e) + { + throw new OperationException(e.getMessage()); + } + catch (InvocationTargetException e) + { + throw new OperationException(e.getMessage()); + } + + + if (loadedPO == null || loadedPO.get_ID() == 0) + { + po.save(); + pm.put(ctx, key, ""+po.get_ID()); + } + else + { + po = loadedPO; + } + } + + put(ctx, key, po); + } + + private void put(Properties ctx, String key, PO po) + { + int adClientId = Env.getAD_Client_ID(ctx); + String nKey = key + KEY_SEPARATOR + String.valueOf(adClientId); + map.put(nKey, po); + } + + public PO get(Properties ctx, String key) throws OperationException + { + if (map == null) + { + initFactory(ctx, null); + } + + int adClientId = Env.getAD_Client_ID(ctx); + String nKey = key + KEY_SEPARATOR + String.valueOf(adClientId); + PO retPO = map.get(nKey); + + if (retPO == null) + throw new OperationException("Could not get PO with key: " + key); + + return retPO; + } + + protected void setFields(Properties ctx, PO fromPO, PO toPO) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException + { + + } + + public ArrayList getAllKeys(Properties ctx) throws OperationException + { + if (map == null) + loadFactory(ctx); + + Set keySet = map.keySet(); + + ArrayList keyList = new ArrayList(); + + for(Object objKey : keySet) + { + String key = (String)objKey; + int ind = key.lastIndexOf(KEY_SEPARATOR); + if(ind > 0) + { + key = key.substring(0, ind); + } + keyList.add(key); + } + + return keyList; + } +} diff --git a/posterita/posterita/src/main/org/posterita/factory/DBPropertiesManager.java b/posterita/posterita/src/main/org/posterita/factory/DBPropertiesManager.java new file mode 100644 index 0000000000..b42c1c0f9e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/DBPropertiesManager.java @@ -0,0 +1,88 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 12-Oct-2005 + */ + + +package org.posterita.factory; + +import java.util.Properties; + +import org.compiere.util.Env; + +import org.posterita.exceptions.OperationException; +import org.posterita.model.MWebProperties; + + +public class DBPropertiesManager implements WebProperties +{ + + public void put(Properties ctx, String key, String value) + { + int [] propertieIds = MWebProperties.getAllIDs(MWebProperties.Table_Name," U_KEY='"+key+"' and AD_CLIENT_ID = "+Env.getAD_Client_ID(ctx),null); + + if(propertieIds.length==0) + { + MWebProperties webProperties = new MWebProperties(ctx,0,null); + webProperties.setU_Key(key); + webProperties.setU_Value(value); + webProperties.save(); + } + else + { + MWebProperties webProperties = new MWebProperties(ctx,propertieIds[0],null); + webProperties.setU_Value(value); + webProperties.save(); + } + } + + + public String get(Properties ctx, String key) throws OperationException + { + + int [] values; + + values = MWebProperties.getAllIDs(MWebProperties.Table_Name,"u_key ='"+key+"' and AD_CLIENT_ID = "+Env.getAD_Client_ID(ctx),null); + + if (values.length == 0) + { + return null; + } + + + MWebProperties webProperties = new MWebProperties(ctx,values[0],null); + + return webProperties.getU_Value(); + } + +// private boolean iskeyPresent(Properties ctx,String key) +// { +// boolean keyPresent = true; +// int [] propertieIds = MWebProperties.getAllIDs(MWebProperties.Table_Name," U_KEY='"+key+"' and AD_CLIENT_ID = "+Env.getAD_Client_ID(ctx),null); +// +// if(propertieIds.length==0) +// keyPresent = false; +// +// return keyPresent; +// } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/factory/DunningFactory.java b/posterita/posterita/src/main/org/posterita/factory/DunningFactory.java new file mode 100644 index 0000000000..c23c1125d5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/DunningFactory.java @@ -0,0 +1,86 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 30, 2006 + */ + + +package org.posterita.factory; + +import java.util.Properties; + +import org.posterita.businesslogic.administration.DunningManager; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ReloadFactoryException; + + +public class DunningFactory extends AbstractFactory +{ + public static final String DUNNING_ID = "dunning.id"; + public static final String DUNNING_NAME="Dunning"; + public static final String DESCRIPTION="Include due an non-due invoices"; + public static final String DUNNING_LEVEL_NAME="Statement"; + public static final String PRINT_TEXT = "Statement "; + public static final String PRINT_NOTE="Please review your statement and submit due payments."; + + + private static DunningFactory singleton; + private DunningFactory() throws OperationException + { + + } + + public static DunningFactory getFactoryInstance(Properties ctx) throws OperationException + { + if (singleton == null) + singleton = new DunningFactory(); + + Properties nCtx = (Properties)ctx.clone(); + singleton.loadFactory(nCtx); + + return singleton; + } + + protected void loadFactory(Properties ctx) throws OperationException + { + loadFactory(ctx, singleton); + } + + protected void loadFactory(Properties ctx, AbstractFactory factory) throws OperationException + { + factory.add(ctx,DUNNING_ID, + DunningManager.createDunningAndLevel + (ctx,DUNNING_NAME,DESCRIPTION,DUNNING_LEVEL_NAME,PRINT_TEXT,PRINT_NOTE,-9999)); + + } + + public static void reloadFactory(Properties ctx) throws ReloadFactoryException + { + try + { + DunningFactory nFactory = new DunningFactory(); + nFactory.initFactory(ctx, nFactory); + singleton = nFactory; + } + catch(OperationException ex) + { + throw new ReloadFactoryException("Could not reload DunningFactory", ex); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/factory/GenericSystemObjectsFactory.java b/posterita/posterita/src/main/org/posterita/factory/GenericSystemObjectsFactory.java new file mode 100644 index 0000000000..87590a4ba8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/GenericSystemObjectsFactory.java @@ -0,0 +1,110 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + **/ +package org.posterita.factory; + +import java.util.Properties; + +import org.compiere.model.MAssetGroup; +import org.compiere.model.MDiscountSchema; +import org.compiere.model.MDiscountSchemaLine; +import org.compiere.model.MProductCategory; +import org.compiere.model.MTax; +import org.compiere.model.MTaxCategory; +import org.posterita.core.SystemObjects; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ReloadFactoryException; +import org.posterita.lib.UdiConstants; + + +public class GenericSystemObjectsFactory extends AbstractFactory +{ + + public static final String PRODUCT_CATEGORY_ID = "product.category.id"; + public static final String TAX_CATEGORY_DEFAULT_ID = "tax.category.default.id"; + + public static final String ASSET_GROUP_ID = "asset.group.id"; + public static final String TAX_DEFAULT_ID = "tax.default.id"; + public static final String DISCOUNT_SCHEMA_ID = "discount.schema.id"; + public static final String DISCOUNT_SCHEMA_LINE_ID = "discount.schema.line.id"; + + private static GenericSystemObjectsFactory genericSystemsObjectFactory; + private GenericSystemObjectsFactory() + { + + } + + public static GenericSystemObjectsFactory getFactoryInstance() + { + if (genericSystemsObjectFactory == null) + genericSystemsObjectFactory = new GenericSystemObjectsFactory(); + + return genericSystemsObjectFactory; + } + + protected void loadFactory(Properties ctx) throws OperationException + { + loadFactory(ctx, genericSystemsObjectFactory); + } + + protected void loadFactory(Properties ctx, AbstractFactory factory) throws OperationException + { + MAssetGroup assetGroup = SystemObjects.getAssetGroup(ctx, "Posterita Asset Group"); + factory.add(ctx, ASSET_GROUP_ID, assetGroup); + assetGroup = (MAssetGroup)factory.get(ctx, ASSET_GROUP_ID); + + MProductCategory productCategory = SystemObjects.getProductCategory(ctx, "Posterita Product Category"); + factory.add(ctx, PRODUCT_CATEGORY_ID, productCategory); + productCategory = (MProductCategory) factory.get(ctx, GenericSystemObjectsFactory.PRODUCT_CATEGORY_ID); + productCategory.setA_Asset_Group_ID(assetGroup.get_ID()); + productCategory.save(); + + factory.add(ctx, TAX_CATEGORY_DEFAULT_ID, SystemObjects.getTaxCategory(ctx, "Posterita Tax Category")); + MTaxCategory taxCategory = (MTaxCategory) factory.get(ctx, TAX_CATEGORY_DEFAULT_ID); + + MTax tax = SystemObjects.getTax(ctx, "Posterita TAx", UdiConstants.COUNTRY_MAURITIUS, "Posterita Tax"); + tax.setC_TaxCategory_ID(taxCategory.getC_TaxCategory_ID()); + tax.setIsTaxExempt(true); + tax.setSOPOType(MTax.SOPOTYPE_SalesTax); + factory.add(ctx, TAX_DEFAULT_ID, tax); + + MDiscountSchema discountSchema = SystemObjects.getDiscountSchema(ctx, "Posterita Discount Schema"); + factory.add(ctx, DISCOUNT_SCHEMA_ID, discountSchema); + discountSchema = (MDiscountSchema) factory.get(ctx, GenericSystemObjectsFactory.DISCOUNT_SCHEMA_ID); + + MDiscountSchemaLine discountSchemaLine = SystemObjects.getDiscountSchemaLine(ctx, discountSchema.getM_DiscountSchema_ID()); + factory.add(ctx, DISCOUNT_SCHEMA_LINE_ID, discountSchemaLine); + discountSchemaLine = (MDiscountSchemaLine)factory.get(ctx, GenericSystemObjectsFactory.DISCOUNT_SCHEMA_LINE_ID); + } + + public static void reloadFactory(Properties ctx) throws ReloadFactoryException + { + try + { + GenericSystemObjectsFactory nFactory = new GenericSystemObjectsFactory(); + nFactory.initFactory(ctx, nFactory); + genericSystemsObjectFactory = nFactory; + } + catch(OperationException ex) + { + throw new ReloadFactoryException("Could not reload GenericSystemObjectsFactory", ex); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/factory/MenuGenerator.java b/posterita/posterita/src/main/org/posterita/factory/MenuGenerator.java new file mode 100644 index 0000000000..6dbfe133a7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/MenuGenerator.java @@ -0,0 +1,91 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.factory; + +import java.util.Properties; + +import org.compiere.model.MRole; +import org.compiere.model.X_U_RoleMenu; +import org.compiere.util.Env; +import org.posterita.businesslogic.MenuManager; +import org.posterita.exceptions.OperationException; +import org.posterita.model.MRoleMenu; +import org.posterita.util.PoManager; + + +public class MenuGenerator +{ + public static void createMenus(Properties ctx, MRole role) throws OperationException + { + int menuIds[] = MenuManager.getMenuIdForOrganisation(ctx); + int roleId = role.get_ID(); + + for(int i = 0; i < menuIds.length; i++) + { + if(MenuGenerator.isRoleMenuPresent(ctx, roleId, menuIds[i])) + continue; + MRoleMenu roleMenu = new MRoleMenu(ctx, 0, null); + + roleMenu.setAD_Role_ID(roleId); + roleMenu.setU_WebMenu_ID(menuIds[i]); + PoManager.save(roleMenu); + } + } + + private static boolean isRoleMenuPresent(Properties ctx, int roleId, int menuId) + { + boolean present = true; + + String sqlWhereClause = ""; + int adClientId = Env.getAD_Client_ID(ctx); + int adOrgId = Env.getAD_Org_ID(ctx); + + sqlWhereClause += "AD_CLIENT_ID=" + adClientId + " and AD_ORG_ID=" + adOrgId + " and U_WEBMENU_ID=" + menuId + " and AD_ROLE_ID=" + roleId; + int ids[] = X_U_RoleMenu.getAllIDs(X_U_RoleMenu.Table_Name, sqlWhereClause, null); + + if(ids.length == 0) + present = false; + + return present; + } + + /** + * @param ctx + * @param role + * @throws OperationException + */ + public static void createSuperUserMenus(Properties ctx, MRole role) throws OperationException + { + int menuIds[] = MenuManager.getMenuIdForSuperUser(ctx); + + int roleId = role.get_ID(); + + for(int i = 0; i < menuIds.length; i++) + { + if(MenuGenerator.isRoleMenuPresent(ctx, roleId, menuIds[i])) + continue; + MRoleMenu roleMenu = new MRoleMenu(ctx, 0, null); + + roleMenu.setAD_Role_ID(roleId); + roleMenu.setU_WebMenu_ID(menuIds[i]); + PoManager.save(roleMenu); + } + } +} diff --git a/posterita/posterita/src/main/org/posterita/factory/POSMenuFactory.java b/posterita/posterita/src/main/org/posterita/factory/POSMenuFactory.java new file mode 100644 index 0000000000..4836e9b9be --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/POSMenuFactory.java @@ -0,0 +1,735 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.factory; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MProcess; +import org.compiere.model.PO; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.model.MWebMenu; +import org.posterita.order.UDIOrderTypes; + +public class POSMenuFactory extends AbstractFactory +{ + + public static final String MENU_POSITION_TOP = "TOP"; + public static final String MENU_POSITION_LEFT = "LEFT"; + public static final String MENU_POSITION_RIGHT = "RIGHT"; + public static final String MENU_POSITION_DOWN = "DOWN"; + + public static final String PMENU_SALES_ID = "pmenu.order.id"; + + public static final String PMENU_CREDITSALES_ID = "pmenu.creditsales.id"; + public static final String PMENU_PURCHASES_ID = "pmenu.purchases.id"; + public static final String PMENU_STOCK_ID = "pmenu.stock.id"; + + + public static final String SMENU_POSORDER_ID = "smenu.posorder.id"; + public static final String SMENU_POSORDERWA_ID="smenu.posorderwa.id"; + public static final String SMENU_POSPARTIALORDER_ID = "smenu.pospartialorder.id"; + public static final String SMENU_INVOKEPOSPARTIALORDER_ID = "smenu.invokepospartialorder.id"; + public static final String SMENU_POSGOODRECNOTE_ID = "smenu.posgoodrecnote.id"; + public static final String SMENU_POSGOODRETNOTE_ID= "smenu.posgoodretnote.id"; + public static final String SMENU_CUSTRETORDER_ID="smenu.custretorder.id"; + public static final String SMENU_POSPARTIALHISTORYORDER_ID="smenu.pospartialposhistory.id"; + public static final String SMENU_CUSTRETOREDRFROMPOS_ID="smenu.custretorderfrompos.id"; + public static final String SMENU_POSORDERQUICK="smenu.posorderquick.id"; + public static final String SMENU_POSORDERCUSTOMERCOMPULSORY="smenu.posordercustomercompulsory.id"; + public static final String SMENU_CREDITORDER_ID = "smenu.creditorder.id"; + public static final String SMENU_SETTLE_PAYMENT_ID = "smenu.settlepayment.id"; + public static final String SMENU_CUSTOMER_RETURN_HISTORY_ID="smenu.customer.return.history.id"; + + + public static final String PMENU_REPORTS_ID="pmenu.reports.id"; + public static final String SMENU_POSSTOCKMOV="smenu.posstockmov.id"; + public static final String SMENU_SALESANALREP="smenu.salesanalrep.id"; + public static final String SMENU_FASTMOVITEMS="smenu.fastmovitems.id"; + public static final String SMENU_SLOWMOVITEMS="smenu.slowmovitems.id"; + public static final String SMENU_CUSTSALESREPORT="smenu.custsalesreport.id"; + public static final String SMENU_CASHBOOKREPORT="smenu.cashbookreport.id"; + public static final String SMENU_PERIODICASHBOOKDETAILS="smenu.periodiccashbookdetails.id"; + public static final String SMENU_NOIMAGEREPORT="smenu.noimagereport.id"; + + public static final String PMENU_ADMINISTRATION_ID="pmenu.administration.id"; + public static final String SMENU_USER_ID="smenu.user.id"; + + public static final String SMENU_VIEWROLE_ID="smenu.viewrole.id"; + public static final String SMENU_CREATEVENDOR_ID="smenu.createvendor.id"; + + public static final String SMENU_CURRENTTILLAMOUNT_ID="smenu.currenttillamout.id"; + public static final String SMENU_CLOSECASHBOOK_ID="smenu.closecashbook.id"; + public static final String SMENU_POSINFO_ID="smenu.posinfo.id"; + public static final String SMENU_MYSTOCK_ID="smenu.mystock.id"; + + public static final String SMENU_ORDERHISTORY_ID="smenu.orderhistory.id"; + public static final String SMENU_DOCUMENTHISTORY_ID="smenu.documenthistory.id"; + + public static final String SMENU_PRODUCTS="smenu.products.id"; + public static final String SMENU_BARCODE_PRINTING = "smenu.barcode.printing"; + public static final String SMENU_VIEW_BPINFO="smenu.view.bp.info.id"; + public static final String SMENU_CUSTOMER="smenu.customer.id"; + public static final String SMENU_EDIT_BULK_PRODUCT="smenu.edit.bulk.product.id"; + public static final String SMENU_EDIT_BULK_PRICE="smenu.edit.bulk.price.id"; + public static final String SMENU_EDIT_ATTRIBUTE_VALUE="smenu.edit.attribute.value.id"; + public static final String SMENU_ADJUST_CASH_BOOK="smenu.adjust.cashbook.id"; + public static final String SMENU_SYNCHRONIZE_COLLECTIONS="smenu.synchronize.collections.id"; + public static final String PMENU_LOGOUT_ID="pmenu.logout.id"; + public static final String SMENU_CLOSE_POS_TILL="smenu.close.pos.till.id"; + public static final String SMENU_OPEN_CASH_DRAWER = "smenu.opencashdrawer.id"; + public static final String SMENU_UPDATE_PRODUCT_BY_CSV = "smenu.update.produc.csv.id"; + + public static final String SMENU_CHECK_SEQUENCE = "smenu.checkSequence.id"; + public static final String SMENU_PRINT_DUNNING_LETTERS_ID = "smenu.printDunningLetters.id"; + public static final String SMENU_VIEW_PAYMENT_ALLOCATION = "smenu.viewpaymentallocation.id"; + public static final String SMENU_VIEW_PAYMENT_TERM = "smenu.viewpaymentterm.id"; + public static final String SMENU_GENERATE_COMMISSION_ID = "smenu.generatecommission.id"; + public static final String SMENU_VIEW_GENERATED_COMMISSION_ID = "smenu.viewgeneratedcommission.id"; + public static final String SMENU_VIEW_TAX="smenu.tax.id"; + public static final String SMENU_CREDITMEMOFROMPOS_ID="smenu.creditmemo.from.creditorder.id"; + public static final String SMENU_CREATE_UNALLOCATED_PAYMENT_ID="smenu.create.unallocated.payment.id"; + public static final String SMENU_CREDIT_MEMO_HISTORY_ID="smenu.credit.memo.history.id"; + + public static final String MODULE_NAME = "POS"; + + private static final String SMENU_CASH_SALES_NEW_ID = "smenu.cash.sales.new.id"; + private static final String SMENU_CASH_SALES_HISTORY_ID = "smenu.cash.sales.history.id"; + private static final String SMENU_CREDIT_SALES_HISTORY_ID = "smenu.credit.sales.history.id"; + private static final String SMENU_GOODSRECNOTEHISTORY_HISTORY_ID = "smenu.goods.received.note.history.id"; + private static final String SMENU_GOODSRETNOTEHISTORY_HISTORY_ID = "smenu.goods.returned.note.history.id"; + + private static final String SMENU_ADJUST_STOCK_ID = "smenu.adjust.stock.id"; + private static final String SMENU_INVENTORY_HISTORY_ID = "smenu.inventory.history.id"; + private static final String SMENU_ADJUST_INVENTORY_ID = "smenu.adjust.inventory.id"; + private static final String SMENU_TRANSFER_STOCK = "smenu.transfer.stock"; + private static final String SMENU_VIEW_PREFERENCES = "smenu.viewpreferences.id"; + private static final String SMENU_VIEW_BPARTNERS = "smenu.bpartners.id"; + private static final String SMENU_PRICE_CHECK = "smenu.price.check"; + private static final String SMENU_ORGANISATION = "smenu.organisation"; + + private static final String SMENU_POS_SALES_REPORT_ID = "smenu.pos.sales.report.id"; + private static final String SMENU_POS_PURCHASE_REPORT = "smenu.pos.purchase.report"; + private static final String SMENU_INVENTORY_MOVE = "smenu.inventory.move"; + private static final String SMENU_MOVE_CONFIRMATION = "smenu.move.confirmation"; + public static final String SMENU_BEST_SELLING_ITEMS = "smenu.best.selling.items"; + + public static final String SMENU_STOCK_SALES_REPORT = "smenu.stock.sales.report"; + + public static final String PMENU_HELP_ID="pmenu.help.id"; + public static final String SMENU_USER_MANUAL="smenu.user.manual"; + public static final String SMENU_CONTACTUS="smenu.contactus"; + private static final String SMENU_PRICE_LIST = "smenu.price.list"; + + private static final String PMENU_NEW_REPORTS_ID = "pmenu.new.reports.id"; + private static final String SMENU_REPORTS = "smenu.reports."; + + private static final String SMENU_CURRENCY = "smenu.currency"; + private static final String SMENU_DELETE_PRICE_ON_PRICELIST = "smenu.delete.price.on.pricelist"; + + public static final String SMENU_CASHBOOK = "smenu.cashbook"; + public static final String SMENU_TERMINAL = "smenu.terminal"; + + public static final String SMENU_SETTLE_GRN_PAYMENT_ID = "smenu.settle.grn.payment"; + public static final String SMENU_DEBTORS_ID = "smenu.debtors.id"; + public static final String SMENU_CREDITORS_ID = "smenu.creditors.id"; + private static final String SMENU_CREATE_UNALLOCATED_AP_PAYMENT_ID = "smenu.create.unallocated.ap.payment.id"; + public static final String SMENU_VIEW_AP_PAYMENT_ALLOCATION = "smenu.view.ap.payment.allocation.id"; + + + private static POSMenuFactory singleton; + + protected void loadFactory(Properties ctx) throws OperationException + { + loadFactory(ctx, singleton); + } + + @Override + protected void loadFactory(Properties ctx, AbstractFactory factory) throws OperationException + { + loadCashSalesMenu(ctx, factory); + // new configuration functionality requires only one screen for all types of orders. :( + loadCreditSalesMenu(ctx, factory); + loadPurchasesMenu(ctx, factory); + loadPerformanceAnalysisMenu(ctx, factory); + loadStockMenu(ctx, factory); + loadAdministrationMenu(ctx, factory); + loadHelpMenu(ctx, factory); + loadReportsMenu(ctx, factory); + + } + + + public static POSMenuFactory getFactoryInstance(Properties ctx) throws OperationException + { + if (singleton == null) + singleton = new POSMenuFactory(); + + Properties nCtx = (Properties)ctx.clone(); + nCtx.setProperty(UdiConstants.CLIENT_ID_CTX_PARAM, "0"); + nCtx.setProperty(UdiConstants.ORG_ID_CTX_PARAM, "0"); + singleton.loadFactory(nCtx); + + return singleton; + } + + + private void loadCashSalesMenu(Properties ctx, AbstractFactory factory) throws OperationException + { + MWebMenu pmenu_sales = MenuManager.createParentMenu(ctx, "pmenu.cash.sales", MODULE_NAME, 1000); + pmenu_sales.setPosition(MENU_POSITION_TOP); + pmenu_sales.setImageLink("images/pos/buttons/button_order.gif"); + + factory.add(ctx, PMENU_SALES_ID, pmenu_sales); + pmenu_sales = (MWebMenu)factory.get(ctx, PMENU_SALES_ID); + + /*factory.add(ctx, SMENU_POSORDER_ID, + MenuManager.createSubMenu(ctx, "smenu.cash.sales.multiple.payments", + "CreatePOSOrder.do", + MODULE_NAME, pmenu_sales.get_ID(), 1010, "sales.order")); + */ + factory.add(ctx, SMENU_POSORDERWA_ID, + MenuManager.createSubMenu(ctx, "smenu.cash.sales", + "LoadOrderScreen.do?action=loadOrderScreen&"+Constants.IS_SOTRX+"=true&orderType=POS%20Order", + MODULE_NAME, pmenu_sales.get_ID(), 1010, "sales.order")); + + /*factory.add(ctx, SMENU_POSORDERQUICK, + MenuManager.createSubMenu(ctx, "smenu.quick.cash.sales", + "CreatePOSOrder3.do", + MODULE_NAME, pmenu_sales.get_ID(), 1030, "sales.order")); + + + factory.add(ctx, SMENU_POSORDERCUSTOMERCOMPULSORY, + MenuManager.createSubMenu(ctx, "smenu.cash.sales.customer.complusory", + "CreatePOSOrder2.do", + MODULE_NAME, pmenu_sales.get_ID(), 1040, "sales.order"));*/ + + factory.add(ctx, SMENU_CASH_SALES_HISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.cash.sales.history", + "ViewPOSHistoryAction.do?action=getPOSHistory&orderType="+UDIOrderTypes.POS_ORDER.getOrderType(), + MODULE_NAME, pmenu_sales.get_ID(), 1050, "sales.order")); + + /*factory.add(ctx, SMENU_CASH_SALES_NEW_ID, + MenuManager.createSubMenu(ctx, "smenu.cash.sales.new", + "CreatePOSOrderScreen.do", + factory.add(ctx, SMENU_POSPARTIALORDER_ID, + MenuManager.createSubMenu(ctx, "smenu.prepare.order", + "CreatePartialPOSOrder.do", + MODULE_NAME, pmenu_sales.get_ID(), 1060, "prepared.order")); + + factory.add(ctx, SMENU_INVOKEPOSPARTIALORDER_ID, + MenuManager.createSubMenu(ctx, "smenu.complete.prepared.order", + "InvokePartialPOSOrder.do", + MODULE_NAME, pmenu_sales.get_ID(), 1070, "prepared.order")); + + factory.add(ctx, SMENU_POSPARTIALHISTORYORDER_ID, + MenuManager.createSubMenu(ctx, "smenu.prepared.order.history", + "ViewPartialPOSOrderHistoryAction.do?action=initPartialPOSHistory", + MODULE_NAME, pmenu_sales.get_ID(), 1080, "prepared.order")); + ;*/ + + factory.add(ctx, SMENU_CUSTRETORDER_ID, + MenuManager.createSubMenu(ctx, "smenu.customer.returned.order", + "LoadOrderScreen.do?action=loadOrderScreen&"+Constants.IS_SOTRX+"=true&orderType=Customer%20Returned%20Order", + MODULE_NAME, pmenu_sales.get_ID(), 1090,"returned.order")); + + factory.add(ctx, SMENU_CUSTOMER_RETURN_HISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.customer.return.history.id", + "ViewPOSHistoryAction.do?action=getPOSHistory&orderType=Customer%20Returned%20Order", + MODULE_NAME, pmenu_sales.get_ID(), 1170, "returned.order")); + + factory.add(ctx, SMENU_CUSTRETOREDRFROMPOS_ID, + MenuManager.createSubMenu(ctx, "smenu.invoke.customer.returned.order", + "GetCustomerReturnFromPOS.do", + MODULE_NAME, pmenu_sales.get_ID(), 1100,"returned.order")); + + + factory.add(ctx, SMENU_CURRENTTILLAMOUNT_ID, + MenuManager.createSubMenu(ctx, "smenu.current.money.in.terminal", + "GetCurrentTillAmount.do?action=getCurrentTillAmount", + MODULE_NAME, pmenu_sales.get_ID(), 1110,"till.management")); + + factory.add(ctx, SMENU_ADJUST_CASH_BOOK, + MenuManager.createSubMenu(ctx, "smenu.adjust.cashbook", + "AdjustCashBook.do", + MODULE_NAME, pmenu_sales.get_ID(), 1120,"cash.book")); + + factory.add(ctx, SMENU_PERIODICASHBOOKDETAILS, + MenuManager.createSubMenu(ctx, "smenu.cashbook.report", + "CashSummaryDate.do", + MODULE_NAME, pmenu_sales.get_ID(), 1130,"cash.book")); + + factory.add(ctx, SMENU_CASHBOOKREPORT, + MenuManager.createSubMenu(ctx, "smenu.cashbook.history", + "CashReportAction.do?action=initGetCashDetailsHistory", + MODULE_NAME, pmenu_sales.get_ID(), 1140,"cash.book")); + + factory.add(ctx, SMENU_CLOSE_POS_TILL, + MenuManager.createSubMenu(ctx, "smenu.close.till", + "InitClosePOSTillAction.do?action=initCloseTill", + MODULE_NAME, pmenu_sales.get_ID(), 1150,"till.management")); + + factory.add(ctx, SMENU_OPEN_CASH_DRAWER, + MenuManager.createSubMenu(ctx, "smenu.open.cashdrawer", + "javascript:openCashDrawer();", + MODULE_NAME, pmenu_sales.get_ID(), 1160,"till.management")); + + + } + + private void loadCreditSalesMenu(Properties ctx, AbstractFactory factory) throws OperationException + { + MWebMenu pmenu_creditsales = MenuManager.createParentMenu(ctx, "pmenu.credit.sales", MODULE_NAME, 2000); + pmenu_creditsales.setPosition(MENU_POSITION_TOP); + pmenu_creditsales.setImageLink("images/pos/buttons/button_order.gif"); + + factory.add(ctx, PMENU_CREDITSALES_ID, pmenu_creditsales); + pmenu_creditsales = (MWebMenu)factory.get(ctx, PMENU_CREDITSALES_ID); + + /*factory.add(ctx, SMENU_CREDITORDER_ID, + MenuManager.createSubMenu(ctx, "smenu.credit.sales", + "CreditSales.do", + MODULE_NAME, pmenu_creditsales.get_ID(), 2010));*/ + + factory.add(ctx, SMENU_CREDITMEMOFROMPOS_ID, + MenuManager.createSubMenu(ctx, "smenu.creditmemo.from.creditorder.id", + "InvokeCreditOrder.do", + MODULE_NAME, pmenu_creditsales.get_ID(), 2010)); + + factory.add(ctx, SMENU_CREDIT_MEMO_HISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.credit.memo.history.id", + "ViewPOSHistoryAction.do?action=getPOSHistory&orderType="+UDIOrderTypes.CREDIT_MEMO.getOrderType(), + MODULE_NAME, pmenu_creditsales.get_ID(), 2020)); + + factory.add(ctx, SMENU_SETTLE_PAYMENT_ID, + MenuManager.createSubMenu(ctx, "smenu.settle.payment.credit.sales", + "InitGetBpartnerPaymentStatus.do?action=initGetBpartnerPaymentStatus", + MODULE_NAME, pmenu_creditsales.get_ID(), 2030)); + + factory.add(ctx, SMENU_PRINT_DUNNING_LETTERS_ID, + MenuManager.createSubMenu(ctx, "smenu.dunning.letters", + "InitPrintDunningAction.do?action=initPrintDunning", + MODULE_NAME, pmenu_creditsales.get_ID(), 2040)); + + + factory.add(ctx, SMENU_VIEW_PAYMENT_ALLOCATION, + MenuManager.createSubMenu(ctx, "smenu.payment.allocation.history", + "ViewPaymentAllocation.do", + MODULE_NAME, pmenu_creditsales.get_ID(), 2050)); + + factory.add(ctx, SMENU_CREDIT_SALES_HISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.credit.sales.history", + "ViewPOSHistoryAction.do?action=getPOSHistory&orderType=" + UDIOrderTypes.CREDIT_ORDER.getOrderType(), + MODULE_NAME, pmenu_creditsales.get_ID(), 2060)); + + factory.add(ctx, SMENU_CREATE_UNALLOCATED_PAYMENT_ID, + MenuManager.createSubMenu(ctx, "smenu.create.unallocated.payment.id", + "CreateUnallocatedPayment.do", + MODULE_NAME, pmenu_creditsales.get_ID(), 2070)); + + factory.add(ctx, SMENU_DEBTORS_ID, + MenuManager.createSubMenu(ctx, "smenu.debtors.id", + "CreditorDebtorAction.do?action=getDebtors", + MODULE_NAME, pmenu_creditsales.get_ID(), 2080)); + } + + + private void loadPurchasesMenu(Properties ctx, AbstractFactory factory) throws OperationException + { + MWebMenu pmenu_purchases = MenuManager.createParentMenu(ctx, "pmenu.purchases", MODULE_NAME, 3000); + pmenu_purchases.setPosition(MENU_POSITION_TOP); + pmenu_purchases.setImageLink("images/pos/buttons/button_order.gif"); + + factory.add(ctx, PMENU_PURCHASES_ID, pmenu_purchases); + pmenu_purchases = (MWebMenu)factory.get(ctx, PMENU_PURCHASES_ID); + + factory.add(ctx, SMENU_POSGOODRECNOTE_ID, + MenuManager.createSubMenu(ctx, "smenu.goods.received.note", + "LoadOrderScreen.do?action=loadOrderScreen&"+Constants.IS_SOTRX+"=false&orderType=POS%20Goods%20Receive%20Note", + MODULE_NAME, pmenu_purchases.get_ID(), 3010)); + + factory.add(ctx, SMENU_POSGOODRETNOTE_ID, + MenuManager.createSubMenu(ctx, "smenu.goods.returned.note", + "LoadOrderScreen.do?action=loadOrderScreen&"+Constants.IS_SOTRX+"=false&orderType=POS%20Goods%20Returned%20Note", + MODULE_NAME, pmenu_purchases.get_ID(), 3020)); + + factory.add(ctx, SMENU_GOODSRECNOTEHISTORY_HISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.goods.received.note.history", + "ViewPOSHistoryAction.do?action=getPOSHistory&orderType=POS%20Goods%20Receive%20Note", + MODULE_NAME, pmenu_purchases.get_ID(), 3030)); + + factory.add(ctx, SMENU_GOODSRETNOTEHISTORY_HISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.goods.returned.note.history", + "ViewPOSHistoryAction.do?action=getPOSHistory&orderType=POS%20Goods%20Returned%20Note", + MODULE_NAME, pmenu_purchases.get_ID(), 3040)); + + factory.add(ctx, SMENU_SETTLE_GRN_PAYMENT_ID, + MenuManager.createSubMenu(ctx, "smenu.settle.payment.credit.purchase", + "InitGetBpartnerPaymentStatus.do?action=initGetCreditorPaymentStatus", + MODULE_NAME, pmenu_purchases.get_ID(), 3050)); + + factory.add(ctx, SMENU_CREDITORS_ID, + MenuManager.createSubMenu(ctx, "smenu.creditors.id", + "CreditorDebtorAction.do?action=getCreditors", + MODULE_NAME, pmenu_purchases.get_ID(), 3060)); + + factory.add(ctx, SMENU_CREATE_UNALLOCATED_AP_PAYMENT_ID, + MenuManager.createSubMenu(ctx, "smenu.create.unallocated.ap.payment.id", + "CreateUnallocatedAPPayment.do", + MODULE_NAME, pmenu_purchases.get_ID(), 3070)); + + factory.add(ctx, SMENU_VIEW_AP_PAYMENT_ALLOCATION, + MenuManager.createSubMenu(ctx, "smenu.ap.payment.allocation.history", + "ViewAPPaymentAllocation.do", + MODULE_NAME, pmenu_purchases.get_ID(), 3080)); + + + } + + + + private void loadPerformanceAnalysisMenu(Properties ctx, AbstractFactory factory) throws OperationException + { + MWebMenu pmenu_reports = MenuManager.createParentMenu(ctx, "pmenu.performance.analysis", MODULE_NAME, 4000); + pmenu_reports.setPosition(MENU_POSITION_TOP); + pmenu_reports.setImageLink("images/pos/buttons/button_reports.gif"); + + factory.add(ctx, PMENU_REPORTS_ID, pmenu_reports); + pmenu_reports = (MWebMenu)factory.get(ctx, PMENU_REPORTS_ID); + + factory.add(ctx, SMENU_CUSTSALESREPORT, + MenuManager.createSubMenu(ctx, "smenu.performance.analysis.report", + "CustomPOSReportAction.do?action=initCustomReport", + MODULE_NAME, pmenu_reports.get_ID(), 4010)); + + + factory.add(ctx, SMENU_POSINFO_ID, + MenuManager.createSubMenu(ctx, "smenu.sales.report.per.terminal", + "POSInfoReport.do", + MODULE_NAME, pmenu_reports.get_ID(), 4020)); + + factory.add(ctx, SMENU_ORDERHISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.order.history", + "InitPOSHistoryAction.do?action=initPOSHistory", + MODULE_NAME, pmenu_reports.get_ID(), 4030)); + + + factory.add(ctx, SMENU_DOCUMENTHISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.document.history", + "DocumentHistoryAction.do?action=initHistory", + MODULE_NAME, pmenu_reports.get_ID(), 4040)); + + factory.add(ctx, SMENU_VIEW_BPINFO, + MenuManager.createSubMenu(ctx, "smenu.bpartner.sales.details", + "ViewBPartnerInfoAction.do?action=getBpartnerInfo", + MODULE_NAME, pmenu_reports.get_ID(), 4050)); + + factory.add(ctx, SMENU_POS_SALES_REPORT_ID, + MenuManager.createSubMenu(ctx, "smenu.sales.report", + "SalesReport.do?action=getSalesReport&isSalesReport=true", + MODULE_NAME, pmenu_reports.get_ID(), 4060)); + + factory.add(ctx, SMENU_BEST_SELLING_ITEMS, + MenuManager.createSubMenu(ctx, SMENU_BEST_SELLING_ITEMS, + "POSReportAction.do?action=initBestSellingReport", + MODULE_NAME, pmenu_reports.get_ID(), 4070)); + + factory.add(ctx, SMENU_STOCK_SALES_REPORT, + MenuManager.createSubMenu(ctx, SMENU_STOCK_SALES_REPORT, + "ViewStockSales.do", + MODULE_NAME, pmenu_reports.get_ID(), 4080)); + + factory.add(ctx, SMENU_POS_PURCHASE_REPORT, + MenuManager.createSubMenu(ctx, SMENU_POS_PURCHASE_REPORT, + "SalesReport.do?action=getSalesReport&isSalesReport=false", + MODULE_NAME, pmenu_reports.get_ID(), 4090)); + + } + + + + private void loadStockMenu(Properties ctx, AbstractFactory factory) throws OperationException + { + MWebMenu pmenu_stock = MenuManager.createParentMenu(ctx, "pmenu.stock", MODULE_NAME, 5000); + pmenu_stock.setPosition(MENU_POSITION_TOP); + pmenu_stock.setImageLink("images/pos/buttons/button_order.gif"); + + factory.add(ctx, PMENU_STOCK_ID, pmenu_stock); + pmenu_stock = (MWebMenu)factory.get(ctx, PMENU_STOCK_ID); + + factory.add(ctx, SMENU_POSSTOCKMOV, + MenuManager.createSubMenu(ctx, "smenu.stock.movement", + "StockMovementReport.do", + MODULE_NAME, pmenu_stock.get_ID(), 5010)); + + + factory.add(ctx, SMENU_MYSTOCK_ID, + MenuManager.createSubMenu(ctx, "smenu.stock", + "GetPOSStockAction.do?action=initPOSStock", + MODULE_NAME, pmenu_stock.get_ID(), 5020)); + + + factory.add(ctx, SMENU_FASTMOVITEMS, + MenuManager.createSubMenu(ctx, "smenu.fast.moving.items", + "CustomFastMovingItemsReport.do", + MODULE_NAME, pmenu_stock.get_ID(), 5030)); + + factory.add(ctx, SMENU_SLOWMOVITEMS, + MenuManager.createSubMenu(ctx, "smenu.slow.moving.items", + "CustomSlowMovingItemsReport.do", + MODULE_NAME, pmenu_stock.get_ID(), 5040)); + + factory.add(ctx, SMENU_ADJUST_STOCK_ID, + MenuManager.createSubMenu(ctx, "smenu.adjust.stock.id", + "InventoryCartAction.do?action=newInventoryCart", + MODULE_NAME, pmenu_stock.get_ID(), 5040)); + + factory.add(ctx, SMENU_INVENTORY_HISTORY_ID, + MenuManager.createSubMenu(ctx, "smenu.inventory.history.id", + "ViewInventoryHistoryAction.do?action=viewInventoryHistory", + MODULE_NAME, pmenu_stock.get_ID(), 5050)); + + factory.add(ctx, SMENU_TRANSFER_STOCK, + MenuManager.createSubMenu(ctx, "smenu.transfer.stock", + "ViewStock.do?action=viewStock", + MODULE_NAME, pmenu_stock.get_ID(), 5060)); + + factory.add(ctx, SMENU_INVENTORY_MOVE, + MenuManager.createSubMenu(ctx, "smenu.inventory.move", + "StockMovementAction.do?action=viewMMovementHistory", + MODULE_NAME, pmenu_stock.get_ID(), 5070)); + + factory.add(ctx, SMENU_MOVE_CONFIRMATION, + MenuManager.createSubMenu(ctx, "smenu.move.confirmation", + "StockMovementAction.do?action=viewMoveConfirm", + MODULE_NAME, pmenu_stock.get_ID(), 5080)); + + } + + + private void loadAdministrationMenu(Properties ctx, AbstractFactory factory) throws OperationException + { + MWebMenu pmenu_administration = MenuManager.createParentMenu(ctx, "pmenu.administration", MODULE_NAME, 6000); + pmenu_administration.setPosition(MENU_POSITION_TOP); + pmenu_administration.setImageLink("images/pos/buttons/button_administration.gif"); + + factory.add(ctx, PMENU_ADMINISTRATION_ID, pmenu_administration); + pmenu_administration = (MWebMenu)factory.get(ctx, PMENU_ADMINISTRATION_ID); + + factory.add(ctx, SMENU_CUSTOMER, + MenuManager.createSubMenu(ctx, "smenu.customers", + //"ViewAllCustomers.do", + "POSCustomerAction.do?action=initSearchPOSCustomer", + MODULE_NAME, pmenu_administration.get_ID(), 6010)); + + factory.add(ctx, SMENU_CREATEVENDOR_ID, + MenuManager.createSubMenu(ctx, "smenu.vendors", + "SearchVendor.do?action=initSearchVendors", + MODULE_NAME, pmenu_administration.get_ID(), 6020)); + + + factory.add(ctx, SMENU_USER_ID, + MenuManager.createSubMenu(ctx, "smenu.users", + "ListPOSUsers.do", + MODULE_NAME, pmenu_administration.get_ID(), 6030)); + + + factory.add(ctx, SMENU_VIEWROLE_ID, + MenuManager.createSubMenu(ctx, "smenu.role", + "ListPOSRoles.do", + MODULE_NAME, pmenu_administration.get_ID(), 6040)); + + + factory.add(ctx, SMENU_PRODUCTS, + MenuManager.createSubMenu(ctx, "smenu.products", + "ViewAllPOSProduct.do", + MODULE_NAME, pmenu_administration.get_ID(), 6050)); + + factory.add(ctx, SMENU_BARCODE_PRINTING, + MenuManager.createSubMenu(ctx, SMENU_BARCODE_PRINTING, + "initProductBarcodeCart.do", + MODULE_NAME, pmenu_administration.get_ID(), 6060)); + + factory.add(ctx, SMENU_EDIT_ATTRIBUTE_VALUE, + MenuManager.createSubMenu(ctx, "smenu.edit.product.attribute.value", + "InitViewAttributesAction.do?action=initViewAttributeValues", + MODULE_NAME, pmenu_administration.get_ID(), 6070)); + + + factory.add(ctx, SMENU_CHECK_SEQUENCE, + MenuManager.createSubMenu(ctx, "smenu.check.repair.database.integrity", + "CheckSequenceAction.do?action=checkSequence", + MODULE_NAME, pmenu_administration.get_ID(), 6080)); + + + factory.add(ctx, SMENU_GENERATE_COMMISSION_ID, + MenuManager.createSubMenu(ctx, "smenu.generate.commission", + "GenerateCommission.do", + MODULE_NAME, pmenu_administration.get_ID(), 6090)); + + factory.add(ctx, SMENU_VIEW_GENERATED_COMMISSION_ID, + MenuManager.createSubMenu(ctx, "smenu.view.last.generated.commission", + "ViewCommissionAction.do?action=viewCommission", + MODULE_NAME, pmenu_administration.get_ID(), 6100)); + + factory.add(ctx, SMENU_VIEW_PAYMENT_TERM, + MenuManager.createSubMenu(ctx, "smenu.payment.term", + "ViewAllPaymentTermAction.do?action=viewAllPaymentTerms", + MODULE_NAME, pmenu_administration.get_ID(), 6110)); + + factory.add(ctx, SMENU_VIEW_TAX, + MenuManager.createSubMenu(ctx, "smenu.tax", + "TaxAction.do?action=viewAllTax", + MODULE_NAME, pmenu_administration.get_ID(), 6120)); + + factory.add(ctx, SMENU_VIEW_PREFERENCES, + MenuManager.createSubMenu(ctx, "smenu.preferences", + "ViewPreferences.do", + MODULE_NAME, pmenu_administration.get_ID(), 6130)); + + factory.add(ctx, SMENU_VIEW_BPARTNERS, + MenuManager.createSubMenu(ctx, "smenu.bpartners", + "BusinessPartners.do", + MODULE_NAME, pmenu_administration.get_ID(), 6140)); + + factory.add(ctx, SMENU_PRICE_CHECK, + MenuManager.createSubMenu(ctx, "smenu.price.check", + "PriceCheck.do", + MODULE_NAME, pmenu_administration.get_ID(), 6150)); + + factory.add(ctx, SMENU_ORGANISATION, + MenuManager.createSubMenu(ctx, "smenu.organisation", + "ListOrgs.do", + MODULE_NAME, pmenu_administration.get_ID(), 6160)); + + factory.add(ctx, SMENU_PRICE_LIST, + MenuManager.createSubMenu(ctx, SMENU_PRICE_LIST, + "ListPriceLists.do", + MODULE_NAME, pmenu_administration.get_ID(), 6170)); + + factory.add(ctx, SMENU_CURRENCY, + MenuManager.createSubMenu(ctx, SMENU_CURRENCY, + "ListCurrencies.do", + MODULE_NAME, pmenu_administration.get_ID(), 6180)); + + factory.add(ctx, SMENU_DELETE_PRICE_ON_PRICELIST, + MenuManager.createSubMenu(ctx, SMENU_DELETE_PRICE_ON_PRICELIST, + "PriceListAction.do?action=fromDeletePriceOnPriceList", + MODULE_NAME, pmenu_administration.get_ID(), 6190)); + + factory.add(ctx, SMENU_CASHBOOK, + MenuManager.createSubMenu(ctx, SMENU_CASHBOOK, + "SearchCashBookAction.do?action=initSearchCashBook", + MODULE_NAME, pmenu_administration.get_ID(), 6200)); + + factory.add(ctx, SMENU_TERMINAL, + MenuManager.createSubMenu(ctx, SMENU_TERMINAL, + "SearchTerminalAction.do?action=initSearchTerminal", + MODULE_NAME, pmenu_administration.get_ID(), 6210)); + } + + //---------------------------------------------------------------------// + private void loadHelpMenu(Properties ctx, AbstractFactory factory) throws OperationException + { + MWebMenu pmenu_help = MenuManager.createParentMenu(ctx, "pmenu.help", MODULE_NAME, 7000); + pmenu_help.setPosition(MENU_POSITION_TOP); + pmenu_help.setImageLink("images/pos/buttons/button_order.gif"); + + factory.add(ctx, PMENU_HELP_ID, pmenu_help); + pmenu_help = (MWebMenu)factory.get(ctx, PMENU_HELP_ID); + + factory.add(ctx, SMENU_USER_MANUAL, + MenuManager.createSubMenu(ctx, SMENU_USER_MANUAL, + "javascript:void window.open(\"http://www.posterita.org/mediawiki/index.php/User%60s_Manual\")", + MODULE_NAME, pmenu_help.get_ID(), 7010)); + + + factory.add(ctx, SMENU_CONTACTUS, + MenuManager.createSubMenu(ctx, SMENU_CONTACTUS, + "POSHelpAction.do?action=initContactUs", + MODULE_NAME, pmenu_help.get_ID(), 7020)); + } + + /** + * Reports are loaded based on the process access defined for a particular role. + * @param ctx context + * @param factory abstract factory + * @throws OperationException + */ + private void loadReportsMenu(Properties ctx, AbstractFactory factory) throws OperationException + { + MWebMenu pmenu_reports= MenuManager.createParentMenu(ctx, "pmenu.new.reports", MODULE_NAME, 8000); + pmenu_reports.setPosition(MENU_POSITION_TOP); + pmenu_reports.setImageLink("images/pos/buttons/button_order.gif"); + + factory.add(ctx,PMENU_NEW_REPORTS_ID, pmenu_reports); + pmenu_reports = (MWebMenu)factory.get(ctx, PMENU_NEW_REPORTS_ID); + + ArrayList processIds = POSReportManager.loadReports(ctx); + int sequence = 8010; + for (Integer id: processIds) + { + MProcess process = MProcess.get(ctx, id); + String menuName = process.getName(); + + factory.add(ctx, menuName, MenuManager.createSubMenu(ctx, menuName, + "GenerateReportAction.do?action=generateReportInput&processId=" + id, + MODULE_NAME, pmenu_reports.get_ID(), sequence)); + sequence += 10; + } +} + + public PO get(Properties ctx, String key) throws OperationException + { + Properties nCtx = (Properties)ctx.clone(); + Env.setContext(nCtx, UdiConstants.CLIENT_ID_CTX_PARAM, "0"); + Env.setContext(nCtx, UdiConstants.ORG_ID_CTX_PARAM, "0"); + return super.get(nCtx, key); + } + + protected void setFields(Properties ctx, PO fromPO, PO toPO) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException + { + MWebMenu fromUMenu = (MWebMenu)fromPO; + MWebMenu toUMenu = (MWebMenu)toPO; + + toUMenu.setMenuLink(fromUMenu.getMenuLink()); + toUMenu.setName(fromUMenu.getName()); + toUMenu.setHasSubMenu(fromUMenu.isHasSubMenu()); + toUMenu.setModule(fromUMenu.getModule()); + toUMenu.setParentMenu_ID(fromUMenu.getParentMenu_ID()); + toUMenu.setImageLink(fromUMenu.getImageLink()); + toUMenu.setIsActive(fromUMenu.isActive()); + toUMenu.setPosition(fromUMenu.getPosition()); + toUMenu.setCategory(fromUMenu.getCategory()); + toUMenu.setSequence(fromUMenu.getSequence()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/factory/ProcessFactory.java b/posterita/posterita/src/main/org/posterita/factory/ProcessFactory.java new file mode 100644 index 0000000000..6f995b8c7a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/ProcessFactory.java @@ -0,0 +1,93 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 6, 2005 by vishee + */ + +package org.posterita.factory; + +import java.util.Properties; + +import org.compiere.model.MProcess; +import org.compiere.process.SvrProcess; +import org.posterita.exceptions.OperationException; + + + +public class ProcessFactory extends AbstractFactory +{ + + + private static ProcessFactory singleton; + + + private ProcessFactory() throws OperationException + { + super(); + + } + + public static ProcessFactory getFactoryInstance(Properties ctx) throws Exception + { + if (singleton ==null) + singleton = new ProcessFactory(); + + return singleton; + } + + + protected void loadFactory(Properties ctx) throws OperationException + { + loadFactory(ctx, singleton); + } + + + + /* + * key - the value retrieved from properties file for the name of the process + * className - the class from which the process will run (eg com.mu.process.MyProcess where MyProcess is the java file) + */ + private MProcess createProcess(Properties ctx, String className) throws OperationException + { + + MProcess mProcess = new MProcess(ctx,0, null); + mProcess.setClassname(className); + mProcess.setDescription(className); + mProcess.setName(className); + mProcess.setValue(className); + + + return mProcess; + + } + + public SvrProcess getSvrProcess(Properties ctx,String key) throws Exception + { + MProcess p = (MProcess) singleton.get(ctx, key); + Object arr[] = {}; + SvrProcess process = (SvrProcess) Class.forName(p.getClass().getName()).getConstructors()[0].newInstance(arr); // use better reflection + return process; + } + + @Override + protected void loadFactory(Properties ctx, AbstractFactory factory) throws OperationException + { + // TODO Auto-generated method stub + + } +} diff --git a/posterita/posterita/src/main/org/posterita/factory/SystemObjectsFactory.java b/posterita/posterita/src/main/org/posterita/factory/SystemObjectsFactory.java new file mode 100644 index 0000000000..26af960e4a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/SystemObjectsFactory.java @@ -0,0 +1,81 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.factory; + +import java.util.Properties; + +import org.compiere.model.MTax; +import org.compiere.model.MTaxCategory; +import org.posterita.core.SystemObjects; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ReloadFactoryException; +import org.posterita.lib.UdiConstants; + + +public class SystemObjectsFactory extends AbstractFactory +{ + public static final String DEFAULT_TAX_ID = "tax.default.id"; + public static final String TAX_CATEGORY_DEFAULT_ID = "taxCategory.default.id"; + private static SystemObjectsFactory systemObjectsFactory; + + private SystemObjectsFactory() throws OperationException + { + + } + + public static SystemObjectsFactory getFactoryInstance() throws OperationException + { + if (systemObjectsFactory == null) + systemObjectsFactory = new SystemObjectsFactory(); + + return systemObjectsFactory; + } + + + protected void loadFactory(Properties ctx) throws OperationException + { + loadFactory(ctx, systemObjectsFactory); + } + + protected void loadFactory(Properties ctx, AbstractFactory factory) throws OperationException + { + factory.add(ctx, TAX_CATEGORY_DEFAULT_ID, SystemObjects.getTaxCategory(ctx, "Default Tax Category")); + MTaxCategory taxCategory = (MTaxCategory) factory.get(ctx, TAX_CATEGORY_DEFAULT_ID); + + MTax tax = SystemObjects.getTax(ctx, "Udi tax", UdiConstants.COUNTRY_MAURITIUS, "default udi tax"); + tax.setC_TaxCategory_ID(taxCategory.get_ID()); + factory.add(ctx, DEFAULT_TAX_ID, tax); + } + + public static void reloadFactory(Properties ctx) throws ReloadFactoryException + { + try + { + SystemObjectsFactory nFactory = new SystemObjectsFactory(); + nFactory.initFactory(ctx, nFactory); + systemObjectsFactory = nFactory; + } + catch(OperationException ex) + { + throw new ReloadFactoryException("Could not reload SystemObjectsFactory", ex); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/factory/UserFactory.java b/posterita/posterita/src/main/org/posterita/factory/UserFactory.java new file mode 100644 index 0000000000..dea71b99b6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/UserFactory.java @@ -0,0 +1,88 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.factory; + +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MOrg; +import org.compiere.model.MUser; +import org.compiere.model.PO; +import org.compiere.util.Env; +import org.posterita.core.SystemObjects; +import org.posterita.exceptions.OperationException; + + +public class UserFactory extends AbstractFactory +{ + private static UserFactory singleton; + + public static final String SUPER_USER_ID = "superUser.id"; + public static String UDI_ADMIN_ID = "udiAdmin.id"; + public static String HSAFAUTO_ADMIN_ID = "hsafAuto.admin.id"; + public static String HSAFWING_ADMIN_ID = "hsafWing.Admin.id"; + + private UserFactory() throws OperationException + { + + } + + public static UserFactory getFactoryInstance() throws OperationException + { + if (singleton == null) + singleton = new UserFactory(); + + return singleton; + } + + protected void loadFactory(Properties ctx) throws OperationException + { + loadFactory(ctx, singleton); + } + + protected void loadFactory(Properties ctx, AbstractFactory factory) throws OperationException + { + factory.add(ctx, SUPER_USER_ID, createUser(ctx, SystemObjects.getSuperUser(ctx))); + // singleton.add(UDI_ADMIN_ID, createUser(ctx, SystemObjects.getUdiAdmin(ctx))); + // singleton.add(HSAFAUTO_ADMIN_ID, createUser(ctx, SystemObjects.getHsafAuto(ctx))); + // singleton.add(HSAFWING_ADMIN_ID, createUser(ctx, SystemObjects.getHsafWing(ctx))); + + } + + private PO createUser(Properties ctx, MUser mUser) throws OperationException + { + MUser user = new MUser(ctx, 0, null); + user.setName(mUser.getName()); + user.setPassword(mUser.getPassword()); + user.setEMail(mUser.getEMail()); + + int ad_org_id = Env.getAD_Org_ID(ctx); + MOrg org = new MOrg(ctx, ad_org_id, null); + + // Is it necessary, taking business partner of the organisation. + // Should create a bpartner for this user. + // DefaultUser, Should maybe call a manager here. + MBPartner bpartner = new MBPartner(ctx, org.getLinkedC_BPartner_ID(null), null); + + user.setC_BPartner_ID(bpartner.get_ID()); + + return user; + } +} diff --git a/posterita/posterita/src/main/org/posterita/factory/WebComponentFactory.java b/posterita/posterita/src/main/org/posterita/factory/WebComponentFactory.java new file mode 100644 index 0000000000..11b787595f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/WebComponentFactory.java @@ -0,0 +1,290 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.factory; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.apache.ecs.Element; +import org.apache.ecs.xhtml.input; +import org.apache.ecs.xhtml.label; +import org.apache.ecs.xhtml.option; +import org.apache.ecs.xhtml.script; +import org.apache.ecs.xhtml.select; +import org.apache.ecs.xhtml.td; +import org.apache.ecs.xhtml.tr; +import org.compiere.model.Lookup; +import org.compiere.model.MProcessPara; +import org.compiere.model.MRefList; +import org.compiere.model.MRefTable; +import org.compiere.model.PO; +import org.compiere.util.DB; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.ValueNamePair; +import org.posterita.businesslogic.administration.RoleManager; + +/** + * Factory to load a web component which corresponds to the display + * type of a process parameter and populates it with the appropriate + * values as per the constraints of the parameter. + * + * @author sendy + * + */ +public class WebComponentFactory +{ + + public static org.apache.ecs.Element getWebComponent(Properties ctx, MProcessPara parameter) throws Exception + { + Element element = null; + label name = new label().addElement(parameter.getName()); + td label = new td().addElement(name); + td editor = new td().setAlign("left"); + + + input textFrom = new input(input.TYPE_TEXT, parameter.getColumnName()+ "From", ""); + input textTo = new input(input.TYPE_TEXT, parameter.getColumnName() + "To", ""); + input text = new input(input.TYPE_TEXT, parameter.getColumnName(), ""); + + int displayType = parameter.getAD_Reference_ID(); + + if (DisplayType.isLookup(displayType) || DisplayType.isID(displayType)) + { + option[] options = getOptions(ctx, parameter); + select select = new select(parameter.getColumnName(), options); + editor = editor.addElement(select); + } + else if (displayType == DisplayType.YesNo) + { + input inputCheck = new input(input.TYPE_CHECKBOX, parameter.getColumnName(), "Y"); + editor = editor.addElement(inputCheck); + } + else if (DisplayType.isNumeric(displayType) + || displayType == DisplayType.String) // SENDYFIXME need to add calculator for numeric + { + if (parameter.isRange()) + { + editor = editor.addElement(textFrom).addElement("-").addElement(textTo); + } + else + { + editor = editor.addElement(text); + } + } + else if (DisplayType.isDate(displayType)) + { + if (parameter.isRange()) + { + String idFrom = textFrom.getAttribute("name"); + textFrom.setID(idFrom); + script scriptFrom = getScript(idFrom); + input calendarFromBtn = getCalendarBtn(idFrom); + editor = editor.addElement(textFrom).addElement(calendarFromBtn).addElement(scriptFrom).addElement("-"); + + String idTo = textTo.getAttribute("name"); + textTo.setID(idTo); + script scriptTo = getScript(idTo); + input calendarToBtn = getCalendarBtn(idTo); + + editor = editor.addElement(textTo).addElement(calendarToBtn).addElement(scriptTo); + } + else + { + String id = text.getAttribute("name"); + text.setID(id); + script script = getScript(id); + input calendarBtn = getCalendarBtn(id); + + editor = editor.addElement(text).addElement(calendarBtn).addElement(script); + } + } + else // FIXME need to cater for other display types such as locator, location, etc + { + editor = editor.addElement(text); + } + + td tdContent = label.addElement(editor); + element = new tr().addElement(tdContent); + return element; + } + + private static option[] getOptions(Properties ctx, MProcessPara parameter) + throws Exception + { + int displayType = parameter.getAD_Reference_ID(); + String columnName = parameter.getColumnName(); + String tableName = null; + String whereClause = null; + String orderBy = null; + option[] options = null; + + Lookup lookup = parameter.getLookup(); + if (displayType == DisplayType.Table || displayType == DisplayType.Search) + { + int refValueId = parameter.getAD_Reference_Value_ID(); + + if (refValueId != 0) + { + MRefTable refTable = getRefTable(ctx, parameter.getAD_Reference_Value_ID(), null); + tableName = refTable.getAD_Table().getTableName(); + whereClause = refTable.getWhereClause(); + String validation = lookup.getValidation(); + + if (validation != null && !validation.equals("")) + { + whereClause += " AND " + validation; + } + orderBy = refTable.getOrderByClause(); + } + else + { + tableName = columnName.substring(0, columnName.length() - 3); + } + } + else if (displayType == DisplayType.TableDir + || displayType == DisplayType.Locator + || displayType == DisplayType.Location) + { + tableName = columnName.substring(0, columnName.length() - 3); + } + + if (displayType != DisplayType.List) // get key name pair from table + { + ArrayList keyNamePair = getKeyNamePair(ctx, parameter, + tableName, whereClause, orderBy, null); + options = new option[keyNamePair.size() + 1]; + int count = 1; + options[0] = new option(null); + + for (KeyNamePair pair : keyNamePair) + { + options[count] = new option(pair.getName(), pair.getKey()); + options[count].addElement(pair.getName()); + count++; + } + } + else // get value name list + { + ValueNamePair[] refListVNP = MRefList.getList(ctx, parameter + .getAD_Reference_Value_ID(), false); + options = new option[refListVNP.length + 1]; + int count = 1; + options[0] = new option(null); + + for (ValueNamePair pair : refListVNP) + { + options[count] = new option(pair.getName(), pair.getValue()); + options[count].addElement(pair.getName()); + count++; + } + } + + return options; + } + + private static input getCalendarBtn(String id) + { + input calendarBtn = new input(input.TYPE_BUTTON, "", ""); + calendarBtn.setID(id + "Btn"); + calendarBtn.setClass("calendar-icon float-left"); + + return calendarBtn; + } + + private static script getScript(String id) + { + script s = new script("function setDate(calendar){};" + + "Calendar.setup({ inputField : '" + id + + "', ifFormat : '%Y-%m-%d',showTime : true," + "button : '" + + id + "Btn', onUpdate : setDate });"); + return s; + } + + private static MRefTable getRefTable(Properties ctx, + int reference_Value_ID, String trxName) + { + String sql = "SELECT * from AD_Ref_Table where AD_Reference_ID = " + + reference_Value_ID; + + PreparedStatement pstmt = null; + ResultSet rs = null; + MRefTable refTable = null; + try + { + pstmt = DB.prepareStatement(sql, trxName); + rs = pstmt.executeQuery(); + + if (rs.next()) + { + refTable = new MRefTable(ctx, rs, trxName); + } + } + catch (SQLException e) + { + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + return refTable; + } + + private static ArrayList getKeyNamePair(Properties ctx, + MProcessPara parameter, String tableName, String whereClause, + String orderBy, String trxName) + { + String orgs = RoleManager.getRoleViewableOrgAccess(ctx); + StringBuffer sql = new StringBuffer(); + + if (whereClause != null && !whereClause.equals("")) + { + sql.append(whereClause + " AND"); + } + sql.append(" isActive = 'Y'").append( + " AND AD_Client_ID IN (0," + Env.getAD_Client_ID(ctx) + ")") + .append(" AND AD_Org_ID IN (" + orgs + ")"); + + if (orderBy != null && !orderBy.equals("")) + { + sql.append(" Order by " + orderBy); + } + + int ids[] = PO.getAllIDs(tableName, sql.toString(), trxName); + ArrayList list = new ArrayList(); + + for (int id : ids) + { + Lookup lookup = parameter.getLookup(); + String value = lookup.getDisplay(id); + KeyNamePair pair = new KeyNamePair(id, value); + list.add(pair); + } + return list; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/factory/WebProperties.java b/posterita/posterita/src/main/org/posterita/factory/WebProperties.java new file mode 100644 index 0000000000..f8e18d3df8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/factory/WebProperties.java @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 12-Oct-2005 + */ + + +package org.posterita.factory; + +import java.util.Properties; + +import org.posterita.exceptions.OperationException; + +public interface WebProperties +{ + public void put(Properties ctx, String key, String value) throws OperationException; + public String get(Properties ctx, String key) throws OperationException; + +} diff --git a/posterita/posterita/src/main/org/posterita/form/AttachmentForm.java b/posterita/posterita/src/main/org/posterita/form/AttachmentForm.java new file mode 100644 index 0000000000..2fc2a45925 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/AttachmentForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.AttachmentBean; +import org.posterita.struts.core.DefaultForm; + +public class AttachmentForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public AttachmentForm() + { + setBean(new AttachmentBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/AttributeForm.java b/posterita/posterita/src/main/org/posterita/form/AttributeForm.java new file mode 100644 index 0000000000..15b0de8ca3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/AttributeForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 15, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.AttributeBean; +import org.posterita.struts.core.DefaultForm; + + +public class AttributeForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public AttributeForm() + { + setBean(new AttributeBean()); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/AttributeValuesForm.java b/posterita/posterita/src/main/org/posterita/form/AttributeValuesForm.java new file mode 100644 index 0000000000..d838092163 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/AttributeValuesForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 23, 2006 by ashley +* +*/ + +package org.posterita.form; + +import org.posterita.beans.AttributeValueDetailBean; +import org.posterita.struts.core.DefaultForm; + +public class AttributeValuesForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public AttributeValuesForm() + { + setBean(new AttributeValueDetailBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/BPartnerForm.java b/posterita/posterita/src/main/org/posterita/form/BPartnerForm.java new file mode 100644 index 0000000000..11564884a2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/BPartnerForm.java @@ -0,0 +1,49 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. POSTERITA SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Aug 12, 2008 11:01:56 PM by praveen + * + */ + +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.BPartnerBean; +import org.posterita.struts.bPartner.BPartnerAction; +import org.posterita.struts.core.DefaultForm; + +public class BPartnerForm extends DefaultForm +{ + public BPartnerForm() + { + setBean(new BPartnerBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(BPartnerAction.GET_CREDITOR_HISTORY.equals(this.action)) + { + // add required fields here + } + + return super.validate(mapping, request); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/BPartnerInfoForm.java b/posterita/posterita/src/main/org/posterita/form/BPartnerInfoForm.java new file mode 100644 index 0000000000..948ba2c066 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/BPartnerInfoForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 26, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.BPartnerInfoBean; +import org.posterita.struts.core.DefaultForm; + + +public class BPartnerInfoForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public BPartnerInfoForm() + { + setBean(new BPartnerInfoBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/BankForm.java b/posterita/posterita/src/main/org/posterita/form/BankForm.java new file mode 100644 index 0000000000..eea521bcd6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/BankForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Jul-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.BankBean; +import org.posterita.struts.core.DefaultForm; + + +public class BankForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BankForm() + { + setBean(new BankBean()); + addRequiredFields(new String[]{"bankName"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/BlackListForm.java b/posterita/posterita/src/main/org/posterita/form/BlackListForm.java new file mode 100644 index 0000000000..1fada75b88 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/BlackListForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Jul-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.BlackListedBean; +import org.posterita.struts.core.DefaultForm; + + +public class BlackListForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BlackListForm() + { + setBean(new BlackListedBean()); + //addRequiredFields(new String[] {"bankName", "chequeNo"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/CashBookDetailForm.java b/posterita/posterita/src/main/org/posterita/form/CashBookDetailForm.java new file mode 100644 index 0000000000..b236ffca39 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CashBookDetailForm.java @@ -0,0 +1,55 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 5, 2006 + */ + + +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.CashBookDetailBean; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.CashBookAction; + + +public class CashBookDetailForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public CashBookDetailForm() + { + setBean(new CashBookDetailBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + // Add validation to the form for cash book adjustment + if(CashBookAction.ADJUST_CASH_BOOK_ACTION.equals(action)) + { + addRequiredFields(new String[]{"adjustmentAmount", "transferType", "description"}); + } + + return super.validate(mapping, request); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/CashBookForm.java b/posterita/posterita/src/main/org/posterita/form/CashBookForm.java new file mode 100644 index 0000000000..4e065c2a87 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CashBookForm.java @@ -0,0 +1,36 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.form; + +import org.posterita.beans.CashBookBean; +import org.posterita.struts.core.DefaultForm; + +/** + * @author Ashley G Ramdass + * May 27, 2008 + */ +public class CashBookForm extends DefaultForm +{ + + public CashBookForm() + { + super.setBean(new CashBookBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/CashForm.java b/posterita/posterita/src/main/org/posterita/form/CashForm.java new file mode 100644 index 0000000000..9598d89877 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CashForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Sep 11, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.form; + +import org.posterita.beans.CashBean; +import org.posterita.struts.core.DefaultForm; + +public class CashForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public CashForm() + { + this.setBean(new CashBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ChangeDocumentStatusForm.java b/posterita/posterita/src/main/org/posterita/form/ChangeDocumentStatusForm.java new file mode 100644 index 0000000000..1ed9047bda --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ChangeDocumentStatusForm.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.form; + +import org.posterita.beans.ChangeDocumentStatusBean; +import org.posterita.struts.core.DefaultForm; + + +public class ChangeDocumentStatusForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ChangeDocumentStatusForm() + { + setBean(new ChangeDocumentStatusBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ChangePasswordForm.java b/posterita/posterita/src/main/org/posterita/form/ChangePasswordForm.java new file mode 100644 index 0000000000..be5ac9d6be --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ChangePasswordForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 29, 2005 by din + */ + +package org.posterita.form; + +import org.posterita.beans.ChangePasswordBean; +import org.posterita.struts.core.DefaultForm; + +public class ChangePasswordForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ChangePasswordForm() + { + setBean(new ChangePasswordBean()); + addRequiredFields(new String[] {"oldPassword","newPassword","confirmPassword"}); + addMatchFields("newPassword","confirmPassword"); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/CheckoutForm.java b/posterita/posterita/src/main/org/posterita/form/CheckoutForm.java new file mode 100644 index 0000000000..101f477a23 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CheckoutForm.java @@ -0,0 +1,306 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * Mar 21, 2008 10:32:47 AM by praveen + * + */ + +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.config.ActionConfig; +import org.posterita.beans.CheckoutBean; +import org.posterita.struts.core.DefaultForm; + +public class CheckoutForm extends DefaultForm +{ + private String amountTendered; + private String amountRefunded; + private String cardNo; + private String chequeNo; + private String cashAmt; + private String chequeAmt; + private String cardAmt; + private String bpartnerId; + private String tenderType; + private String[] discount; + private String[] discountedPrice; + private String[] isDiscOnInclUnitPrice; + private String[] discInclUnitPrice; + private String orderType; + private String discountLimit; + private String priceListId; + private String toBeShipped = "true"; + private String discountedTotal; + private String discountOnTotal; + private String discountOnTotalPercent; + private String overridePriceLimit; + private String totalDiscount; + private String[] isDiscOnPerc; + private String[] isDiscOnTotal; + private String[] qtyPerLine; + private String m_productId; + private String grandTotal; + + public CheckoutForm() + { + setBean(new CheckoutBean()); + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + public String getRoleId() { + return roleId; + } + + public String getAmountTendered() { + return amountTendered; + } + public void setAmountTendered(String amountTendered) { + this.amountTendered = amountTendered; + } + public String getCardNo() { + return cardNo; + } + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + public String getChequeNo() { + return chequeNo; + } + public void setChequeNo(String chequeNo) { + this.chequeNo = chequeNo; + } + public String getCashAmt() { + return cashAmt; + } + public void setCashAmt(String cashAmt) { + this.cashAmt = cashAmt; + } + public String getChequeAmt() { + return chequeAmt; + } + public void setChequeAmt(String chequeAmt) { + this.chequeAmt = chequeAmt; + } + public String getBpartnerId() { + return bpartnerId; + } + public void setBpartnerId(String bpartnerId) { + this.bpartnerId = bpartnerId; + } + public String getTenderType() { + return tenderType; + } + public void setTenderType(String tenderType) { + this.tenderType = tenderType; + } + + public String getOrderType() { + return orderType; + } + public void setOrderType(String orderType) { + this.orderType = orderType; + } + + public String getDiscountLimit() { + return discountLimit; + } + + public void setDiscountLimit(String discountLimit) { + this.discountLimit = discountLimit; + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + ActionConfig config = (ActionConfig) request.getAttribute("org.apache.struts.action.mapping.instance"); + if(config != null && input != null) + { + config.setInput(input); + } + + ActionErrors errors = super.validate(mapping, request); + + if(errors!=null && !errors.isEmpty()) + { + reset(mapping, request); + } + + return errors; + } + + public String[] getDiscount() { + return discount; + } + + public void setDiscount(String[] discount) { + this.discount = discount; + } + + public String getAmountRefunded() { + return amountRefunded; + } + + public void setAmountRefunded(String amountRefunded) { + this.amountRefunded = amountRefunded; + } + + public String getCardAmt() { + return cardAmt; + } + + public void setCardAmt(String cardAmt) { + this.cardAmt = cardAmt; + } + + public String[] getDiscountedPrice() { + return discountedPrice; + } + + public void setDiscountedPrice(String[] discountedPrice) { + this.discountedPrice = discountedPrice; + } + + public String getPriceListId() { + return priceListId; + } + + public void setPriceListId(String priceListId) { + this.priceListId = priceListId; + } + + public String getToBeShipped() { + return toBeShipped; + } + + public void setToBeShipped(String toBeShipped) { + this.toBeShipped = toBeShipped; + } + + public String getDiscountedTotal() { + return discountedTotal; + } + + public void setDiscountedTotal(String discountedTotal) { + this.discountedTotal = discountedTotal; + } + + public String getDiscountOnTotal() { + return discountOnTotal; + } + + public void setDiscountOnTotal(String discountOnTotal) { + this.discountOnTotal = discountOnTotal; + } + + public String getOverridePriceLimit() { + return overridePriceLimit; + } + + public void setOverridePriceLimit(String overridePriceLimit) { + this.overridePriceLimit = overridePriceLimit; + } + + public String getTotalDiscount() { + return totalDiscount; + } + + public void setTotalDiscount(String totalDiscount) { + this.totalDiscount = totalDiscount; + } + + public String[] getIsDiscOnInclUnitPrice() { + return isDiscOnInclUnitPrice; + } + + public void setIsDiscOnInclUnitPrice(String[] isDiscOnInclUnitPrice) { + this.isDiscOnInclUnitPrice = isDiscOnInclUnitPrice; + } + + public String[] getDiscInclUnitPrice() { + return discInclUnitPrice; + } + + public void setDiscInclUnitPrice(String[] discInclUnitPrice) { + this.discInclUnitPrice = discInclUnitPrice; + } + + public String[] getIsDiscOnPerc() + { + return isDiscOnPerc; + } + + public void setIsDiscOnPerc(String[] isDiscOnPerc) + { + this.isDiscOnPerc = isDiscOnPerc; + } + + public String[] getIsDiscOnTotal() + { + return isDiscOnTotal; + } + + public void setIsDiscOnTotal(String[] isDiscOnTotal) + { + this.isDiscOnTotal = isDiscOnTotal; + } + + public String[] getQtyPerLine() + { + return qtyPerLine; + } + + public void setQtyPerLine(String[] qtyPerLine) + { + this.qtyPerLine = qtyPerLine; + } + + public String getDiscountOnTotalPercent() { + return discountOnTotalPercent; + } + + public void setDiscountOnTotalPercent(String discountOnTotalPercent) { + this.discountOnTotalPercent = discountOnTotalPercent; + } + + public String getM_productId() + { + return m_productId; + } + + public void setM_productId(String id) + { + m_productId = id; + } + + public String getGrandTotal() + { + return grandTotal; + } + + public void setGrandTotal(String grandTotal) + { + this.grandTotal = grandTotal; + } + + + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/CommissionForm.java b/posterita/posterita/src/main/org/posterita/form/CommissionForm.java new file mode 100644 index 0000000000..a46ae818aa --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CommissionForm.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 7, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.CommissionBean; +import org.posterita.struts.core.DefaultForm; + + +public class CommissionForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public CommissionForm() + { + this.setBean(new CommissionBean()); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/CreateBPartnerForm.java b/posterita/posterita/src/main/org/posterita/form/CreateBPartnerForm.java new file mode 100644 index 0000000000..6316cc2c5c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CreateBPartnerForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.BPartnerBean; +import org.posterita.struts.core.DefaultForm; + + +public class CreateBPartnerForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreateBPartnerForm() + { + setBean( new BPartnerBean()); + addRequiredFields(new String[]{"partnerName","name2","address1"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/CreateBankAccountForm.java b/posterita/posterita/src/main/org/posterita/form/CreateBankAccountForm.java new file mode 100644 index 0000000000..6ad931862f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CreateBankAccountForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 26, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.BankAccountBean; +import org.posterita.struts.core.DefaultForm; + +public class CreateBankAccountForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreateBankAccountForm() + { + setBean(new BankAccountBean()); + addRequiredFields(new String[]{"bankId","accountNo","accountType","currentBalance"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/CreateLocatorForm.java b/posterita/posterita/src/main/org/posterita/form/CreateLocatorForm.java new file mode 100644 index 0000000000..9f6718e330 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CreateLocatorForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Jul-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.LocatorBean; +import org.posterita.struts.core.DefaultForm; + + +public class CreateLocatorForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreateLocatorForm() + { + setBean(new LocatorBean()); + addRequiredFields(new String[]{"aisle","bin","level"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/CreateProductAttributeForm.java b/posterita/posterita/src/main/org/posterita/form/CreateProductAttributeForm.java new file mode 100644 index 0000000000..14527546f7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CreateProductAttributeForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 28, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.ProductAttributeBean; +import org.posterita.struts.core.DefaultForm; + +public class CreateProductAttributeForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreateProductAttributeForm() + { + setBean(new ProductAttributeBean()); + //addRequiredFields(new String[]{"attributeValue"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/CreateProductAttributeValueForm.java b/posterita/posterita/src/main/org/posterita/form/CreateProductAttributeValueForm.java new file mode 100644 index 0000000000..8bf7f3d4a7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CreateProductAttributeValueForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 28, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.ProductAttributeBean; +import org.posterita.struts.core.DefaultForm; + +public class CreateProductAttributeValueForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreateProductAttributeValueForm() + { + setBean(new ProductAttributeBean()); + addRequiredFields(new String[]{"attributeValue"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/CreateUserForm.java b/posterita/posterita/src/main/org/posterita/form/CreateUserForm.java new file mode 100644 index 0000000000..ebfe66e927 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CreateUserForm.java @@ -0,0 +1,44 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 29, 2005 by din + */ + +package org.posterita.form; + +import org.posterita.beans.UserBean; +import org.posterita.struts.core.DefaultForm; + + + +public class CreateUserForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreateUserForm() + { + setBean(new UserBean()); + addRequiredFields(new String[]{"username", "password", "confirmPassword","userPIN", "orgId"}); + addMatchFields("password","confirmPassword"); + //addEmailValidation("email"); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/CreditCardForm.java b/posterita/posterita/src/main/org/posterita/form/CreditCardForm.java new file mode 100644 index 0000000000..9264cc421c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CreditCardForm.java @@ -0,0 +1,43 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 02-Sep-2005 + */ + + +package org.posterita.form; + +import org.posterita.beans.CustomerBean; +import org.posterita.struts.core.DefaultForm; + + +public class CreditCardForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CreditCardForm() + { + + setBean(new CustomerBean()); + addRequiredFields(new String[]{"creditCardNumber", "cvv", "creditCardExpMonth", "creditCardExpYear"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/CurrencyForm.java b/posterita/posterita/src/main/org/posterita/form/CurrencyForm.java new file mode 100644 index 0000000000..3ebe2cf503 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CurrencyForm.java @@ -0,0 +1,39 @@ +/* + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Servansingh + * */ + +package org.posterita.form; + +import org.posterita.beans.CurrencyBean; +import org.posterita.struts.core.DefaultForm; + + + +public class CurrencyForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public CurrencyForm() + { + setBean(new CurrencyBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/CurrenrPOSBalanceForm.java b/posterita/posterita/src/main/org/posterita/form/CurrenrPOSBalanceForm.java new file mode 100644 index 0000000000..ab3c68060f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CurrenrPOSBalanceForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 5, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.CurrentTillAmountBean; +import org.posterita.struts.core.DefaultForm; + + +public class CurrenrPOSBalanceForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + +public CurrenrPOSBalanceForm() + { + setBean(new CurrentTillAmountBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/CustomerAndCreditCardForm.java b/posterita/posterita/src/main/org/posterita/form/CustomerAndCreditCardForm.java new file mode 100644 index 0000000000..b5e2ed6a84 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CustomerAndCreditCardForm.java @@ -0,0 +1,46 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 02-Sep-2005 + */ + + +package org.posterita.form; + +import org.posterita.beans.CustomerBean; +import org.posterita.struts.core.DefaultForm; + + +public class CustomerAndCreditCardForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CustomerAndCreditCardForm() + { + setBean(new CustomerBean()); + + addRequiredFields(new String[]{"creditCardPayment","username","userSurname", "email", "address1","address2","city","countryId"}); + addCreditCardFieldsValidation("creditCardPayment"); + addCVVFieldsValidation("creditCardPayment"); + addCreditCardExpiryDateFieldsValidation("creditCardPayment"); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/CustomerForm.java b/posterita/posterita/src/main/org/posterita/form/CustomerForm.java new file mode 100644 index 0000000000..49d9e1daea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/CustomerForm.java @@ -0,0 +1,48 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 02-Sep-2005 + */ + + +package org.posterita.form; + +import org.posterita.beans.CustomerBean; +import org.posterita.struts.core.DefaultForm; + + +public class CustomerForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public CustomerForm() + { + + setBean(new CustomerBean()); + addRequiredFields(new String[]{ + "partnerName" + ,"surname" + ,"address1" + }); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/DateFilterForm.java b/posterita/posterita/src/main/org/posterita/form/DateFilterForm.java new file mode 100644 index 0000000000..b7a829e6da --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/DateFilterForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Sep 11, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.form; + +import org.posterita.beans.DateFilterBean; +import org.posterita.struts.core.DefaultForm; + +public class DateFilterForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public DateFilterForm() + { + this.setBean(new DateFilterBean()); + addRequiredFields(new String[]{"fromDate", "toDate"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/DocumentForm.java b/posterita/posterita/src/main/org/posterita/form/DocumentForm.java new file mode 100644 index 0000000000..6bb16182a6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/DocumentForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 12-Aug-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.DocumentBean; +import org.posterita.struts.core.DefaultForm; + + +public class DocumentForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public DocumentForm() + { + setBean(new DocumentBean()); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/DocumentHistoryForm.java b/posterita/posterita/src/main/org/posterita/form/DocumentHistoryForm.java new file mode 100644 index 0000000000..53d4883285 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/DocumentHistoryForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.DocumentHistoryBean; +import org.posterita.struts.core.DefaultForm; + + +public class DocumentHistoryForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public DocumentHistoryForm() + { + setBean( new DocumentHistoryBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/DunningForm.java b/posterita/posterita/src/main/org/posterita/form/DunningForm.java new file mode 100644 index 0000000000..276ca021b0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/DunningForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 27, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.DunningBean; +import org.posterita.struts.core.DefaultForm; + + +public class DunningForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public DunningForm() + { + setBean( new DunningBean()); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/EditAttributeForm.java b/posterita/posterita/src/main/org/posterita/form/EditAttributeForm.java new file mode 100644 index 0000000000..b5677fbd66 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/EditAttributeForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 24, 2006 by ashley +* +*/ + +package org.posterita.form; + +import org.posterita.beans.AttributeValueDetailBean; +import org.posterita.struts.core.DefaultForm; + +public class EditAttributeForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public EditAttributeForm() + { + this.setBean(new AttributeValueDetailBean()); + this.addRequiredFields(new String[]{"newName"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/EditPriceListForm.java b/posterita/posterita/src/main/org/posterita/form/EditPriceListForm.java new file mode 100644 index 0000000000..715f9472a1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/EditPriceListForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 20, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.EditPriceBean; +import org.posterita.struts.core.DefaultForm; + +public class EditPriceListForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public EditPriceListForm() + { + setBean(new EditPriceBean()); + addRequiredFields(new String[]{"price"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/EditProductForm.java b/posterita/posterita/src/main/org/posterita/form/EditProductForm.java new file mode 100644 index 0000000000..4f186b1ec3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/EditProductForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 4, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.ProductBean; +import org.posterita.struts.core.DefaultForm; + +public class EditProductForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public EditProductForm() + { + setBean(new ProductBean()); + //addRequiredFields(new String[] {"productName","revenueRecognition","description"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/GarmentForm.java b/posterita/posterita/src/main/org/posterita/form/GarmentForm.java new file mode 100644 index 0000000000..4113912497 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/GarmentForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 30, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.ProductBean; +import org.posterita.struts.core.DefaultForm; + + +public class GarmentForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public GarmentForm() + { + setBean(new ProductBean()); + addRequiredFields(new String[] {"description","brandName","modelName","revenueRecognition","designName","colourName","purchasePriceStandard","salesPriceStandard"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/GeneralPaymentForm.java b/posterita/posterita/src/main/org/posterita/form/GeneralPaymentForm.java new file mode 100644 index 0000000000..adc5196f6d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/GeneralPaymentForm.java @@ -0,0 +1,16 @@ +package org.posterita.form; + +import org.posterita.beans.PaymentBean; +import org.posterita.struts.core.DefaultForm; + +public class GeneralPaymentForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public GeneralPaymentForm() + { + setBean(new PaymentBean()); + addRequiredFields(new String[]{"amount","bpartnerId"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/GenericProductForm.java b/posterita/posterita/src/main/org/posterita/form/GenericProductForm.java new file mode 100644 index 0000000000..83622e125d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/GenericProductForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.posterita.form; + +import org.posterita.beans.GenericProductBean; +import org.posterita.struts.core.DefaultForm; + + +public class GenericProductForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public GenericProductForm() + { + setBean(new GenericProductBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/InOutHistoryForm.java b/posterita/posterita/src/main/org/posterita/form/InOutHistoryForm.java new file mode 100644 index 0000000000..7e53bc3d30 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/InOutHistoryForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 16, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.InOutHistoryBean; +import org.posterita.struts.core.DefaultForm; + +public class InOutHistoryForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InOutHistoryForm() + { + setBean(new InOutHistoryBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/InitCustomerForm.java b/posterita/posterita/src/main/org/posterita/form/InitCustomerForm.java new file mode 100644 index 0000000000..939e980658 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/InitCustomerForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jan 16, 2007 + */ + + +package org.posterita.form; + +import org.posterita.beans.CustomerBean; +import org.posterita.struts.core.DefaultForm; + + +public class InitCustomerForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InitCustomerForm() + { + setBean(new CustomerBean()); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/InventoryForm.java b/posterita/posterita/src/main/org/posterita/form/InventoryForm.java new file mode 100644 index 0000000000..acd773bb0f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/InventoryForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 8, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.InventoryBean; +import org.posterita.struts.core.DefaultForm; + + +public class InventoryForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public InventoryForm() + { + setBean( new InventoryBean()); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/InventoryLineForm.java b/posterita/posterita/src/main/org/posterita/form/InventoryLineForm.java new file mode 100644 index 0000000000..a56b44f223 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/InventoryLineForm.java @@ -0,0 +1,17 @@ +package org.posterita.form; + +import org.posterita.beans.InventoryLineBean; +import org.posterita.struts.core.DefaultForm; + +public class InventoryLineForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InventoryLineForm() + { + setBean( new InventoryLineBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/InvoiceHistoryForm.java b/posterita/posterita/src/main/org/posterita/form/InvoiceHistoryForm.java new file mode 100644 index 0000000000..ec6ce344c5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/InvoiceHistoryForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 15, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.InvoiceHistoryBean; +import org.posterita.struts.core.DefaultForm; + +public class InvoiceHistoryForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvoiceHistoryForm() + { + setBean(new InvoiceHistoryBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/InvokeOrderForm.java b/posterita/posterita/src/main/org/posterita/form/InvokeOrderForm.java new file mode 100644 index 0000000000..71849dd110 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/InvokeOrderForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 11-Aug-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.OrderLineBean; +import org.posterita.struts.core.DefaultForm; + + +public class InvokeOrderForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public InvokeOrderForm() + { + setBean(new OrderLineBean()); + addRequiredFields(new String[]{"documentNo"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/ItemForm.java b/posterita/posterita/src/main/org/posterita/form/ItemForm.java new file mode 100644 index 0000000000..0f68c2d794 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ItemForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.form; + +import org.posterita.beans.ItemBean; +import org.posterita.struts.core.DefaultForm; + + +public class ItemForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ItemForm() + { + setBean(new ItemBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/LoginForm.java b/posterita/posterita/src/main/org/posterita/form/LoginForm.java new file mode 100644 index 0000000000..f876931e07 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/LoginForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.form; + +import org.posterita.beans.LoginBean; +import org.posterita.struts.core.DefaultForm; + + +public class LoginForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public LoginForm() + { + setBean(new LoginBean()); + //addRequiredFields(new String[] {"username", "password"}); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/form/MenuItemForm.java b/posterita/posterita/src/main/org/posterita/form/MenuItemForm.java new file mode 100644 index 0000000000..8b2648220c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/MenuItemForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Jul-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.MenuItemBean; +import org.posterita.struts.core.DefaultForm; + + +public class MenuItemForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public MenuItemForm() + { + setBean(new MenuItemBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/OpenItemForm.java b/posterita/posterita/src/main/org/posterita/form/OpenItemForm.java new file mode 100644 index 0000000000..70b0e723c2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/OpenItemForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 17, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.OpenItemBean; +import org.posterita.struts.core.DefaultForm; + + +public class OpenItemForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public OpenItemForm() + { + setBean( new OpenItemBean()); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/OrderForm.java b/posterita/posterita/src/main/org/posterita/form/OrderForm.java new file mode 100644 index 0000000000..2189fdcb17 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/OrderForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.form; + +import org.posterita.beans.OrderBean; +import org.posterita.struts.core.DefaultForm; + +public class OrderForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public OrderForm() + { + this.setBean(new OrderBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/OrderHistoryForm.java b/posterita/posterita/src/main/org/posterita/form/OrderHistoryForm.java new file mode 100644 index 0000000000..c95be9b137 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/OrderHistoryForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 04-Aug-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.OrderHistoryBean; +import org.posterita.struts.core.DefaultForm; + + +public class OrderHistoryForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public OrderHistoryForm() + { + setBean(new OrderHistoryBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/OrderLineForm.java b/posterita/posterita/src/main/org/posterita/form/OrderLineForm.java new file mode 100644 index 0000000000..1fcb12f9ea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/OrderLineForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 11-Aug-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.OrderLineBean; +import org.posterita.struts.core.DefaultForm; + + +public class OrderLineForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public OrderLineForm() + { + setBean(new OrderLineBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/OrgForm.java b/posterita/posterita/src/main/org/posterita/form/OrgForm.java new file mode 100644 index 0000000000..1f536a0f62 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/OrgForm.java @@ -0,0 +1,51 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.OrgBean; +import org.posterita.struts.admin.OrganisationAction; +import org.posterita.struts.core.DefaultForm; + + +public class OrgForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public OrgForm() + { + setBean(new OrgBean()); + + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(OrganisationAction.UPDATE_OR_CREATE_ORG.equals(action)) + { + addRequiredFields(new String[]{"orgName"}); + } + + return super.validate(mapping, request); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSDescriptionForm.java b/posterita/posterita/src/main/org/posterita/form/POSDescriptionForm.java new file mode 100644 index 0000000000..bc8553015f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSDescriptionForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 5, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.POSDescriptionBean; +import org.posterita.struts.core.DefaultForm; + + +public class POSDescriptionForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public POSDescriptionForm() + { + setBean(new POSDescriptionBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSForm.java b/posterita/posterita/src/main/org/posterita/form/POSForm.java new file mode 100644 index 0000000000..487b69f68a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSForm.java @@ -0,0 +1,43 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 22-Mar-2006 + */ + + +package org.posterita.form; + + +import org.posterita.beans.POSBean; +import org.posterita.struts.core.DefaultForm; + + +public class POSForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + +public POSForm() + { + setBean(new POSBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSHelpForm.java b/posterita/posterita/src/main/org/posterita/form/POSHelpForm.java new file mode 100644 index 0000000000..f3334d19ea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSHelpForm.java @@ -0,0 +1,60 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 6 Feb 2008 18:02:07 by shameem + * + */ + +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.POSHelpBean; +import org.posterita.pos.help.POSHelpAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.POSGoodsAction; +import org.posterita.struts.pos.POSProductAction; + +public class POSHelpForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public POSHelpForm() + { + setBean(new POSHelpBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(POSHelpAction.INIT_CONTACT_US.equals(action)) + { + // no validation required + } + else if(POSHelpAction.SEND_EMAIL.equals(action)) + { + addRequiredFields(new String[] {"fromAddress","subject","textMessage"}); + } + else + { + + } + + return super.validate(mapping, request); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSHistoryForm.java b/posterita/posterita/src/main/org/posterita/form/POSHistoryForm.java new file mode 100644 index 0000000000..14d4be6ec0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSHistoryForm.java @@ -0,0 +1,79 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on May 15, 2006 + */ + + +package org.posterita.form; + +import java.util.Calendar; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.POSHistoryBean; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.CashAction; + + +public class POSHistoryForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public POSHistoryForm() throws OperationException + { + setBean(new POSHistoryBean()); + initForm(); + } + + private void initForm() throws OperationException + { + try + { + Calendar cal = Calendar.getInstance(); + POSHistoryBean bean = (POSHistoryBean) getBean(); + + bean.setMonth(Integer.valueOf(cal.get(Calendar.MONTH) + 1)); + bean.setYear(Integer.valueOf(cal.get(Calendar.YEAR))); + + month = bean.getMonth().toString(); + year = bean.getYear().toString(); + } + catch (ApplicationException e) + { + throw new OperationException(e); + } + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if( CashAction.GET_CASH_DETAILS_HISTORY.equals(action)) + { + addRequiredFields(new String[] {"cashBookId"}); + } + return super.validate(mapping, request); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSInfoForm.java b/posterita/posterita/src/main/org/posterita/form/POSInfoForm.java new file mode 100644 index 0000000000..0d0c343b1f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSInfoForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 5, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.POSInfoBean; +import org.posterita.struts.core.DefaultForm; + + +public class POSInfoForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + +public POSInfoForm() + { + setBean(new POSInfoBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSOrderLineForm2.java b/posterita/posterita/src/main/org/posterita/form/POSOrderLineForm2.java new file mode 100644 index 0000000000..d54f0dba31 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSOrderLineForm2.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 11-Aug-2005 by alok + * + */ +package org.posterita.form; + +import org.posterita.beans.OrderLineBean; +import org.posterita.struts.core.DefaultForm; + + +public class POSOrderLineForm2 extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public POSOrderLineForm2() + { + setBean(new OrderLineBean()); + + addRequiredFields(new String[] {"bpartnerId"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSProductForm.java b/posterita/posterita/src/main/org/posterita/form/POSProductForm.java new file mode 100644 index 0000000000..ce9d931039 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSProductForm.java @@ -0,0 +1,42 @@ +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.ProductBean; +import org.posterita.struts.admin.OrganisationAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.POSGoodsAction; +import org.posterita.struts.pos.POSProductAction; + +public class POSProductForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public POSProductForm() + { + setBean(new ProductBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(POSProductAction.VIEW_PRODUCT.equals(action) || POSProductAction.GET_CREATE_PRODUCT_FORM.equals(action)) + { + + } + else if (POSProductAction.CREATE_OR_UPDATE_PRODUCT.equals(action)) + { + addRequiredFields(new String[] {"productName","revenueRecognition","description"}); + } + else + { + addRequiredFields(new String[] {"productName","purchasePriceStandard","description","salesPriceStandard","salesPriceLimit","salesPriceList"}); + } + + return super.validate(mapping, request); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSReportForm.java b/posterita/posterita/src/main/org/posterita/form/POSReportForm.java new file mode 100644 index 0000000000..912dfdc0aa --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSReportForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 11, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.POSReportBean; +import org.posterita.struts.core.DefaultForm; + + +public class POSReportForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public POSReportForm() + { + setBean(new POSReportBean()); + } + + } diff --git a/posterita/posterita/src/main/org/posterita/form/POSStockForm.java b/posterita/posterita/src/main/org/posterita/form/POSStockForm.java new file mode 100644 index 0000000000..9e976155ea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSStockForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 8, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.POSStockBean; +import org.posterita.struts.core.DefaultForm; + + +public class POSStockForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public POSStockForm() + { + setBean(new POSStockBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/POSSupplierForm.java b/posterita/posterita/src/main/org/posterita/form/POSSupplierForm.java new file mode 100644 index 0000000000..7992f1ccc9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/POSSupplierForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 8, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.POSSupplierBean; +import org.posterita.struts.core.DefaultForm; + + +public class POSSupplierForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public POSSupplierForm() + { + setBean(new POSSupplierBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/PaymentAllocationForm.java b/posterita/posterita/src/main/org/posterita/form/PaymentAllocationForm.java new file mode 100644 index 0000000000..5dc9f3bede --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/PaymentAllocationForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 30, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.PaymentAllocationBean; +import org.posterita.struts.core.DefaultForm; + + +public class PaymentAllocationForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + public PaymentAllocationForm() + { + setBean( new PaymentAllocationBean()); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/PaymentForm.java b/posterita/posterita/src/main/org/posterita/form/PaymentForm.java new file mode 100644 index 0000000000..f7c492fbf4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/PaymentForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 08-Dec-2006 14:08:03 by praveen + * + */ + +package org.posterita.form; + +import org.posterita.beans.PaymentBean; +import org.posterita.struts.core.DefaultForm; + +public class PaymentForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public PaymentForm() + { + setBean(new PaymentBean()); + addRequiredFields(new String[]{"amount", "allocateAmount"}); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/PaymentHistoryForm.java b/posterita/posterita/src/main/org/posterita/form/PaymentHistoryForm.java new file mode 100644 index 0000000000..da7e594264 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/PaymentHistoryForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 15, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.PaymentHistoryBean; +import org.posterita.struts.core.DefaultForm; + +public class PaymentHistoryForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public PaymentHistoryForm() + { + setBean(new PaymentHistoryBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/PaymentTermForm.java b/posterita/posterita/src/main/org/posterita/form/PaymentTermForm.java new file mode 100644 index 0000000000..3f17a3610f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/PaymentTermForm.java @@ -0,0 +1,61 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 1, 2006 + */ + + +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; + +import org.posterita.beans.PaymentTermBean; +import org.posterita.struts.core.DefaultForm; + + +public class PaymentTermForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public PaymentTermForm() + { + setBean(new PaymentTermBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + //some custom validation + + if("true".equalsIgnoreCase(getFixedDueDate())) + { + addRequiredFields(new String[]{"paymentTermName","fixedMonthDay","fixedMonthOffset","fiedMonthCutoff"}); + } + else + { + addRequiredFields(new String[]{"paymentTermName","netDays"}); + } + + return super.validate(mapping, request); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/PaymentTermForm2.java b/posterita/posterita/src/main/org/posterita/form/PaymentTermForm2.java new file mode 100644 index 0000000000..92e81d4d56 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/PaymentTermForm2.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 28, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.PaymentTermBean; +import org.posterita.struts.core.DefaultForm; + + +public class PaymentTermForm2 extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public PaymentTermForm2() + { + setBean(new PaymentTermBean()); + } + + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/PriceCheckForm.java b/posterita/posterita/src/main/org/posterita/form/PriceCheckForm.java new file mode 100644 index 0000000000..50efbb09cc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/PriceCheckForm.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +package org.posterita.form; + +import org.posterita.struts.core.DefaultForm; + +public class PriceCheckForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public PriceCheckForm() + { + addRequiredFields(new String[]{"barCode"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/PriceListForm.java b/posterita/posterita/src/main/org/posterita/form/PriceListForm.java new file mode 100644 index 0000000000..6830c1878c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/PriceListForm.java @@ -0,0 +1,54 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 19, 2005 by praveen + * + */ +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.PriceListBean; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.PriceListAction; + +public class PriceListForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public PriceListForm() + { + setBean(new PriceListBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(PriceListAction.CREATE_OR_UPDATE_PRICE_LIST.equalsIgnoreCase(action)) + { + addRequiredFields(new String[] {"name"}); + } + + return super.validate(mapping, request); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/ProductAttributeForm.java b/posterita/posterita/src/main/org/posterita/form/ProductAttributeForm.java new file mode 100644 index 0000000000..d52b076249 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ProductAttributeForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 1, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.ProductAttributeBean; +import org.posterita.struts.core.DefaultForm; + +public class ProductAttributeForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductAttributeForm() + { + setBean(new ProductAttributeBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/ProductAttributeValueForm.java b/posterita/posterita/src/main/org/posterita/form/ProductAttributeValueForm.java new file mode 100644 index 0000000000..fb77ea3732 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ProductAttributeValueForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 1, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.ProductAttributeBean; +import org.posterita.struts.core.DefaultForm; + +public class ProductAttributeValueForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductAttributeValueForm() + { + setBean(new ProductAttributeBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/ProductDetailInfoForm.java b/posterita/posterita/src/main/org/posterita/form/ProductDetailInfoForm.java new file mode 100644 index 0000000000..5450c915a6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ProductDetailInfoForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +/** + @author ashley + */ + +package org.posterita.form; + +import org.posterita.beans.ProductDetailsBean; +import org.posterita.struts.core.DefaultForm; + +public class ProductDetailInfoForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public ProductDetailInfoForm() + { + this.setBean(new ProductDetailsBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/ProductImageForm.java b/posterita/posterita/src/main/org/posterita/form/ProductImageForm.java new file mode 100644 index 0000000000..b756529f8a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ProductImageForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 14, 2006 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.ProductImageBean; +import org.posterita.struts.core.DefaultForm; + +public class ProductImageForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductImageForm() + { + setBean(new ProductImageBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/ProductKeywordsForm.java b/posterita/posterita/src/main/org/posterita/form/ProductKeywordsForm.java new file mode 100644 index 0000000000..31a9a5e036 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ProductKeywordsForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 12, 2006 by ashley +* +*/ + +package org.posterita.form; + +import org.posterita.beans.ProductKeywordsBean; +import org.posterita.struts.core.DefaultForm; + +public class ProductKeywordsForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductKeywordsForm() + { + setBean(new ProductKeywordsBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ProductRestrictionForm.java b/posterita/posterita/src/main/org/posterita/form/ProductRestrictionForm.java new file mode 100644 index 0000000000..78e03dc431 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ProductRestrictionForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 30, 2005 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.ProductRestrictionBean; +import org.posterita.struts.core.DefaultForm; + +public class ProductRestrictionForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductRestrictionForm() + { + setBean(new ProductRestrictionBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ProductSearchForm.java b/posterita/posterita/src/main/org/posterita/form/ProductSearchForm.java new file mode 100644 index 0000000000..15521f2867 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ProductSearchForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 17, 2006 by ashley +* +*/ + +package org.posterita.form; + +import org.posterita.beans.ProductSearchBean; +import org.posterita.struts.core.DefaultForm; + +public class ProductSearchForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductSearchForm() + { + //this.setIsActive("true"); + //this.setIsWebstoreFeatured("true"); + setBean(new ProductSearchBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ProductStatusForm.java b/posterita/posterita/src/main/org/posterita/form/ProductStatusForm.java new file mode 100644 index 0000000000..3d60c8af3a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ProductStatusForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Feb 9, 2006 by praveen + * + */ +package org.posterita.form; + +import org.posterita.beans.ProductStatusBean; +import org.posterita.struts.core.DefaultForm; + +public class ProductStatusForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProductStatusForm() + { + setBean(new ProductStatusBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/RemoveSessionForm.java b/posterita/posterita/src/main/org/posterita/form/RemoveSessionForm.java new file mode 100644 index 0000000000..6aeabffa14 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/RemoveSessionForm.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jan 26, 2007 + */ + + +package org.posterita.form; + +import org.posterita.beans.RemoveSessionBean; +import org.posterita.struts.core.DefaultForm; + + + +public class RemoveSessionForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public RemoveSessionForm() + { + setBean(new RemoveSessionBean()); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/ReportForm.java b/posterita/posterita/src/main/org/posterita/form/ReportForm.java new file mode 100644 index 0000000000..856209ec8e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ReportForm.java @@ -0,0 +1,53 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.ReportBean; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.POSReportAction; + + +public class ReportForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ReportForm() + { + //initForm(); + setBean(new ReportBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if (!POSReportAction.GET_STOCK_SALES_REPORT.equals(action) && !POSReportAction.CLEAR_STOCK_SALES_REPORT.equals(action)) + { + addRequiredFields(new String[]{"fromDate", "toDate"}); + } + + return super.validate(mapping, request); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ReportImageForm.java b/posterita/posterita/src/main/org/posterita/form/ReportImageForm.java new file mode 100644 index 0000000000..3d8f00dc34 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ReportImageForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.form; + +import org.posterita.beans.ReportImageBean; +import org.posterita.struts.core.DefaultForm; + + +public class ReportImageForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ReportImageForm() + { + setBean(new ReportImageBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/ReportSummaryHistoryForm.java b/posterita/posterita/src/main/org/posterita/form/ReportSummaryHistoryForm.java new file mode 100644 index 0000000000..4297ae1311 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ReportSummaryHistoryForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Sep 11, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.form; + +import org.posterita.struts.core.DefaultForm; + +public class ReportSummaryHistoryForm extends DefaultForm +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + +} diff --git a/posterita/posterita/src/main/org/posterita/form/RoleForm.java b/posterita/posterita/src/main/org/posterita/form/RoleForm.java new file mode 100644 index 0000000000..bec770dac5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/RoleForm.java @@ -0,0 +1,56 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 16, 2005 by praveen + * + */ +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.RoleBean; +import org.posterita.struts.admin.OrganisationAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.POSReportAction; +import org.posterita.struts.pos.POSRoleAction; + +public class RoleForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public RoleForm() + { + setBean(new RoleBean()); + } + + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(POSRoleAction.CREATE_ROLE.equals(action) || POSRoleAction.EDIT_ROLE.equals(action)) + { + addRequiredFields(new String[]{"name"}); + } + + return super.validate(mapping, request); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/SalesAnalysisReportForm.java b/posterita/posterita/src/main/org/posterita/form/SalesAnalysisReportForm.java new file mode 100644 index 0000000000..a13a3b9c26 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/SalesAnalysisReportForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 14-Jul-2006 13:57:30 by praveen + * + */ + +package org.posterita.form; + +import org.posterita.beans.SalesAnalysisReportBean; +import org.posterita.struts.core.DefaultForm; + +public class SalesAnalysisReportForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SalesAnalysisReportForm() + { + setBean(new SalesAnalysisReportBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/SalesDetailsForm.java b/posterita/posterita/src/main/org/posterita/form/SalesDetailsForm.java new file mode 100644 index 0000000000..7bc6763b2f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/SalesDetailsForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.form; + +import org.posterita.beans.SalesDetailsBean; +import org.posterita.struts.core.DefaultForm; + + +public class SalesDetailsForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SalesDetailsForm() + { + //initForm(); + setBean(new SalesDetailsBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/SalesReportForm.java b/posterita/posterita/src/main/org/posterita/form/SalesReportForm.java new file mode 100644 index 0000000000..bf61183015 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/SalesReportForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.form; + +import org.posterita.beans.ReportBean; +import org.posterita.struts.core.DefaultForm; + + +public class SalesReportForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SalesReportForm() + { + //initForm(); + setBean(new ReportBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/SearchProductForm.java b/posterita/posterita/src/main/org/posterita/form/SearchProductForm.java new file mode 100644 index 0000000000..910b99de31 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/SearchProductForm.java @@ -0,0 +1,39 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Apr 27, 2006 by ashley +* +*/ + +package org.posterita.form; + +import org.posterita.beans.StockBean; +import org.posterita.struts.core.DefaultForm; + +public class SearchProductForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SearchProductForm() + { + setBean(new StockBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/SellingItemForm.java b/posterita/posterita/src/main/org/posterita/form/SellingItemForm.java new file mode 100644 index 0000000000..94926e8bb6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/SellingItemForm.java @@ -0,0 +1,35 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 16 Jan 2008 13:10:40 by shameem + * + */ + +package org.posterita.form; + +import org.posterita.beans.ReportBean; +import org.posterita.struts.core.DefaultForm; + +public class SellingItemForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public SellingItemForm() + { + setBean(new ReportBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/SetApplicationParametersForm.java b/posterita/posterita/src/main/org/posterita/form/SetApplicationParametersForm.java new file mode 100644 index 0000000000..3645e1cbc7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/SetApplicationParametersForm.java @@ -0,0 +1,37 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * */ +package org.posterita.form; + +import org.posterita.beans.ApplicationParametersBean; +import org.posterita.struts.core.DefaultForm; + + +public class SetApplicationParametersForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SetApplicationParametersForm() + { + setBean(new ApplicationParametersBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/SingleDateFilterForm.java b/posterita/posterita/src/main/org/posterita/form/SingleDateFilterForm.java new file mode 100644 index 0000000000..7f1a64ce5e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/SingleDateFilterForm.java @@ -0,0 +1,44 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 7, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.ReportBean; +import org.posterita.struts.core.DefaultForm; + + +public class SingleDateFilterForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public SingleDateFilterForm() + { + //initForm(); + setBean(new ReportBean()); + addRequiredFields(new String[]{"fromDate"}); + + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/StockEnquiryForm.java b/posterita/posterita/src/main/org/posterita/form/StockEnquiryForm.java new file mode 100644 index 0000000000..f970b739bb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/StockEnquiryForm.java @@ -0,0 +1,36 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 16 Jan 2008 13:12:10 by shameem + * + */ + +package org.posterita.form; + +import org.posterita.beans.ReportBean; +import org.posterita.struts.core.DefaultForm; + +public class StockEnquiryForm extends DefaultForm +{ + + private static final long serialVersionUID = 1L; + + public StockEnquiryForm() + { + setBean(new ReportBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/StockForm.java b/posterita/posterita/src/main/org/posterita/form/StockForm.java new file mode 100644 index 0000000000..1b83cd5022 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/StockForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.form; + +import org.posterita.beans.StockBean; +import org.posterita.struts.core.DefaultForm; + + +public class StockForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public StockForm() + { + setBean(new StockBean()); + addRequiredFields(new String[] {"checkbox"}); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/StockMovementForm.java b/posterita/posterita/src/main/org/posterita/form/StockMovementForm.java new file mode 100644 index 0000000000..b2bf7f0c8f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/StockMovementForm.java @@ -0,0 +1,15 @@ +package org.posterita.form; + +import org.posterita.beans.StockMovementBean; +import org.posterita.struts.core.DefaultForm; + +public class StockMovementForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public StockMovementForm() + { + setBean(new StockMovementBean()); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/SynchronizeCollectionsForm.java b/posterita/posterita/src/main/org/posterita/form/SynchronizeCollectionsForm.java new file mode 100644 index 0000000000..b3dcb5654a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/SynchronizeCollectionsForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +/** + @author ashley + */ + +package org.posterita.form; + +import org.posterita.beans.SynchronizeCollectionBean; +import org.posterita.struts.core.DefaultForm; + +public class SynchronizeCollectionsForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public SynchronizeCollectionsForm() + { + this.setBean(new SynchronizeCollectionBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/TaxForm.java b/posterita/posterita/src/main/org/posterita/form/TaxForm.java new file mode 100644 index 0000000000..c4c8b5869c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/TaxForm.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 28, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.TaxBean; +import org.posterita.struts.core.DefaultForm; + + +public class TaxForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public TaxForm() + { + setBean(new TaxBean()); + // addRequiredFields(new String[] {"taxName","taxRate"}); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/form/TerminalForm.java b/posterita/posterita/src/main/org/posterita/form/TerminalForm.java new file mode 100644 index 0000000000..207fa000ce --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/TerminalForm.java @@ -0,0 +1,50 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.TerminalBean; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.TerminalAction; + +/** + * @author Ashley G Ramdass + * Apr 14, 2008 + */ +public class TerminalForm extends DefaultForm +{ + public TerminalForm() + { + super.setBean(new TerminalBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(TerminalAction.CREATE_TERMINAL.equals(action) || TerminalAction.SAVE_TERMINAL.equals(action)) + { + addRequiredFields(new String[]{"name", "orgId", "bpartnerId", "purchasePriceListId", "salesPriceListId", "warehouseId", "cashBookId", "cardBankAccountId", "checkBankAccountId", "cashbookTransferType"}); + } + + return super.validate(mapping, request); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/UOMForm.java b/posterita/posterita/src/main/org/posterita/form/UOMForm.java new file mode 100644 index 0000000000..63674fa7d0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/UOMForm.java @@ -0,0 +1,8 @@ +package org.posterita.form; + +import org.posterita.struts.core.DefaultForm; + +public class UOMForm extends DefaultForm +{ + +} diff --git a/posterita/posterita/src/main/org/posterita/form/UserForm.java b/posterita/posterita/src/main/org/posterita/form/UserForm.java new file mode 100644 index 0000000000..2ef8dcbd50 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/UserForm.java @@ -0,0 +1,60 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.Constants; +import org.posterita.beans.UserBean; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.login.LoginAction; + + +public class UserForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public UserForm() + { + setBean(new UserBean()); + + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(Constants.PASSWORD.equals(action)) + { + addRequiredFields(new String[]{"username"}); + } + else + { + addRequiredFields(new String[]{"password", "confirmPassword","userPIN", "orgId"}); + addMatchFields("password","confirmPassword"); + } + + return super.validate(mapping, request); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/form/UserRegistrationForm.java b/posterita/posterita/src/main/org/posterita/form/UserRegistrationForm.java new file mode 100644 index 0000000000..02003363bb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/UserRegistrationForm.java @@ -0,0 +1,52 @@ +/* + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Servansingh + * */ + +package org.posterita.form; + +import javax.servlet.http.HttpServletRequest; +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.UserBean; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.user.UserRegistrationAction; + + + +public class UserRegistrationForm extends DefaultForm +{ + private static final long serialVersionUID = 1L; + + public UserRegistrationForm() + { + setBean(new UserBean()); + } + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + if(UserRegistrationAction.REGISTER_USER.equals(action)) + { + addRequiredFields(new String[]{"name", "userSurname", "address1","city", "email"}); + } + + return super.validate(mapping, request); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/VendorForm.java b/posterita/posterita/src/main/org/posterita/form/VendorForm.java new file mode 100644 index 0000000000..d728dea7de --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/VendorForm.java @@ -0,0 +1,19 @@ +package org.posterita.form; + +import org.posterita.beans.VendorBean; +import org.posterita.struts.core.DefaultForm; + +public class VendorForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public VendorForm() + { + setBean(new VendorBean()); + addRequiredFields(new String[]{"partnerName"}); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ViewBPartnerForm.java b/posterita/posterita/src/main/org/posterita/form/ViewBPartnerForm.java new file mode 100644 index 0000000000..d1efc12b0a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ViewBPartnerForm.java @@ -0,0 +1,38 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 22, 2005 by din + */ + +package org.posterita.form; + +import org.posterita.beans.BPartnerBean; +import org.posterita.struts.core.DefaultForm; + +public class ViewBPartnerForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ViewBPartnerForm() + { + setBean(new BPartnerBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ViewProductForm.java b/posterita/posterita/src/main/org/posterita/form/ViewProductForm.java new file mode 100644 index 0000000000..e8b0280e9f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ViewProductForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 17, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.ProductBean; +import org.posterita.struts.core.DefaultForm; + + +public class ViewProductForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ViewProductForm() + { + setBean(new ProductBean()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/form/ViewTaxForm.java b/posterita/posterita/src/main/org/posterita/form/ViewTaxForm.java new file mode 100644 index 0000000000..bb83285f8d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/form/ViewTaxForm.java @@ -0,0 +1,40 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 30, 2006 + */ + + +package org.posterita.form; + +import org.posterita.beans.TaxBean; +import org.posterita.struts.core.DefaultForm; + + +public class ViewTaxForm extends DefaultForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public ViewTaxForm() + { + setBean(new TaxBean()); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/formatter/ArrayListFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/ArrayListFormatter.java new file mode 100644 index 0000000000..d5804b57dd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/ArrayListFormatter.java @@ -0,0 +1,51 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ + +package org.posterita.formatter; + +import java.util.ArrayList; + + +public class ArrayListFormatter extends Formatter +{ + + public Object format(Object target) + { + if (target == null) + return new ArrayList(); + + return target; + } + + public Object unformat(Object target) + { + ArrayList temp = (ArrayList) target; + + if (target == null || temp.size() == 0 ) + return null; + + return target; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/BigDecimalArrayFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/BigDecimalArrayFormatter.java new file mode 100644 index 0000000000..64ff52d949 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/BigDecimalArrayFormatter.java @@ -0,0 +1,49 @@ +package org.posterita.formatter; + +import java.math.BigDecimal; + +public class BigDecimalArrayFormatter extends Formatter +{ + // return String[] + public Object format(Object value) + { + if (value == null) + return new String[]{}; + + BigDecimal values[] = (BigDecimal[])value; + + String retVal[] = new String[values.length]; + + for (int i = 0; i < values.length; i++) + { + retVal[i] = values[i].toPlainString(); + } + + return retVal; + } + + // return BigDecimal[] + public Object unformat(Object object) + { + if (object == null) + { + return null; + } + + String values[] = (String[])object; + + if (values.length == 0) + { + return null; + } + + BigDecimal retVal[] = new BigDecimal[values.length]; + + for (int i = 0; i < values.length; i++) + { + retVal[i] = new BigDecimal(values[i]); + } + + return retVal; + } +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/BigDecimalFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/BigDecimalFormatter.java new file mode 100644 index 0000000000..643787eb65 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/BigDecimalFormatter.java @@ -0,0 +1,57 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 18-Aug-2006 16:45:26 by praveen + * + */ + +package org.posterita.formatter; + +import java.math.BigDecimal; + +public class BigDecimalFormatter extends Formatter +{ + + //converts a BigDecimal to String + public Object format(Object value) + { + if(value == null) + { + return ""; + } + + BigDecimal valuebd = (BigDecimal) value; + + BigDecimal db = valuebd.setScale(4, BigDecimal.ROUND_HALF_UP); + + return db.toString(); + } + + //converts a String to BigDecimal + public Object unformat(Object object) + { + String string = (String) object; + if(string == null || string.trim().length() <1) + return null; + + BigDecimal bd = new BigDecimal(string).setScale(4, BigDecimal.ROUND_HALF_UP); + + return bd; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/BooleanArrayFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/BooleanArrayFormatter.java new file mode 100644 index 0000000000..5135e61d21 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/BooleanArrayFormatter.java @@ -0,0 +1,49 @@ +package org.posterita.formatter; + + +public class BooleanArrayFormatter extends Formatter +{ + + public Object format(Object value) + { + if (value == null) + return new String[]{}; + + Boolean values[] = (Boolean[])value; + + String retVal[] = new String[values.length]; + + for (int i = 0; i < values.length; i++) + { + retVal[i] = values[i].toString(); + } + + return retVal; + } + + // return Boolean[] + public Object unformat(Object object) + { + if (object == null) + { + return null; + } + + String values[] = (String[])object; + + if (values.length == 0) + { + return null; + } + + Boolean retVal[] = new Boolean[values.length]; + + for (int i = 0; i < values.length; i++) + { + retVal[i] = new Boolean(values[i]); + } + + return retVal; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/BooleanFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/BooleanFormatter.java new file mode 100644 index 0000000000..69221d258e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/BooleanFormatter.java @@ -0,0 +1,50 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Jul-2005 by alok + * + */ +package org.posterita.formatter; + + +public class BooleanFormatter extends Formatter +{ + + //converts Boolean to String + public Object format(Object target) + { + if (target == null) + return Boolean.toString(false); + + Boolean bool = (Boolean) target; + return bool.toString(); + } + + //convert String to Boolean + public Object unformat(Object target) + { + String string = (String) target; + + if(string == null || string.trim().length() <1) + return Boolean.valueOf(false); + + return Boolean.valueOf(string); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/DefaultFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/DefaultFormatter.java new file mode 100644 index 0000000000..2bde2bb1bc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/DefaultFormatter.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ + +package org.posterita.formatter; + + +public class DefaultFormatter extends Formatter +{ + + public Object format(Object target) + { + if (target == null) + return ""; + else + return target.toString(); + } + + public Object unformat(Object target) + { + return target; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/DoubleFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/DoubleFormatter.java new file mode 100644 index 0000000000..5329fbe5c1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/DoubleFormatter.java @@ -0,0 +1,48 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ +package org.posterita.formatter; + + +public class DoubleFormatter extends Formatter +{ + + public Object format(Object value) + { + if (value == null) + return ""; + + Double dbl = (Double) value; + return dbl.toString(); + + + } + + public Object unformat(Object object) + { + String string = (String) object; + if(string == null || string.trim().length() <1) + return null; + + return new Double(string); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/Formatter.java b/posterita/posterita/src/main/org/posterita/formatter/Formatter.java new file mode 100644 index 0000000000..5d806a317f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/Formatter.java @@ -0,0 +1,76 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ +package org.posterita.formatter; + +import java.math.BigDecimal; +import java.util.ArrayList; + +import org.posterita.core.JulianDate; +import org.posterita.core.SimpleCalendarDate; +import org.posterita.exceptions.FormattingException; + + +public abstract class Formatter +{ + + public String getErrorKey() + { + return "error.key"; + } + + public static Formatter getFormatter(Class type) + { + if (type == null) + return new DefaultFormatter(); + if (String.class.isAssignableFrom(type)) + return new StringFormatter(); + if (Integer.class.isAssignableFrom(type)) + return new IntegerFormatter(); + if (Long.class.isAssignableFrom(type)) + return new LongFormatter(); + if (ArrayList.class.isAssignableFrom(type)) + return new ArrayListFormatter(); + if (Double.class.isAssignableFrom(type)) + return new DoubleFormatter(); + if (String[].class.isAssignableFrom(type)) + return new StringArrayFormatter(); + if (JulianDate.class.isAssignableFrom(type)) + return new JulianDateFormatter(); + if (SimpleCalendarDate.class.isAssignableFrom(type)) + return new SimpleCalendarDateFormatter(); + if (Boolean.class.isAssignableFrom(type)) + return new BooleanFormatter(); + if (Boolean[].class.isAssignableFrom(type)) + return new BooleanArrayFormatter(); + if (BigDecimal.class.isAssignableFrom(type)) + return new BigDecimalFormatter(); + if (BigDecimal[].class.isAssignableFrom(type)) + return new BigDecimalArrayFormatter(); + + return new DefaultFormatter(); + } + + public abstract Object format(Object target) throws FormattingException; + + public abstract Object unformat(Object target) throws FormattingException; + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/IntegerFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/IntegerFormatter.java new file mode 100644 index 0000000000..13a4f77767 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/IntegerFormatter.java @@ -0,0 +1,56 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ +package org.posterita.formatter; + + +public class IntegerFormatter extends Formatter +{ + + public Object format(Object value) + { + if (value == null) + return ""; + + Integer integer = (Integer) value; + + return integer.toString(); + } + + public Object unformat(Object value) throws NumberFormatException + { + if (value != null) + { + String string = value.toString(); + + if (string.trim().length() <1) + { + return null; + } + return Integer.valueOf(string); + } + else + { + return value; + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/JulianDateFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/JulianDateFormatter.java new file mode 100644 index 0000000000..6179d6ba17 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/JulianDateFormatter.java @@ -0,0 +1,82 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ + +package org.posterita.formatter; + +import java.text.DateFormat; +import java.text.ParseException; +import java.util.Date; + +import org.posterita.core.JulianDate; + + +public class JulianDateFormatter extends Formatter +{ + public Object format(Object value) + { + if (value==null) + return ""; + + JulianDate julianDate = (JulianDate) value; + + DateFormat mediumDF = DateFormat.getDateInstance(DateFormat.MEDIUM); + + String string = mediumDF.format(julianDate.getJavaDate()); + + return string; + } + + + + /* (non-Javadoc) + * @see com.shortletting.formatter.Formatter#unformat(java.lang.Object) + */ + public Object unformat(Object target) + { + if (target == null) + return null; + String value = (String) target; + + DateFormat mediumDF = DateFormat.getDateInstance(DateFormat.MEDIUM); + + Date date = new Date(); + + try + { + date = mediumDF.parse(value); + } + catch (ParseException e) + { + //throw new RunTimeException("Fatal Error converting dates"); + /* + * @TODO silent exception needs to be logged. + */ + e.printStackTrace(); + } + + JulianDate julDate = new JulianDate(date); + + return julDate; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/LongFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/LongFormatter.java new file mode 100644 index 0000000000..71ea4d7ae9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/LongFormatter.java @@ -0,0 +1,48 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ +package org.posterita.formatter; + + +public class LongFormatter extends Formatter +{ + + public Object format(Object value) + { + if (value == null) + return ""; + + Long dbl = (Long) value; + return dbl.toString(); + + + } + + public Object unformat(Object object) + { + String string = (String) object; + if(string == null || string.trim().length() <1) + return null; + + return new Long(string); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/PriceFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/PriceFormatter.java new file mode 100644 index 0000000000..a785f63a8b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/PriceFormatter.java @@ -0,0 +1,42 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Feb 3, 2006 by ashley +* +*/ + +package org.posterita.formatter; + +import java.math.BigDecimal; +import java.text.DecimalFormat; + +public class PriceFormatter +{ + + + public static String format(BigDecimal price, String priceFormat) + { + DecimalFormat format = new DecimalFormat(priceFormat); + + double dblPrice = price.doubleValue(); + + String strPrice = format.format(dblPrice); + + return strPrice; + } +} diff --git a/posterita/posterita/src/main/org/posterita/formatter/PrintFormatter.java b/posterita/posterita/src/main/org/posterita/formatter/PrintFormatter.java new file mode 100644 index 0000000000..737d037120 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/formatter/PrintFormatter.java @@ -0,0 +1,70 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 24, 2006 + */ + + +package org.posterita.formatter; + +import java.util.Properties; + +import org.compiere.model.MAttributeInstance; +import org.compiere.model.MAttributeValue; +import org.compiere.model.MProduct; + + +public class PrintFormatter extends Formatter +{ + + public Object format(Object target) + { + if(target==null) + return null; + + MProduct product = (MProduct)target; + int attributeSetInstanceId = product.getM_AttributeSetInstance_ID(); + Properties ctx = product.getCtx(); + + String whereClause="AD_CLIENT_ID="+product.getAD_Client_ID()+" and M_ATTRIBUTESETINSTANCE_ID="+attributeSetInstanceId; + int [] attributeValuesIds = MAttributeInstance.getAllIDs(MAttributeInstance.Table_Name,whereClause,null); + + MAttributeValue attrValue=null; + + String productName=""; + + for(int i=0;i keyNamePairs = new ArrayList(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + + String sql = "select attrIns.m_attributevalue_id,attrVal.name ATTRIBUTE_VALUE " + + "from M_PRODUCT prod,M_ATTRIBUTEINSTANCE attrIns ,M_attribute attr,M_attributeValue attrVal " + + "where prod.M_ATTRIBUTESETINSTANCE_id = attrIns.M_ATTRIBUTESETINSTANCE_id " + + "and attr.m_attribute_id = attrIns.m_attribute_id " + + "and attrIns.m_attributevalue_id = attrVal.m_attributevalue_id " + + "and attr.name = '" + attributeName + "' " + + "and attr.AD_CLIENT_ID = " + ad_client_id; + + PreparedStatement pstmt = null; + + System.out.println("Query for attributeValueKeyNamePair : " + sql); + + try + { + pstmt = DB.prepareStatement(sql, null); + ResultSet rs = pstmt.executeQuery(); + KeyNamePair pair = null; + + + while(rs.next()) + { + pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + keyNamePairs.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw new SystemException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + } + + pstmt = null; + } + + return keyNamePairs; + } +} diff --git a/posterita/posterita/src/main/org/posterita/keyname/BPartnerKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/BPartnerKeyNamePair.java new file mode 100644 index 0000000000..ddae3243c3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/BPartnerKeyNamePair.java @@ -0,0 +1,52 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 6, 2005 by praveen + * + */ +package org.posterita.keyname; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.util.Env; + +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.OperationException; + + +public class BPartnerKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id=" + Env.getAD_Org_ID(ctx) + " and isactive = 'Y'"; + + try + { + return getData(ctx, MBPartner.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } + +} + diff --git a/posterita/posterita/src/main/org/posterita/keyname/BankKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/BankKeyNamePair.java new file mode 100644 index 0000000000..e2e209e727 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/BankKeyNamePair.java @@ -0,0 +1,48 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.keyname; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.util.Env; + +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.OperationException; +import org.posterita.model.MBank; + + +public class BankKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id=" + Env.getAD_Org_ID(ctx) + " and isactive = 'Y'"; + + try + { + return getData(ctx, MBank.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } +} diff --git a/posterita/posterita/src/main/org/posterita/keyname/CBPartnerKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/CBPartnerKeyNamePair.java new file mode 100644 index 0000000000..7e93c70cf0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/CBPartnerKeyNamePair.java @@ -0,0 +1,108 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 6, 2005 by praveen + * + */ +package org.posterita.keyname; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MOrg; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +import org.posterita.exceptions.SystemException; + + +public class CBPartnerKeyNamePair +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws SystemException + { + ArrayList bpList = new ArrayList(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + int ad_org_id = Env.getAD_Org_ID(ctx); + + MOrg org = new MOrg(ctx,ad_org_id,null); + + String orgType = ""; + + /* if(org.isAutomobile()) + { + orgType = " and isAutomobile = 'Y'"; + } + else + { + orgType = " and isMotorcycle = 'Y'"; + }*/ + + String sql = "select bp.C_BPARTNER_ID,bp.NAME" + + " from AD_ORG org, C_BPARTNER bp" + + " where org.AD_CLIENT_ID = " + ad_client_id + + " and org.isRetailer = 'Y'" + + " and org.AD_CLIENT_ID = bp.AD_CLIENT_ID" + + " and org.AD_ORG_ID = bp.AD_ORG_ID" + + " and bp.isactive = 'Y'"; + + sql = sql + orgType; + + PreparedStatement pstmt = null; + + pstmt = DB.prepareStatement(sql,null); + ResultSet rs; + KeyNamePair pair = null; + + try + { + rs = pstmt.executeQuery(); + + while (rs.next()) + { + pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + bpList.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw new SystemException(e.getMessage()); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return bpList; + } + +} + diff --git a/posterita/posterita/src/main/org/posterita/keyname/LocatorKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/LocatorKeyNamePair.java new file mode 100644 index 0000000000..7d87f0af41 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/LocatorKeyNamePair.java @@ -0,0 +1,102 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Sep 22, 2005 by ashley +* +*/ + +package org.posterita.keyname; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MLocator; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +import org.posterita.exceptions.OperationException; + +public class LocatorKeyNamePair +{ + public static ArrayList getKeyNamePair(Properties ctx) throws OperationException + { + ArrayList list = new ArrayList(); + + PreparedStatement prepStmt = null; + + try + { + int adOrgId = Env.getAD_Org_ID(ctx); + int adClientId = Env.getAD_Client_ID(ctx); + + String sqlStatement = "select M_LOCATOR_ID, VALUE from " + MLocator.Table_Name + " where AD_ORG_ID=" + adOrgId + " and AD_CLIENT_ID=" + adClientId + " and isactive = 'Y'"; + + prepStmt = DB.prepareStatement(sqlStatement, null); + ResultSet rs = prepStmt.executeQuery(); + + while(rs.next()) + { + int id = rs.getInt(1); + String name = rs.getString(2); + + KeyNamePair keyPair = new KeyNamePair(id, name); + list.add(keyPair); + } + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return list; + } + + public static KeyNamePair getKeyNamePair(Properties ctx, int locatorId) throws OperationException + { + PreparedStatement prepStmt = null; + KeyNamePair keyPair = null; + try + { + int adOrgId = Env.getAD_Org_ID(ctx); + int adClientId = Env.getAD_Client_ID(ctx); + + String sqlStatement = "select M_LOCATOR_ID, VALUE from " + MLocator.Table_Name + " where AD_ORG_ID=" + adOrgId + " and AD_CLIENT_ID=" + adClientId + " and M_LOCATOR_ID=" + locatorId; + + prepStmt = DB.prepareStatement(sqlStatement, null); + ResultSet rs = prepStmt.executeQuery(); + + while(rs.next()) + { + int id = rs.getInt(1); + String name = rs.getString(2); + + keyPair = new KeyNamePair(id, name); + } + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return keyPair; + } +} diff --git a/posterita/posterita/src/main/org/posterita/keyname/MenuKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/MenuKeyNamePair.java new file mode 100644 index 0000000000..cebd24433e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/MenuKeyNamePair.java @@ -0,0 +1,53 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Jul 28, 2005 by Fred + */ + +package org.posterita.keyname; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.X_U_WebMenu; +import org.compiere.util.Env; + +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.OperationException; + +public class MenuKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + "and ad_org_id="+ Env.getAD_Org_ID(ctx) + " and parentmenu_id is not null order by parentmenu_id"; + //+ " and isClosable= 'Y' "; + try + { + return getData(ctx, X_U_WebMenu.Table_Name,sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/keyname/OrgKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/OrgKeyNamePair.java new file mode 100644 index 0000000000..aaf7e4f411 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/OrgKeyNamePair.java @@ -0,0 +1,62 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 2, 2005 by din + */ + +package org.posterita.keyname; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.X_AD_Org; +import org.compiere.util.Env; + +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.OperationException; + +public class OrgKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + { + String isAuto = "N"; + String isMoto = "N"; + + /* if(OrganisationManager.getMyOrg(ctx).isAutomobile()) + { + isAuto = "Y"; + } + + if(OrganisationManager.getMyOrg(ctx).isMotorcycle()) + { + isMoto = "Y"; + }*/ + + String sql = "AD_CLIENT_ID =" + Env.getAD_Client_ID(ctx) + "and ISAUTOMOBILE ='"+ isAuto +"' and ISMOTORCYCLE ='"+ isMoto +"'" + " and isactive = 'Y'"; + try + { + return getData(ctx, X_AD_Org.Table_Name,sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } +} diff --git a/posterita/posterita/src/main/org/posterita/keyname/PriceListVersionKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/PriceListVersionKeyNamePair.java new file mode 100644 index 0000000000..c71ccd146a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/PriceListVersionKeyNamePair.java @@ -0,0 +1,47 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 19, 2005 by praveen + * + */ +package org.posterita.keyname; + +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MPriceListVersion; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +public class PriceListVersionKeyNamePair +{ + public static ArrayList getKeyNamePairs(Properties ctx) + { + ArrayList list = new ArrayList(); + int id[] = MPriceListVersion.getAllIDs(MPriceListVersion.Table_Name,"AD_Client_id = "+Env.getAD_Client_ID(ctx),null); + + for(int i=0; i getKeyNamePairs(Properties ctx, int attributeId, int productcategoryId) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and m_attribute_id=" + attributeId + " and m_product_category_id=" + productcategoryId + " and isactive = 'Y'"; + + try + { + return getData(ctx, MAttributeValue.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/keyname/RegionKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/RegionKeyNamePair.java new file mode 100644 index 0000000000..aba9278260 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/RegionKeyNamePair.java @@ -0,0 +1,48 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.keyname; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MRegion; + +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; + + +public class RegionKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + { + String sql = "c_country_id = " + UdiConstants.COUNTRY_SOUTH_AFRICA + " and isactive = 'Y'"; + + try + { + return getData(ctx, MRegion.Table_Name,sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } +} diff --git a/posterita/posterita/src/main/org/posterita/keyname/RoleKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/RoleKeyNamePair.java new file mode 100644 index 0000000000..8ced214270 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/RoleKeyNamePair.java @@ -0,0 +1,50 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 1, 2005 by din + */ + +package org.posterita.keyname; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MRole; +import org.compiere.util.Env; + +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.OperationException; + +public class RoleKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyName(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + "and ad_org_id=" + Env.getAD_Org_ID(ctx) + " and isactive = 'Y'"; + + try + { + return getData(ctx, MRole.Table_Name,sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + } +} diff --git a/posterita/posterita/src/main/org/posterita/keyname/SalesRepKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/SalesRepKeyNamePair.java new file mode 100644 index 0000000000..024fbe8172 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/SalesRepKeyNamePair.java @@ -0,0 +1,104 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 6, 2005 by praveen + * + */ +package org.posterita.keyname; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MOrg; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +import org.posterita.exceptions.SystemException; + + +public class SalesRepKeyNamePair +{ + /** + * returns an arraylist of keyname pairs. + * key -> user_id + * name -> username + */ + public static ArrayList getKeyNamePairs(Properties ctx) throws SystemException + { + ArrayList srList = new ArrayList(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + int ad_org_id = Env.getAD_Org_ID(ctx); + + new MOrg(ctx,ad_org_id,null); + + + String sql = "select c_bpartner_id,name " + + "from c_bpartner " + + "where issalesrep = 'Y' " + + "and isactive = 'Y' " + + "and ad_client_id = ? " + + "and ad_org_id = ? "; + + + PreparedStatement pstmt = null; + + pstmt = DB.prepareStatement(sql, null); + ResultSet rs; + KeyNamePair pair = null; + + try + { + pstmt.setInt(1,ad_client_id); + pstmt.setInt(2,ad_org_id); + + rs = pstmt.executeQuery(); + + while (rs.next()) + { + pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + srList.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw new SystemException(e.getMessage()); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return srList; + } + +} + diff --git a/posterita/posterita/src/main/org/posterita/keyname/WarehouseKeyNamePair.java b/posterita/posterita/src/main/org/posterita/keyname/WarehouseKeyNamePair.java new file mode 100644 index 0000000000..9f44840e5c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/keyname/WarehouseKeyNamePair.java @@ -0,0 +1,71 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 29-Jul-2005 by alok + * + */ +package org.posterita.keyname; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.util.Env; + +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exceptions.OperationException; + + +public class WarehouseKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePair(Properties ctx) throws OperationException + { + ArrayList list = new ArrayList(); + + try + { + list = getData(ctx,"M_WAREHOUSE","AD_ORG_ID="+ Env.getAD_Org_ID(ctx) + " and ad_client_Id=" + Env.getAD_Client_ID(ctx)+ " and isactive = 'Y'"); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return list; + + } + + public static ArrayList getKeyNamePair(Properties ctx,int warehouseId) throws OperationException + { + ArrayList list = new ArrayList(); + + + + try + { + list = getData(ctx,"M_WAREHOUSE","AD_ORG_ID="+ Env.getAD_Org_ID(ctx) + " and ad_client_Id=" + Env.getAD_Client_ID(ctx)+ " and isactive = 'Y' and m_warehouse_id<>"+warehouseId); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return list; + + } +} diff --git a/posterita/posterita/src/main/org/posterita/lib/PropertiesConstant.java b/posterita/posterita/src/main/org/posterita/lib/PropertiesConstant.java new file mode 100644 index 0000000000..bf9766a6e1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/lib/PropertiesConstant.java @@ -0,0 +1,131 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Mar-2005 by fred + * + */ +package org.posterita.lib; + + +public class PropertiesConstant +{ + public static final String LOGO_HOME="logo.home"; + public static final String UDI_HOME = "udi.home"; + +/* public static final String CLIENT_NAME = "client.name"; + public static final String CLIENT_ID = "client.id"; + public static final String NTIER_HOME = "ntier.home"; + public static final String DCS_HOME = "dcs.home"; + //public static final String HONDA_HEAD_OFFICE_AUTO_ID = "honda.headoffice.auto.id"; + public static final String HONDA_HEAD_OFFICE_MOTO_ID = "honda.headoffice.moto.id"; + + public static final String AUTO_METALLIC_PRICE_ID = "auto.metallic.price.list.id"; + public static final String MOTO_METALLIC_PRICE_ID = "wing.metallic.price.list.id"; + public static final String PRODUCT_CATEGORY_CAR = "productCategory.car.id"; + public static final String FACTORY_HOME = "factory.home"; + + + public static final String CSV_HOME="csv.home"; + + public static final String ATTRIBUTE_SET_CAR = "car.attributeSet.id"; + public static final String BPARTNER_HSAF_ID = "bpartner.hsaf.id"; + public static final String USER_ROLE_SUPER_USER_ID = "user.role.superUser.id"; + public static final String ROLE_MENU_SUPER_USER_ID = "role.menu.superUser.id"; + public static final String SUPER_USER_ID = "superUser.id"; + public static final String USER_ROLE_UDI_ADMIN_ID = "user.role.udiAdmin.id"; + public static final String ROLE_MENU_UDI_ADMIN_ID = "role.menu.udiAdmin.id"; + public static final String UDI_ADMIN_ID = "udiAdmin.id"; + //public static final String HSAFAUTO_ADMIN_ID = "hsafAuto.admin.id"; + public static final String HSAFWING_ADMIN_ID = "hsafWing.Admin.id"; + public static final String ATTRIBUTE_SET_VIN_NO="vinNo.attributeVinNo.id"; + public static final String MODEL_ATTRIBUTE = "attribute.model.id"; + public static final String COLOUR_ATTRIBUTE = "attribute.colour.id"; + public static final String TRX_ATTRIBUTE = "attribute.transmisson.id"; + public static final String YEAR_ATTRIBUTE = "attribute.year.id"; + public static final String VIN_NO_ATTRIBUTE = "attribute.vinNo.id"; + public static final String UOM_EACH = "uom.each"; + public static final String TAX_CATEGORY_DEFAULT = "taxCategory.default.id"; + public static final String DEFAULT_BPGROUP = "default.bpartner.group"; + + //ROLES + public static final String ROLE_DEALER_PRINCIPAL_ID = "role.dealer.principal.id"; + public static final String ROLE_SALES_MANAGER_ID = "role.sales.manager.id"; + public static final String ROLE_SALES_PERSON_ID = "role.sales.person.id"; + public static final String ROLE_STOCK_CONTROLLER_ID = "role.stock.controller.id"; + public static final String ROLE_TEST_ID = "role.test.id"; + public static final String ROLE_SYSTEM_ADMINISTRATOR_ID = "role.system.administrator.id"; + public static final String ROLE_UDI_ADMIN_ID = "role.udiAdmin.id"; + public static final String ROLE_HSAFAUTO_ADMIN_ID = "role.hsafAutoAdmin.id"; + public static final String ROLE_HSAFWING_ADMIN_ID = "role.hsafWingAdmin.id"; + //MENUS + public static final String PMENU_HOME_ID = "pmenu.home.id"; + public static final String PMENU_CREATEMENU_ID = "pmenu.createmenu.id"; + //testing + public static final String SMENU_ORGANISATION_ID = "smenu.organisation.id"; + //end of test + public static final String SMENU_WAREHOUSE_ID= "smenu.warehouse.id"; + public static final String SMENU_CREATEUSER_ID= "smenu.createuser.id"; + public static final String PMENU_STOCK_INQUIRY_ID = "pmenu.stock.inquiry.id"; + public static final String SMENU_INQUIRY_ID = "smenu.inquiry.id"; + public static final String SMENU_MY_STOCK_ID = "smenu.my.stock.id"; + + public static final String PMENU_DEALER_ORDER_ID = "pmenu.dealer.order.id"; + public static final String SMENU_CREATE_ORDER_ID = "smenu.create.order.id"; + + public static final String PMENU_NATIS_RELEASE_ID = "pmenu.natis.release.id"; + public static final String SMENU_RELEASE_VEHICLE_ID = "smenu.release.vehicle.id"; + + public static final String PMENU_ALLOCATIONS_ID = "pmenu.allocations.id"; + + public static final String PMENU_DEALER_TRANSFER_ID = "pmenu.dealer.transfer.id"; + public static final String PMENU_DEALER_ADMIN_ID = "pmenu.dealer.admin.id"; + public static final String PMENU_MESSAGES_ID = "pmenu.messages.id"; + public static final String SMENU_MESSAGESINBOX_ID="smenu.messagesinbox.id"; + public static final String SMENU_MESSAGESSENT_ID = "smenu.messagessent.id"; + public static final String SMENU_MESSAGESCOMPOSE_ID = "smenu.messagescompose.id"; + public static final String PMENU_LOGOUT_ID = "pmenu.logout.id"; + public static final String CAR_ASSET_GRP = "car.assetgroup.id"; + + public static final String SSL_CERT_PATH = "ssl.cert.path"; + public static final String NATIS_POST_PROCESSOR = "natis.post.processor"; + public static final String NATIS_OPERATIONAL_MODE = "natis.operational.mode"; + public static final String NATIS_URL = "natis.url"; + public static final String SMTP_SERVER = "smtp.server"; + + public static final String FTP_SERVER_URL = "ftp.server.url"; + public static final String FTP_USERNAME = "ftp.user.name"; + public static final String FTP_PASSWORD = "ftp.user.password"; + + public static final String NATIS_AUTOMATION_TIME = "natis.automation.time"; + + public static final String FTP_IMPORT_AUTOMATION = "ftp.import.automation"; + public static final String FTP_IMPORT_TIME = "ftp.import.time"; + + public static final String WEBSTORE_AUTOMATED_IMPORT = "webstore.automated.import"; + public static final String WEBSTORE_AUTOMATED_TIME = "webstore.automated.time"; + public static final String WEBSTORE_IMAGE_FOLDER_TOBEPROCESSED = "webstore.folder.tobeprocessed"; + public static final String WEBSTORE_IMAGE_FOLDER_PROCESSED = "webstore.folder.processed"; + public static final String WEBSTORE_IMAGE_FOLDER_ERRORS = "webstore.folder.errors"; + public static final String WEBSTORE_IMAGE_COLLECTION_FOLDER = "webstore.collection.folder"; + public static final String WEBSTORE_IMAGE_INACTIVE_FOLDER = "webstore.inactive.folder"; + + public static final String APPLICATION_TYPE = "application.type"; + public static final String SMTP_AUTH = "smtp.authorisation"; + public static final String SMTP_USERNAME = "smtp.username"; + public static final String SMTP_PASSWORD = "smtp.password"; +*/} diff --git a/posterita/posterita/src/main/org/posterita/lib/UdiConstants.java b/posterita/posterita/src/main/org/posterita/lib/UdiConstants.java new file mode 100644 index 0000000000..b8e7afd4c8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/lib/UdiConstants.java @@ -0,0 +1,97 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.lib; + +import org.compiere.util.Env; + + +public class UdiConstants +{ + public static final String ACCOUNTING_FILE="/config/accounting/AccountingUS.csv"; + //public static int CURRENCY_EURO=102; + public static final int CURRENCY_USD=100; + public static final int COUNTRY_SOUTH_AFRICA=305; + public static final int COUNTRY_MAURITIUS = 245; + public static final int COUNTRY_US = 100; + public static final int CURRENCY_RUPEES = 280; + + public static final int UOM_EACH_ID = 100; + + public static String POS_VERSION = ""; + public static String INVALID_LICENSING_REASON = ""; + + public static final String THUMBNAIL_IMAGE_PREFIX = "THUMB-"; + public static final String FULL_IMAGE_PREFIX = "FULL-"; + public static final String FULL_IMAGE = "fullImage"; + public static final String THUMBNAIL = "thumbnail"; + public static final String DEFAULT_IMAGE = "Default"; + public static final String IMAGE_EXTENSION = ".jpg"; + public static final String IMPORT_AUTOMATATION_ON = "ON"; + + public static final String CLIENT_ID_CTX_PARAM = "#AD_Client_ID"; + public static final String ORG_ID_CTX_PARAM = "#AD_Org_ID"; + public static final String AD_ROLE_ID = "#AD_Role_ID"; + public static final String CSS = "webParam5"; + public static final String FORWARD = "webParam6"; + public static final String MODULE_NAME_CTX_PARAM = "#ModuleName"; + //public static final String WEBPARAM6 = "webParam6"; + public static final String PRICELIST_CTX_PARAM = "#M_PriceList_ID"; + public static final String PRICELIST_VERSION_CTX_PARAM = "#M_Pricelist_Version_ID"; + public static final String PRODUCT_CATEGORY_CTX_PARAM = "#M_Product_Category_ID"; + public static final String USER_ID_CTX_PARAM = "#AD_User_ID"; + public static final String ROLE_EDITABLE_ORGS_CTX_PARAM = "#Role_Editable_Org_Access"; + public static final String ROLE_VIEWABLE_ORGS_CTX_PARAM = "#Role_Viewable_Org_Access"; + public static final String LANGUAGE_CTX_PARAM = "#AD_Language"; + public static final String WSTORE_CTX_PARAM = "#W_Store_ID"; + + public static final String DEFAULT_FORWARD = "pos"; + + public static final String WEBSTORE_DEFAULT_AD_ORG_ID_CTX_PARAM = "#AD_Org_ID_WebStoreDefault"; + + public static final String WAREHOUSE_CTX_PARAM = "#M_Warehouse_ID"; + + public static final String WEBSTORE_APP_SUFFIX = "WEBSTORE"; + + public static final String REQUEST_UPDATE_EMAIL_PREFIX = "`EMAIL`"; + public static final String REQUEST_UPDATE_EMAIL_EXT = ".txt"; + + public static final String PRINTFORMAT_ITEM_LOGO = "Logo"; + public static final String FIDELITY_BACKGROUND_IMAGE = "Fidelity"; + + + public static final String PAYMENTRULE_MIXED = "M"; + + + public static final String SHIPMENT_CHARGE = "Shipment Charge"; + + public static final String TERMINAL_ID = Env.POS_ID; + public static final String U_POSTERMINAL_ID = "#U_POSTerminal_ID"; + public static final String POS_PURCHASE_PL = "#POSPurchasePL"; + public static final String POS_PURCHASE_PL_VERSION = "#POSPurchasePLVersion"; + public static final String WEB_USER_ROLE = "WebStoreUserRole"; + public static final String ORIGINAL_IMAGE = "originalImage"; + public static final String TAMAK_ADMIN_ROLE = "posterita Admin"; + public static final String TAMAK_USER_ROLE = "posterita User"; + public static final String WEBSTORE_USER_ROLE = "WebStoreUserRole"; + + + public static final String EMAIL_FOOTER_MESSAGE = "Powered by Tamak ICT - CRM Module for Compiere ERP/CRM"; + +} diff --git a/posterita/posterita/src/main/org/posterita/model/MBPartnerProduct.java b/posterita/posterita/src/main/org/posterita/model/MBPartnerProduct.java new file mode 100644 index 0000000000..71c4dbb3cf --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/model/MBPartnerProduct.java @@ -0,0 +1,52 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 10, 2006 + */ + + +package org.posterita.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.model.X_C_BPartner_Product; + + +public class MBPartnerProduct extends X_C_BPartner_Product +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + + public MBPartnerProduct(Properties ctx, int C_BpartnerProduct_ID, String m_trxName) + { + super(ctx, C_BpartnerProduct_ID, m_trxName); + + } + + public MBPartnerProduct(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/model/MBank.java b/posterita/posterita/src/main/org/posterita/model/MBank.java new file mode 100644 index 0000000000..c5f6a6b2cb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/model/MBank.java @@ -0,0 +1,51 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 07-Jul-2005 by alok + * + */ +package org.posterita.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.model.X_C_Bank; + + +public class MBank extends X_C_Bank +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public MBank(Properties ctx, int C_Bank_ID, String m_trxName) + { + super(ctx, C_Bank_ID, m_trxName); + + } + public MBank(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/model/MBlackListCheque.java b/posterita/posterita/src/main/org/posterita/model/MBlackListCheque.java new file mode 100644 index 0000000000..027ac58fa4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/model/MBlackListCheque.java @@ -0,0 +1,47 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 07-Jul-2005 by alok + * + */ +package org.posterita.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.model.X_U_BlackListCheque; + +public class MBlackListCheque extends X_U_BlackListCheque +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public MBlackListCheque(Properties ctx, int U_BlackListCheque_ID, String trxName) + { + super(ctx, U_BlackListCheque_ID, trxName); + } + + public MBlackListCheque(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/model/MMAttachment.java b/posterita/posterita/src/main/org/posterita/model/MMAttachment.java new file mode 100644 index 0000000000..6af9c714fc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/model/MMAttachment.java @@ -0,0 +1,81 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 10, 2006 by ashley +* +*/ + +package org.posterita.model; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.model.MAttachment; +import org.compiere.util.DB; + +import org.posterita.exceptions.OperationException; + +public class MMAttachment extends MAttachment +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unused") + private MMAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String trxName) + { + super(ctx, AD_Table_ID, Record_ID, trxName); + } + + public static MAttachment get (Properties ctx, int AD_Table_ID, int Record_ID, String trxName) throws OperationException + { + MAttachment retValue = null; + PreparedStatement pstmt = null; + String sql = "SELECT * FROM AD_Attachment WHERE AD_Table_ID=? AND Record_ID=?"; + try + { + pstmt = DB.prepareStatement (sql, trxName); + pstmt.setInt (1, AD_Table_ID); + pstmt.setInt (2, Record_ID); + ResultSet rs = pstmt.executeQuery (); + if (rs.next ()) + retValue = new MAttachment (ctx, rs, trxName); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + throw new OperationException("Cannot get attachment!!!", e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + return retValue; + } // get +} diff --git a/posterita/posterita/src/main/org/posterita/model/MRevenueRecognition.java b/posterita/posterita/src/main/org/posterita/model/MRevenueRecognition.java new file mode 100644 index 0000000000..e9c7fb668a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/model/MRevenueRecognition.java @@ -0,0 +1,50 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jun 12, 2006 + */ + + +package org.posterita.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.model.X_C_RevenueRecognition; + + +public class MRevenueRecognition extends X_C_RevenueRecognition +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public MRevenueRecognition(Properties ctx, int C_REVENUERECOGNITION_ID, String trxName) + { + super(ctx, C_REVENUERECOGNITION_ID, trxName); + } + + public MRevenueRecognition(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + +} + + diff --git a/posterita/posterita/src/main/org/posterita/model/MRoleMenu.java b/posterita/posterita/src/main/org/posterita/model/MRoleMenu.java new file mode 100644 index 0000000000..09e4c118c3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/model/MRoleMenu.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.model.X_U_RoleMenu; + + +public class MRoleMenu extends X_U_RoleMenu +{ + + public MRoleMenu(Properties ctx, int U_RoleMenu_ID, String trxName) + { + super(ctx, U_RoleMenu_ID, trxName); + } + + public MRoleMenu(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/model/MWebMenu.java b/posterita/posterita/src/main/org/posterita/model/MWebMenu.java new file mode 100644 index 0000000000..36f5639f34 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/model/MWebMenu.java @@ -0,0 +1,41 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.model.X_U_WebMenu; + + +public class MWebMenu extends X_U_WebMenu +{ + + public MWebMenu(Properties ctx, int U_WebMenu_ID, String trxName) + { + super(ctx, U_WebMenu_ID, trxName); + } + + public MWebMenu(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/model/MWebProperties.java b/posterita/posterita/src/main/org/posterita/model/MWebProperties.java new file mode 100644 index 0000000000..30d0db4200 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/model/MWebProperties.java @@ -0,0 +1,52 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 12-Oct-2005 + */ + + +package org.posterita.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.model.X_U_Web_Properties; + + +public class MWebProperties extends X_U_Web_Properties +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + + public MWebProperties(Properties ctx, int uWebProperties , String trxName) + { + super(ctx,uWebProperties,trxName); + } + + public MWebProperties(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/order/UDIOrderType.java b/posterita/posterita/src/main/org/posterita/order/UDIOrderType.java new file mode 100644 index 0000000000..a29436670a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/order/UDIOrderType.java @@ -0,0 +1,26 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.order; + + +public interface UDIOrderType +{ + public String getOrderType(); +} diff --git a/posterita/posterita/src/main/org/posterita/order/UDIOrderTypes.java b/posterita/posterita/src/main/org/posterita/order/UDIOrderTypes.java new file mode 100644 index 0000000000..61f4c4d524 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/order/UDIOrderTypes.java @@ -0,0 +1,142 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.order; + + +public class UDIOrderTypes +{ + private UDIOrderTypes() + { + + } + + public static final UDIOrderType CREDIT_ORDER = new CreditOrder(); + + public static final UDIOrderType CREDIT_ORDER_NO_SHIPMENT = new CreditOrderNoShipment(); + + public static final UDIOrderType CUSTOMER_RETURN_ORDER = new CustomerReturnOrder(); + + public static final UDIOrderType POS_ORDER = new POSOrder(); + + public static final UDIOrderType POS_GOODS_RECEIVE_NOTE = new POSGoodsReceiveNote(); + + public static final UDIOrderType POS_GOODS_RETURN_NOTE = new POSGoodsReturnNote(); + + public static final UDIOrderType WEBSTORE_ORDER = new WebstoreOrder(); + + public static final UDIOrderType CREDIT_MEMO = new CreditMemo(); + + + + public static class POSGoodsReceiveNote implements UDIOrderType + { + + public String getOrderType() + { + return "POS Goods Receive Note"; + } + + } + + public static class CreditMemo implements UDIOrderType + { + + public String getOrderType() + { + return "Credit Memo"; + } + + } + + public static class POSGoodsReturnNote implements UDIOrderType + { + + public String getOrderType() + { + return "POS Goods Returned Note"; + } + + } + + public static class POSOrder implements UDIOrderType + { + + public String getOrderType() + { + return "POS Order"; + } + + } + + public static class CustomerOrder implements UDIOrderType + { + + public String getOrderType() + { + return "Customer Order"; + } + + } + + public static class AllocationOrder implements UDIOrderType + { + public String getOrderType() + { + return "Allocation Order"; + } + + } + + public static class CreditOrder implements UDIOrderType + { + public String getOrderType() + { + return "Credit Order"; + } + } + + public static class CreditOrderNoShipment implements UDIOrderType + { + public String getOrderType() + { + return "Credit Order no Shipment"; + } + } + + public static class CustomerReturnOrder implements UDIOrderType + { + + public String getOrderType() + { + return "Customer Returned Order"; + } + + } + + public static class WebstoreOrder implements UDIOrderType + { + + public String getOrderType() + { + return "Webstore Order"; + } + + } +} diff --git a/posterita/posterita/src/main/org/posterita/pos/help/POSHelpAction.java b/posterita/posterita/src/main/org/posterita/pos/help/POSHelpAction.java new file mode 100644 index 0000000000..3bd9fac91e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/pos/help/POSHelpAction.java @@ -0,0 +1,101 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 6 Feb 2008 17:25:51 by shameem + * + */ + +package org.posterita.pos.help; + +import java.io.FileNotFoundException; +import java.text.ParseException; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.beans.POSHelpBean; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.POSHelpForm; +import org.posterita.struts.core.BaseDispatchAction; + +import com.lowagie.text.DocumentException; + +public class POSHelpAction extends BaseDispatchAction +{ + public static final String INIT_CONTACT_US= "initContactUs"; + public ActionForward initContactUs(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, ParseException, FileNotFoundException, DocumentException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(INIT_CONTACT_US); + } + + public static final String SEND_EMAIL = "sendEmail"; + + public ActionForward sendEmail(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, ParseException, FileNotFoundException, DocumentException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + boolean Ok = false; + + POSHelpForm hf = (POSHelpForm) form; + POSHelpBean bean = (POSHelpBean) hf.getBean(); + + if(bean.getFromAddress().equals("")) + { + postGlobalError("error.required.email",request); + return mapping.getInputForward(); + } + + if(bean.getSubject().equals("")) + { + postGlobalError("email.subject.error",request); + return mapping.getInputForward(); + } + + if(bean.getTextMessage().equals("")) + { + postGlobalError("email.message.error",request); + return mapping.getInputForward(); + } + + + Ok = POSHelpManager.sendEmail(ctx, bean.getFromAddress(), bean.getToAddresses(), bean.getSubject(), bean.getTextMessage()); + + if(Ok == false) + { + postGlobalError("email.send.error",request); + return mapping.getInputForward(); + } + else + { + return mapping.findForward(SEND_EMAIL); + } + + } +} diff --git a/posterita/posterita/src/main/org/posterita/pos/help/POSHelpManager.java b/posterita/posterita/src/main/org/posterita/pos/help/POSHelpManager.java new file mode 100644 index 0000000000..50a4a604b8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/pos/help/POSHelpManager.java @@ -0,0 +1,61 @@ +/** + * + * Copyright (c) 2008 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 11 Feb 2008 10:20:44 by shameem + * + */ + +package org.posterita.pos.help; + +import java.util.Properties; +import java.util.logging.Level; + +import javax.mail.Message; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; + +import org.compiere.model.MClient; +import org.compiere.util.EMail; +import org.compiere.util.Env; + +public class POSHelpManager +{ + + public static boolean sendEmail(Properties ctx, String from, String to, String subject, String body) + { + String emailAddress = to; + + MClient client = MClient.get(ctx); + + EMail email = client.createEMail(emailAddress, subject, body); + email.setFrom(from); + if (email != null) + { + if (EMail.SENT_OK.equals (email.send ())) + { + return true; + } + } + + client.get_Logger().log(Level.SEVERE, "Unable to sent email"); + + return false; + + } +} diff --git a/posterita/posterita/src/main/org/posterita/pos/taglib/AjaxTag.java b/posterita/posterita/src/main/org/posterita/pos/taglib/AjaxTag.java new file mode 100644 index 0000000000..6eae32e6ba --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/pos/taglib/AjaxTag.java @@ -0,0 +1,34 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.pos.taglib; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Ashley G Ramdass + * Apr 28, 2008 + */ +public interface AjaxTag +{ + public static final String AJAX_ACTION = "AjaxAction.do"; + + public abstract void processRequest(HttpServletRequest request, HttpServletResponse response); +} diff --git a/posterita/posterita/src/main/org/posterita/pos/taglib/BPartnerSearchTag.java b/posterita/posterita/src/main/org/posterita/pos/taglib/BPartnerSearchTag.java new file mode 100644 index 0000000000..c11f5155f4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/pos/taglib/BPartnerSearchTag.java @@ -0,0 +1,423 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.pos.taglib; + +import java.io.OutputStream; +import java.io.PrintWriter; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.tagext.TagSupport; + +import org.apache.commons.beanutils.BeanUtils; +import org.apache.ecs.xhtml.div; +import org.apache.ecs.xhtml.input; +import org.apache.ecs.xhtml.script; +import org.compiere.model.I_C_BPartner; +import org.compiere.model.MBPartner; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.businesslogic.ElementManager; +import org.posterita.struts.core.AjaxAction; + +/** + * @author Ashley G Ramdass + * Apr 22, 2008 + */ +public class BPartnerSearchTag extends TagSupport implements AjaxTag +{ + private static final CLogger log = CLogger.getCLogger(BPartnerSearchTag.class); + private static final String REQUEST_PARAM = "bpValue"; + private String name = ""; + private String property = ""; + private boolean disabled = false; + private boolean isCustomer = false; + private boolean isVendor = false; + private boolean isEmployee = false; + private boolean showNonActive = false; + private int size = 20; + private String queryId = ""; + private String resultId = ""; + private String searchTerm; + private int bpartnerId = 0; + private String bpartnerValue = ""; + + + public int doStartTag() throws JspException + { + JspWriter out = pageContext.getOut(); + bpartnerId = 0; + bpartnerValue = ""; + try + { + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + + Object form = request.getAttribute(name); + + if (form == null) + { + form = request.getSession().getAttribute(name); + } + + String value = (String)BeanUtils.getSimpleProperty(form, property); + if (value != null && value.trim().length() > 0) + { + bpartnerId = Integer.parseInt(value); + } + + if (bpartnerId > 0) + { + MBPartner bPartner = new MBPartner(TmkJSPEnv.getCtx((HttpServletRequest)pageContext.getRequest()), bpartnerId, null); + bpartnerValue = bPartner.getName(); + } + } + catch (Exception ex) + { + log.log(Level.SEVERE, "Could not get value of BPartner", ex); + bpartnerId = -1; + } + + queryId = property + "Query"; + resultId = property + "SearchResult"; + + input bpInput = new input(); + bpInput.setID(property); + bpInput.setName(property); + bpInput.setType(input.TYPE_HIDDEN); + if (bpartnerId > 0) + { + bpInput.setValue(bpartnerId); + } + + input queryInput = new input(); + queryInput.setType(input.TYPE_TEXT); + queryInput.setID(queryId); + queryInput.setValue(bpartnerValue); + queryInput.setDisabled(disabled); + queryInput.setSize(size); + + div resultDiv = new div(); + resultDiv.setID(resultId); + resultDiv.setClass("autocomplete"); + + div mainDiv = new div(); + mainDiv.addElement(bpInput); + mainDiv.addElement(queryInput); + mainDiv.addElement(resultDiv); + mainDiv.addElement(getAjaxScript()); + + try + { + out.write(mainDiv.toString()); + } + catch (Exception ex) + { + throw new JspException(ex); + } + + return SKIP_BODY; + } + + public int doEndTag() throws JspException + { + return EVAL_PAGE; + } + + private script getAjaxScript() + { + script ajaxScript = new script(); + + StringBuffer src = new StringBuffer(400); + src.append("// auto complete for customer\n"); + src.append("$('").append(queryId).append("').Autocompleter = new Ajax.Autocompleter('") + .append(queryId).append("','").append(resultId).append("',\n"); + src.append("'").append(AJAX_ACTION).append("',{\n"); + src.append("paramName:'").append(REQUEST_PARAM).append("',\n"); + src.append("parameters: 'action=processRequest&").append(AjaxAction.PROCESS_REQUEST_PARAM).append("=BPartnerSearchTag") + .append("&isCustomer=").append(isCustomer).append("&isVendor=").append(isVendor).append("&isEmployee=").append(isEmployee).append("',\n"); + src.append("frequency:TROTTLE_TIME,\n"); + src.append("onShow:function(element, update){\n"); + src.append(" if(!update.style.position || update.style.position=='absolute') {\n"); + src.append(" update.style.position = 'absolute';\n"); + src.append(" Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});\n"); + src.append(" }\n"); + src.append(" update.style.display = 'block';\n"); + src.append("},\n"); + src.append("afterUpdateElement:function(e1,e2) {\n"); + src.append(" var id = $('").append(property).append("');\n"); + src.append(" var text = $('").append(queryId).append("');\n"); + src.append(" if(e2.value != '-1')\n"); + src.append(" {\n"); + src.append(" if(e2.value)\n"); + src.append(" {\n"); + //src.append(" alert(e2.value);"); + src.append(" id.value = e2.value;\n"); + src.append(" text.value = e2.getAttribute('name');\n"); + src.append(" }\n"); + src.append(" else\n"); + src.append(" {\n"); + //src.append(" alert('Setting blank');"); + src.append(" id.value = '';\n"); + src.append(" }\n"); + src.append(" }\n"); + src.append(" else\n"); + src.append(" {\n"); + //src.append(" alert('set blank');"); + src.append(" id.value = '';\n"); + src.append(" text.value = '';\n"); + src.append(" }//if\n"); + src.append("}\n"); + src.append("});\n"); + + ajaxScript.setTagText(src.toString()); + return ajaxScript; + } + + + private ArrayList getBPartnerList(Properties ctx) + { + ArrayList bpartnerList = new ArrayList(); + + StringBuffer sqlStmt = new StringBuffer(); + sqlStmt.append("SELECT * FROM C_BPartner WHERE AD_Client_ID=? AND IsActive='Y' AND IsCustomer=? "); + sqlStmt.append("AND IsVendor=? AND IsEmployee=? "); + + if (searchTerm != null && searchTerm.trim().length() != 0) + { + sqlStmt.append("AND UPPER(Name) LIKE '%").append(searchTerm.toUpperCase()).append("%' "); + } + + sqlStmt.append("ORDER BY Name"); + + PreparedStatement pstmt = null; + ResultSet rs = null; + + try + { + int param = 1; + pstmt = DB.prepareStatement(sqlStmt.toString(), null); + pstmt.setInt(param++, Env.getAD_Client_ID(ctx)); + pstmt.setString(param++, isCustomer ? "Y" : "N"); + pstmt.setString(param++, isVendor ? "Y" : "N"); + pstmt.setString(param++, isEmployee ? "Y" : "N"); + + rs = pstmt.executeQuery(); + + while (rs.next()) + { + MBPartner bPartner = new MBPartner(ctx, rs, null); + bpartnerList.add(bPartner); + } + } + catch (Exception ex) + { + log.log(Level.SEVERE, "Could not retrieve BPartners", ex); + } + finally + { + DB.close(rs, pstmt); + } + return bpartnerList; + } + + private void writeOutput(Properties ctx, OutputStream outStream, ArrayList bpartnerList) + { + PrintWriter writer = new PrintWriter(outStream); + + if (bpartnerList == null || bpartnerList.size() == 0) + { + writer.write("
      "); + writer.write("
    • "); + writer.write("
    "); + writer.write("
    "); + } + else + { + writer.write("
      "); + for (I_C_BPartner bpartner : bpartnerList) + { + writer.write("
    • "); + writer.write(bpartner.getName()); + writer.write("
    • "); + } + writer.write("
    "); + } + + writer.flush(); + writer.close(); + } + + public void processRequest(HttpServletRequest request, HttpServletResponse response) + { + Properties ctx = TmkJSPEnv.getCtx(request); + isCustomer = Boolean.parseBoolean(request.getParameter("isCustomer")); + isVendor = Boolean.parseBoolean(request.getParameter("isVendor")); + isEmployee = Boolean.parseBoolean(request.getParameter("isEmployee")); + searchTerm = request.getParameter(REQUEST_PARAM); + + try + { + ArrayList bpartnerList = getBPartnerList(ctx); + writeOutput(ctx, response.getOutputStream(), bpartnerList); + response.getOutputStream().flush(); + } + catch (Exception ex) + { + log.log(Level.SEVERE, "Could not write output", ex); + } + } + + /** + * @return the isCustomer + */ + public boolean getIsCustomer() + { + return isCustomer; + } + + /** + * @param isCustomer the isCustomer to set + */ + public void setIsCustomer(boolean isCustomer) + { + this.isCustomer = isCustomer; + } + + /** + * @return the isVendor + */ + public boolean getIsVendor() + { + return isVendor; + } + + /** + * @param isVendor the isVendor to set + */ + public void setIsVendor(boolean isVendor) + { + this.isVendor = isVendor; + } + + /** + * @return the isEmployee + */ + public boolean getIsEmployee() + { + return isEmployee; + } + + /** + * @param isEmployee the isEmployee to set + */ + public void setIsEmployee(boolean isEmployee) + { + this.isEmployee = isEmployee; + } + + /** + * @return the showNonActive + */ + public boolean getIsShowNonActive() + { + return showNonActive; + } + + /** + * @param showNonActive the showNonActive to set + */ + public void setIsShowNonActive(boolean showNonActive) + { + this.showNonActive = showNonActive; + } + + /** + * @return the id + */ + public String getProperty() + { + return property; + } + + /** + * @param id the id to set + */ + public void setProperty(String id) + { + this.property = id; + } + + /** + * @return the name + */ + public String getName() + { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) + { + this.name = name; + } + + /** + * @return the disabled + */ + public boolean isDisabled() + { + return disabled; + } + + /** + * @param disabled the disabled to set + */ + public void setDisabled(boolean disabled) + { + this.disabled = disabled; + } + + /** + * @return the size + */ + public int getSize() + { + return size; + } + + /** + * @param size the size to set + */ + public void setSize(int size) + { + this.size = size; + } +} diff --git a/posterita/posterita/src/main/org/posterita/pos/taglib/MessageTag.java b/posterita/posterita/src/main/org/posterita/pos/taglib/MessageTag.java new file mode 100644 index 0000000000..84908ebfdd --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/pos/taglib/MessageTag.java @@ -0,0 +1,128 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Nov 15, 2006 by ashley + */ + +/** + * @author ashley + */ + +package org.posterita.pos.taglib; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.tagext.TagSupport; + +import org.compiere.wstore.JSPEnv; + +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; + +public class MessageTag extends TagSupport +{ + private static final long serialVersionUID = 1L; + + private String key; + private boolean printing = false; + private boolean textOnly = false; + + public int doStartTag() throws JspException + { + Properties ctx = JSPEnv.getCtx((HttpServletRequest)pageContext.getRequest()); + + ElementBean elementBean = ElementManager.getMsg(ctx, key); + + String disp = ""; + + if (isPrinting()) + { + disp = elementBean.getPrintName(); + } + else + { + disp = elementBean.getName(); + } + + try + { + JspWriter out = pageContext.getOut(); + if (this.isTextOnly()) + { + out.write(elementBean.getName()); + } + else + { + String help = ((elementBean.getHelp() != null) ? elementBean.getHelp() : ""); + out.print(""); + out.print(disp); + out.print(""); + } + } + catch (Exception e) + { + throw new JspException(e); + } + + return (SKIP_BODY); + } + + public int doEndTag() throws JspException + { + return EVAL_PAGE; + } + + public String getKey() + { + return key; + } + + public void setKey(String key) + { + this.key = key; + } + + public boolean isPrinting() + { + return printing; + } + + public void setPrinting(boolean printing) + { + this.printing = printing; + } + + public boolean isTextOnly() + { + return textOnly; + } + + public void setTextOnly(boolean textOnly) + { + this.textOnly = textOnly; + } +} diff --git a/posterita/posterita/src/main/org/posterita/process/SetupWebPOS.java b/posterita/posterita/src/main/org/posterita/process/SetupWebPOS.java new file mode 100644 index 0000000000..4c2c94f0a1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/process/SetupWebPOS.java @@ -0,0 +1,341 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + * Autor: Victor Perez victor.perez@e-evolution.con www.e-evolution.com * + *****************************************************************************/ + +package org.posterita.process; + +import java.math.BigDecimal; +import java.util.Iterator; +import java.util.logging.Level; + +import org.compiere.model.MRole; +import org.compiere.model.MRoleMenu; +import org.compiere.model.MUser; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.process.SvrProcess; +import org.compiere.util.Env; +import org.posterita.factory.POSMenuFactory; +import org.posterita.model.MWebMenu; +import org.posterita.util.PoManager; + + + + +/** + * Setup Web POS in Adempiere + * @author victor.perez@e-evolution + */ +public class SetupWebPOS extends SvrProcess +{ + + + private int p_AD_Org_ID = 0; + private int p_C_CashBook_ID = 0; + private int p_M_PriceList_Version_ID = 0; + private int p_PriceList_Version_ID = 0; + private int p_M_DiscountSchema_ID = 0; + private int p_C_Bank_ID = 0; + private int p_C_BankAccount_ID = 0 ; + private int p_C_TaxCategory_ID = 0 ; + private int p_M_Locator_ID = 0; + private int p_C_BPartner_ID = 0; + private int p_SalesRep_ID = 0; + private int p_AD_Role_ID = 0; + private String p_userPIN = ""; + private String p_POS_Name = "Terminal 1"; + private String p_HostAddress = ""; + + private int AD_Client_ID = 0; + + + + /** + * Prepare + */ + protected void prepare() + { + AD_Client_ID = Env.getAD_Client_ID(getCtx()); + ProcessInfoParameter[] para = getParameter(); + for (int i = 0; i < para.length; i++) + { + String name = para[i].getParameterName(); + + if (para[i].getParameter() == null) + ; + else if (name.equals("AD_Org_ID")) + { + p_AD_Org_ID = para[i].getParameterAsInt(); + } + else if (name.equals("C_CashBook_ID")) + { + p_C_CashBook_ID = para[i].getParameterAsInt(); + } + else if (name.equals("M_PriceList_Version_ID")) + { + p_M_PriceList_Version_ID = para[i].getParameterAsInt(); + } + else if (name.equals("PriceList_Version_ID")) + { + p_PriceList_Version_ID = para[i].getParameterAsInt(); + } + else if (name.equals("M_DiscountSchema_ID")) + { + p_M_DiscountSchema_ID = para[i].getParameterAsInt(); + } + else if (name.equals("C_Bank_ID")) + { + p_C_Bank_ID = para[i].getParameterAsInt(); + } + else if (name.equals("C_BankAccount_ID")) + { + p_C_BankAccount_ID = para[i].getParameterAsInt(); + } + else if (name.equals("C_TaxCategory_ID")) + { + p_C_TaxCategory_ID = para[i].getParameterAsInt(); + } + else if (name.equals("M_Locator_ID")) + { + p_M_Locator_ID = para[i].getParameterAsInt(); + } + else if (name.equals("C_BPartner_ID")) + { + p_C_BPartner_ID = para[i].getParameterAsInt(); + } + else if (name.equals("SalesRep_ID")) + { + p_SalesRep_ID = para[i].getParameterAsInt(); + } + else if (name.equals("AD_Role_ID")) + { + p_AD_Role_ID = para[i].getParameterAsInt(); + } + else if (name.equals("UserPIN")) + { + p_userPIN = (String)para[i].getParameter(); + } + else if (name.equals("Name")) + { + p_POS_Name = (String)para[i].getParameter(); + } + else if (name.equals("HostAddress")) + { + p_HostAddress = (String)para[i].getParameter(); + } + else + { + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } + } + + } + + + /** + * Process create a new Terminal POS + * @return info + * @throws Exception + */ + protected String doIt() throws Exception + { + CreatePOS(); + createAdmin(); + return "@OK@"; + } + + /** + * Create new terminal web POS + */ + public void CreatePOS() throws Exception + { + // Need to refactor correctly with new terminal @ashley + /*log.info("Creating POS Terminal..."); + MPriceListVersion purchasepricelistversion = new MPriceListVersion(getCtx(), p_PriceList_Version_ID, get_TrxName()); + MPOS posTerminal = null; + int pos_id = DB.getSQLValue(get_TrxName(), "SELECT C_POS_ID FROM C_POS WHERE AD_Client_ID=" + AD_Client_ID + " AND Name='"+p_POS_Name + "'"); + if(pos_id != 0) + { + posTerminal = new MPOS(getCtx(), pos_id , get_TrxName()); + } + else + { + posTerminal = new MPOS(getCtx(), 0 , get_TrxName()); + } + + + posTerminal = new MPOS(getCtx(), 0, get_TrxName()); + posTerminal.setName(p_POS_Name); + posTerminal.setAD_Org_ID(p_AD_Org_ID); + posTerminal.setC_CashBook_ID(p_C_CashBook_ID); + MPriceListVersion pricelistversion = new MPriceListVersion(getCtx(), p_M_PriceList_Version_ID, get_TrxName()); + posTerminal.setM_PriceList_ID(pricelistversion.getM_PriceList_ID()); + MLocator locator = new MLocator (getCtx(), p_M_Locator_ID, get_TrxName()); + posTerminal.setM_Warehouse_ID(locator.getM_Warehouse_ID()); + posTerminal.setC_BPartnerCashTrx_ID(p_C_BPartner_ID); + posTerminal.setSalesRep_ID(p_SalesRep_ID); + posTerminal.setM_PriceList_ID(purchasepricelistversion.getM_PriceList_ID()); + if(!posTerminal.save()) + throw new IllegalArgumentException("can not create POS Terminal"); + + log.info("Creating Web store configuration..."); + MClient client = new MClient(getCtx(), AD_Client_ID, get_TrxName()); + MStore store = null; + int store_id = DB.getSQLValue(get_TrxName(), "SELECT W_STORE_ID FROM W_STORE WHERE AD_Client_ID=" + AD_Client_ID + " AND IsActive='Y' AND Name='"+client.getName() + " POS" + "'"); + if(store_id != 0) + { + store = new MStore(getCtx(), store_id , get_TrxName()); + } + else + { + store = new MStore(getCtx(), 0, get_TrxName()); + } + + store.setName(client.getName() + " POS"); + store.setM_PriceList_ID(purchasepricelistversion.getM_PriceList_ID()); + store.setWebContext(client.getName() + "pos"); + store.setSalesRep_ID(p_SalesRep_ID); + store.setAD_Org_ID(p_AD_Org_ID); + store.setWebParam5("posteritaWarmsCSS.jsp"); + store.setWebParam6("pos"); + store.setURL(p_HostAddress); + store.setM_Warehouse_ID(locator.getM_Warehouse_ID()); + if(!store.save()) + throw new IllegalArgumentException("can not create Web Store");*/ + + return ; + + } + + /** + * Create Admin Role POS web + */ + public void createAdmin() throws Exception + { + + MRole role = new MRole(getCtx(), p_AD_Role_ID, get_TrxName()); + role.setUserDiscount(BigDecimal.valueOf(0.00)); + role.setIsPersonalAccess(true); + role.setIsAccessAllOrgs(false); + role.setUserLevel(MRole.USERLEVEL_Organization); + role.save(); + + /*if(!role.isAccessAllOrgs()) + { + MRoleOrgAccess orgAccess = new MRoleOrgAccess(role,Env.getAD_Org_ID(getCtx())); + orgAccess.save(); + }*/ + + + + MUser user = new MUser(getCtx(), p_SalesRep_ID, get_TrxName()); + user.setIsFullBPAccess(true); + if(p_userPIN!=null) + { + int id[] = MUser.getAllIDs(MUser.Table_Name," AD_Client_ID=" + Env.getAD_Client_ID(getCtx()) + " and userPin='"+p_userPIN + "'",null); + + if(id.length>0) + throw new IllegalArgumentException("User Pin Already exists"); + else + user.setUserPIN(p_userPIN); + } + + user.save(); + + /*int [] commissionIds = MCommission.getAllIDs(MCommission.Table_Name," AD_CLIENT_ID="+Env.getAD_Client_ID(getCtx())+" and C_BPARTNER_ID="+user.getC_BPartner_ID()+" and isActive='Y'",null); + if(commissionIds!=null && commissionIds.length>1) + throw new IllegalArgumentException("Sales rep has more than one commission"+ commissionIds.length); + + MCommission com; + MCommissionLine comLine; + if(commissionIds==null || commissionIds.length<1) + { + com = new MCommission(getCtx(),0,get_TrxName()); + comLine = new MCommissionLine(getCtx(),0,get_TrxName()); + } + else + { + com = new MCommission(getCtx(),commissionIds[0],get_TrxName()); + MCommissionLine [] line =com.getLines(); + if(line.length!=1) + throw new IllegalArgumentException("either No commissionLine or more than One commission Line has bean defined for this bPartner"); + comLine = new MCommissionLine(getCtx(),line[0].get_ID(),get_TrxName()); + } + int [] chargeIds = MCharge.getAllIDs(MCharge.Table_Name, " AD_Client_ID = " + AD_Client_ID + " AND IsDefault='Y'", get_TrxName()); + if(chargeIds.length<1) + { + MCharge charge = new MCharge(getCtx(),0,get_TrxName()); + charge.setName(Msg.translate(getCtx(), "Commission")); + charge.setChargeAmt(new BigDecimal(0)); + //charge.setC_TaxCategory_ID(); + charge.save(); + com.setC_Charge_ID( charge.getC_Charge_ID()); + } + else + { + com.setC_Charge_ID( chargeIds[0]); + } + + + + com.setC_Charge_ID( chargeIds[0]); + com.setName(user.getName()); + com.setC_BPartner_ID(user.getC_BPartner_ID()); + com.setFrequencyType(com.FREQUENCYTYPE_Monthly); + MClient client = new MClient(getCtx(), AD_Client_ID , get_TrxName()); + com.setC_Currency_ID(client.getAcctSchema().getC_Currency_ID()); + com.setDocBasisType(com.DOCBASISTYPE_Receipt); + com.setListDetails(true); + com.save(); + + + + comLine.setC_Commission_ID(com.get_ID()); + comLine.setAmtMultiplier(Env.ZERO); + comLine.setDescription(Msg.translate(getCtx(), "Commission")); + comLine.setCommissionOrders(true); + comLine.setIsPositiveOnly(true); + comLine.setAmtSubtract(Env.ZERO); + comLine.save();*/ + + + String whereClause = " AD_Role_ID=" + role.get_ID(); + + int roleMenuIds[] = MRoleMenu.getAllIDs(MRoleMenu.Table_Name, whereClause, get_TrxName()); + + for(int i = 0; i < roleMenuIds.length; i++) + { + MRoleMenu roleMenu = new MRoleMenu(getCtx(), roleMenuIds[i], get_TrxName()); + roleMenu.delete(true); + } + + + POSMenuFactory posMFactory = POSMenuFactory.getFactoryInstance(getCtx()); + Iterator keyIter = posMFactory.getAllKeys(getCtx()).iterator(); + + while(keyIter.hasNext()) + { + String key = (String)keyIter.next(); + MWebMenu menu = (MWebMenu)posMFactory.get(getCtx(), key); + MRoleMenu roleMenu = new MRoleMenu(getCtx(), 0, get_TrxName()); + roleMenu.setAD_Role_ID(role.get_ID()); + roleMenu.setU_WebMenu_ID(menu.get_ID()); + PoManager.save(roleMenu); + } + + return; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/admin/CheckSequenceAction.java b/posterita/posterita/src/main/org/posterita/struts/admin/CheckSequenceAction.java new file mode 100644 index 0000000000..6100034d93 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/admin/CheckSequenceAction.java @@ -0,0 +1,67 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 09-Feb-2006 + */ + + +package org.posterita.struts.admin; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.core.TmkJSPEnv; + +import org.posterita.businesslogic.administration.CheckSequenceManager; +import org.posterita.exceptions.SequenceUpdateException; +import org.posterita.struts.core.BaseDispatchAction; + + +public class CheckSequenceAction extends BaseDispatchAction +{ + public static final String CHECK_SEQUENCE="checkSequence"; + public ActionForward checkSequence(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + try + { + CheckSequenceManager.runProcess(ctx); + } + catch(SequenceUpdateException e) + { + postGlobalError("error.update.sequence",request); + return mapping.getInputForward(); + } + + + return mapping.findForward(CHECK_SEQUENCE); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/admin/OrganisationAction.java b/posterita/posterita/src/main/org/posterita/struts/admin/OrganisationAction.java new file mode 100644 index 0000000000..6050fc8aef --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/admin/OrganisationAction.java @@ -0,0 +1,139 @@ +package org.posterita.struts.admin; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.OrgBean; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.WarehouseAlreadyExistsException; +import org.posterita.form.OrgForm; +import org.posterita.struts.core.BaseDispatchAction; + +public class OrganisationAction extends BaseDispatchAction +{ + + public static final String UPDATE_OR_CREATE_ORG = "updateOrCreateOrg"; + public ActionForward updateOrCreateOrg(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, SQLException, WarehouseAlreadyExistsException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + OrgForm of = (OrgForm) form; + OrgBean bean = (OrgBean) of.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + + try + { + trx.start(); + OrganisationManager.updateOrCreateOrganisation(ctx, bean, trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.process", e.getMessage(), request); + } + finally + { + trx.close(); + } + ArrayList list = OrganisationManager.getOrganisations(ctx, bean.getOrgName(), null); + + request.getSession().setAttribute(Constants.ALL_ORGS, list); + return mapping.findForward(LIST_ORGS); + } + + public static final String LIST_ORGS = "listOrgs"; + public ActionForward listOrgs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, SQLException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + OrgForm of = (OrgForm) form; + OrgBean bean = (OrgBean) of.getBean(); + + String orgName = bean.getOrgName(); + ArrayList list = OrganisationManager.getOrganisations(ctx, orgName, null); + + request.getSession().setAttribute(Constants.ALL_ORGS, list); + return mapping.findForward(LIST_ORGS); + } + + public static final String ACTIVATE_ORG = "activateOrg"; + public ActionForward activateOrg(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + OrgForm of = (OrgForm) form; + OrgBean bean = (OrgBean) of.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + + try + { + trx.start(); + OrganisationManager.activateOrganisation(ctx, bean, trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.process", e.getMessage(), request); + } + finally + { + trx.close(); + } + ArrayList list = new ArrayList(); + list.add(OrganisationManager.getOrganisation(ctx, bean.getOrgId())); + + request.getSession().setAttribute(Constants.ALL_ORGS, list); + return mapping.findForward(LIST_ORGS); + } + + public static final String VIEW_ORG = "viewOrg"; + public ActionForward viewOrg(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, SQLException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + OrgForm of = (OrgForm) form; + + OrgBean bean = (OrgBean) of.getBean(); + bean = OrganisationManager.getOrganisation(ctx, bean.getOrgId()); + of.populate(bean); + + request.getSession().setAttribute(Constants.ORG_ID,bean.getOrgId()); + return mapping.findForward(UPDATE_OR_CREATE_ORG); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/admin/RoleAction.java b/posterita/posterita/src/main/org/posterita/struts/admin/RoleAction.java new file mode 100644 index 0000000000..3eec984603 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/admin/RoleAction.java @@ -0,0 +1,196 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 16, 2005 by praveen + * + */ +package org.posterita.struts.admin; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MRole; +import org.compiere.util.Trx; +import org.posterita.core.TmkJSPEnv; + +import org.posterita.Constants; +import org.posterita.beans.RoleBean; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.core.MenuItem; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.RoleAlreadyExistsException; +import org.posterita.exceptions.SystemException; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class RoleAction extends BaseDispatchAction +{ + public static final String CREATE_ROLE = "createRole"; + public static final String INIT_ROLE = "initRole"; + public static final String LIST_ROLES = "listRoles"; + public static final String VIEW_ROLE = "viewRole"; + public static final String DELETE_ROLE = "deleteRole"; + + public ActionForward createRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + RoleBean bean = (RoleBean) df.getBean(); + + + //Create Role and assign menus + MRole role; + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + trx.start(); + try + { + role = RoleManager.createRole(ctx,bean.getOrgId(), bean.getName(),bean.getIsAccessAllOrgs(), bean.getCheckBox(), bean.getUserDiscount(), bean.getIsOverwritePriceLimit() , bean.getIsDiscountAllowedOnTotal(), bean.getIsDiscountUptoLimitPrice(), bean.getCanCreateOrder(), bean.getCanAlterOrder(), bean.getCanViewOrder(), trx.getTrxName()); + ArrayList menus = MenuManager.getMenus(ctx, role.get_ID()); + MenuItem rootItem = MenuManager.buildMenuTree(ctx, menus); + + request.getSession().setAttribute(Constants.ROLE,bean); + request.getSession().setAttribute(Constants.ROLE_MENUS, rootItem.getSubMenus()); + trx.commit(); + } + catch (RoleAlreadyExistsException e) + { + trx.rollback(); + postGlobalError("error.role.already.exists",request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(CREATE_ROLE); + + } + + public ActionForward initRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + //ArrayList menuList = MenuKeyNamePair.getKeyNamePairs(ctx); + + //String menu = MenuItem.getMenu(ctx, null); + + //request.getSession().setAttribute(Constants.MENUS,menu); + + ArrayList menus = MenuManager.getMenusForOrganisationType(ctx); + MenuItem rootItem = MenuManager.buildMenuTree(ctx, menus); + + //request.getSession().setAttribute(Constants.ROLE,bean); + request.getSession().setAttribute(Constants.ROLE_MENUS, rootItem.getSubMenus()); + + return mapping.findForward(CREATE_ROLE); + + } + + public ActionForward listRoles(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList roles = RoleManager.getAllRoles(ctx); + + request.getSession().setAttribute(Constants.ALL_ROLES,roles); + + return mapping.findForward(LIST_ROLES); + + } + + public ActionForward deleteRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + Integer roleId = Integer.valueOf(df.getRoleId()); + + RoleManager.deleteRole(ctx,roleId.intValue()); + + return mapping.findForward(DELETE_ROLE); + } + + + public ActionForward viewRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + Integer roleId = Integer.valueOf(df.getRoleId()); + + RoleBean bean = RoleManager.getRole(ctx,roleId.intValue()); + + //ArrayList menus = MenuItem.getMenu(ctx,roleId.intValue()); + + //request.getSession().setAttribute(Constants.MENUS,menus); + + ArrayList menus = MenuManager.getMenus(ctx, roleId.intValue()); + MenuItem rootItem = MenuManager.buildMenuTree(ctx, menus); + + request.getSession().setAttribute(Constants.ROLE,bean); + request.getSession().setAttribute(Constants.ROLE_MENUS, rootItem.getSubMenus()); + + request.getSession().setAttribute(Constants.ROLE,bean); + + return mapping.findForward(VIEW_ROLE); + + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/attachment/AttachmentAction.java b/posterita/posterita/src/main/org/posterita/struts/attachment/AttachmentAction.java new file mode 100644 index 0000000000..1f16aaa74d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/attachment/AttachmentAction.java @@ -0,0 +1,126 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ +package org.posterita.struts.attachment; + +import java.io.FileNotFoundException; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.upload.FormFile; +import org.compiere.util.Trx; +import org.posterita.core.TmkJSPEnv; + +import org.posterita.Constants; +import org.posterita.beans.AttachmentBean; +import org.posterita.businesslogic.core.AttachmentManager; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class AttachmentAction extends BaseDispatchAction +{ + public static final String CREATE_ATTACHMENT = "createAttachment"; + public ActionForward createAttachment(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + + AttachmentBean bean = (AttachmentBean) df.getBean(); + + FormFile logo = (FormFile) df.getLogo(); + + Trx trx = Trx.get(Trx.createTrxName(TrxPrefix.getPrefix()), true); + + + try + { + trx.start(); + AttachmentManager.attachImage(ctx,logo,bean.getLogoName()); + trx.commit(); + } + catch (FileNotFoundException e) + { + trx.rollback(); + postGlobalError("error.source.file.notpresent", request); + mapping.getInputForward(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.file.save", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(CREATE_ATTACHMENT); + + } + + public static final String GET_ATTACHMENT = "getAttachment"; + + public ActionForward getAttachment(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + AttachmentBean bean = (AttachmentBean) df.getBean(); + String logo = AttachmentManager.getImage(ctx,bean.getLogoName()); + + request.getSession().setAttribute(Constants.GET_LOGO,logo); + + return mapping.findForward(GET_ATTACHMENT); + + } + +} + + + + + + + + + + + + + + diff --git a/posterita/posterita/src/main/org/posterita/struts/attachment/ImageAttachmentAction.java b/posterita/posterita/src/main/org/posterita/struts/attachment/ImageAttachmentAction.java new file mode 100644 index 0000000000..07e5a51c3b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/attachment/ImageAttachmentAction.java @@ -0,0 +1,54 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Mar 13, 2006 by praveen + * + */ +package org.posterita.struts.attachment; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.exceptions.ApplicationException; +import org.posterita.struts.core.BaseDispatchAction; + +public class ImageAttachmentAction extends BaseDispatchAction +{ + public ActionForward getImage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return null; + } + + public ActionForward getThumbnailImage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return null; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/attributes/AttributesAction.java b/posterita/posterita/src/main/org/posterita/struts/attributes/AttributesAction.java new file mode 100644 index 0000000000..83304780e7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/attributes/AttributesAction.java @@ -0,0 +1,134 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 26-Aug-2005 by alok + * + */ + +package org.posterita.struts.attributes; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.AttributeValueDetailBean; +import org.posterita.businesslogic.AttributeValuesManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class AttributesAction extends BaseDispatchAction +{ + public static final String INIT_VIEW_ATTRIBUTEVALUES = "initViewAttributeValues"; + public ActionForward initViewAttributeValues(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList attributeList = AttributeValuesManager.getAttributes(ctx); + + request.getSession().setAttribute(Constants.ATTRIBUTE_LIST, attributeList); + + return mapping.findForward(INIT_VIEW_ATTRIBUTEVALUES); + } + + public static final String LIST_ATTRIBUTEVALUES = "listAttributeValues"; + public ActionForward listAttributeValues(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm)form; + + AttributeValueDetailBean attrValBean = (AttributeValueDetailBean)df.getBean(); + + ArrayList attributeValuesList =null; + if(attrValBean.getAttributeId()!=null) + { + attributeValuesList= AttributeValuesManager.getAttributeValues(ctx, attrValBean.getAttributeId().intValue()); + request.setAttribute(Constants.ATTRIBUTE_VALUES_LIST, attributeValuesList); + } + + return mapping.findForward(LIST_ATTRIBUTEVALUES); + } + + + + public static final String INITEDIT_ATTRIBUTEVALUE = "initEditAttributeValue"; + public ActionForward initEditAttributeValue(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(INITEDIT_ATTRIBUTEVALUE); + } + + /*public static final String EDIT_ATTRIBUTEVALUE = "editAttributeValue"; + public ActionForward editAttributeValue(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm)form; + + AttributeValueDetailBean attrBean = (AttributeValueDetailBean)df.getBean(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + trx.start(); + + try + { + int newAttrValueId = AttributeValuesManager.changeAttributeValue(ctx, attrBean.getAttributeValueId().intValue(), attrBean.getNewName(), trx.getTrxName()); + WBProductManager.updateProductsAttribute(ctx, attrBean.getAttributeValueId().intValue(), newAttrValueId, attrBean.getAttributeId().intValue(), trx.getTrxName()); + trx.commit(); + } + catch(Exception ex) + { + trx.rollback(); + postGlobalError("error.updating.attribute", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + + return mapping.findForward(EDIT_ATTRIBUTEVALUE); + } */ + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/bPartner/BPartnerAction.java b/posterita/posterita/src/main/org/posterita/struts/bPartner/BPartnerAction.java new file mode 100644 index 0000000000..b27ac9904f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/bPartner/BPartnerAction.java @@ -0,0 +1,301 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ +package org.posterita.struts.bPartner; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MOrg; +import org.compiere.util.Trx; + +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.StatementOfAccountBean; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BPartnerAlreadyExistsException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.BPartnerForm; +import org.posterita.form.CreateBPartnerForm; +import org.posterita.keyname.RegionKeyNamePair; +import org.posterita.lib.UdiConstants; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + +public class BPartnerAction extends BaseDispatchAction +{ + public static final String CREATE_BPARTNER = "createBPartner"; + public static final String GET_REGION = "getRegion"; + + public ActionForward getRegion(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList region = RegionKeyNamePair.getKeyNamePairs(ctx); + request.getSession().setAttribute(Constants.REGIONS,region); + + return mapping.findForward(GET_REGION); + + } + + public ActionForward createBPartner(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + DefaultForm df = (DefaultForm) form; + + BPartnerBean bean = (BPartnerBean) df.getBean(); + + Properties ctx = TmkJSPEnv.getCtx(request); + + MOrg parentOrg = OrganisationManager.getMyOrg(ctx); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + trx.start(); + + try + { + int countryId =UdiConstants.COUNTRY_SOUTH_AFRICA; + BPartnerManager.createBPartner(ctx, parentOrg.get_ID(), parentOrg.getLinkedC_BPartner_ID(null), bean.getPartnerName(),bean.getName2(),bean.getIsCustomer().booleanValue(),bean.getIsVendor().booleanValue(),bean.getIsEmployee().booleanValue(),bean.getIsSalesRep().booleanValue(),bean.getAddress1(),bean.getAddress2(),bean.getPostalAddress(), bean.getRegionId(), bean.getCity(),bean.getPhone(),bean.getFax(),countryId, true, true, trx.getTrxName()); + + request.getSession().setAttribute(Constants.BUSINESSPARTNER,bean); + trx.commit(); + } + catch(BPartnerAlreadyExistsException exp) + { + trx.rollback(); + postGlobalError("error.bp.alreadyexist", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + + return mapping.findForward(CREATE_BPARTNER); + } + + + + //------------------------------------------------------------------------------------------------------- + + public static final String INIT_EDIT_BPARTNER_DETAILS = "initEditBpartnerDetails"; + public ActionForward initEditBpartnerDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + CreateBPartnerForm bPf = (CreateBPartnerForm) form; + + int bPartnerId = Integer.parseInt(bPf.getBpartnerId()); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + BPartnerBean bean = new BPartnerBean(); + + try + { + trx.start(); + bean = BPartnerManager.getBpartner(ctx,bPartnerId, trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.get.partner.detail", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + bPf.populate(bean); + + ArrayList region = RegionKeyNamePair.getKeyNamePairs(ctx); + request.getSession().setAttribute(Constants.REGIONS,region); + + return mapping.findForward(INIT_EDIT_BPARTNER_DETAILS); + } + + public static final String EDIT_BPARTNER_DETAILS = "editBpartnerDetails"; + public ActionForward editBpartnerDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + BPartnerBean bean = (BPartnerBean) df.getBean(); + + + BPartnerManager.editBPartner(ctx, bean.getOrgId() , bean.getBpartnerId().intValue(), bean.getPartnerName(),bean.getName2(),bean.getIsCustomer().booleanValue(),bean.getIsVendor().booleanValue(),bean.getIsEmployee().booleanValue(),bean.getIsSalesRep().booleanValue(),bean.getAddress1(),bean.getAddress2(),bean.getPostalAddress(),bean.getCity(),bean.getPhone(),null,bean.getFax(),0,null); + + + return mapping.findForward(EDIT_BPARTNER_DETAILS); + } + + public static final String ACTIVATE_BPARTNER = "activateBPartner"; + public ActionForward activateBPartner(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + int bpartnerId = Integer.parseInt(df.getBpartnerId()); + boolean isActive = Boolean.parseBoolean(df.getIsActive()); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + + try + { + trx.start(); + BPartnerManager.activateBPartner(ctx,bpartnerId,isActive,trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.activate.partner", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(ACTIVATE_BPARTNER); + } + + public static final String SEARCH_BPARTNER = "searchBPartner"; + public ActionForward searchBPartner(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + + ArrayList bplist = new ArrayList(); + + bplist = BPartnerManager.searchBpartners(ctx,df.getName(),null); + + request.getSession().setAttribute(Constants.ALLBUSINESSPARTNERS,bplist); + return mapping.findForward(SEARCH_BPARTNER); + } + + public static final String GET_CREDITORS = "getCreditors"; + public ActionForward getCreditors(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList bplist = BPartnerManager.getCreditorsDebtors(ctx, true, null); + + request.getSession().setAttribute(Constants.CREDITORS,bplist); + return mapping.findForward(GET_CREDITORS); + } + + public static final String GET_DEBTORS = "getDebtors"; + public ActionForward getDebtors(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList bplist = BPartnerManager.getCreditorsDebtors(ctx, false, null); + + request.getSession().setAttribute(Constants.DEBTORS,bplist); + return mapping.findForward(GET_DEBTORS); + } + + public static final String GET_CREDITOR_HISTORY = "getCreditorHistory"; + public ActionForward getCreditorHistory(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + BPartnerForm pf = (BPartnerForm) form; + BPartnerBean bean = (BPartnerBean)pf.getBean(); + + int c_bpartner_id = bean.getBpartnerId(); + + ArrayList history = BPartnerManager.getCreditorsHistory(ctx, c_bpartner_id, null, null, null); + request.getSession().setAttribute(Constants.CREDITOR_HISTORY, history); + request.getSession().setAttribute(Constants.BPARTNER, bean); + + return mapping.findForward(GET_CREDITOR_HISTORY); + } + + public static final String GET_DEBTOR_HISTORY = "getDebtorHistory"; + public ActionForward getDebtorHistory(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + BPartnerForm pf = (BPartnerForm) form; + BPartnerBean bean = (BPartnerBean)pf.getBean(); + + int c_bpartner_id = bean.getBpartnerId(); + + ArrayList history = BPartnerManager.getDebtorsHistory(ctx, c_bpartner_id, null, null, null); + request.getSession().setAttribute(Constants.DEBTOR_HISTORY, history); + request.getSession().setAttribute(Constants.BPARTNER, bean); + + return mapping.findForward(GET_DEBTOR_HISTORY); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/bPartner/ViewBPartnerAction.java b/posterita/posterita/src/main/org/posterita/struts/bPartner/ViewBPartnerAction.java new file mode 100644 index 0000000000..55a2ce36fb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/bPartner/ViewBPartnerAction.java @@ -0,0 +1,138 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 18, 2005 by Alok + */ + +package org.posterita.struts.bPartner; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.Trx; +import org.posterita.core.TmkJSPEnv; + +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class ViewBPartnerAction extends BaseDispatchAction +{ + public static final String GET_ALL_BPARTNERS = "getAllBpartners"; + public ActionForward getAllBpartners(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + + ArrayList bpartners = new ArrayList(); + + try + { + trx.start(); + bpartners = BPartnerManager.getAllBpartners(ctx, trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.getall.partners", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + request.getSession().setAttribute(Constants.ALLBUSINESSPARTNERS, bpartners); + + return mapping.findForward(GET_ALL_BPARTNERS); + + } + + public static final String VIEW_BPARTNER_DETAILS = "viewBpartnerDetails"; + public ActionForward viewBpartnerDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + BPartnerBean bean = (BPartnerBean) df.getBean(); + + ArrayList bpartners = (ArrayList) request.getSession().getAttribute(Constants.ALLBUSINESSPARTNERS); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + + try + { + trx.start(); + + if(bpartners == null) + bpartners = BPartnerManager.getAllBpartners(ctx, trx.getTrxName()); + + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.get.partner.detail", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + try + { + bean = BPartnerManager.getBpartner(ctx, bean.getBpartnerId(), trx.getTrxName()); + } + catch (OperationException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + request.getSession().setAttribute(Constants.BUSINESSPARTNERSDETAILS, bean); + + + return mapping.findForward(VIEW_BPARTNER_DETAILS); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/core/AjaxAction.java b/posterita/posterita/src/main/org/posterita/struts/core/AjaxAction.java new file mode 100644 index 0000000000..35a426f8a6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/core/AjaxAction.java @@ -0,0 +1,53 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.struts.core; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.pos.taglib.AjaxTag; + +/** + * @author Ashley G Ramdass + * Apr 22, 2008 + */ +public class AjaxAction extends BaseDispatchAction +{ + public static final String PROCESS_REQUEST_PARAM = "RequestProcessor"; + public static final String AJAX_TAG_PACKAGE = "org.posterita.pos.taglib"; + + public ActionForward processRequest(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + { + try + { + String tagClass = request.getParameter(PROCESS_REQUEST_PARAM); + AjaxTag tag = (AjaxTag)Class.forName(AJAX_TAG_PACKAGE + "." + tagClass).newInstance(); + tag.processRequest(request, response); + } + catch (Exception ex) + { + + } + return null; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/core/BaseAction.java b/posterita/posterita/src/main/org/posterita/struts/core/BaseAction.java new file mode 100644 index 0000000000..1c7342dcf6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/core/BaseAction.java @@ -0,0 +1,151 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.core; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.Globals; +import org.apache.struts.action.Action; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.apache.struts.action.ActionServlet; +import org.apache.struts.config.ModuleConfig; +import org.apache.struts.util.RequestUtils; + +import org.posterita.exceptions.ApplicationException; +import org.posterita.user.WebUserInfo; + + +public class BaseAction extends Action +{ + + public static final String LOGIN_HOME = "loginHome"; + public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + WebUserInfo userInfo = (WebUserInfo) request.getSession().getAttribute(WebUserInfo.NAME); + + if (userInfo == null) + return mapping.findForward(LOGIN_HOME); + else + return null; + + + + } + + protected void postGlobalError(String errorKey, HttpServletRequest request) + { + postGlobalError(errorKey, null, request); + } + + protected void postComplexGlobalError(String errorKey, Object[] args,HttpServletRequest request) + { + + ActionMessage message = (args.length == 0 ? + new ActionMessage(errorKey): + new ActionMessage(errorKey, args)); + + ActionMessages messages = new ActionMessages(); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + saveErrors(request, messages); + + + + } + + protected void postGlobalError(String errorKey, Object arg, HttpServletRequest request) + { + //TODO Replace this code + ActionMessage message = (arg == null ? + new ActionMessage(errorKey): + new ActionMessage(errorKey, arg)); + + ActionMessages messages = new ActionMessages(); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + saveErrors(request, messages); + + // workflow + //TODO Integrate this code when workflow works + //WorkFlowManager.removeLastWorkFlowAction(request); + } + + protected void postGlobalMessage(String msgKey, Object arg, HttpServletRequest request) + { + //TODO Replace this code + ActionMessage message = (arg == null ? + new ActionMessage(msgKey): + new ActionMessage(msgKey, arg)); + + ActionMessages messages = new ActionMessages(); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + saveMessages(request, messages); + + // workflow + //TODO Integrate this code when workflow works + //WorkFlowManager.removeLastWorkFlowAction(request); + } + + protected ActionForm getForm(String formName, String path, HttpServletRequest request) + { + return getForm(formName, path, request, getServlet()); + } + + protected ActionForm getForm(String formName, String path, HttpServletRequest request, ActionServlet servlet) + { + // check if the form is in the request scope + ActionForm form = (ActionForm) request.getAttribute(formName); + + // check if the form is in the session scope + if (form == null) + { + form = (ActionForm) request.getSession().getAttribute(formName); + } + // if not found in any of these create one and set it in the appropriate scope. + if(form == null) + { + ModuleConfig appConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); + + ActionMapping mapping = (ActionMapping) appConfig.findActionConfig(path); + + form = RequestUtils.createActionForm(request,mapping,appConfig, servlet); + + String key = mapping.getAttribute(); + + if (!key.equals(formName)) + throw new RuntimeException("error.baseAction.InvalidFormName"); + + if(mapping.getScope().equals("request")) + request.setAttribute(key, form); + else + request.getSession().setAttribute(key, form); + + } + return form; + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/core/BaseDispatchAction.java b/posterita/posterita/src/main/org/posterita/struts/core/BaseDispatchAction.java new file mode 100644 index 0000000000..d8b6e40f82 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/core/BaseDispatchAction.java @@ -0,0 +1,141 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.core; + +import java.util.ArrayList; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.apache.struts.actions.DispatchAction; +import org.compiere.util.WebSessionCtx; +import org.displaytag.tags.TableTagParameters; +import org.displaytag.util.ParamEncoder; +import org.posterita.Constants; +import org.posterita.core.MenuItem; +import org.posterita.exceptions.ApplicationException; + +public class BaseDispatchAction extends DispatchAction +{ + BaseAction act = new BaseAction(); + + public static final String LOGIN_HOME = "loginHome"; + public static final String APPLICATION_ERROR = "applicationError"; + public static final String CHOOSE_APPLICATION = "chooseApplication"; + public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + Object webSessionCtx = request.getSession().getAttribute(WebSessionCtx.NAME); + + DefaultForm df = (DefaultForm) form; + + if (df != null) + if ((request.getSession().getAttribute(Constants.MENUS) != null) && (df.getMenuId() != null)) + { + MenuItem menuItem = (MenuItem) request.getSession().getAttribute(Constants.MENUS); + + Integer menuId = Integer.valueOf(df.getMenuId()); + ArrayList list = menuItem.getBreadCrumb(menuId.intValue()); + + request.getSession().setAttribute(Constants.BREADCRUMB, list); + } + + + if (webSessionCtx == null) // Session Timeout + { + return mapping.findForward(CHOOSE_APPLICATION); + } + else + return null; + } + + + + protected void postGlobalError(String errorKey, HttpServletRequest request) + { + act.postGlobalError(errorKey, null, request); + } + + protected void postGlobalError(String errorKey, Object arg, HttpServletRequest request) + { + act.postGlobalError(errorKey, arg, request); + } + + protected void postGlobalMessage(String msgKey, HttpServletRequest request) + { + act.postGlobalMessage(msgKey, null, request); + } + + protected ActionForm getForm(String formName, String path, HttpServletRequest request) + { + return act.getForm(formName, path, request, getServlet()); + } + + + public Object getAttribute(HttpServletRequest request, Class vo) + { + Object object = request.getSession().getAttribute(getClass().getName()+vo.getName()); + request.getSession().setAttribute(getClass().getName()+vo.getName(),null); + return object; + } + + protected void postComplexGlobalError(String errorKey, Object[] args,HttpServletRequest request) + { + + ActionMessage message = (args.length == 0 ? + new ActionMessage(errorKey): + new ActionMessage(errorKey, args)); + + ActionMessages messages = new ActionMessages(); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + saveErrors(request, messages); + } + + /** + * Checks whether the request is an action on the display tag table (Paging, sorting) + * @param request Server Request + * @return True if the request is a display tag action + */ + protected boolean isDisplayTagAction(HttpServletRequest request) + { + String tableId = request.getParameter(Constants.DISPLAYTAG_TABLE_ID); + + if (tableId == null || tableId.trim().length() == 0) + { + return false; + } + + String strOrder = request.getParameter(new ParamEncoder(tableId).encodeParameterName(TableTagParameters.PARAMETER_ORDER)); + String strPage = request.getParameter(new ParamEncoder(tableId).encodeParameterName(TableTagParameters.PARAMETER_PAGE)); + String strSort = request.getParameter(new ParamEncoder(tableId).encodeParameterName(TableTagParameters.PARAMETER_SORT)); + + return ((strOrder != null && strOrder.trim().length() > 0) + || (strPage != null && strPage.trim().length() > 0) + || (strSort != null && strSort.trim().length() > 0)); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/core/BaseForm.java b/posterita/posterita/src/main/org/posterita/struts/core/BaseForm.java new file mode 100644 index 0000000000..8131b328f9 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/core/BaseForm.java @@ -0,0 +1,983 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ +package org.posterita.struts.core; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.beanutils.PropertyUtils; +import org.apache.struts.Globals; +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MPayment; + +import org.posterita.core.EmailValidator; +import org.posterita.core.JulianDate; +import org.posterita.core.Range; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.FormattingException; +import org.posterita.formatter.Formatter; + + + +/** + * An abstract base class for ActionForms that adds support for automatic formatting + * and unformatting of string values and for the transfer of the resulting values + * between itself and the given bean. The populate() method provides + * and entry point to this functionality, while the keysToSkip method allows + * subclasses to specify fields that should not be populated. + *

    + * + * Additional methods are provided to allow subclasses to override formatting defaults. + * The DefaultString() method allows callers to specify overrides for the default + * string used to represent a null for a given property. Similarly, + * the setFormatterype() method allows callers to specify a + * formatting type other than the default for a given property. + *

    + * Developers can also specify validation rules by invoking addRange() + * to add a range validation or addRequiredFields() to add required field validations + * for an array of property names. + * + */ +public class BaseForm extends ActionForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + private Map defaultStringMap = new HashMap(); + private Map formatMap = new HashMap(); + MessageResources resources = null; + + public final static int TO_OBJECT = 0; + public final static int TO_STRING = 1; + public final static int MIN_LENGTH = 6; + + public final static String REQUIRED = "required"; + public final static String RANGE = "range"; + public final static String STRING_NUMBER="stringNumber"; + public final static String EMAIL_VALID = "emailValid"; + public final static String MIN_LENGTH_VALID = "minLengthValid"; + public final static String MATCH_FIELDS = "matchFields"; + public final static String DATE_FIELDS_VALID = "dateValid"; + public final static String IMAGE_FILE_EXT_VALID = "imageFileValid"; + public static final String YEAR_VALID = "yearValid"; + public static final String CREDITCARD_VALID = "creditcardValid"; + public static final String CVV_VALID = "cvvValid"; + public static final String EXPIRY_DATE_VALID = "expiryDateValid"; + private static final String ACCOUNT_VALID = "accountValid"; + private int currentYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR); + private int currentMonth = java.util.Calendar.getInstance().get(java.util.Calendar.MONTH) + 1; + + private transient Object bean; + private Map validationMap = new HashMap(); + + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) + { + /* + * This is where you need to get the country specific details. + */ + + resources = (MessageResources)request.getAttribute(Globals.MESSAGES_KEY); + + ActionErrors errors = populate(this.bean, TO_OBJECT); + return errors; + + } + + public ActionErrors populate(Object vo) + { + return populate(vo,TO_STRING); + } + + /* + * field1 does not contain the value of the field but contains the name of the field. + */ + public void addMatchFields(String key, String otherFieldName) + { + addValidationRule(key, MATCH_FIELDS, otherFieldName); + } + + public void addDateFieldsValidation(String key, String otherKey) + { + addValidationRule(key, DATE_FIELDS_VALID, otherKey); + } + + public void addCreditCardFieldsValidation(String key) + { + addValidationRule(key, CREDITCARD_VALID, Boolean.TRUE); + } + + public void addAccountFieldValidation(String key) + { + addValidationRule(key, ACCOUNT_VALID, Boolean.TRUE); + } + + public void addCVVFieldsValidation(String key) + { + addValidationRule(key, CVV_VALID, Boolean.TRUE); + } + + public void addCreditCardExpiryDateFieldsValidation(String key) + { + addValidationRule(key, EXPIRY_DATE_VALID, Boolean.TRUE); + } + + @SuppressWarnings("unchecked") + public void addValidationRule(String key, String rule, Object value) + { + Map values =(Map) validationMap.get(key); + if (values == null) + { + values = new HashMap(); + validationMap.put(key,values); + } + + values.put(rule, value); + } + + + public void addRequiredFields(String[] keys) + { + for (int i=0; i< keys.length; i++) + { + addValidationRule(keys[i],REQUIRED, Boolean.TRUE); + } + } + + + public void addRange(String key, Comparable min, Comparable max) + { + Range range = new Range(min,max); + addValidationRule(key,RANGE, range); + } + + public void addEmailValidation(String key) + { + addValidationRule(key,EMAIL_VALID,Boolean.TRUE); + } + + public void addYearValidation(String key) + { + addValidationRule(key, YEAR_VALID, Boolean.TRUE ); + } + + public void addValidateCustomerNumber(String key) + { + addValidationRule(key,STRING_NUMBER,Boolean.TRUE); + } + + + public void addImageFileExtensionValidation(String key) + { + addValidationRule(key, IMAGE_FILE_EXT_VALID, Boolean.TRUE); + } + + public void addMinLengthValidation(String key, Integer min, Integer max) + { + Range range = new Range(min, max); + addValidationRule(key,MIN_LENGTH_VALID,range); + } + + public Object getBean() throws ApplicationException + { + return bean; + } + + public void setBean(Object bean) + { + this.bean = bean; + } + + + + public ActionErrors populate(Object vo, int mode) + { + String errorMsg = "Unable to format values from bean: "+ vo; + + //Object source = (mode == TO_STRING ? bean : this); + Object target = (mode == TO_STRING ? vo : this); + + + Map valueMap = mapRepresentation(target, mode); + + ActionErrors errors = new ActionErrors(); + + + if(mode == TO_STRING) + { + setBean(vo); + } + + Iterator keyIter = valueMap.keySet().iterator(); + + while(keyIter.hasNext()) + { + String currKey = (String) keyIter.next(); + Object currValue = valueMap.get(currKey); + + try + { + ActionErrors currErrors = populateProperty(vo,currKey, currValue, mode, valueMap); + errors.add(currErrors); + + } + catch(InstantiationException ie) + { + throw new FormattingException(errorMsg, ie); + } + catch(IllegalAccessException iae) + { + throw new FormattingException(errorMsg, iae); + } + catch(InvocationTargetException ite) + { + throw new FormattingException(errorMsg,ite); + } + catch(NoSuchMethodException nsme) + { + //throw new FormattingException(errorMsg,nsme); + // There can be some assymetry in the form and the bean so do not treat this as an exception. + } + } + + return errors; + } + + /** + * @param target + * @param mode + * @return + */ + public Map mapRepresentation(Object vo, int mode) + { + String errorMsg = "Unable to format values from bean: "+ vo; + + + Map valueMap = null; + + try + { + valueMap = PropertyUtils.describe(vo); + } + catch(IllegalAccessException iae) + { + throw new FormattingException(errorMsg, iae); + } + catch(InvocationTargetException ite) + { + throw new FormattingException(errorMsg, ite); + } + catch(NoSuchMethodException nsme) + { + throw new FormattingException(errorMsg,nsme); + } + + Iterator keyIter = keysToSkip().iterator(); + + while(keyIter.hasNext()) + { + String key = (String) keyIter.next(); + valueMap.remove(key); + } + + return valueMap; + } + + protected Object convert(Class type, String key, Object obj, int mode) + throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, NumberFormatException + { + Object convertedObj = null; + Formatter formatter = getFormatter(key, type); + + try + { + switch(mode) + { + case TO_OBJECT: + convertedObj = formatter.unformat(obj); + break; + case TO_STRING: + if (obj == null) + convertedObj = (String) defaultStringMap.get(key); + else + convertedObj = formatter.format(obj); + + /** + * This let's the toDate being converted into endDay, endMonth and endYear + * note that the String here are sensitive. + */ + + if (key.equals("toDate")) + { + JulianDate dateValue = (JulianDate) obj; + if (dateValue != null) + { + PropertyUtils.setSimpleProperty(this, "endDay", ""+dateValue.getDay()); + PropertyUtils.setSimpleProperty(this, "endMonth", ""+dateValue.getMonth()); + PropertyUtils.setSimpleProperty(this, "endYear", ""+dateValue.getYear()); + } + else + { + PropertyUtils.setSimpleProperty(this, "endDay", ""); + PropertyUtils.setSimpleProperty(this, "endMonth", ""); + PropertyUtils.setSimpleProperty(this, "endYear", ""); + } + + } + if (key.equals("fromDate")) + { + JulianDate dateValue = (JulianDate) obj; + if (dateValue != null) + { + PropertyUtils.setSimpleProperty(this, "startDay", ""+dateValue.getDay()); + PropertyUtils.setSimpleProperty(this, "startMonth", ""+dateValue.getMonth()); + PropertyUtils.setSimpleProperty(this, "startYear", ""+dateValue.getYear()); + } + else + { + PropertyUtils.setSimpleProperty(this, "startDay", ""); + PropertyUtils.setSimpleProperty(this, "startMonth", ""); + PropertyUtils.setSimpleProperty(this, "startYear", ""); + } + } + + break; + + default: + throw new RuntimeException("Unknown mode:" + mode); + + } + } + catch(FormattingException e) + { + e.setFormatter(formatter); + throw e; + } + + return convertedObj; + } + + + protected Object getKeyStringValue(String key, int mode) + { + Object target = (mode == TO_STRING ? this.bean : this); + Map valueMap = mapRepresentation(target, mode); + + Object currValue = valueMap.get(key); + + return currValue; + + } + + + protected ActionErrors populateProperty(Object vo, String key, Object obj, int mode, Map valueMap) + throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException + { + + Object target = (mode == TO_STRING? this : vo); + Class type = PropertyUtils.getPropertyType(vo, key); + ActionErrors errors = new ActionErrors(); + + Object value = null; + + if (mode == TO_STRING) + { + value = convert(type, key, obj, mode); + } + else + { + try + { + String errorKey = null; + + value = convert(type, key, obj, mode); + + errorKey = validateRequired(key, obj); + + if (errorKey == null) + errorKey = validateRange(key, value); + if (errorKey == null) + errorKey = validateEmail(key,value); + if (errorKey == null) + errorKey = validateLength(key, obj); + if (errorKey == null) + errorKey = validateImageFileExtension(key, obj); + if (errorKey == null) + errorKey = validateMatchFields(key,value, vo, valueMap); + if (errorKey == null) + errorKey = validateCustomerNumber(key, value); + if (errorKey == null) + errorKey = validateMatchFields(key,value, vo, valueMap); + if (errorKey == null) + errorKey = validateDateFields(key,value, vo, valueMap); + if (errorKey == null) + errorKey = validateCreditCardExpiryDateFields(key,value, vo, valueMap); + if (errorKey !=null) + errors.add(key, new ActionMessage(errorKey,key)); + + //This part is placed here because validateCreditCardField method may return an errorKey + //As we are reusing the same variable to store an error message + //the error is added above in the ActionMessage and then variable errorKey is reused here + errorKey = validateCVVField(key,value, vo, valueMap); + if (errorKey !=null) + errors.add(key, new ActionMessage(errorKey,key)); + + errorKey = validateAccountField(key,value, vo, valueMap); + if (errorKey !=null) + errors.add(key, new ActionMessage(errorKey,key)); + + errorKey = validateCreditCardField(key,value, vo, valueMap); + if (errorKey !=null) + errors.add(key, new ActionMessage(errorKey,key)); + + + } + catch(FormattingException e) + { + String errorKey = e.getFormatter().getErrorKey(); + errors.add(key, new ActionMessage(errorKey, key)); + } + catch (NumberFormatException nfe) + { + String errorKey; + + if (resources.getMessage("error.numberformatexception."+key) == null) + errorKey = "error.numberformatexception"; + else + errorKey = "error.numberformatexception."+key; + + errors.add(key, new ActionMessage(errorKey,key)); + } + + } + + PropertyUtils.setSimpleProperty(target, key, value); + + return errors; + + } + + private String validateAccountField(String key, Object value, Object vo, Map valueMap) + { + Map rules = (Map) validationMap.get(key); + + if (rules == null) + return null; + + if (!rules.containsKey(ACCOUNT_VALID)) + return null; + + if (value == null) + return null; + + + if (value.equals(MPayment.TENDERTYPE_CreditCard)) + { + String accountName = (String) valueMap.get("accountName"); + + if (accountName == null || accountName.equals("")) + return "error.required.accountName"; + } + + return null; + + + } + + private String validateCreditCardExpiryDateFields(String key, Object value, Object vo, Map valueMap) + { + Map rules = (Map) validationMap.get(key); + + if (rules == null) + return null; + + if (!rules.containsKey(EXPIRY_DATE_VALID)) + return null; + + if (value == null) + return null; + + + if (value.equals(MPayment.TENDERTYPE_CreditCard)) + { + String creditCardExpYear = (String) valueMap.get("creditCardExpYear"); + + if (creditCardExpYear == null || creditCardExpYear.equals("")) + return "error.required.creditCardExpYear"; + + if (Integer.parseInt(creditCardExpYear) == currentYear) + { + + + String creditCardExpMonth = (String) valueMap.get("creditCardExpMonth"); + + if (creditCardExpMonth == null || creditCardExpMonth.equals("")) + return "error.required.creditCardExpMonth"; + + if (Integer.parseInt(creditCardExpMonth) < currentMonth) + return "error.creditCardExpMonth"; + } + + } + + return null; + + } + + private String validateCustomerNumber(String key, Object value) + { + + Map rules = (Map) validationMap.get(key); + + if(rules == null) + return null; + + Boolean bool = (Boolean) rules.get(STRING_NUMBER); + + if (bool == null) + { + return null; + } + + String str = (String) value; + + boolean isNumber = true; + try + { + // Double numb = new Double(str); + } + catch(NumberFormatException e) + { + isNumber = false; + } + + + if (!isNumber) + { + + if (resources.getMessage("error.customer.id.numberformat."+key) == null) + return "error.customer.id.numberformat"; + else + return "error.customer.id.numberformat."+key; + } + else + + if (str.length()!=13) + { + + if (resources.getMessage("error.customer.id.length."+key) == null) + return "error.customer.id.length"; + else + return "error.customer.id.length."+key; + } + else + return null; + + } + + + private String validateRange(String key, Object value) + { + + Map rules = (Map) validationMap.get(key); + + if(rules == null) + return null; + + Range range = (Range) rules.get(RANGE); + + if (range == null) + { + return null; + } + + if(!range.isInRange((Comparable) value)) + { + if (resources.getMessage("error.range."+key) == null) + return "error.range"; + else + return "error.range."+key; + } + else + return null; + } + + private String validateEmail(String key, Object value) + { + Map rules = (Map) validationMap.get(key); + + if(rules == null) + return null; + + Boolean email_valid = (Boolean) rules.get(EMAIL_VALID); + + if (email_valid == null) + return null; + + String email = (String) value; + if(!EmailValidator.isValidEmail(email)) + return "error.email"; + else + return null; + + } + + private String validateImageFileExtension(String key, Object value) + { + Map rules = (Map) validationMap.get(key); + + if (rules == null) + return null; + + Boolean imageFile_valid = (Boolean) rules.get(IMAGE_FILE_EXT_VALID); + + if (imageFile_valid == null) + return null; + + //String imageFile = (String) value; + + /* if(!FileExtensionChecker.isValidFileExtention(imageFile)) + return "error.fileNotSupportedException"; + else*/ + return null; + + } + + private String validateMatchFields(String key, Object value, Object vo, Map valueMap) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException + { + Map rules = (Map) validationMap.get(key); + + if((rules == null)) + return null; + + if (!rules.containsKey(MATCH_FIELDS)) + return null; + + String otherField = (String) rules.get(MATCH_FIELDS); + + Class typeOfOtherField = PropertyUtils.getPropertyType(vo, otherField); + String currOtherFieldValue = (String) valueMap.get(otherField); + + if (otherField == null) + { + return null; + } + else + { + Object obj = convert(typeOfOtherField, otherField, currOtherFieldValue, TO_OBJECT); + if(!value.equals(obj)) + { + if (resources.getMessage("error.match."+key) == null) + return "error.match"; + else + return "error.match."+key; + } + else + return null; + + } + } + + private String validateLength(String key, Object value) + { + Map rules = (Map) validationMap.get(key); + + if(rules == null) + return null; + + Range range = (Range) rules.get(MIN_LENGTH_VALID); + + if (range == null) + return null; + + String str = (String) value; + Integer len = Integer.valueOf(str.length()); + + if(!range.isInRange(len)) + { + if (resources.getMessage("error.minlength."+key) == null) + return "error.minlength"; + else + return "error.minlength."+key; + } + else + return null; + + } + +// private String validateYear(String key, Object obj) +// { +// Map rules = (Map) validationMap.get(key); +// +// if (rules == null) +// return null; +// +// Boolean year_valid = (Boolean) rules.get(YEAR_VALID); +// +// String year = (String) obj; +// +// if (year.length()!= 4) +// return "error.year.length.invalid"; +// +// return null; +// +// +// } + + private String validateRequired(String key, Object obj) + { + // This was added because of the String[] + if (obj!=null && !String.class.isAssignableFrom(obj.getClass())) + { + return null; + } + + String value = (String) obj; + Map rules = (Map) validationMap.get(key); + + if(rules == null) + return null; + + Boolean required = (Boolean) rules.get(REQUIRED); + + if (required == null) + return null; + + boolean isRequired = required.booleanValue(); + boolean isBlank =(value == null || value.trim().equals("")); + + if(isRequired && isBlank) + { + if (resources.getMessage("error.required."+key) == null) + return "error.required"; + else + return "error.required."+key; + } + + else + return null; + } + + private String validateCreditCardField(String key, Object value, Object vo, Map valueMap) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException + { + Map rules = (Map) validationMap.get(key); + + if (rules == null) + return null; + + if (!rules.containsKey(CREDITCARD_VALID)) + return null; + + if (value == null) + return null; + + if (value.equals(MPayment.TENDERTYPE_CreditCard)) + { + String creditCardNumber = (String) valueMap.get("creditCardNumber"); + + if (creditCardNumber == null || creditCardNumber.equals("")) + return "error.required.creditCardNumber"; + + } + + return null; + + } + + private String validateCVVField(String key, Object value, Object vo, Map valueMap) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException + { + Map rules = (Map) validationMap.get(key); + + if (rules == null) + return null; + + if (!rules.containsKey(CVV_VALID)) + return null; + + if (value == null) + return null; + + if (value.equals(MPayment.TENDERTYPE_CreditCard)) + { + String cvv = (String) valueMap.get("cvv"); + + if (cvv == null || cvv.equals("")) + return "error.required.cvv"; + + } + + return null; + + } + + private String validateDateFields(String key, Object value, Object vo, Map valueMap) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException + { + Map rules = (Map) validationMap.get(key); + + if (rules == null) + return null; + + if (!rules.containsKey(DATE_FIELDS_VALID)) + return null; + + String otherKey = (String) rules.get(DATE_FIELDS_VALID); + + String otherValue = (String) valueMap.get(otherKey); + + if (value == null && otherValue == null) + return null; + + if (value == null) + return "error.date.prior.today"; + + if (otherValue == null) + return "error.date.prior.today"; + + Class otherType = PropertyUtils.getPropertyType(vo, otherKey); + + + JulianDate toDate = (JulianDate) convert(otherType, otherKey, otherValue, TO_OBJECT); + + JulianDate fromDate = (JulianDate) value; + + Range range = new Range(JulianDate.getToday(), toDate); + + if (!range.isInRange(fromDate)) + return "error.date.prior.today"; + else + return null; + + } + + + protected Formatter getFormatter(String key, Class type) + { + Formatter formatType = (Formatter) formatMap.get(key); + + if (formatType == null) + { + return Formatter.getFormatter(type); + } + + return formatType; + } + + public void setDefaultString(String key, String value) + { + defaultStringMap.put(key,value); + } + /* + * This is where you can override the way things are formatted. + */ + public void setFormatterType(String key, Class type) + { + if(!Formatter.class.isAssignableFrom(type)) + throw new FormattingException(type + "must be a Formatter"); + + formatMap.put(key,type); + } + + protected Map mapRepresentation(Object bean) + { + String errorMsg = "Unable to format values from bean: " + bean; + Map valueMap = null; + + try + { + valueMap = PropertyUtils.describe(bean); + } + catch(IllegalAccessException iae) + { + throw new FormattingException(errorMsg,iae); + } + catch(InvocationTargetException ite) + { + throw new FormattingException(errorMsg,ite); + } + catch(NoSuchMethodException nsme) + { + throw new FormattingException(errorMsg,nsme); + } + + Iterator keyIter = keysToSkip().iterator(); + + while(keyIter.hasNext()) + { + String key = (String) keyIter.next(); + valueMap.remove(key); + } + return valueMap; + } + + protected ArrayList keysToSkip() + { + ArrayList keysToSkip = new ArrayList(); + + // Don't popluate "class" field inherited from Object + + keysToSkip.add("class"); + keysToSkip.add("servletWrapper"); + keysToSkip.add("multipartRequestHandler"); + keysToSkip.add("bean"); + keysToSkip.add("properties"); + keysToSkip.add("checkBoxLists"); +// keysToSkip.add("file"); + keysToSkip.add("minValue"); + keysToSkip.add("maxValue"); + + + return keysToSkip; + } + + + // + protected String action; + protected String input; + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getInput() { + return input; + } + + public void setInput(String input) { + this.input = input; + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/core/DefaultForm.java b/posterita/posterita/src/main/org/posterita/struts/core/DefaultForm.java new file mode 100644 index 0000000000..6d42b19e27 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/core/DefaultForm.java @@ -0,0 +1,5794 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.struts.core; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; + +import org.apache.struts.upload.FormFile; +import org.compiere.model.MInOut; +import org.posterita.beans.AttributeValuesPair; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.PaymentBean; +import org.posterita.beans.PriceListBean; +import org.posterita.beans.ProductBean; +import org.posterita.beans.ProductImageBean; +import org.posterita.beans.RoleBean; +import org.posterita.beans.StockMovementBean; +import org.posterita.beans.UDIBean; + + +public class DefaultForm extends BaseForm +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + protected String aaCardnumber; + protected String blackListedId; + protected String blackListedBankName; + protected String blackListedChequeNo; + + protected String forward; + protected String accountNo; + protected String accountType; + protected String accountName; + protected String address1; + protected String address2; + protected String agreement; + protected String aisle; + protected String allocationId; + protected String allocationStatus; + protected String attribute; + protected String attributeId; + protected String attributeSetId; + protected String attributeSetInstanceId; + protected Integer [] sernoAttributeSetInstanceIds; + protected String attributeValue; + protected String attributeValueId; + protected String bankId; + protected String bankName; + protected String basePriceListId; + protected String bin; + protected String bpartnerId; + + protected String customSize; + protected String discountedLinePrice; + protected String documentId; + protected String documentNo; + protected String documentType; + protected String email; + protected String endDay = "" + Calendar.getInstance().get(Calendar.DATE); + protected String endHour; + protected String endMinute; + protected String endMonth = "" + (Calendar.getInstance().get(Calendar.MONTH) + 1); + protected String endYear="" + Calendar.getInstance().get(Calendar.YEAR); + protected String engineNo; + protected String engineNumber; + protected String fax; + protected String grossProfit; + protected String grossProfitPercentage; + protected FormFile file; + protected FormFile image; + protected String day; + protected String fromDate; + protected String fromOrderLineId; + protected String grandTotal; + protected String id; + protected String inclPrice; + protected String index; + protected String invoiceId; + protected String isAccessAllOrgs= "false"; + protected String isActive="false"; + protected String isApproved; + protected String isAvailableForBackOrder="true"; + protected String isAutomobile; + protected String isCreatePriceList = "false"; + protected String isCustomer="true"; + protected String isDefault = "false"; + protected String isDeleteOldRecords="false"; + protected String isDelivered; + protected String isEmployee="true"; + protected String isInvoiced; + protected String isMandatory; + protected String isMotorcycle; + protected String isNatisReleased; + protected String isOverridePinOk; + + protected String isPresentForProduct; + protected String isPublic="false"; + protected String isQtyReserved; + protected String isTaxIncluded = "false"; + + protected Integer [] checkBox; + protected String checkNo; + protected String city; + protected String colour; + protected String compiereDocStatus; + protected String confirmEmail; + protected String confirmPassword; + protected String counterOrderStatusInfo; + protected String counterOrgID; + protected String counterOrgName; + protected String currentBalance; + protected String custIdNumber; + protected String dateCreated; + protected String dateOrdered; + protected String datePromised; + protected String dateTrx; + protected String description; + protected String isDiscountOnInclUnitPrice = "false"; + protected String discountedInclUnitPrice; + protected String docStatus; + protected String docStatusCode; + + protected String isDiscountAllowed; + protected String isAllowedOverridePriceLimit; + protected String isReceipt; + protected String isRetailer ="true"; + protected String isSalesRep="false"; + protected String isSoTrx; + protected String isVendor="true"; + protected String isVisible; + protected String isWholesaler="true"; + protected String level; + protected String limitPrice; + protected String listPriceIncl; + protected String stdPriceIncl; + protected String limitPriceIncl; + protected String lineNo; + protected ArrayList list; + protected String listPrice; + protected String locationId; + protected String locatorId; + protected FormFile logo; + protected String logoName; + protected String lockingTime; + protected String maintenanceContractNumber; + protected String make; + protected String makeAttributeValueId; + protected String menuId; + protected String menuItemName; + protected String menuLink; + protected String message; + protected String messageID; + protected String mobile; + protected String model; + protected String modelGroup; + protected String month; + protected String moveConfirmId; + protected String movementDate; + protected String movementDescription; + protected String movementId; + protected String movementLineId; + protected String name; + protected String natisApplicationDate; + protected String natisControlNumber; + protected String natisReleaseId; + protected String newEmail; + protected String newPassword; + protected String oldPassword; + + protected PaymentBean paymentBeanIndex; + protected String orderId; + protected String orderLineId; + protected ArrayList orderLineBean; + protected OrderLineBean orderLineIndexed; + protected ArrayList orderLineList = new ArrayList(); + protected String orderStatusInfo; + protected String orderType; + protected String orgId; + protected String allocatedAmount; + protected String OrgID; + protected String orgFromId; + protected String orgFromName; + protected String orgToId; + protected String orgToName; + protected String orgName; + protected String orgType; + protected String orgUser; + protected String parentMenuId; + protected String partnerId; + protected String partnerName=""; + protected String password; + protected String payAmt; + protected String paymentId; + protected String phone; + protected String phone2; + protected String poReference; + protected String POReference; + protected String postalAddress; + protected String postalAddress1; + protected String postalCity; + protected String postalCode; + protected String postalPostalCode; + protected String prefOrderLineId; + protected String price; + protected String priceEntered; + protected String priceList; + protected PriceListBean priceListBean; + protected ArrayList priceListBeanList = new ArrayList(); + protected String priceListName; + protected String salesPriceListId; + protected String purchasePriceListId; + protected String priceListId; + protected String priceListVersionId; + + protected AttributeValuesPair productAttributes; + protected String productAttributeSetInstanceId; + protected String productCategoryId; + protected String productId; + protected ProductBean productBean; + protected ArrayList productBeanList = new ArrayList(); + protected String productName; + protected String qty; + protected String qtyOnHand; + protected String qtyToMove; + protected String qtyReserved; + protected String [] qtyTargeted; + protected String quantity; + protected String read; + protected String refNo; + protected String reference; + protected Integer refToQuote; + protected String region; + protected String regionId; + protected String registerNumber; + protected String reserveStatus; + protected String roleId; + protected String roleName; + protected String routingNumber; + protected String sernoAttributeSetInstance; + protected String sotrxFlag; + protected String startDay = "" + Calendar.getInstance().get(Calendar.DATE); + protected String startHour; + protected String startMinute; + protected String startMonth= "" + (Calendar.getInstance().get(Calendar.MONTH) + 1); + protected String startYear="" + Calendar.getInstance().get(Calendar.YEAR); + protected String stdPrice; + protected String stdPurchasePrice; + protected String stdSalesPrice; + protected String subject; + protected String submit; + protected String subTotal; + protected String surname; + protected Integer[] targetId; + protected String termsAgreement; + protected String toDate; + protected String toOrderLineId; + protected String totalLines; + protected String transmission; + protected String transmissionAttributeValueId; + protected String userId; + protected String username; + protected String value; + protected String vinNumber; + protected String warehouseId; + protected String warehouseName; + protected String warehouseType; + protected String year; + protected String yearAttributeValueId; + protected String first; + protected String licensingDistrictId; + protected String licensingDistrict; + protected String tradeInOrderlineId; + protected String passportNo; + protected String companyRegNo; + protected ArrayList showroomTrafficBean; + + protected String sales; + protected String traffic; + protected String prospects; + + protected String modelId; + protected String trxId; + protected String trx; + protected String modelCode; + protected String modelCodeId; + protected String dealerCode; + protected String dealerCodeId; + protected String name2; + protected String isAllocationWarehouse="false"; + protected String canAlterOrder; + protected String canCreateOrder; + protected String canViewOrder; + protected String salesRepId; + + protected String imagePath; + protected String imageTitle; + protected String altText; + protected String dateFrom; + protected String dateTo; + + protected String weekNo; + protected String startDate; + protected String endDate; + protected String financeOption; + protected String status; + + protected String newVinNumber; + protected String countryOfImpCode; + protected String enginePower; + protected String mainColourCode; + protected String natisModelNo; + protected String noOfWheels; + protected String tare; + protected String unitNumber; + protected Integer unitsPerPack; + protected String isTradeIn = "true"; + + protected String attributesetinstanceIdFrom; + protected String attributesetinstanceIdTo; + protected String releasedBy; + protected Integer productIds[]; + protected String ETA; + protected String ETAFilter; + + protected String engineCapacity; + protected String colourCodeHES; + protected String colourName; + protected String natisModelDescription; + protected Integer orderIds[]; + + protected String colourCodeMatchId; + protected String modelMatchID; + protected String natisModelDesc; + protected String modelDesc; + protected String trans; + protected String showActiveOnly = "true"; + protected String updateAttrValueId; + protected String active; + protected String visible; + protected String beginingBalance; + protected String statementDifference; + protected String endingBalance; + protected String amount; + protected String trxType; + protected String amountGiven; + protected String amountRefunded; + protected String cashBookId; + protected String cashId; + protected String cashLineId; + protected String cashBookName; + protected String chequeNo; + protected String creditCardType; + protected String creditCardNumber; + protected String creditCardNumberEncrypted; + protected String creditCardExpMonth; + protected String creditCardExpMonthName; + protected String creditCardExpYear; + protected Integer orderLineIds[]; + protected Integer [] posOrderLineIds; + protected Integer [] bpartnerIds; + protected Integer [] invoiceIds; + + private String qtySmall; + private String qtyMedium; + private String qtyLarge; + private String qtyXLarge; + private String clientName; + protected String transferAmount; + protected String cashBookIds; + protected String designAttributeValueId; + protected String modelAttributeValueId; + protected String sizeAttributeValueId; + protected String colourAttributeValueId; + protected String shoppingCartItemId; + protected String keyword; + protected String searchText; + protected String backOrder; + + protected String fieldName; + protected String applicationName; + protected String storeId; + protected String isWebstoreFeatured="false"; + protected String isNotWebstoreFeatured; + protected String imageName; + + protected String posId; + protected String purchasePriceList; + protected String purchasePriceLimit; + protected String purchasePriceStandard; + protected String salesPriceList; + protected String salesPriceLimit; + protected String salesPriceStandard; + protected String barCode; + protected String trackingNo; + protected String reportType; + protected String noOfProductsRequired; + protected String qtyAndItem; + protected String [] discountPercent; + protected String [] actualPrice; + protected String userSurname; + protected String countryId; + protected String countryName; + + protected String newName; + protected ArrayList productsList = new ArrayList(); + protected ProductImageBean productsIndexed; + protected String paymentByCash; + protected String paymentByCard; + protected String paymentByChq; + protected String isSales; + protected String isSOPriceList; + protected String ifAdd="true"; + + protected String brandName; + protected String modelName; + protected String designName; + protected String sizeName; + protected String productCategory; + protected String productClassification; + protected String [] sizes; + protected String revenueRecognition; + protected String cvv; + protected String creditCardPayment; + protected String shipmentMethod = MInOut.DELIVERYVIARULE_Pickup; + protected String shipTo; + protected String billTo; + protected String shipperId; + protected String paymentMethod; + + protected String revenueRecoId; + protected String isTextileProduct; + protected String qtyFilter; + protected ArrayList attributeValueList; + protected String [] attributeValueIds; + protected String attributeSetName; + protected String attributeName; + + + protected String requestId; + protected String fromAddress; + protected String toAddresses; + protected String ccAddresses; + protected String bccAddresses; + protected String textMessage; + protected String toUserId; + protected String priority; + protected String title; + protected String chargeId; + protected String statusId; + protected String totalActualPrice; + protected String productType="I"; + protected String qtyNumberFilter; + protected String taxCategoryId; + protected String taxCategoryName; + protected String endingBalanceAsString; + protected String beginingBalanceAsString; + protected String vendorName; + protected String timePeriod; + protected String chartType; + protected String salesGroup; + protected String taxRate; + protected String state; + protected String accountId; + protected String dateRange; + protected String reportName; + protected String orderGrandTotal; + protected String transferAllAmount; + protected String adjustmentAmount; + + protected String differenceAmt; + protected String tillGrandTotal; + protected String cashTotal; + protected String cardTotal; + protected String chequeTotal; + protected String creatingFromOrder; + protected String transferType; + protected String priceQtyFilter; + protected String deliveryViaRule; + protected String userPIN; + protected String paymentRule; + protected String cardDifference; + protected String chequeDifference; + + + protected String isSelfService; + protected String documentNote; + protected String currencySymbole; + protected String userDiscount; + + + + + protected String invoiceDate; + protected String netDays; + protected String daysDue; + protected String dueDate; + protected String discountDate; + protected String discountAmt; + protected String invoiceGrandTotal; + protected String paidAmt; + protected String openAmt; + protected String currencyId; + protected String paymentTermId; + protected String invoiceScheduleId; + + protected String invoicedAmt; + protected String pastDue91_plus; + protected String pastDue61_90; + protected String pastDue31_60; + protected String pastDue1_30; + protected String pastDue8_30; + protected String pastDue1_7; + protected String pastDueAmt; + protected String dueAmt; + protected String due0; + protected String due1_7; + protected String due8_30; + protected String due0_30; + protected String due31_60; + protected String due61_90; + protected String due91_PLUS; + + + protected String paymentAmt; + protected String overUnderPayment; + protected String writeOffAmt; + + protected String invoiceNo; + protected String paymentTermName; + + protected String dunningLevelId; + protected String dunningLevelName; + protected String dunningPrintText; + protected String dunningPrintNote; + protected String BP_Group_ID ; + protected String dunningId; + protected String dunningName; + protected String creditLimit; + protected String creditStatus; + protected String creditUsed; + public String docBasisType; + protected String amtMultiplier; + protected String frequencyType; + protected String commissionAmtId; + protected String subtractAmt; + + protected String taxName; + protected String taxId; + protected String isTaxExempted; + + protected Integer [] paymentIds; + + + protected String inventoryLineId; + protected String inventoryId; + protected String qtyBook; + protected String qtyCount; + protected String qtyCsv; + + protected String afterDelivery; + protected String fixedDueDate; + protected String nextBusinessday; + protected String fixedMonthDay; + protected String fixedMonthOffset; + protected String fiedMonthCutoff; + protected String toBeShipped; + protected String discountDay1; + protected String discountDay2; + protected String discountAmt1; + protected String discountAmt2; + protected String [] allocateAmount; + protected String group1; + protected String group2; + protected Integer [] inventoryIds; + + + protected String isFullAccess; + + protected String historyType; + + protected String birthdate; + protected String openDrawer="true"; + protected String uomId; + protected String uom; + protected String isOverwritePriceLimit; + protected String isDiscountUptoLimitPrice; + protected String isDiscountAllowedOnTotal; + protected String isChecked; + protected String fullDetails; + protected String unitPrice; + protected String unitPurchasePrice; + protected String totalGrossProfit; + protected String totalGrossProfitPercentage; + + protected StockMovementBean stock; + protected ArrayList stockList = new ArrayList(); + protected String stockValue; + private String noOfPack; + + // Additional fields required for user registration + protected String company = ""; + protected String industry = ""; + protected String comments = ""; + + protected String roundOffFactor; + protected String stdPrecision; + protected String isoCode; + protected String curSymbol; + + protected String terminalId; + protected String cashbookTransferType; + protected String checkTransferType; + protected String cardTransferType; + protected String cardBankAccountId; + protected String checkBankAccountId; + protected String templateBPartnerId; + protected String cashbookTransferCashbookId; + protected String cashbookTransferBankAccountId; + protected String checkTransferCashbookId; + protected String checkTransferBankAccountId; + protected String cardTransferCashbookId; + protected String cardTransferBankAccountId; + protected String autoLock; + protected String locked; + protected String isDiscountOnPercentage = "false"; + protected String isDiscountOnTotal = "false"; + protected String isAllowToView; + protected String isAllowToEdit; + protected String isAllowToCreate; + protected String isAllowToDelete; + protected String webMenuId; + protected String isSalesReport; + protected String receiptFooterMsg; + protected String branch; + protected String saleRepName; + + protected String readOnly = "false"; + + public String getIsoCode() { + return isoCode; + } + + public void setIsoCode(String isoCode) { + this.isoCode = isoCode; + } + + public String getCurSymbol() { + return curSymbol; + } + + public void setCurSymbol(String curSymbol) { + this.curSymbol = curSymbol; + } + + public String getStdPrecision() { + return stdPrecision; + } + + public void setStdPrecision(String stdPrecision) { + this.stdPrecision = stdPrecision; + } + + public String getHistoryType() + { + return historyType; + } + + public void setHistoryType(String historyType) + { + this.historyType = historyType; + } + + public Integer[] getPaymentIds() + { + return paymentIds; + } + + public void setPaymentIds(Integer[] paymentIds) + { + this.paymentIds = paymentIds; + } + + public DefaultForm() + { + setBean(new UDIBean()); + } + + public String getOrderGrandTotal() + { + return orderGrandTotal; + } + + public void setOrderGrandTotal(String orderGrandTotal) + { + this.orderGrandTotal = orderGrandTotal; + } + + public String getSalesGroup() + { + return salesGroup; + } + + public void setSalesGroup(String salesGroup) + { + this.salesGroup = salesGroup; + } + + public String getBeginingBalanceAsString() + { + return beginingBalanceAsString; + } + + public void setBeginingBalanceAsString(String beginingBalanceAsString) + { + this.beginingBalanceAsString = beginingBalanceAsString; + } + + public String getEndingBalanceAsString() + { + return endingBalanceAsString; + } + + public void setEndingBalanceAsString(String endingBalanceAsString) + { + this.endingBalanceAsString = endingBalanceAsString; + } + + public String getAttributeName() + { + return attributeName; + } + + public void setAttributeName(String attributeName) + { + this.attributeName = attributeName; + } + + public String getAttributeSetName() + { + return attributeSetName; + } + + public void setAttributeSetName(String attributeSetName) + { + this.attributeSetName = attributeSetName; + } + + public String getBillTo() + { + return billTo; + } + + public void setBillTo(String billTo) + { + this.billTo = billTo; + } + + public String getShipmentMethod() + { + return shipmentMethod; + } + + public void setShipmentMethod(String shipmentMethod) + { + this.shipmentMethod = shipmentMethod; + } + + public String getShipTo() + { + return shipTo; + } + + public void setShipTo(String shipTo) + { + this.shipTo = shipTo; + } + public String[] getActualPrice() + { + return actualPrice; + } + + public void setActualPrice(String[] actualPrice) + { + this.actualPrice = actualPrice; + } + + public String[] getDiscountPercent() + { + return discountPercent; + } + + public void setDiscountPercent(String[] discountPercent) + { + this.discountPercent = discountPercent; + } + + public String getQtyAndItem() + { + return qtyAndItem; + } + + public void setQtyAndItem(String qtyAndItem) + { + this.qtyAndItem = qtyAndItem; + } + + public String getIsTradeIn() + { + return isTradeIn; + } + + public void setIsTradeIn(String isTradeIn) + { + this.isTradeIn = isTradeIn; + } + + public String getLicensingDistrictId() { + return licensingDistrictId; + } + public void setLicensingDistrictId(String licensingDistrictId) { + this.licensingDistrictId = licensingDistrictId; + } + public String getIsAvailableForBackOrder() { + return isAvailableForBackOrder; + } + public void setIsAvailableForBackOrder(String isAvailableForBackOrder) { + this.isAvailableForBackOrder = isAvailableForBackOrder; + } + public String getAaCardnumber() { + return aaCardnumber; + } + public String getAccountNo() { + return accountNo; + } + public String getAccountType() { + return accountType; + } + public String getAddress1() { + return address1; + } + public String getAddress2() { + return address2; + } + + public String getAgreement() + { + return agreement; + } + public String getAisle() { + return aisle; + } + + + public String getAllocationId() + { + return allocationId; + } + + + + public String getAllocationStatus() + { + return allocationStatus; + } + public String getAttribute() { + return attribute; + } + public String getAttributeId() { + return attributeId; + } + public String getAttributeSetId() { + return attributeSetId; + } + public String getAttributeSetInstanceId() + { + return attributeSetInstanceId; + } + public String getAttributeValue() { + return attributeValue; + } + public String getBankId() { + return bankId; + } + public String getBankName() { + return bankName; + } + public String getBin() { + return bin; + } + public String getBpartnerId() { + return bpartnerId; + } + + public Integer[] getCheckBox() + { + return checkBox; + } + + public String getCheckNo() { + return checkNo; + } + public String getCity() { + return city; + } + public String getColour() { + return colour; + } + public String getColourAttributeValueId() { + return colourAttributeValueId; + } + + public String getCompiereDocStatus() + { + return compiereDocStatus; + } + + public String getConfirmEmail() { + return confirmEmail; + } + public String getConfirmPassword() { + return confirmPassword; + } + public String getCounterOrderStatusInfo() { + return counterOrderStatusInfo; + } + public String getCounterOrgID() { + return counterOrgID; + } + public String getCounterOrgName() { + return counterOrgName; + } + public String getCurrentBalance() { + return currentBalance; + } + public String getCustIdNumber() { + return custIdNumber; + } + public String getDateCreated() { + return dateCreated; + } + public String getDateOrdered() { + return dateOrdered; + } + public String getDatePromised() { + return datePromised; + } + public String getDateTrx() { + return dateTrx; + } + + public String getDescription() { + return description; + } + + public String getDocStatus() { + return docStatus; + } + public String getDocStatusCode() { + return docStatusCode; + } + public String getDocumentId() { + return documentId; + } + public String getDocumentNo() { + return documentNo; + } + public String getDocumentType() { + return documentType; + } + public String getEmail() { + return email; + } + + public String getEndDay() { + return endDay; + } + public String getEndHour() { + return endHour; + } + public String getEndMinute() { + return endMinute; + } + public String getEndMonth() { + return endMonth; + } + public String getEndYear() { + return endYear; + } + + + public String getEngineNo() { + return engineNo; + } + + + public String getEngineNumber() + { + return engineNumber; + } + public FormFile getFile() + { + return file; + } + + public String getFromDate() { + return fromDate; + } + + public String getFromOrderLineId() + { + return fromOrderLineId; + } + + public String getGrandTotal() { + return grandTotal; + } + public String getId() { + return id; + } + + public String getInvoiceId() { + return invoiceId; + } + public String getIsAccessAllOrgs() { + return isAccessAllOrgs; + } + public String getIsActive() { + return isActive; + } + public String getIsApproved() { + return isApproved; + } + public String getIsAutomobile() { + return isAutomobile; + } + public String getIsCustomer() { + return isCustomer; + } + public String getIsDefault() { + return isDefault; + } + public String getIsDelivered() { + return isDelivered; + } + public String getIsEmployee() { + return isEmployee; + } + public String getIsInvoiced() { + return isInvoiced; + } + public String getIsMotorcycle() { + return isMotorcycle; + } + public String getIsNatisReleased() { + return isNatisReleased; + } + public String getIsPublic() { + return isPublic; + } + + + public String getIsQtyReserved() { + return isQtyReserved; + } + + public String getIsReceipt() { + return isReceipt; + } + public String getIsRetailer() { + return isRetailer; + } + public String getIsSalesRep() { + return isSalesRep; + } + public String getIsSoTrx() { + return isSoTrx; + } + public String getIsVendor() { + return isVendor; + } + public String getIsWholesaler() { + return isWholesaler; + } + public String getLevel() { + return level; + } + public ArrayList getList() + { + return list; + } + + public String getLocationId() { + return locationId; + } + + + public String getLocatorId() + { + return locatorId; + } + + public FormFile getLogo() + { + return logo; + } + public String getLogoName() + { + return logoName; + } + public String getMaintenanceContractNumber() { + return maintenanceContractNumber; + } + + public String getMake() + { + return make; + } + + public String getMakeAttributeValueId() + { + return makeAttributeValueId; + } + + public String getMenuId() { + return menuId; + } + public String getMenuItemName() { + return menuItemName; + } + public String getMenuLink() { + return menuLink; + } + public String getMessage() { + return message; + } + public String getMessageID() { + return messageID; + } + public String getMobile() { + return mobile; + } + public String getModel() { + return model; + } + public String getModelAttributeValueId() { + return modelAttributeValueId; + } + + public String getModelGroup() { + return modelGroup; + } + public String getMonth() { + return month; + } + + public String getMovementDate() + { + return movementDate; + } + + public String getMovementDescription() + { + return movementDescription; + } + public String getName() { + return name; + } + public String getNatisApplicationDate() + { + return natisApplicationDate; + } + public String getNatisControlNumber() + { + return natisControlNumber; + } + public String getNatisReleaseId() + { + return natisReleaseId; + } + public String getNewEmail() { + return newEmail; + } + public String getNewPassword() { + return newPassword; + } + public String getOldPassword() { + return oldPassword; + } + public String getOrderId() { + return orderId; + } + public ArrayList getOrderLineBean() + { + return orderLineBean; + } + + public String getOrderLineId() + { + return orderLineId; + } + + + public String getOrderStatusInfo() { + return orderStatusInfo; + } + + + public String getOrderType() + { + return orderType; + } + public String getOrgId() + { + return orgId; + } + public String getOrgID() { + return OrgID; + } + public String getOrgName() { + return orgName; + } + public String getOrgType() { + return orgType; + } + public String getOrgUser() { + return orgUser; + } + public String getParentMenuId() { + return parentMenuId; + } + public String getPartnerId() { + return partnerId; + } + public String getPartnerName() { + return partnerName; + } + public String getPassword() { + return password; + } + public String getPayAmt() { + return payAmt; + } + public String getPaymentId() { + return paymentId; + } + + public String getPhone1() { + return phone; + } + public String getPhoneNo() { + return phone2; + } + public String getPoReference() { + return poReference; + } + public String getPOReference() + { + return POReference; + } + + public String getPostalAddress() { + return postalAddress; + } + public String getPostalAddress1() { + return postalAddress1; + } + public String getPostalCity() { + return postalCity; + } + public String getPostalCode() { + return postalCode; + } + public String getPostalPostalCode() { + return postalPostalCode; + } + public String getPrefOrderLineId() + { + return prefOrderLineId; + } + + public String getPriceEntered() + { + return priceEntered; + } + + public String getPriceListVersionId() { + return priceListVersionId; + } + public AttributeValuesPair getProductAttributes() + { + return productAttributes; + } + + public String getProductAttributeSetInstanceId() + { + return productAttributeSetInstanceId; + } + + public String getProductCategoryId() + { + return productCategoryId; + } + + public String getProductId() + { + return productId; + } + + public String getProductName() + { + return productName; + } + + public String getQty() { + return qty; + } + public String getQtyReserved() + { + return qtyReserved; + } + + public String[] getQtyTargeted() { + return qtyTargeted; + } + + public String getQuantity() + { + return quantity; + } + + public String getRead() { + return read; + } + + + public Integer getRefToQuote() + { + return refToQuote; + } + public String getRegion() { + return region; + } + + public String getRegionId() { + return regionId; + } + public String getRegisterNumber() + { + return registerNumber; + } + + public String getReserveStatus() + { + return reserveStatus; + } + public String getRoleId() { + return roleId; + } + public String getRoleName() { + return roleName; + } + public String getRoutingNumber() { + return routingNumber; + } + + public String getSernoAttributeSetInstance() + { + return sernoAttributeSetInstance; + } + + public String getSotrxFlag() + { + return sotrxFlag; + } + public String getStartDay() { + return startDay; + } + public String getStartHour() { + return startHour; + } + public String getStartMinute() { + return startMinute; + } + public String getStartMonth() { + return startMonth; + } + public String getStartYear() { + return startYear; + } + public String getStdPurchasePrice() { + return stdPurchasePrice; + } + public String getStdSalesPrice() { + return stdSalesPrice; + } + public String getSubject() { + return subject; + } + + public String getSubmit() + { + return submit; + } + public String getSurname() { + return surname; + } + + public Integer[] getTargetId() { + return targetId; + } + public String getTermsAgreement() + { + return termsAgreement; + } + + public String getToDate() { + return toDate; + } + + public String getToOrderLineId() + { + return toOrderLineId; + } + + public String getTotalLines() + { + return totalLines; + } + + public String getTransmission() { + return transmission; + } + public String getTransmissionAttributeValueId() { + return transmissionAttributeValueId; + } + public String getUserId() { + return userId; + } + + public String getUsername() { + return username; + } + public String getValue() { + return value; + } + + public String getVinNumber() + { + return vinNumber; + } + public String getWarehouseId() { + return warehouseId; + } + public String getWarehouseName() { + return warehouseName; + } + + public String getWarehouseType() + { + return warehouseType; + } + public String getYear() { + return year; + } + + public void setAisle(String aisle) { + this.aisle = aisle; + } + + + public void setAllocationId(String allocationId) + { + this.allocationId = allocationId; + } + + public void setAllocationStatus(String allocationStatus) + { + this.allocationStatus = allocationStatus; + } + public void setAttribute(String attribute) { + this.attribute = attribute; + } + public void setAttributeId(String attributeId) { + this.attributeId = attributeId; + } + public void setAttributeSetId(String attributeSetId) { + this.attributeSetId = attributeSetId; + } + public void setAttributeSetInstanceId(String attributeSetInstanceId) + { + this.attributeSetInstanceId = attributeSetInstanceId; + } + public void setAttributeValue(String attributeValue) { + this.attributeValue = attributeValue; + } + public void setBankId(String bankId) { + this.bankId = bankId; + } + public void setBankName(String bankName) { + this.bankName = bankName; + } + public void setBin(String bin) { + this.bin = bin; + } + public void setBpartnerId(String partnerId) { + bpartnerId = partnerId; + } + public void setCheckBox(Integer[] checkBox) + { + this.checkBox = checkBox; + } + + public String getYearAttributeValueId() { + return yearAttributeValueId; + } + public void setAaCardnumber(String aaCardnumber) { + this.aaCardnumber = aaCardnumber; + } + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + public void setAccountType(String accountType) { + this.accountType = accountType; + } + public void setAddress1(String address1) { + this.address1 = address1; + } + public void setAddress2(String address2) { + this.address2 = address2; + } + + public void setAgreement(String agreement) + { + this.agreement = agreement; + } + + public void setCheckNo(String checkNo) { + this.checkNo = checkNo; + } + public void setCity(String city) { + this.city = city; + } + public void setColour(String colour) { + this.colour = colour; + } + public void setColourAttributeValueId(String colourAttributeValueId) { + this.colourAttributeValueId = colourAttributeValueId; + } + + public void setCompiereDocStatus(String compiereDocStatus) + { + this.compiereDocStatus = compiereDocStatus; + } + public void setConfirmEmail(String confirmEmail) { + this.confirmEmail = confirmEmail; + } + public void setConfirmPassword(String confirmPassword) { + this.confirmPassword = confirmPassword; + } + public void setCounterOrderStatusInfo(String counterOrderStatusInfo) { + this.counterOrderStatusInfo = counterOrderStatusInfo; + } + public void setCounterOrgID(String counterOrgID) { + this.counterOrgID = counterOrgID; + } + public void setCounterOrgName(String counterOrgName) { + this.counterOrgName = counterOrgName; + } + public void setCurrentBalance(String currentBalance) { + this.currentBalance = currentBalance; + } + public void setCustIdNumber(String custIdNumber) { + this.custIdNumber = custIdNumber; + } + public void setDateCreated(String dateCreated) { + this.dateCreated = dateCreated; + } + public void setDateOrdered(String dateOrdered) { + this.dateOrdered = dateOrdered; + } + public void setDatePromised(String datePromised) { + this.datePromised = datePromised; + } + public void setDateTrx(String dateTrx) { + this.dateTrx = dateTrx; + } + public void setDescription(String description) { + this.description = description; + } + public void setDocStatus(String docStatus) { + this.docStatus = docStatus; + } + public void setDocStatusCode(String docStatusCode) { + this.docStatusCode = docStatusCode; + } + public void setDocumentId(String documentId) { + this.documentId = documentId; + } + public void setDocumentNo(String documentNo) { + this.documentNo = documentNo; + } + public void setDocumentType(String documentType) { + this.documentType = documentType; + } + public void setEmail(String email) { + this.email = email; + } + public void setEndDay(String endDay) { + this.endDay = endDay; + } + public void setEndHour(String endHour) { + this.endHour = endHour; + } + public void setEndMinute(String endMinute) { + this.endMinute = endMinute; + } + public void setEndMonth(String endMonth) { + this.endMonth = endMonth; + } + public void setEndYear(String endYear) { + this.endYear = endYear; + } + public void setEngineNo(String engineNo) { + this.engineNo = engineNo; + } + public void setEngineNumber(String engineNumber) + { + this.engineNumber = engineNumber; + } + + public void setFile(FormFile file) + { + this.file = file; + } + + public void setFromDate(String fromDate) { + this.fromDate = fromDate; + } + + public void setFromOrderLineId(String fromOrderLineId) + { + this.fromOrderLineId = fromOrderLineId; + } + + public void setGrandTotal(String grandTotal) { + this.grandTotal = grandTotal; + } + public void setId(String id) { + this.id = id; + } + public void setInvoiceId(String invoiceId) { + this.invoiceId = invoiceId; + } + public void setIsAccessAllOrgs(String isAccessAllOrgs) { + this.isAccessAllOrgs = isAccessAllOrgs; + } + + public void setIsActive(String isActive) { + this.isActive = isActive; + } + public void setIsApproved(String isApproved) { + this.isApproved = isApproved; + } + public void setIsAutomobile(String isAutomobile) { + this.isAutomobile = isAutomobile; + } + public void setIsCustomer(String isCustomer) { + this.isCustomer = isCustomer; + } + public void setIsDefault(String isDefault) { + this.isDefault = isDefault; + } + public void setIsDelivered(String isDelivered) { + this.isDelivered = isDelivered; + } + public void setIsEmployee(String isEmployee) { + this.isEmployee = isEmployee; + } + public void setIsInvoiced(String isInvoiced) { + this.isInvoiced = isInvoiced; + } + public void setIsMotorcycle(String isMotorcycle) { + this.isMotorcycle = isMotorcycle; + } + public void setIsNatisReleased(String isNatisReleased) { + this.isNatisReleased = isNatisReleased; + } + public void setIsPublic(String isPublic) { + this.isPublic = isPublic; + } + public void setIsQtyReserved(String isQtyReserved) { + this.isQtyReserved = isQtyReserved; + } + + public void setIsReceipt(String isReceipt) { + this.isReceipt = isReceipt; + } + public void setIsRetailer(String isRetailer) { + this.isRetailer = isRetailer; + } + public void setIsSalesRep(String isSalesRep) { + this.isSalesRep = isSalesRep; + } + public void setIsSoTrx(String isSoTrx) { + this.isSoTrx = isSoTrx; + } + public void setIsVendor(String isVendor) { + this.isVendor = isVendor; + } + public void setIsWholesaler(String isWholesaler) { + this.isWholesaler = isWholesaler; + } + public void setLevel(String level) { + this.level = level; + } + public void setList(ArrayList list) + { + this.list = list; + } + + public void setLocationId(String locationId) { + this.locationId = locationId; + } + + public void setLocatorId(String locatorId) + { + this.locatorId = locatorId; + } + + public void setLogo(FormFile logo) + { + this.logo = logo; + } + public void setLogoName(String logoName) + { + this.logoName = logoName; + } + public void setMaintenanceContractNumber(String maintenanceContractNumber) { + this.maintenanceContractNumber = maintenanceContractNumber; + } + + public void setMake(String make) + { + this.make = make; + } + + public void setMakeAttributeValueId(String makeAttributeValueId) + { + this.makeAttributeValueId = makeAttributeValueId; + } + + public void setMenuId(String menuId) { + this.menuId = menuId; + } + public void setMenuItemName(String menuItemName) { + this.menuItemName = menuItemName; + } + public void setMenuLink(String menuLink) { + this.menuLink = menuLink; + } + public void setMessage(String message) { + this.message = message; + } + public void setMessageID(String messageID) { + this.messageID = messageID; + } + public void setMobile(String mobile) { + this.mobile = mobile; + } + public void setModel(String model) { + this.model = model; + } + public void setModelAttributeValueId(String modelAttributeValueId) { + this.modelAttributeValueId = modelAttributeValueId; + } + public void setModelGroup(String modelGroup) { + this.modelGroup = modelGroup; + } + public void setMonth(String month) { + this.month = month; + } + + public void setMovementDate(String movementDate) + { + this.movementDate = movementDate; + } + + public void setMovementDescription(String movementDescription) + { + this.movementDescription = movementDescription; + } + public void setName(String name) { + this.name = name; + } + public void setNatisApplicationDate(String natisApplicationDate) + { + this.natisApplicationDate = natisApplicationDate; + } + public void setNatisControlNumber(String natisControlNumber) + { + this.natisControlNumber = natisControlNumber; + } + public void setNatisReleaseId(String natisReleaseId) + { + this.natisReleaseId = natisReleaseId; + } + public void setNewEmail(String newEmail) { + this.newEmail = newEmail; + } + public void setNewPassword(String newPassword) { + this.newPassword = newPassword; + } + public void setOldPassword(String oldPassword) { + this.oldPassword = oldPassword; + } + public void setOrderId(String orderId) { + this.orderId = orderId; + } + public void setOrderLineBean(ArrayList orderLineBean) + { + this.orderLineBean = orderLineBean; + } + + public void setOrderLineId(String orderLineId) + { + this.orderLineId = orderLineId; + } + + + + public void setOrderStatusInfo(String orderStatusInfo) { + this.orderStatusInfo = orderStatusInfo; + } + + public void setOrderType(String orderType) + { + this.orderType = orderType; + } + public void setOrgId(String orgId) + { + this.orgId = orgId; + } + public void setOrgID(String orgID) { + OrgID = orgID; + } + public void setOrgName(String orgName) { + this.orgName = orgName; + } + public void setOrgType(String orgType) { + this.orgType = orgType; + } + public void setOrgUser(String orgUser) { + this.orgUser = orgUser; + } + public void setParentMenuId(String parentMenuId) { + this.parentMenuId = parentMenuId; + } + public void setPartnerId(String partnerId) { + this.partnerId = partnerId; + } + public void setPartnerName(String partnerName) { + this.partnerName = partnerName; + } + public void setPassword(String password) { + this.password = password; + } + public void setPayAmt(String payAmt) { + this.payAmt = payAmt; + } + public void setPaymentId(String paymentId) { + this.paymentId = paymentId; + } + public void setPhone1(String phone1) { + this.phone = phone1; + } + public void setPhoneNo(String phoneNo) { + this.phone2 = phoneNo; + } + public void setPoReference(String poReference) { + this.poReference = poReference; + } + public void setPOReference(String reference) + { + POReference = reference; + } + + public void setPostalAddress(String postalAddress) { + this.postalAddress = postalAddress; + } + public void setPostalAddress1(String postalAddress1) { + this.postalAddress1 = postalAddress1; + } + public void setPostalCity(String postalCity) { + this.postalCity = postalCity; + } + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + public void setPostalPostalCode(String postalPostalCode) { + this.postalPostalCode = postalPostalCode; + } + + public void setPrefOrderLineId(String prefOrderLineId) + { + this.prefOrderLineId = prefOrderLineId; + } + + public void setPriceEntered(String priceEntered) + { + this.priceEntered = priceEntered; + } + + public void setPriceListVersionId(String priceListVersionId) { + this.priceListVersionId = priceListVersionId; + } + public void setProductAttributes(AttributeValuesPair productAttributes) + { + this.productAttributes = productAttributes; + } + + public void setProductAttributeSetInstanceId(String productAttributeSetInstanceId) + { + this.productAttributeSetInstanceId = productAttributeSetInstanceId; + } + + public void setProductCategoryId(String productCategoryId) + { + this.productCategoryId = productCategoryId; + } + + public void setProductId(String productId) + { + this.productId = productId; + } + + public void setProductName(String productName) + { + this.productName = productName; + } + public void setQty(String qty) { + this.qty = qty; + } + public void setQtyReserved(String qtyReserved) + { + this.qtyReserved = qtyReserved; + } + public void setQtyTargeted(String[] qtyTargeted) { + this.qtyTargeted = qtyTargeted; + } + + + public void setQuantity(String quantity) + { + this.quantity = quantity; + } + + public void setRead(String read) { + this.read = read; + } + public void setRefToQuote(Integer refToQuote) + { + this.refToQuote = refToQuote; + } + public void setRegion(String region) { + this.region = region; + } + + + public void setRegionId(String regionId) { + this.regionId = regionId; + } + public void setRegisterNumber(String registerNumber) + { + this.registerNumber = registerNumber; + } + + public void setReserveStatus(String reserveStatus) + { + this.reserveStatus = reserveStatus; + } + public void setRoleId(String roleId) { + this.roleId = roleId; + } + public void setRoleName(String roleName) { + this.roleName = roleName; + } + public String getPrice() { + return price; + } + public void setPrice(String price) { + this.price = price; + } + public String getPriceList() { + return priceList; + } + public void setPriceList(String priceList) { + this.priceList = priceList; + } + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + public void setSernoAttributeSetInstance(String sernoAttributeSetInstance) + { + this.sernoAttributeSetInstance = sernoAttributeSetInstance; + } + + public void setSotrxFlag(String sotrxFlag) + { + this.sotrxFlag = sotrxFlag; + } + public void setStartDay(String startDay) { + this.startDay = startDay; + } + public void setStartHour(String startHour) { + this.startHour = startHour; + } + public void setStartMinute(String startMinute) { + this.startMinute = startMinute; + } + public void setStartMonth(String startMonth) { + this.startMonth = startMonth; + } + public void setStartYear(String startYear) { + this.startYear = startYear; + } + public void setStdPurchasePrice(String stdPurchasePrice) { + this.stdPurchasePrice = stdPurchasePrice; + } + public void setStdSalesPrice(String stdSalesPrice) { + this.stdSalesPrice = stdSalesPrice; + } + public void setSubject(String subject) { + this.subject = subject; + } + + public void setSubmit(String submit) + { + this.submit = submit; + } + public void setSurname(String surname) { + this.surname = surname; + } + public void setTargetId(Integer[] targetId) { + this.targetId = targetId; + } + public void setTermsAgreement(String termsAgreement) + { + this.termsAgreement = termsAgreement; + } + public void setToDate(String toDate) { + this.toDate = toDate; + } + + public void setToOrderLineId(String toOrderLineId) + { + this.toOrderLineId = toOrderLineId; + } + + public void setTotalLines(String totalLines) + { + this.totalLines = totalLines; + } + public void setTransmission(String transmission) { + this.transmission = transmission; + } + public void setTransmissionAttributeValueId( + String transmissionAttributeValueId) { + this.transmissionAttributeValueId = transmissionAttributeValueId; + } + public void setUserId(String userId) { + this.userId = userId; + } + + public void setUsername(String username) { + this.username = username; + } + public void setValue(String value) { + this.value = value; + } + public void setVinNumber(String vinNumber) + { + this.vinNumber = vinNumber; + } + public void setWarehouseId(String warehouseId) { + this.warehouseId = warehouseId; + } + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public void setWarehouseType(String warehouseType) + { + this.warehouseType = warehouseType; + } + + public void setYear(String year) { + this.year = year; + } + public void setYearAttributeValueId(String yearAttributeValueId) { + this.yearAttributeValueId = yearAttributeValueId; + } + + public String getFirst() + { + return first; + } + + public void setFirst(String first) + { + this.first = first; + } + + public String getLicensingDistrict() + { + return licensingDistrict; + } + + public void setLicensingDistrict(String licensingDistrict) + { + this.licensingDistrict = licensingDistrict; + } + + public String getCompanyRegNo() + { + return companyRegNo; + } + + public void setCompanyRegNo(String companyRegNo) + { + this.companyRegNo = companyRegNo; + } + + public String getPassportNo() + { + return passportNo; + } + + public void setPassportNo(String passportNo) + { + this.passportNo = passportNo; + } + + public String getTradeInOrderlineId() + { + return tradeInOrderlineId; + } + + public void setTradeInOrderlineId(String tradeInOrderlineId) + { + this.tradeInOrderlineId = tradeInOrderlineId; + } + + public String getProspects() + { + return prospects; + } + + public void setProspects(String prospects) + { + this.prospects = prospects; + } + + public String getSales() + { + return sales; + } + + public void setSales(String sales) + { + this.sales = sales; + } + + public ArrayList getShowroomTrafficBean() + { + return showroomTrafficBean; + } + + public void setShowroomTrafficBean(ArrayList showroomTrafficBean) + { + this.showroomTrafficBean = showroomTrafficBean; + } + + + + public String getTraffic() + { + return traffic; + } + + public void setTraffic(String traffic) + { + this.traffic = traffic; + } + + + + public String getModelCode() { + return modelCode; + } + public void setModelCode(String modelCode) { + this.modelCode = modelCode; + } + public String getModelCodeId() { + return modelCodeId; + } + public void setModelCodeId(String modelCodeId) { + this.modelCodeId = modelCodeId; + } + public String getModelId() { + return modelId; + } + public void setModelId(String modelId) { + this.modelId = modelId; + } + public String getTrx() { + return trx; + } + public void setTrx(String trx) { + this.trx = trx; + } + public String getTrxId() { + return trxId; + } + public void setTrxId(String trxId) { + this.trxId = trxId; + } + public String getDealerCode() { + return dealerCode; + } + public void setDealerCode(String dealerCode) { + this.dealerCode = dealerCode; + } + public String getDealerCodeId() { + return dealerCodeId; + } + public void setDealerCodeId(String dealerCodeId) { + this.dealerCodeId = dealerCodeId; + } + public String getName2() + { + return name2; + } + public void setName2(String name2) + { + this.name2 = name2; + } + public String getIsAllocationWarehouse() { + return isAllocationWarehouse; + } + public void setIsAllocationWarehouse(String isAllocationWarehouse) { + this.isAllocationWarehouse = isAllocationWarehouse; + } + + + public String getCanAlterOrder() { + return canAlterOrder; + } + public void setCanAlterOrder(String canAlterOrder) { + this.canAlterOrder = canAlterOrder; + } + public String getCanCreateOrder() { + return canCreateOrder; + } + public void setCanCreateOrder(String canCreateOrder) { + this.canCreateOrder = canCreateOrder; + } + public String getCanViewOrder() { + return canViewOrder; + } + public void setCanViewOrder(String canViewOrder) { + this.canViewOrder = canViewOrder; + } + public String getSalesRepId() { + return salesRepId; + } + public void setSalesRepId(String salesRepId) { + this.salesRepId = salesRepId; + } + public String getAltText() { + return altText; + } + public void setAltText(String altText) { + this.altText = altText; + } + public String getDateFrom() { + return dateFrom; + } + public void setDateFrom(String dateFrom) { + this.dateFrom = dateFrom; + } + public String getDateTo() { + return dateTo; + } + public void setDateTo(String dateTo) { + this.dateTo = dateTo; + } + public String getImagePath() { + return imagePath; + } + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + public String getImageTitle() { + return imageTitle; + } + public void setImageTitle(String imageTitle) { + this.imageTitle = imageTitle; + } + + public String getEndDate() + { + return endDate; + } + public void setEndDate(String endDate) + { + this.endDate = endDate; + } + public String getStartDate() + { + return startDate; + } + public void setStartDate(String startDate) + { + this.startDate = startDate; + } + public String getWeekNo() + { + return weekNo; + } + public void setWeekNo(String weekNo) + { + this.weekNo = weekNo; + } + public String getFax() + { + return fax; + } + public void setFax(String fax) + { + this.fax = fax; + } + + public String getFinanceOption() + { + return financeOption; + } + public void setFinanceOption(String financeOption) + { + this.financeOption = financeOption; + } + public String getStatus() + { + return status; + } + public void setStatus(String status) + { + this.status = status; + } + + + + public String getCountryOfImpCode() + { + return countryOfImpCode; + } + + + + public void setCountryOfImpCode(String countryOfImpCode) + { + this.countryOfImpCode = countryOfImpCode; + } + + + + public String getEnginePower() + { + return enginePower; + } + + + + public void setEnginePower(String enginePower) + { + this.enginePower = enginePower; + } + + + + public String getMainColourCode() + { + return mainColourCode; + } + + + + public void setMainColourCode(String mainColourCode) + { + this.mainColourCode = mainColourCode; + } + + + + public String getNatisModelNo() + { + return natisModelNo; + } + + + + public void setNatisModelNo(String natisModelNo) + { + this.natisModelNo = natisModelNo; + } + + + + public String getNewVinNumber() + { + return newVinNumber; + } + + + + public void setNewVinNumber(String newVinNumber) + { + this.newVinNumber = newVinNumber; + } + + + + public String getNoOfWheels() + { + return noOfWheels; + } + + + + public void setNoOfWheels(String noOfWheels) + { + this.noOfWheels = noOfWheels; + } + + + + public String getTare() + { + return tare; + } + + + + public void setTare(String tare) + { + this.tare = tare; + } + + + + public String getUnitNumber() + { + return unitNumber; + } + + + + public void setUnitNumber(String unitNumber) + { + this.unitNumber = unitNumber; + } + + public String getAttributesetinstanceIdFrom() { + return attributesetinstanceIdFrom; + } + public void setAttributesetinstanceIdFrom(String attributesetinstanceIdFrom) { + this.attributesetinstanceIdFrom = attributesetinstanceIdFrom; + } + public String getAttributesetinstanceIdTo() { + return attributesetinstanceIdTo; + } + public void setAttributesetinstanceIdTo(String attributesetinstanceIdTo) { + this.attributesetinstanceIdTo = attributesetinstanceIdTo; + } + + public String getReleasedBy() { + return releasedBy; + } + public void setReleasedBy(String releasedBy) { + this.releasedBy = releasedBy; + } + + public Integer[] getProductIds() { + return productIds; + } + public void setProductIds(Integer[] productIds) { + this.productIds = productIds; + } + public String getColourCodeHES() + { + return colourCodeHES; + } + + + + public void setColourCodeHES(String colourCodeHES) + { + this.colourCodeHES = colourCodeHES; + } + public String getNatisModelDescription() + { + return natisModelDescription; + } + + + + public void setNatisModelDescription(String natisModelDescription) + { + this.natisModelDescription = natisModelDescription; + } + + public String getETA() + { + return ETA; + } + public void setETA(String eta) + { + ETA = eta; + } + + public String getETAFilter() + { + return ETAFilter; + } + public void setETAFilter(String filter) + { + ETAFilter = filter; + } + + + public String getEngineCapacity() + { + return engineCapacity; + } + + public void setEngineCapacity(String engineCapacity) + { + this.engineCapacity = engineCapacity; + } + + public Integer[] getOrderIds() + { + return orderIds; + } + public void setOrderIds(Integer[] orderIds) { + this.orderIds = orderIds; + } + + public Integer[] getSernoAttributeSetInstanceIds() + { + return sernoAttributeSetInstanceIds; + } + public void setSernoAttributeSetInstanceIds( + Integer[] sernoAttributeSetInstanceIds) + { + this.sernoAttributeSetInstanceIds = sernoAttributeSetInstanceIds; + } + + + public String getModelDesc() + { + return modelDesc; + } + + public void setModelDesc(String modelDesc) + { + this.modelDesc = modelDesc; + } + + public String getModelMatchID() + { + return modelMatchID; + } + + public void setModelMatchID(String modelMatchID) + { + this.modelMatchID = modelMatchID; + } + + public String getNatisModelDesc() + { + return natisModelDesc; + } + + public void setNatisModelDesc(String natisModelDesc) + { + this.natisModelDesc = natisModelDesc; + } + + public String getTrans() + { + return trans; + } + + public void setTrans(String trans) + { + this.trans = trans; + } + public String getAttributeValueId() { + return attributeValueId; + } + public void setAttributeValueId(String attributeValueId) { + this.attributeValueId = attributeValueId; + } + public String getShowActiveOnly() { + return showActiveOnly; + } + public void setShowActiveOnly(String showActiveOnly) { + this.showActiveOnly = showActiveOnly; + } + public String getUpdateAttrValueId() { + return updateAttrValueId; + } + public void setUpdateAttrValueId(String updateAttrValueId) { + this.updateAttrValueId = updateAttrValueId; + } + + public String getIsVisible() + { + return isVisible; + } + + public void setIsVisible(String isVisible) + { + this.isVisible = isVisible; + } + + public String getActive() + { + return active; + } + + public void setActive(String active) + { + this.active = active; + } + + public String getVisible() + { + return visible; + } + + public void setVisible(String visible) + { + this.visible = visible; + } + + public String getColourName() + { + return colourName; + } + + public void setColourName(String colourName) + { + this.colourName = colourName; + } + + public String getColourCodeMatchId() + { + return colourCodeMatchId; + } + + public void setColourCodeMatchId(String colourCodeMatchId) + { + this.colourCodeMatchId = colourCodeMatchId; + } + + + + public String getBeginingBalance() + { + return beginingBalance; + } + + public void setBeginingBalance(String beginingBalance) + { + this.beginingBalance = beginingBalance; + } + + public String getEndingBalance() + { + return endingBalance; + } + + public void setEndingBalance(String endingBalance) + { + this.endingBalance = endingBalance; + } + + public String getStatementDifference() + { + return statementDifference; + } + + public void setStatementDifference(String statementDifference) + { + this.statementDifference = statementDifference; + } + + public String getAmount() + { + return amount; + } + + + public void setAmount(String amount) + { + this.amount = amount; + } + + + public String getTrxType() + { + return trxType; + } + + + public void setTrxType(String trxType) + { + this.trxType = trxType; + } + + + + public String getAmountGiven() { + return amountGiven; + } + + public void setAmountGiven(String amountGiven) { + this.amountGiven = amountGiven; + } + + public String getAmountRefunded() + { + return amountRefunded; + } + + public void setAmountRefunded(String amountRefunded) + { + this.amountRefunded = amountRefunded; + } + + + + public String getCashBookId() + { + return cashBookId; + } + + public void setCashBookId(String cashBookId) + { + this.cashBookId = cashBookId; + } + + public String getCashBookName() + { + return cashBookName; + } + + + public void setCashBookName(String cashBookName) + { + this.cashBookName = cashBookName; + } + + + + public String getChequeNo() + { + return chequeNo; + } + + public void setChequeNo(String chequeNo) + { + this.chequeNo = chequeNo; + } + + public String getCreditCardExpMonth() + { + return creditCardExpMonth; + } + + public void setCreditCardExpMonth(String creditCardExpMonth) + { + this.creditCardExpMonth = creditCardExpMonth; + } + + public String getCreditCardExpYear() + { + return creditCardExpYear; + } + + public void setCreditCardExpYear(String creditCardExpYear) + { + this.creditCardExpYear = creditCardExpYear; + } + + public String getCreditCardNumber() + { + return creditCardNumber; + } + + public void setCreditCardNumber(String creditCardNumber) + { + this.creditCardNumber = creditCardNumber; + } + + public String getCreditCardType() + { + return creditCardType; + } + + public void setCreditCardType(String creditCardType) + { + this.creditCardType = creditCardType; + } + + + + public Integer[] getOrderLineIds() + { + return orderLineIds; + } + + public void setOrderLineIds(Integer[] orderLineIds) + { + this.orderLineIds = orderLineIds; + } + + + public Integer[] getPosOrderLineIds() + { + return posOrderLineIds; + } + + public void setPosOrderLineIds(Integer[] posOrderLineIds) + { + this.posOrderLineIds = posOrderLineIds; + } + public String getQtyLarge() + { + return qtyLarge; + } + + public void setQtyLarge(String qtyLarge) + { + this.qtyLarge = qtyLarge; + } + + public String getQtyMedium() + { + return qtyMedium; + } + + public void setQtyMedium(String qtyMedium) + { + this.qtyMedium = qtyMedium; + } + + public String getQtySmall() + { + return qtySmall; + } + + public void setQtySmall(String qtySmall) + { + this.qtySmall = qtySmall; + } + + public String getQtyXLarge() + { + return qtyXLarge; + } + + public void setQtyXLarge(String qtyXLarge) + { + this.qtyXLarge = qtyXLarge; + } + + public String getClientName() + { + return clientName; + } + + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + + + public String getCashBookIds() { + return cashBookIds; + } + public void setCashBookIds(String cashBookIds) { + this.cashBookIds = cashBookIds; + } + public String getTransferAmount() { + return transferAmount; + } + public void setTransferAmount(String transferAmount) { + this.transferAmount = transferAmount; + } + public String getApplicationName() { + return applicationName; + } + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + + public String getPosId() { + return this.posId; + } + + public String getBackOrder() + { + return backOrder; + } + + public void setBackOrder(String backOrder) + { + this.backOrder = backOrder; + } + + public String getDesignAttributeValueId() + { + return designAttributeValueId; + } + + public void setDesignAttributeValueId(String designAttributeValueId) + { + this.designAttributeValueId = designAttributeValueId; + } + + public String getFieldName() + { + return fieldName; + } + + public void setFieldName(String fieldName) + { + this.fieldName = fieldName; + } + + public String getKeyword() + { + return keyword; + } + + public void setKeyword(String keyword) + { + this.keyword = keyword; + } + + public String getSearchText() + { + return searchText; + } + + public void setSearchText(String searchText) + { + this.searchText = searchText; + } + + public String getShoppingCartItemId() + { + return shoppingCartItemId; + } + + public void setShoppingCartItemId(String shoppingCartItemId) + { + this.shoppingCartItemId = shoppingCartItemId; + } + + public String getSizeAttributeValueId() + { + return sizeAttributeValueId; + } + + public void setSizeAttributeValueId(String sizeAttributeValueId) + { + this.sizeAttributeValueId = sizeAttributeValueId; + } + + public String getIsNotWebstoreFeatured() + { + return isNotWebstoreFeatured; + } + + public void setIsNotWebstoreFeatured(String isNotWebstoreFeatured) + { + this.isNotWebstoreFeatured = isNotWebstoreFeatured; + } + + public String getIsWebstoreFeatured() + { + return isWebstoreFeatured; + } + + public void setIsWebstoreFeatured(String isWebstoreFeatured) + { + this.isWebstoreFeatured = isWebstoreFeatured; + } + + public String getImageName() + { + return imageName; + } + + public void setImageName(String imageName) + { + this.imageName = imageName; + } + + public ProductImageBean getProductsIndexed() + { + return productsIndexed; + } + + public ProductImageBean getProductsIndexed(int index) + { + while (index >= productsList.size()) + productsList.add(new ProductImageBean()); + return (ProductImageBean) productsList.get(index); + } + + public void setProductsIndexed(ProductImageBean productsIndexed) + { + this.productsIndexed = productsIndexed; + } + + public void setProductsIndexed(int index, ProductImageBean value) + { + productsList.add(index, value); + } + public void setPosId(String posId) { + this.posId = posId; + } + + public String getBarCode() { + return barCode; + } + public void setBarCode(String barCode) { + this.barCode = barCode; + } + public String getPurchasePriceStandard() { + return purchasePriceStandard; + } + public void setPurchasePriceStandard(String purchasePriceStandard) { + this.purchasePriceStandard = purchasePriceStandard; + } + + + public String getPurchasePriceLimit() { + return purchasePriceLimit; + } + public void setPurchasePriceLimit(String purchasePriceLimit) { + this.purchasePriceLimit = purchasePriceLimit; + } + public String getPurchasePriceList() { + return purchasePriceList; + } + public void setPurchasePriceList(String purchasePriceList) { + this.purchasePriceList = purchasePriceList; + } + public String getSalesPriceLimit() { + return salesPriceLimit; + } + public void setSalesPriceLimit(String salesPriceLimit) { + this.salesPriceLimit = salesPriceLimit; + } + public String getSalesPriceList() { + return salesPriceList; + } + public void setSalesPriceList(String salesPriceList) { + this.salesPriceList = salesPriceList; + } + public String getSalesPriceStandard() { + return salesPriceStandard; + } + public void setSalesPriceStandard(String salesPriceStandard) { + this.salesPriceStandard = salesPriceStandard; + } + public String getNoOfProductsRequired() { + return noOfProductsRequired; + } + public void setNoOfProductsRequired(String noOfProductsRequired) { + this.noOfProductsRequired = noOfProductsRequired; + } + public String getReportType() { + return reportType; + } + public void setReportType(String reportType) { + this.reportType = reportType; + } + + public String getUserSurname() { + return userSurname; + } + public void setUserSurname(String userSurname) { + this.userSurname = userSurname; + } + public String getCountryId() { + return countryId; + } + public void setCountryId(String countryId) { + this.countryId = countryId; + } + public String getCountryName() { + return countryName; + } + public void setCountryName(String countryName) { + this.countryName = countryName; + } + + public ArrayList getProductsList() + { + return productsList; + } + + public void setProductsList(ArrayList productsList) + { + this.productsList = productsList; + } + + public String getNewName() + { + return newName; + } + + public void setNewName(String newName) + { + this.newName = newName; + } + public String getPaymentByCard() { + return paymentByCard; + } + public void setPaymentByCard(String paymentByCard) { + this.paymentByCard = paymentByCard; + } + public String getPaymentByCash() { + return paymentByCash; + } + public void setPaymentByCash(String paymentByCash) { + this.paymentByCash = paymentByCash; + } + public String getPaymentByChq() { + return paymentByChq; + } + public void setPaymentByChq(String paymentByChq) { + this.paymentByChq = paymentByChq; + } + public String getIsSales() { + return isSales; + } + public void setIsSales(String isSales) { + this.isSales = isSales; + } + public String getProductClassification() { + return productClassification; + } + + public void setProductClassification(String productClassification) { + this.productClassification = productClassification; + } + + + public String getTrackingNo() { + return trackingNo; + } + + + public void setTrackingNo(String trackingNo) { + this.trackingNo = trackingNo; + } + + public String[] getSizes() + { + return sizes; + } + public void setSizes(String[] sizes) + { + this.sizes = sizes; + } + + public String getRevenueRecognition() + { + return revenueRecognition; + } + public void setRevenueRecognition(String revenueRecognition) + { + this.revenueRecognition = revenueRecognition; + } + public String getBrandName() + { + return brandName; + } + + public void setBrandName(String brandName) + { + this.brandName = brandName; + } + public String getDesignName() + { + return designName; + } + + public void setDesignName(String designName) { + this.designName = designName; + } + + public String getModelName() { + return modelName; + } + + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getProductCategory() { + return productCategory; + } + + public void setProductCategory(String productCategory) + { + this.productCategory = productCategory; + } + + public String getSizeName() + { + return sizeName; + } + + public String getRevenueRecoId() + { + return revenueRecoId; + } + + + public void setRevenueRecoId(String revenueRecoId) + { + this.revenueRecoId = revenueRecoId; + } + + + public void setSizeName(String sizeName) + { + this.sizeName = sizeName; + } + + + + public String getIsTextileProduct() + { + return isTextileProduct; + } + + + public void setIsTextileProduct(String isTextileProduct) + { + this.isTextileProduct = isTextileProduct; + } + + + public String getQtyFilter() + { + return qtyFilter; + } + + + public void setQtyFilter(String qtyFilter) + { + this.qtyFilter = qtyFilter; + } + public ArrayList getAttributeValueList() { + return attributeValueList; + } + public void setAttributeValueList(ArrayList attributeValueList) { + this.attributeValueList = attributeValueList; + } + public String[] getAttributeValueIds() { + return attributeValueIds; + } + public void setAttributeValueIds(String[] attributeValueIds) { + this.attributeValueIds = attributeValueIds; + } + + + + public String getCvv() + { + return cvv; + } + + public void setCvv(String cvv) + { + this.cvv = cvv; + } + + + + + public String getCreditCardPayment() + { + return creditCardPayment; + } + + + + + public void setCreditCardPayment(String creditCardPayment) + { + this.creditCardPayment = creditCardPayment; + } + + + + + + + + + public String getRequestId() + { + return requestId; + } + + public void setRequestId(String requestId) + { + this.requestId = requestId; + } + + + + + public String getBccAddresses() + { + return bccAddresses; + } + + + + + public void setBccAddresses(String bccAddresses) + { + this.bccAddresses = bccAddresses; + } + + + + + public String getCcAddresses() + { + return ccAddresses; + } + + + + + public void setCcAddresses(String ccAddresses) + { + this.ccAddresses = ccAddresses; + } + + + + + public String getFromAddress() + { + return fromAddress; + } + + + + + public void setFromAddress(String fromAddress) + { + this.fromAddress = fromAddress; + } + + + + + public String getTextMessage() + { + return textMessage; + } + + + + + public void setTextMessage(String textMessage) + { + this.textMessage = textMessage; + } + + + + + public String getToAddresses() + { + return toAddresses; + } + + + + + public void setToAddresses(String toAddresses) + { + this.toAddresses = toAddresses; + } + + + + + public String getShipperId() + { + return shipperId; + } + + + + + public void setShipperId(String shipperId) + { + this.shipperId = shipperId; + } + + + + + public String getAccountName() + { + return accountName; + } + + + + + public void setAccountName(String accountName) + { + this.accountName = accountName; + } + + + + + public String getCreditCardExpMonthName() + { + return creditCardExpMonthName; + } + + + + + public void setCreditCardExpMonthName(String creditCardExpMonthName) + { + this.creditCardExpMonthName = creditCardExpMonthName; + } + + + + + public String getCreditCardNumberEncrypted() + { + return creditCardNumberEncrypted; + } + + + + + public void setCreditCardNumberEncrypted(String creditCardNumberEncrypted) + { + this.creditCardNumberEncrypted = creditCardNumberEncrypted; + } + + + + + public String getPaymentMethod() + { + return paymentMethod; + } + + + + + public void setPaymentMethod(String paymentMethod) + { + this.paymentMethod = paymentMethod; + } + + + public String getToUserId() + { + return toUserId; + } + + + + + public void setToUserId(String toUserId) + { + this.toUserId = toUserId; + } + + + + + public String getPriority() + { + return priority; + } + + public void setPriority(String priority) + { + this.priority = priority; + } + public String getTitle() + { + return title; + } + public void setTitle(String title) + { + this.title = title; + } + public String getChargeId() + { + return chargeId; + } + public void setChargeId(String chargeId) + { + this.chargeId = chargeId; + } + public String getStatusId() + { + return statusId; + } + public void setStatusId(String statusId) + { + this.statusId = statusId; + } + public String getProductType() + { + return productType; + } + public void setProductType(String productType) + { + this.productType = productType; + } + public String getQtyNumberFilter() + { + return qtyNumberFilter; + } + public void setQtyNumberFilter(String qtyNumberFilter) + { + this.qtyNumberFilter = qtyNumberFilter; + } + public String getTaxCategoryId() + { + return taxCategoryId; + } + public void setTaxCategoryId(String taxCategoryId) + { + this.taxCategoryId = taxCategoryId; + } + public String getTaxCategoryName() + { + return taxCategoryName; + } + public void setTaxCategoryName(String taxCategoryName) + { + this.taxCategoryName = taxCategoryName; + } + public String getTotalActualPrice() + { + return totalActualPrice; + } + public void setTotalActualPrice(String totalActualPrice) + { + this.totalActualPrice = totalActualPrice; + } + public String getIfAdd() { + return ifAdd; + } + public void setIfAdd(String ifAdd) { + this.ifAdd = ifAdd; + } + public String getVendorName() { + return vendorName; + } + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + public String getTimePeriod() { + return timePeriod; + } + public void setTimePeriod(String timePeriod) { + this.timePeriod = timePeriod; + } + + public String getChartType() { + return chartType; + } + public void setChartType(String chartType) { + this.chartType = chartType; + } + + public String getTaxRate() { + return taxRate; + } + + + public void setTaxRate(String taxRate) { + this.taxRate = taxRate; + } + + + public String getState() + { + return state; + } + public void setState(String state) + { + this.state = state; + } + + public String getAccountId() { + return accountId; + } + public void setAccountId(String accountId) { + this.accountId = accountId; + } + public String getDateRange() { + return dateRange; + } + public void setDateRange(String dateRange) { + this.dateRange = dateRange; + } + public String getReportName() { + return reportName; + } + public void setReportName(String reportName) { + this.reportName = reportName; + } + + + public String getTransferAllAmount() { + return transferAllAmount; + } + + + public void setTransferAllAmount(String transferAllAmount) { + this.transferAllAmount = transferAllAmount; + } + + + public String getAdjustmentAmount() { + return adjustmentAmount; + } + + + public void setAdjustmentAmount(String adjustmentAmount) { + this.adjustmentAmount = adjustmentAmount; + } + + + public String getDifferenceAmt() { + return differenceAmt; + } + + + public void setDifferenceAmt(String differenceAmt) { + this.differenceAmt = differenceAmt; + } + + + public String getCardTotal() { + return cardTotal; + } + + + public void setCardTotal(String cardTotal) { + this.cardTotal = cardTotal; + } + + + public String getCashTotal() { + return cashTotal; + } + + + public void setCashTotal(String cashTotal) { + this.cashTotal = cashTotal; + } + + + public String getChequeTotal() { + return chequeTotal; + } + + + public void setChequeTotal(String chequeTotal) { + this.chequeTotal = chequeTotal; + } + + + public String getTillGrandTotal() { + return tillGrandTotal; + } + + + public void setTillGrandTotal(String tillGrandTotal) { + this.tillGrandTotal = tillGrandTotal; + } + + + public String getCreatingFromOrder() { + return creatingFromOrder; + } + + + public void setCreatingFromOrder(String creatingFromOrder) { + this.creatingFromOrder = creatingFromOrder; + } + + + public String getTransferType() { + return transferType; + } + + + public void setTransferType(String transferType) { + this.transferType = transferType; + } +public String getCustomSize() { + return customSize; + } + + + public void setCustomSize(String customSize) { + this.customSize = customSize; + } + + + public String getPriceQtyFilter() { + return priceQtyFilter; + } + + public String getDeliveryViaRule() + { + return deliveryViaRule; + } + + + public void setPriceQtyFilter(String priceQtyFilter) { + this.priceQtyFilter = priceQtyFilter; + } + + public void setDeliveryViaRule(String deliveryViaRule) + { + this.deliveryViaRule = deliveryViaRule; + } + + + public String getCashId() + { + return cashId; + } + + + public void setCashId(String cashId) + { + this.cashId = cashId; + } + + + public String getCashLineId() + { + return cashLineId; + } + + + public void setCashLineId(String cashLineId) + { + this.cashLineId = cashLineId; + } + public String getUserPIN() { + return userPIN; + } + + + public void setUserPIN(String userPIN) { + this.userPIN = userPIN; + } + + public String getPaymentRule() { + return paymentRule; + } + + + public void setPaymentRule(String paymentRule) { + this.paymentRule = paymentRule; + } + + public String getIsSelfService() + { + return isSelfService; + } + + + public void setIsSelfService(String isSelfService) + { + this.isSelfService = isSelfService; + } + + + public String getCardDifference() { + return cardDifference; + } + + + public void setCardDifference(String cardDifference) { + this.cardDifference = cardDifference; + } + + + public String getChequeDifference() { + return chequeDifference; + } + + + public void setChequeDifference(String chequeDifference) { + this.chequeDifference = chequeDifference; + } + + + + public String getDocumentNote() + { + return documentNote; + } + + + public void setDocumentNote(String documentNote) + { + this.documentNote = documentNote; + } + + + public String getCurrencySymbole() { + return currencySymbole; + } + + + public void setCurrencySymbole(String currencySymbole) { + this.currencySymbole = currencySymbole; + } + +public String getUserDiscount() { + return userDiscount; + } + + + public void setUserDiscount(String userDiscount) { + this.userDiscount = userDiscount; + } + + + public String getOpenAmt() { + return openAmt; + } + + + public void setOpenAmt(String openAmt) { + this.openAmt = openAmt; + } + + + public String getOverUnderPayment() { + return overUnderPayment; + } + + + public void setOverUnderPayment(String overUnderPayment) { + this.overUnderPayment = overUnderPayment; + } + + + public String getPaidAmt() { + return paidAmt; + } + + + public void setPaidAmt(String paidAmt) { + this.paidAmt = paidAmt; + } + + + public String getPaymentAmt() { + return paymentAmt; + } + + + public void setPaymentAmt(String paymentAmt) { + this.paymentAmt = paymentAmt; + } + + + public String getWriteOffAmt() { + return writeOffAmt; + } + + + public void setWriteOffAmt(String writeOffAmt) { + this.writeOffAmt = writeOffAmt; + } + + + + public String getCurrencyId() { + return currencyId; + } + + + public void setCurrencyId(String currencyId) { + this.currencyId = currencyId; + } + + + public String getDaysDue() { + return daysDue; + } + + + public void setDaysDue(String daysDue) { + this.daysDue = daysDue; + } + + + public String getDiscountAmt() { + return discountAmt; + } + + + public void setDiscountAmt(String discountAmt) { + this.discountAmt = discountAmt; + } + + + public String getDiscountDate() { + return discountDate; + } + + + public void setDiscountDate(String discountDate) { + this.discountDate = discountDate; + } + + + public String getDue0() { + return due0; + } + + + public void setDue0(String due0) { + this.due0 = due0; + } + + + public String getDue0_30() { + return due0_30; + } + + + public void setDue0_30(String due0_30) { + this.due0_30 = due0_30; + } + + + public String getDue1_7() { + return due1_7; + } + + + public void setDue1_7(String due1_7) { + this.due1_7 = due1_7; + } + + + public String getDue31_60() { + return due31_60; + } + + + public void setDue31_60(String due31_60) { + this.due31_60 = due31_60; + } + + + public String getDue61_90() { + return due61_90; + } + + + public void setDue61_90(String due61_90) { + this.due61_90 = due61_90; + } + + + public String getDue8_30() { + return due8_30; + } + + + public void setDue8_30(String due8_30) { + this.due8_30 = due8_30; + } + + + public String getDue91_PLUS() { + return due91_PLUS; + } + + + public void setDue91_PLUS(String due91_PLUS) { + this.due91_PLUS = due91_PLUS; + } + + + public String getDueAmt() { + return dueAmt; + } + + + public void setDueAmt(String dueAmt) { + this.dueAmt = dueAmt; + } + + + public String getDueDate() { + return dueDate; + } + + + public void setDueDate(String dueDate) { + this.dueDate = dueDate; + } + + + public String getInvoicedAmt() { + return invoicedAmt; + } + + + public void setInvoicedAmt(String invoicedAmt) { + this.invoicedAmt = invoicedAmt; + } + + + public String getInvoiceDate() { + return invoiceDate; + } + + + public void setInvoiceDate(String invoiceDate) { + this.invoiceDate = invoiceDate; + } + + + public String getInvoiceGrandTotal() { + return invoiceGrandTotal; + } + + + public void setInvoiceGrandTotal(String invoiceGrandTotal) { + this.invoiceGrandTotal = invoiceGrandTotal; + } + + + public String getInvoiceScheduleId() { + return invoiceScheduleId; + } + + + public void setInvoiceScheduleId(String invoiceScheduleId) { + this.invoiceScheduleId = invoiceScheduleId; + } + + + public String getNetDays() { + return netDays; + } + + + public void setNetDays(String netDays) { + this.netDays = netDays; + } + + + public String getPastDue1_30() { + return pastDue1_30; + } + + + public void setPastDue1_30(String pastDue1_30) { + this.pastDue1_30 = pastDue1_30; + } + + + public String getPastDue1_7() { + return pastDue1_7; + } + + + public void setPastDue1_7(String pastDue1_7) { + this.pastDue1_7 = pastDue1_7; + } + + + public String getPastDue31_60() { + return pastDue31_60; + } + + + public void setPastDue31_60(String pastDue31_60) { + this.pastDue31_60 = pastDue31_60; + } + + + public String getPastDue61_90() { + return pastDue61_90; + } + + + public void setPastDue61_90(String pastDue61_90) { + this.pastDue61_90 = pastDue61_90; + } + + + public String getPastDue8_30() { + return pastDue8_30; + } + + + public void setPastDue8_30(String pastDue8_30) { + this.pastDue8_30 = pastDue8_30; + } + + + public String getPastDue91_plus() { + return pastDue91_plus; + } + + + public void setPastDue91_plus(String pastDue91_plus) { + this.pastDue91_plus = pastDue91_plus; + } + + + public String getPastDueAmt() { + return pastDueAmt; + } + + + public void setPastDueAmt(String pastDueAmt) { + this.pastDueAmt = pastDueAmt; + } + + + public String getPaymentTermId() { + return paymentTermId; + } + + + public void setPaymentTermId(String paymentTermId) { + this.paymentTermId = paymentTermId; + } + + + public FormFile getImage() + { + return image; + } + + + public void setImage(FormFile image) + { + this.image = image; + } + + + public String getBlackListedId() + { + return blackListedId; + } + + + public void setBlackListedId(String blackListedId) + { + this.blackListedId = blackListedId; + } + + + public String getBlackListedBankName() + { + return blackListedBankName; + } + + + public void setBlackListedBankName(String blackListedBankName) + { + this.blackListedBankName = blackListedBankName; + } + + + public String getBlackListedChequeNo() + { + return blackListedChequeNo; + } + + + public void setBlackListedChequeNo(String blackListedChequeNo) + { + this.blackListedChequeNo = blackListedChequeNo; + } + + public String getInvoiceNo() + { + + return invoiceNo; + } + public void setInvoiceNo(String invoiceNo) + { + this.invoiceNo = invoiceNo; + } + + + + + + + public Integer[] getBpartnerIds() { + return bpartnerIds; + } + + + public void setBpartnerIds(Integer[] bpartnerIds) { + this.bpartnerIds = bpartnerIds; + } + + + public String getPaymentTermName() { + return paymentTermName; + } + + + public void setPaymentTermName(String paymentTermName) { + this.paymentTermName = paymentTermName; + } + + + public String getBP_Group_ID() { + return BP_Group_ID; + } + + + public void setBP_Group_ID(String group_ID) { + BP_Group_ID = group_ID; + } + + + public String getDunningLevelId() { + return dunningLevelId; + } + + + public void setDunningLevelId(String dunningLevelId) { + this.dunningLevelId = dunningLevelId; + } + + + public String getDunningLevelName() { + return dunningLevelName; + } + + + public void setDunningLevelName(String dunningLevelName) { + this.dunningLevelName = dunningLevelName; + } + + + public String getDunningPrintNote() { + return dunningPrintNote; + } + + + public void setDunningPrintNote(String dunningPrintNote) { + this.dunningPrintNote = dunningPrintNote; + } + + + public String getDunningPrintText() { + return dunningPrintText; + } + + + public void setDunningPrintText(String dunningPrintText) { + this.dunningPrintText = dunningPrintText; + } + + + + + public String getDunningId() { + return dunningId; + } + + + public void setDunningId(String dunningId) { + this.dunningId = dunningId; + } + + + public String getDunningName() { + return dunningName; + } + + + public void setDunningName(String dunningName) { + this.dunningName = dunningName; + } + + + public String getCreditLimit() { + return creditLimit; + } + + + public void setCreditLimit(String creditLimit) { + this.creditLimit = creditLimit; + } + + + public String getCreditStatus() { + return creditStatus; + } + + + public void setCreditStatus(String creditStatus) { + this.creditStatus = creditStatus; + } + + + public String getCreditUsed() { + return creditUsed; + } + + + public void setCreditUsed(String creditUsed) { + this.creditUsed = creditUsed; + } + + + public String getDocBasisType() { + return docBasisType; + } + + + public void setDocBasisType(String docBasisType) { + this.docBasisType = docBasisType; + } + + + public String getAmtMultiplier() { + return amtMultiplier; + } + + + public void setAmtMultiplier(String amtMultiplier) { + this.amtMultiplier = amtMultiplier; + } + + + public String getFrequencyType() { + return frequencyType; + } + + + public void setFrequencyType(String frequencyType) { + this.frequencyType = frequencyType; + } + + + public String getCommissionAmtId() { + return commissionAmtId; + } + + + public void setCommissionAmtId(String commissionAmtId) { + this.commissionAmtId = commissionAmtId; + } + + + public String getSubtractAmt() { + return subtractAmt; + } + + + public void setSubtractAmt(String subtractAmt) { + this.subtractAmt = subtractAmt; + } + + + public String getForward() { + return forward; + } + + + public void setForward(String forward) { + this.forward = forward; + } + + + public String getIsTaxExempted() { + return isTaxExempted; + } + + + public void setIsTaxExempted(String isTaxExempted) { + this.isTaxExempted = isTaxExempted; + } + + + public String getTaxId() { + return taxId; + } + + + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + + public String getTaxName() { + return taxName; + } + + + public void setTaxName(String taxName) { + this.taxName = taxName; + } + + + public Integer[] getInvoiceIds() { + return invoiceIds; + } + + + public void setInvoiceIds(Integer[] invoiceIds) { + this.invoiceIds = invoiceIds; + } + + + public String getInventoryId() { + return inventoryId; + } + + + public void setInventoryId(String inventoryId) { + this.inventoryId = inventoryId; + } + + + public String getInventoryLineId() { + return inventoryLineId; + } + + + public void setInventoryLineId(String inventoryLineId) { + this.inventoryLineId = inventoryLineId; + } + + + public String getQtyBook() { + return qtyBook; + } + + + public void setQtyBook(String qtyBook) { + this.qtyBook = qtyBook; + } + + + public String getQtyCount() { + return qtyCount; + } + + + public void setQtyCount(String qtyCount) { + this.qtyCount = qtyCount; + } + + + public String getAfterDelivery() { + return afterDelivery; + } + + + public void setAfterDelivery(String afterDelivery) { + this.afterDelivery = afterDelivery; + } + + + public String getFiedMonthCutoff() { + return fiedMonthCutoff; + } + + + public void setFiedMonthCutoff(String fiedMonthCutoff) { + this.fiedMonthCutoff = fiedMonthCutoff; + } + + + public String getFixedDueDate() { + return fixedDueDate; + } + + + public void setFixedDueDate(String fixedDueDate) { + this.fixedDueDate = fixedDueDate; + } + + + public String getFixedMonthDay() { + return fixedMonthDay; + } + + + public void setFixedMonthDay(String fixedMonthDay) { + this.fixedMonthDay = fixedMonthDay; + } + + + public String getFixedMonthOffset() { + return fixedMonthOffset; + } + + + public void setFixedMonthOffset(String fixedMonthOffset) { + this.fixedMonthOffset = fixedMonthOffset; + } + + + public String getNextBusinessday() { + return nextBusinessday; + } + + + public void setNextBusinessday(String nextBusinessday) { + this.nextBusinessday = nextBusinessday; + } + + + public String getPhone() { + return phone; + } + + + public void setPhone(String phone) { + this.phone = phone; + } + + + public String getPhone2() { + return phone2; + } + + + public void setPhone2(String phone2) { + this.phone2 = phone2; + } + + public String getToBeShipped() { + return toBeShipped; + } + + + public void setToBeShipped(String toBeShipped) { + this.toBeShipped = toBeShipped; + } + + + public String getDiscountAmt1() { + return discountAmt1; + } + + + public void setDiscountAmt1(String discountAmt1) { + this.discountAmt1 = discountAmt1; + } + + + public String getDiscountAmt2() { + return discountAmt2; + } + + + public void setDiscountAmt2(String discountAmt2) { + this.discountAmt2 = discountAmt2; + } + + + public String getDiscountDay1() { + return discountDay1; + } + + + public void setDiscountDay1(String discountDay1) { + this.discountDay1 = discountDay1; + } + + + public String getDiscountDay2() { + return discountDay2; + } + + + public void setDiscountDay2(String discountDay2) { + this.discountDay2 = discountDay2; + } + + + + + + + + public PaymentBean getPaymentBeanIndex() { + return paymentBeanIndex; + } + + + public void setPaymentBeanIndex(PaymentBean paymentBeanIndex) { + this.paymentBeanIndex = paymentBeanIndex; + } + + + public String getAllocatedAmount() { + return allocatedAmount; + } + + + public void setAllocatedAmount(String allocatedAmount) { + this.allocatedAmount = allocatedAmount; + } + + + public String getGroup1() { + return group1; + } + + + public void setGroup1(String group1) { + this.group1 = group1; + } + + + public String getGroup2() { + return group2; + } + + + public void setGroup2(String group2) { + this.group2 = group2; + } + + + + public String getIsFullAccess() { + return isFullAccess; + } + + + public void setIsFullAccess(String isFullAccess) { + this.isFullAccess = isFullAccess; + } + + + public Integer[] getInventoryIds() + { + return inventoryIds; + } + + + public void setInventoryIds(Integer[] inventoryIds) + { + this.inventoryIds = inventoryIds; + } + + + public String[] getAllocateAmount() { + return allocateAmount; + } + + + public void setAllocateAmount(String[] allocateAmount) { + this.allocateAmount = allocateAmount; + } + + + public String getBirthdate() { + return birthdate; + } + + + public void setBirthdate(String birthdate) { + this.birthdate = birthdate; + } + + + public String getDay() { + return day; + } + + + public void setDay(String day) { + this.day = day; + } + + + public String getOpenDrawer() { + return openDrawer; + } + + + public void setOpenDrawer(String openDrawer) { + this.openDrawer = openDrawer; + } + + + public String getStoreId() { + return storeId; + } + + + public void setStoreId(String storeId) { + this.storeId = storeId; + } + + + public String getUomId() { + return uomId; + } + + + public void setUomId(String uomId) { + this.uomId = uomId; + } + + + public String getIsOverwritePriceLimit() { + return isOverwritePriceLimit; + } + + + public void setIsOverwritePriceLimit(String isOverwritePriceLimit) { + this.isOverwritePriceLimit = isOverwritePriceLimit; + } + + + public String getIsChecked() { + return isChecked; + } + + + public void setIsChecked(String isChecked) { + this.isChecked = isChecked; + } + + //============================================================= + + + public void setOrderLineIndexed(int index, OrderLineBean value) + { + orderLineList.add(index, value); + } + + public void setOrderLineIndexed(OrderLineBean orderLineIndexed) + { + this.orderLineIndexed = orderLineIndexed; + } + + public void setOrderLineList(ArrayList orderLineList) + { + this.orderLineList = orderLineList; + } + + public OrderLineBean getOrderLineIndexed() + { + return orderLineIndexed; + } + + public OrderLineBean getOrderLineIndexed(int index) + { + while (index >= orderLineList.size()) + orderLineList.add(new OrderLineBean()); + return (OrderLineBean) orderLineList.get(index); + } + + public ArrayList getOrderLineList() + { + return orderLineList; + } + + //============================================================= + + protected RoleBean roleOrgAccessIndexed; + protected ArrayList roleOrgAccessList = new ArrayList(); + + + + + + public RoleBean getRoleOrgAccessIndexed() + { + return roleOrgAccessIndexed; + } + + public void setRoleOrgAccessIndexed(int index, RoleBean roleOrgAccessIndexed) + { + this.roleOrgAccessList.add(index, roleOrgAccessIndexed); + } + + public void setRoleOrgAccessIndexed(RoleBean roleOrgAccessIndexed) + { + this.roleOrgAccessIndexed = roleOrgAccessIndexed; + } + + + public ArrayList getRoleOrgAccessList() + { + return roleOrgAccessList; + } + + + public void setRoleOrgAccessList(ArrayList roleOrgAccessList) + { + this.roleOrgAccessList = roleOrgAccessList; + } + + public RoleBean getRoleOrgAccessIndexed(int index) + { + while (index >= roleOrgAccessList.size()) + roleOrgAccessList.add(new RoleBean()); + return (RoleBean) roleOrgAccessList.get(index); + } + + public String getFullDetails() + { + return fullDetails; + } + + public void setFullDetails(String fullDetails) + { + this.fullDetails = fullDetails; + } + + public String getOrgFromId() + { + return orgFromId; + } + + public void setOrgFromId(String orgFromId) + { + this.orgFromId = orgFromId; + } + + public String getOrgToId() + { + return orgToId; + } + + public void setOrgToId(String orgToId) + { + this.orgToId = orgToId; + } + + public String getQtyOnHand() + { + return qtyOnHand; + } + + public void setQtyOnHand(String qtyOnHand) + { + this.qtyOnHand = qtyOnHand; + } + + public String getQtyToMove() + { + return qtyToMove; + } + + public void setQtyToMove(String qtyToMove) + { + this.qtyToMove = qtyToMove; + } + + public String getUom() + { + return uom; + } + + public void setUom(String uom) + { + this.uom = uom; + } + + + public String getUnitPrice() + { + return unitPrice; + } + + + public void setUnitPrice(String unitPrice) + { + this.unitPrice = unitPrice; + } + + + public StockMovementBean getStock() + { + return stock; + } + + public void setStock(StockMovementBean stockBean) + { + this.stock = stockBean; + } + + public void setStock(int index,StockMovementBean stockBean) + { + this.stockList.add(index, stockBean); + } + + public StockMovementBean getStock(int index) + { + while (index >= stockList.size()) + { + stockList.add(new StockMovementBean()); + } + return (StockMovementBean) stockList.get(index); + } + + public ArrayList getStockList() + { + return stockList; + } + + public void setStockList(ArrayList stockList) + { + this.stockList = stockList; + } + + public String getGrossProfit() + { + return grossProfit; + } + + public void setGrossProfit(String grossProfit) + { + this.grossProfit = grossProfit; + } + + public String getRefNo() + { + return refNo; + } + + public void setRefNo(String refNo) + { + this.refNo = refNo; + } + + public String getMovementId() + { + return movementId; + } + + public void setMovementId(String movementId) + { + this.movementId = movementId; + } + + + public String getIndex() + { + return index; + } + + + public void setIndex(String index) + { + this.index = index; + } + + + public String getOrgFromName() + { + return orgFromName; + } + + + public void setOrgFromName(String orgFromName) + { + this.orgFromName = orgFromName; + } + + + public String getOrgToName() + { + return orgToName; + } + + + public void setOrgToName(String orgToName) + { + this.orgToName = orgToName; + } + + public String getMoveConfirmId() + { + return moveConfirmId; + } + + public void setMoveConfirmId(String moveConfirmId) + { + this.moveConfirmId = moveConfirmId; + } + + public String getLineNo() + { + return lineNo; + } + + public void setLineNo(String lineNo) + { + this.lineNo = lineNo; + } + + public String getMovementLineId() { + return movementLineId; + } + + public void setMovementLineId(String movementLineId) { + this.movementLineId = movementLineId; + } + + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public String getIndustry() { + return industry; + } + + public void setIndustry(String industry) { + this.industry = industry; + } + + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + + public String getIsSOPriceList() { + return isSOPriceList; + } + + public void setIsSOPriceList(String isSOPriceList) { + this.isSOPriceList = isSOPriceList; + } + + public String getIsMandatory() { + return isMandatory; + } + + public void setIsMandatory(String isMandatory) { + this.isMandatory = isMandatory; + } + + public String getIsPresentForProduct() { + return isPresentForProduct; + } + + public void setIsPresentForProduct(String isPresentForProduct) { + this.isPresentForProduct = isPresentForProduct; + } + + public String getPriceListId() { + return priceListId; + } + + public void setPriceListId(String priceListId) { + this.priceListId = priceListId; + } + + public String getLimitPrice() { + return limitPrice; + } + + public void setLimitPrice(String limitPrice) { + this.limitPrice = limitPrice; + } + + public String getStdPrice() { + return stdPrice; + } + + public void setStdPrice(String stdPrice) { + this.stdPrice = stdPrice; + } + + public String getListPrice() { + return listPrice; + } + + public void setListPrice(String listPrice) { + this.listPrice = listPrice; + } + + public PriceListBean getPriceListBean() { + return priceListBean; + } + + public void setPriceListBean(PriceListBean priceListBean) { + this.priceListBean = priceListBean; + } + + public ArrayList getPriceListBeanList() { + return priceListBeanList; + } + + public void setPriceListBeanList(ArrayList priceListBeanList) { + this.priceListBeanList = priceListBeanList; + } + + public void setPriceListBean(int index, PriceListBean bean) + { + this.priceListBeanList.add(index, bean); + } + + public PriceListBean getPriceListBean(int index) + { + while (index >= priceListBeanList.size()) + { + priceListBeanList.add(new PriceListBean()); + } + return (PriceListBean) priceListBeanList.get(index); + + } + + public ProductBean getProductBean() { + return productBean; + } + + public void setProductBean(ProductBean productBean) { + this.productBean = productBean; + } + + public ArrayList getProductBeanList() { + return productBeanList; + } + + public void setProductBeanList(ArrayList productBeanList) { + this.productBeanList = productBeanList; + } + public void setProductBean(int index, ProductBean bean) + { + this.productBeanList.add(index, bean); + } + + public ProductBean getProductBean(int index) + { + while (index >= productBeanList.size()) + { + productBeanList.add(new ProductBean()); + } + return (ProductBean) productBeanList.get(index); + + } + + public String getListPriceIncl() { + return listPriceIncl; + } + + public void setListPriceIncl(String listPriceIncl) { + this.listPriceIncl = listPriceIncl; + } + + public String getStdPriceIncl() { + return stdPriceIncl; + } + + public void setStdPriceIncl(String stdPriceIncl) { + this.stdPriceIncl = stdPriceIncl; + } + + public String getLimitPriceIncl() { + return limitPriceIncl; + } + + public void setLimitPriceIncl(String limitPriceIncl) { + this.limitPriceIncl = limitPriceIncl; + + } + + public String getSalesPriceListId() { + return salesPriceListId; + } + + public void setSalesPriceListId(String salesPriceListId) { + this.salesPriceListId = salesPriceListId; + } + + public String getPurchasePriceListId() { + return purchasePriceListId; + } + + public void setPurchasePriceListId(String purchasePriceListId) { + this.purchasePriceListId = purchasePriceListId; + } + + public void setRoundOffFactor(String roundOffFactor) { + this.roundOffFactor = roundOffFactor; + } + + public String getRoundOffFactor() { + return roundOffFactor; + } + + public String getBasePriceListId() { + return basePriceListId; + } + + public void setBasePriceListId(String basePriceListId) { + this.basePriceListId = basePriceListId; + } + + public String getIsDeleteOldRecords() { + return isDeleteOldRecords; + } + + public void setIsDeleteOldRecords(String isDeleteOldRecords) { + this.isDeleteOldRecords = isDeleteOldRecords; + } + + public String getSubTotal() { + return subTotal; + } + + public void setSubTotal(String subTotal) { + this.subTotal = subTotal; + } + + public String getIsDiscountAllowed() { + return isDiscountAllowed; + } + + public void setIsDiscountAllowed(String isDiscountAllowed) { + this.isDiscountAllowed = isDiscountAllowed; + } + + public String getIsAllowedOverridePriceLimit() { + return isAllowedOverridePriceLimit; + } + + public void setIsAllowedOverridePriceLimit(String isAllowedOverridePriceLimit) { + this.isAllowedOverridePriceLimit = isAllowedOverridePriceLimit; + } + + public String getPriceListName() { + return priceListName; + } + + public void setPriceListName(String priceListName) { + this.priceListName = priceListName; + } + + public String getIsCreatePriceList() { + return isCreatePriceList; + } + + public void setIsCreatePriceList(String isCreatePriceList) { + this.isCreatePriceList = isCreatePriceList; + } + + public String getInclPrice() { + return inclPrice; + } + + public void setInclPrice(String inclPrice) { + this.inclPrice = inclPrice; + } + + public String getQtyCsv() + { + return qtyCsv; + } + + public void setQtyCsv(String qtyCsv) + { + this.qtyCsv = qtyCsv; + } + + public String getReadOnly() + { + return readOnly; + } + + public void setReadOnly(String readOnly) + { + this.readOnly = readOnly; + } + + public void setReadOnly(boolean readOnly) + { + this.readOnly = Boolean.toString(readOnly); + } + + public String getTerminalId() + { + return terminalId; + } + + public void setTerminalId(String terminalId) + { + this.terminalId = terminalId; + } + + public String getCashbookTransferType() + { + return cashbookTransferType; + } + + public void setCashbookTransferType(String cashbookTransferType) + { + this.cashbookTransferType = cashbookTransferType; + } + + public String getCheckTransferType() + { + return checkTransferType; + } + + public void setCheckTransferType(String checkTransferType) + { + this.checkTransferType = checkTransferType; + } + + public String getCardTransferType() + { + return cardTransferType; + } + + public void setCardTransferType(String cardTransferType) + { + this.cardTransferType = cardTransferType; + } + + public String getCardBankAccountId() + { + return cardBankAccountId; + } + + public void setCardBankAccountId(String cardBankAccountId) + { + this.cardBankAccountId = cardBankAccountId; + } + + public String getCheckBankAccountId() + { + return checkBankAccountId; + } + + public void setCheckBankAccountId(String checkBankAccountId) + { + this.checkBankAccountId = checkBankAccountId; + } + + public String getTemplateBPartnerId() + { + return templateBPartnerId; + } + + public void setTemplateBPartnerId(String templateBPartnerId) + { + this.templateBPartnerId = templateBPartnerId; + } + + public String getCashbookTransferCashbookId() + { + return cashbookTransferCashbookId; + } + + public void setCashbookTransferCashbookId(String cashTransferCashbookId) + { + this.cashbookTransferCashbookId = cashTransferCashbookId; + } + + public String getCashbookTransferBankAccountId() + { + return cashbookTransferBankAccountId; + } + + public void setCashbookTransferBankAccountId(String cashTransferBankAccountId) + { + this.cashbookTransferBankAccountId = cashTransferBankAccountId; + } + + public String getCheckTransferCashbookId() + { + return checkTransferCashbookId; + } + + public void setCheckTransferCashbookId(String checkTransferCashbookId) + { + this.checkTransferCashbookId = checkTransferCashbookId; + } + + public String getCheckTransferBankAccountId() + { + return checkTransferBankAccountId; + } + + public void setCheckTransferBankAccountId(String checkTransferBankAccountId) + { + this.checkTransferBankAccountId = checkTransferBankAccountId; + } + + public String getCardTransferCashbookId() + { + return cardTransferCashbookId; + } + + public void setCardTransferCashbookId(String cardTransferCashbookId) + { + this.cardTransferCashbookId = cardTransferCashbookId; + } + + public String getCardTransferBankAccountId() + { + return cardTransferBankAccountId; + } + + public void setCardTransferBankAccountId(String cardTransferBankAccountId) + { + this.cardTransferBankAccountId = cardTransferBankAccountId; + } + + public String getAutoLock() + { + return autoLock; + } + + public void setAutoLock(String autoLock) + { + this.autoLock = autoLock; + } + + public String getLocked() + { + return locked; + } + + public void setLocked(String locked) + { + this.locked = locked; + } + + public static long getSerialVersionUID() + { + return serialVersionUID; + } + + /** + * @return the lockingTime + */ + public String getLockingTime() + { + return lockingTime; + } + + /** + * @param lockingTime the lockingTime to set + */ + public void setLockingTime(String lockingTime) + { + this.lockingTime = lockingTime; + } + + public String getIsDiscountOnPercentage() + { + return isDiscountOnPercentage; + } + + public void setIsDiscountOnPercentage(String isDiscountOnPercentage) + { + this.isDiscountOnPercentage = isDiscountOnPercentage; + } + + public String getIsDiscountOnTotal() + { + return isDiscountOnTotal; + } + + public void setIsDiscountOnTotal(String isDiscountOnTotal) + { + this.isDiscountOnTotal = isDiscountOnTotal; + } + + public String getDiscountedLinePrice() { + return discountedLinePrice; + } + + public void setDiscountedLinePrice(String discountedLinePrice) { + this.discountedLinePrice = discountedLinePrice; + } + + public String getIsOverridePinOk() { + return isOverridePinOk; + } + + public void setIsOverridePinOk(String isOverridePinOk) { + this.isOverridePinOk = isOverridePinOk; + } + + public String getIsTaxIncluded() { + return isTaxIncluded; + } + + public void setIsTaxIncluded(String isTaxIncluded) { + this.isTaxIncluded = isTaxIncluded; + } + + public String getIsDiscountOnInclUnitPrice() { + return isDiscountOnInclUnitPrice; + } + + public void setIsDiscountOnInclUnitPrice(String isDiscountOnInclUnitPrice) { + this.isDiscountOnInclUnitPrice = isDiscountOnInclUnitPrice; + } + + public String getDiscountedInclUnitPrice() { + return discountedInclUnitPrice; + } + + public void setDiscountedInclUnitPrice(String discountedInclUnitPrice) { + this.discountedInclUnitPrice = discountedInclUnitPrice; + } + + public String getUnitPurchasePrice() + { + return unitPurchasePrice; + } + + public void setUnitPurchasePrice(String unitPurchasePrice) + { + this.unitPurchasePrice = unitPurchasePrice; + } + + public String getTotalGrossProfit() + { + return totalGrossProfit; + } + + public void setTotalGrossProfit(String totalGrossProfit) + { + this.totalGrossProfit = totalGrossProfit; + } + + public String getGrossProfitPercentage() + { + return grossProfitPercentage; + } + + public void setGrossProfitPercentage(String grossProfitPercentage) + { + this.grossProfitPercentage = grossProfitPercentage; + } + + public String getTotalGrossProfitPercentage() + { + return totalGrossProfitPercentage; + } + + public void setTotalGrossProfitPercentage(String totalGrossProfitPercentage) + { + this.totalGrossProfitPercentage = totalGrossProfitPercentage; + } + + public String getIsAllowToView() + { + return isAllowToView; + } + + public void setIsAllowToView(String isAllowToView) + { + this.isAllowToView = isAllowToView; + } + + public String getIsAllowToEdit() + { + return isAllowToEdit; + } + + public void setIsAllowToEdit(String isAllowToEdit) + { + this.isAllowToEdit = isAllowToEdit; + } + + public String getIsAllowToCreate() + { + return isAllowToCreate; + } + + public void setIsAllowToCreate(String isAllowToCreate) + { + this.isAllowToCreate = isAllowToCreate; + } + + public String getIsAllowToDelete() + { + return isAllowToDelete; + } + + public void setIsAllowToDelete(String isAllowToDelete) + { + this.isAllowToDelete = isAllowToDelete; + } + + public String getWebMenuId() + { + return webMenuId; + } + + public void setWebMenuId(String webMenuId) + { + this.webMenuId = webMenuId; + } + + public String getIsSalesReport() + { + return isSalesReport; + } + + public void setIsSalesReport(String isSalesReport) + { + this.isSalesReport = isSalesReport; + } + + public String getIsDiscountUptoLimitPrice() + { + return isDiscountUptoLimitPrice; + } + + public void setIsDiscountUptoLimitPrice(String isDiscountUptoLimitPrice) + { + this.isDiscountUptoLimitPrice = isDiscountUptoLimitPrice; + } + + public String getIsDiscountAllowedOnTotal() + { + return isDiscountAllowedOnTotal; + } + + public void setIsDiscountAllowedOnTotal(String isDiscountAllowedOnTotal) + { + this.isDiscountAllowedOnTotal = isDiscountAllowedOnTotal; + } + + public String getReceiptFooterMsg() + { + return receiptFooterMsg; + } + + public void setReceiptFooterMsg(String receiptFooterMsg) + { + this.receiptFooterMsg = receiptFooterMsg; + } + public String getStockValue() + { + return stockValue; + } + + public void setStockValue(String stockValue) + { + this.stockValue = stockValue; + } + + public String getBranch() + { + return branch; + } + + public void setBranch(String branch) + { + this.branch = branch; + } + + public String getSalesRepName() + { + return saleRepName; + } + + public void setSalesRepName(String salesRepName) + { + this.saleRepName = salesRepName; + } + + public String getNoOfPack() + { + return noOfPack; + } + + public void setNoOfPack(String noOfPack) + { + this.noOfPack = noOfPack; + } + + public String getReference() + { + return reference; + } + + public void setReference(String reference) + { + this.reference = reference; + } + + public Integer getUnitsPerPack() + { + return unitsPerPack; + } + + public void setUnitsPerPack(Integer unitsPerPack) + { + this.unitsPerPack = unitsPerPack; + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/struts/customer/CustomerAction.java b/posterita/posterita/src/main/org/posterita/struts/customer/CustomerAction.java new file mode 100644 index 0000000000..044e7f1ed3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/customer/CustomerAction.java @@ -0,0 +1,816 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 02-Sep-2005 + */ + + +package org.posterita.struts.customer; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MBPartner; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.CustomerBean; +import org.posterita.beans.PriceListBean; +import org.posterita.businesslogic.CustomerCart; +import org.posterita.businesslogic.PaymentTermManager; +import org.posterita.businesslogic.administration.BarcodeManager; +import org.posterita.businesslogic.administration.CustomerManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.EmailValidator; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BPartnerNotFoundException; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.NoCustomerFoundException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.SurnameNotPresentException; +import org.posterita.exceptions.SystemException; +import org.posterita.form.CustomerForm; +import org.posterita.form.InitCustomerForm; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + +public class CustomerAction extends BaseDispatchAction +{ + public static final String CREATE_CUSTOMER = "createCustomer"; + public static final String RETURN_TO_ORDER = "returnToOrder"; + + public ActionForward createCustomer(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + CustomerBean bean = (CustomerBean)request.getSession().getAttribute(Constants.CUSTOMER_DETAILS); + + String email = bean.getEmail(); + + if( email != null ) + { + boolean isValid = EmailValidator.isValidEmail(email); + if( !isValid ) + { + postGlobalError("errors.invalid","email", request); + return mapping.getInputForward(); + } + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + trx.start(); + try + { + MBPartner partner = CustomerManager.saveCustomer(ctx,bean.getBpartnerId() ,bean, trx.getTrxName()); + Integer customerId = Integer.valueOf(partner.get_ID()); + request.getSession().setAttribute(Constants.CUSTOMER_ID, customerId); + trx.commit(); + } + catch (SurnameNotPresentException e) + { + trx.rollback(); + postGlobalError("error.required.Surname", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + if(bean.getCreatingFromOrder()) + return new ActionForward("RETURN_TO_ORDER"); + else + return mapping.findForward(CREATE_CUSTOMER); + } + + public static final String CREATE_POS_ORDER = "createPOSOrder"; + public static final String CREATE_CREDIT_ORDER = "initCreateCreditOrder"; + public static final String CREATE_POS_ORDER2 = "createPOSOrder2"; + public static final String CREATE_POS_ORDER3 = "createPOSOrder3"; + public static final String CREATE_POS_ORDER_WA = "createPOSOrderWA"; + public static final String SAVE_POS_CUSTOMER = "savePOSCustomer"; + public static final String CREATE_PAYMENT = "createPayment"; + public ActionForward savePOSCustomer(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm)form; + String creatingForOrder=(String)request.getSession().getAttribute(Constants.CREATING_FROM_ORDER); + CustomerBean bean = (CustomerBean)df.getBean(); + bean.setRegionId(Integer.valueOf(1000001));//FIXME why do we need regionId? Is it compulsory? + + String email = bean.getEmail(); + + if( email != null ) + { + boolean isValid = EmailValidator.isValidEmail(email); + if( !isValid ) + { + postGlobalError("errors.invalid","email", request); + return mapping.getInputForward(); + } + } + if(bean.getBpartnerId()==null) + { + bean.setBpartnerId(0); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + trx.start(); + try + { + MBPartner partner = CustomerManager.saveCustomer(ctx, bean.getBpartnerId(), bean, trx.getTrxName()); + + request.getSession().setAttribute(Constants.CUSTOMER_ID, partner.get_ID()); + trx.commit(); + } + catch (SurnameNotPresentException e) + { + trx.rollback(); + postGlobalError("error.required.Surname", request); + return mapping.getInputForward(); + } + catch (NoAccessToEditObjectException e) + { + trx.rollback(); + postGlobalError("error.no.edit.access", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + if (creatingForOrder == null) + return mapping.findForward(SAVE_POS_CUSTOMER); + + if (creatingForOrder.equals(Constants.POS_ORDER)) + return mapping.findForward(CREATE_POS_ORDER); + else + if (creatingForOrder.equals(Constants.CREDIT_ORDER)) + return mapping.findForward(CREATE_CREDIT_ORDER); + else + if (creatingForOrder.equals(Constants.CREATE_PAYMENT)) + return mapping.findForward(CREATE_PAYMENT); + else + if (creatingForOrder.equals(Constants.POS_ORDER_CUSTOMER_COMPULSORY)) + return mapping.findForward(CREATE_POS_ORDER2); + else + if (creatingForOrder.equals(Constants.QUICK_POS_ORDER)) + return mapping.findForward(CREATE_POS_ORDER3); + else + if (creatingForOrder.equals(Constants.POS_ORDER_WITHOUT_ADVANCED)) + return mapping.findForward(CREATE_POS_ORDER_WA); + + return mapping.findForward(SAVE_POS_CUSTOMER); + } + + public static final String GET_EXISTING_CUSTOMERS = "getExistingCustomers"; + public ActionForward getExistingCustomers(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, SQLException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList customers = CustomerManager.getAllCustomers(ctx,false); + + request.getSession().setAttribute(Constants.ALL_CUSTOMERS, customers); + + return mapping.findForward(GET_EXISTING_CUSTOMERS); + } + + + public static final String GET_EXISTING_POS_CUSTOMERS = "getExistingPOSCustomers"; + public ActionForward getExistingPOSCustomers(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, SQLException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + + Properties ctx=TmkJSPEnv.getCtx(request); + + ArrayList customers = CustomerManager.getAllCustomers(ctx,true); + + request.getSession().setAttribute(Constants.ALL_CUSTOMERS, customers); + + return mapping.findForward(GET_EXISTING_POS_CUSTOMERS); + } + + + public static final String GET_CUSTOMER_DETAILS = "getCustomerDetails"; + public ActionForward getCustomerDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + Integer partnerId = Integer.valueOf(df.getBpartnerId()); + + CustomerBean customerBean = CustomerManager.getCustomerDetails(ctx, partnerId.intValue()); + + request.getSession().setAttribute(Constants.CUSTOMER_DETAILS, customerBean); + + return mapping.findForward(GET_CUSTOMER_DETAILS); + } + + + public static final String INIT_CREATE_POS_CUSTOMER_ACTION = "initCreatePOSCustomer"; + public ActionForward initCreatePOSCustomer(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, SystemException + { + ActionForward fwd = init(mapping,form,request,response); + + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + InitCustomerForm cf = (InitCustomerForm) form; + + CustomerBean bean = (CustomerBean) cf.getBean(); + bean.setBpartnerId(0); + String creatingFromOrder= cf.getCreatingFromOrder(); + cf.populate(bean); + + + ArrayList list = PaymentTermManager.getAllActivePaymentTerm(ctx); + request.getSession().setAttribute (Constants.PAYMENT_TERM,list); + + request.getSession().setAttribute(Constants.CREATING_FROM_ORDER, creatingFromOrder); + + return mapping.findForward(INIT_CREATE_POS_CUSTOMER_ACTION); + } + + public static final String GET_ALL_CUSTOMER = "getAllPOSCustomer"; + public ActionForward getAllPOSCustomer(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList customerList = CustomerManager.searchPOSCustomer(ctx, "", "", "","", ""); + + //ArrayList customerList = CustomerManager.getAllPosCustomer(ctx); + + request.getSession().setAttribute(Constants.ALL_CUSTOMERS,customerList); + + return mapping.findForward(GET_ALL_CUSTOMER); + } + + + public static final String INIT_EDIT_POS_CUSTOMER = "initEditPOSCustomer"; + public ActionForward initEditPOSCustomer(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + CustomerForm f = (CustomerForm) form; + f.validate(mapping,request); + + CustomerBean bean = (CustomerBean) f.getBean(); + Integer bpartnerId = bean.getBpartnerId(); + if(bpartnerId==null) + { + throw new OperationException("Cannot edit customer. Cause customer id cannot be null!"); + } + + + bean = CustomerManager.getCustomerDetails(ctx,bpartnerId); + f.populate(bean); + ArrayList list = PaymentTermManager.getAllActivePaymentTerm(ctx); + ArrayList activePriceLists = PriceListManager.getPriceLists(ctx,0,"",true,null,null,true,null); + ArrayList priceListsKNP = PriceListManager.getKeyNamePair(ctx, activePriceLists); + + request.getSession().setAttribute(Constants.USER_PRICE_LISTS, priceListsKNP); + request.getSession().setAttribute (Constants.PAYMENT_TERM,list); + + return mapping.findForward(INIT_EDIT_POS_CUSTOMER); + } + + + public static final String VIEW_POS_CUSTOMER = "viewPOSCustomer"; + public ActionForward viewPOSCustomer(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException,Exception + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + CustomerForm f = (CustomerForm) form; + f.validate(mapping,request); + + CustomerBean bean = (CustomerBean) f.getBean(); + Integer bpartnerId = bean.getBpartnerId(); + if(bpartnerId==null) + { + throw new OperationException("Cannot load customer details. Cause customer id cannot be null!"); + } + + bean = CustomerManager.getCustomerDetails(ctx,bpartnerId); + request.getSession().setAttribute(Constants.CUSTOMER_DETAILS,bean); + + return mapping.findForward(VIEW_POS_CUSTOMER); + } + + public static final String ACTIVATE_POS_CUSTOMER = "activatePOSCustomer"; + @SuppressWarnings("unchecked") + public ActionForward activatePOSCustomer(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + CustomerForm f = (CustomerForm) form; + f.validate(mapping,request); + + CustomerBean bean = (CustomerBean) f.getBean(); + Integer bpartnerId = bean.getBpartnerId(); + if(bpartnerId==null) + { + throw new OperationException("Cannot activate customer. Cause customer id cannot be null!"); + } + + //since customer is a business partner we call the BPartnerManager's activate method + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + + try + { + trx.start(); + CustomerManager.activateCustomer(ctx,bpartnerId.intValue(), trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.activate.customer", request); + mapping.getInputForward(); + } + finally + { + trx.rollback(); + } + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.ALL_CUSTOMERS); + //ArrayList customerBeanList = list; + + ArrayList newList = CustomerManager.updateCustomerListStatus(list, bpartnerId, true); + + request.getSession().setAttribute(Constants.ALL_CUSTOMERS, newList); + + + return mapping.findForward(ACTIVATE_POS_CUSTOMER); + } + + public static final String DEACTIVATE_POS_CUSTOMER = "deactivatePOSCustomer"; + @SuppressWarnings("unchecked") + public ActionForward deactivatePOSCustomer(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + CustomerForm f = (CustomerForm) form; + f.validate(mapping,request); + + CustomerBean bean = (CustomerBean) f.getBean(); + Integer bpartnerId = bean.getBpartnerId(); + if(bpartnerId==null) + { + throw new OperationException("Cannot deactivate customer. Cause customer id cannot be null!"); + } + + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + //since customer is a business partner we call the BPartnerManager's deactivate method + try + { + trx.start(); + CustomerManager.deactivateCustomer(ctx,bpartnerId.intValue(), trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.deactivate.customer", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.ALL_CUSTOMERS); + //ArrayList customerBeanList = list; + + ArrayList newList = CustomerManager.updateCustomerListStatus(list, bpartnerId, false); + + request.getSession().setAttribute(Constants.ALL_CUSTOMERS, newList); + + return mapping.findForward(DEACTIVATE_POS_CUSTOMER); + } + + public static final String GENERATE_CARD ="generateFidelityCard"; + public ActionForward generateFidelityCard(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException, Exception + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList customerList =null; + CustomerCart cart = (CustomerCart) request.getSession().getAttribute(Constants.CUSTOMER_CART); + + if(cart != null) + { + customerList = cart.getCustomers(); + + } + else + { + customerList = new ArrayList(); + } + + String reportName = null; + try + { + reportName = CustomerManager.fidelityCard(ctx,customerList); + } + catch (NoCustomerFoundException e) + { + postGlobalError("error.print.fidelity.card",request); + return new ActionForward("/ViewAllCartCustomers.do"); + } + + String uri = ReportManager.getReportURI(reportName,request); + + response.sendRedirect(uri); + //ReportManager.writeReport(reportName, response); + + + return null; + } + + public static final String INIT_SEARCH_POS_CUSTOMER = "initSearchPOSCustomer"; + public ActionForward initSearchPOSCustomer(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + + return mapping.findForward(INIT_SEARCH_POS_CUSTOMER); + } + + + public static final String SEARCH_POS_CUSTOMER = "searchPOSCustomer"; + public ActionForward searchPOSCustomer(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm)form; + + String customerName = df.getPartnerName(); + + ArrayList customerList = CustomerManager.searchPOSCustomer(ctx, customerName, df.getDay(), df.getMonth(),df.getYear(), df.getIsActive()); + + request.getSession().setAttribute(Constants.ALL_CUSTOMERS,customerList); + + return mapping.findForward(SEARCH_POS_CUSTOMER); + } + + public static final String ADD_ALL_CUSTOMERS = "addAllCustomers"; + public ActionForward addAllCustomers(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + CustomerCart cart = (CustomerCart)request.getSession().getAttribute(Constants.CUSTOMER_CART); + + ArrayList customerList = (ArrayList) request.getSession().getAttribute(Constants.ALL_CUSTOMERS); + + if(customerList==null) + { + return mapping.findForward(SEARCH_POS_CUSTOMER); + } + + if(cart == null) + { + cart = new CustomerCart(ctx); + } + + for(CustomerBean bean : customerList) + { + Integer customerId = bean.getBpartnerId(); + if(customerId == null) continue; + + if(! cart.hasCustomer(customerId.intValue())) + { + cart.addCustomer(customerId.intValue()); + } + + } + + request.getSession().setAttribute(Constants.CUSTOMER_CART, cart); + return mapping.findForward(SEARCH_POS_CUSTOMER); + } + +// used for create pos order to get customer name from id + public ActionForward getNameByID(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, Exception + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + CustomerForm f = (CustomerForm) form; + + String errormsg = ""; + String bpartner = f.getBpartnerId(); + + + + if(bpartner == null||bpartner.length()==0) + { + errormsg = "alert('Invalid Customer ID. ID cannot be empty');"; + return sendData(errormsg,response); + } + + Integer bpartnerId = null; + try + { + bpartnerId = Integer.valueOf(bpartner); + } + catch (NumberFormatException e2) + { + errormsg = "alert('Please enter numeric value for Customer ID!');defaultCustomer();"; + return sendData(errormsg,response); + } + + String customerName = ""; + + try + { + CustomerBean bean = CustomerManager.getCustomerDetails(ctx,bpartnerId); + + String firstname = (bean.getPartnerName() == null) ? "" : bean.getPartnerName(); + String lastname = (bean.getSurname() == null) ? "" : bean.getSurname(); + + customerName = firstname + " " + lastname; + customerName = customerName.trim(); + + String data = "setCustomerName('"+ customerName +"');"; + + return sendData(data,response); + } + catch (BPartnerNotFoundException e1) + { + errormsg = "alert('Could not find customer! Please try again with proper Customer ID');defaultCustomer();"; + return sendData(errormsg,response); + } + + } + + private ActionForward sendData(String data,HttpServletResponse response) throws OperationException + { + try + { + response.setContentType("text/plain"); + PrintWriter out = response.getWriter(); + out.print(data); + + out.flush(); + out.close(); + } + catch (IOException e) + { + throw new OperationException(e); + } + return null; + } + + public static final String ADD_TO_CART = "addToCart"; + public ActionForward addToCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + //CustomerBean bean = (CustomerBean) df.getBean(); + + int customerId = Integer.parseInt(df.getBpartnerId()); + + CustomerCart cart = (CustomerCart) request.getSession().getAttribute(Constants.CUSTOMER_CART); + + if( cart == null ) + { + cart = new CustomerCart( ctx ); + } + + if ( ! cart.hasCustomer (customerId ) ) + { + cart.addCustomer( customerId ); + } + + request.getSession().setAttribute(Constants.CUSTOMER_CART, cart); + + String script = "setCartCounter("+ cart.getNoOfCustomers() +");customerAdded("+ customerId +")"; + + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public ActionForward clearCart (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + HttpSession session = request.getSession(); + session.removeAttribute(Constants.CUSTOMER_CART); + + request.getSession().getAttribute(Constants.CUSTOMER_CART); + + String script = "clearAll();"; + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public static final String VIEW_CART = "viewCart"; + public ActionForward viewCart (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException, Exception + { + HttpSession session = request.getSession(); + CustomerCart cart = (CustomerCart) session.getAttribute(Constants.CUSTOMER_CART); + + ArrayList customerList =null; + + if(cart != null) + { + customerList = cart.getCustomers(); + + } + else + { + customerList = new ArrayList(); + } + + session.setAttribute(Constants.ALL_CART_CUSTOMERS, customerList); + + return mapping.findForward(VIEW_CART); + } + + public static final String REMOVE = "remove"; + public ActionForward remove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException, Exception + { + DefaultForm df = (DefaultForm) form; + + int customerId = Integer.parseInt(df.getBpartnerId()); + CustomerCart cart = (CustomerCart) request.getSession().getAttribute(Constants.CUSTOMER_CART); + + if( cart != null ) + { + cart.removeCustomer(customerId); + ArrayList customerList = cart.getCustomers(); + request.getSession().setAttribute(Constants.CUSTOMER_CART, cart); + request.getSession().setAttribute(Constants.ALL_CART_CUSTOMERS, customerList); + } + + return mapping.findForward(VIEW_CART); + } + + public static final String REMOVE_FROM_CART = "removeFromCart"; + public ActionForward removeFromCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + //CustomerBean bean = (CustomerBean) df.getBean(); + + int customerId = Integer.parseInt(df.getBpartnerId()); + + CustomerCart cart = (CustomerCart) request.getSession().getAttribute(Constants.CUSTOMER_CART); + + if( cart == null ) + { + cart = new CustomerCart( ctx ); + } + + if ( cart.hasCustomer (customerId ) ) + { + cart.removeCustomer( customerId ); + } + + request.getSession().setAttribute(Constants.CUSTOMER_CART, cart); + + String script = "setCartCounter("+ cart.getNoOfCustomers() +");customerRemoved("+ customerId +")"; + + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public static final String GENERATE_CUSTOMER_BARCODE ="generateCustomerBarcode"; + public ActionForward generateCustomerBarcode(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException, Exception + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList customerList =null; + CustomerCart cart = (CustomerCart) request.getSession().getAttribute(Constants.CUSTOMER_CART); + + if(cart != null) + { + customerList = cart.getCustomers(); + + } + else + { + customerList = new ArrayList(); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + byte printData[] = null; + + String barcodeData = BarcodeManager.printCustomerBarcode(ctx, cart, trx.getTrxName()); + + response.setContentType("application/octet-stream"); + printData = barcodeData.getBytes(); + + OutputStream os = response.getOutputStream(); + os.write(printData); + os.flush(); + os.close(); + + return mapping.findForward("/POSCustomerAction.do?action=viewCart"); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/customer/SalesAction.java b/posterita/posterita/src/main/org/posterita/struts/customer/SalesAction.java new file mode 100644 index 0000000000..c942249930 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/customer/SalesAction.java @@ -0,0 +1,94 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 16, 2005 by praveen + * + */ +package org.posterita.struts.customer; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.core.TmkJSPEnv; + +import org.posterita.Constants; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.SystemException; +import org.posterita.keyname.SalesRepKeyNamePair; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class SalesAction extends BaseDispatchAction +{ + public static final String INIT_SALES = "initSales"; + public ActionForward initSales(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, SystemException + { + ActionForward fwd = init(mapping,form,request,response); + + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + //CustomerBean bean = new CustomerBean(); + //get sales reps + ArrayList salesRep = SalesRepKeyNamePair.getKeyNamePairs(ctx); + request.getSession().setAttribute(Constants.SALES_REP,salesRep); + + return mapping.findForward(INIT_SALES); + } + + public static String INIT_SALES_FOR_EXISTING_CUSTOMER = "initSalesForExistingCustomer"; + public ActionForward initSalesForExistingCustomer(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, SystemException + { + ActionForward fwd = init(mapping,form,request,response); + + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + Integer customerId = Integer.valueOf(df.getBpartnerId()); + + request.getSession().setAttribute(Constants.CUSTOMER_ID, customerId); + + ArrayList salesRep = SalesRepKeyNamePair.getKeyNamePairs(ctx); + + Boolean canTradeIn = Boolean.valueOf(true); + request.getSession().setAttribute(Constants.SALES_REP,salesRep); + request.getSession().setAttribute(Constants.CAN_TRADE_IN, canTradeIn); + + return mapping.findForward(INIT_SALES); + } + + public static final String CREATE_TRADE_IN_ORDER = "createTradeInOrder"; + public static final String CREATE_NATIS_ORDER = "createNatisOrder"; + + + public static final String PURCHASE_TRADE_IN_VEHICLE_AND_CREATE_CUSTOMER_ORDER = "purchaseTradeInVehicleAndCreateCustomerOrder"; + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/inOut/ViewMinOutAction.java b/posterita/posterita/src/main/org/posterita/struts/inOut/ViewMinOutAction.java new file mode 100644 index 0000000000..de64bc0fea --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/inOut/ViewMinOutAction.java @@ -0,0 +1,107 @@ +/* +* +* Copyright (c) 2005 UDI Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +*/ +package org.posterita.struts.inOut; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.config.ActionConfig; +import org.apache.struts.config.ForwardConfig; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MInOut; +import org.posterita.core.TmkJSPEnv; + +import org.posterita.Constants; +import org.posterita.beans.DocumentBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.MinOutManager; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.BaseAction; +import org.posterita.struts.core.DefaultForm; + + +public class ViewMinOutAction extends BaseAction +{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + + MessageResources resources = (MessageResources) request.getAttribute(Globals.MESSAGES_KEY); + + String operationException = resources.getMessage("error.operationException"); + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + DocumentBean bean = (DocumentBean) df.getBean(); + Integer minoutId = bean.getDocumentId(); + + // retrieve from cache + WebDocumentBean webBean = null; + + MInOut inout = null; + if (minoutId!= null) + { + inout = new MInOut(ctx, minoutId.intValue(), null); + webBean = MinOutManager.getWebMinOutBean(ctx, inout); + request.getSession().setAttribute(Constants.WEB_MINOUT_BEAN, webBean); + + } + + //int orgID = Env.getAD_Org_ID(ctx); + + if (webBean == null) + webBean = (WebDocumentBean) request.getSession().getAttribute(Constants.WEB_MINOUT_BEAN); + + if (webBean == null) + throw new OperationException(operationException); + + request.getSession().setAttribute(Constants.ME_LOCATION, webBean.getMeLocation()); + request.getSession().setAttribute(Constants.YOU_LOCATION, webBean.getYouLocation()); + request.getSession().setAttribute(Constants.YOU_BP_LOCATION, webBean.getYoubpLocation()); + request.getSession().setAttribute(Constants.ME, webBean.getMe()); + request.getSession().setAttribute(Constants.YOU,webBean.getYou()); + request.getSession().setAttribute(Constants.MINOUT_LINES_COLLECTION, webBean.getLines()); + request.getSession().setAttribute(Constants.MINOUT, webBean.getMinOut()); + request.getSession().setAttribute(Constants.MINVOICE, webBean.getInvoice()); + request.getSession().setAttribute(Constants.SIMPLE_COMMAND,webBean.getSimpleCommand()); + request.getSession().setAttribute(Constants.COMPLEX_COMMAND,webBean.getComplexCommand()); + request.getSession().setAttribute(Constants.WEB_DOCUMENT_HEADER_BEAN, webBean.getHeaderBean()); + + ForwardConfig forwardConfig = getForward(ctx,webBean,mapping,form); + + ActionForward forward = new ActionForward(forwardConfig.getPath()); + + return forward; + } + + private ForwardConfig getForward(Properties ctx, WebDocumentBean webBean, ActionMapping mapping, ActionForm form) + { + + ActionConfig config = mapping.getModuleConfig().findActionConfig("/ViewMinOutAction"); + + return config.findForwardConfig(Constants.VIEW_MINOUT); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/invoice/ViewInvoiceAction.java b/posterita/posterita/src/main/org/posterita/struts/invoice/ViewInvoiceAction.java new file mode 100644 index 0000000000..de257d269e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/invoice/ViewInvoiceAction.java @@ -0,0 +1,190 @@ +/* +* +* Copyright (c) 2007 - 2008 Posterita Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* UDI Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with UDI. +* +* UDI MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UDI SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +*/ +package org.posterita.struts.invoice; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.config.ActionConfig; +import org.apache.struts.config.ForwardConfig; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MDocType; +import org.compiere.model.MInvoice; +import org.compiere.model.MOrder; +import org.compiere.process.DocumentEngine; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.DocumentBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.InvoiceManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.order.UDIOrderTypes; +import org.posterita.struts.core.BaseAction; +import org.posterita.struts.core.DefaultForm; + + +public class ViewInvoiceAction extends BaseAction +{ + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + MessageResources resources = (MessageResources) request.getAttribute(Globals.MESSAGES_KEY); + + //String securityException = resources.getMessage("error.securityException"); + String operationException = resources.getMessage("error.operationException"); + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + DocumentBean bean = (DocumentBean) df.getBean(); + Integer invoiceId = bean.getDocumentId(); + + // retrieve from cache + WebDocumentBean webBean = null; + + MInvoice invoice = null; + if (invoiceId!= null && (invoiceId.intValue()!=0)) + { + invoice = new MInvoice(ctx, invoiceId.intValue(), null); + webBean = InvoiceManager.getWebInvoiceBean(invoice); + request.getSession().setAttribute(Constants.WEB_INVOICE_BEAN, webBean); + } + + //int orgID = Env.getAD_Org_ID(ctx); + + if (webBean == null) + webBean = (WebDocumentBean) request.getSession().getAttribute(Constants.WEB_INVOICE_BEAN); + + if (webBean == null) + throw new OperationException(operationException); + + request.getSession().setAttribute(Constants.ME_LOCATION, webBean.getMeLocation()); + request.getSession().setAttribute(Constants.YOU_LOCATION, webBean.getYouLocation()); + request.getSession().setAttribute(Constants.YOU_BP_LOCATION, webBean.getYoubpLocation()); + request.getSession().setAttribute(Constants.ME, webBean.getMe()); + request.getSession().setAttribute(Constants.YOU,webBean.getYou()); + request.getSession().setAttribute(Constants.MINVOICE, webBean.getInvoice()); + request.getSession().setAttribute(Constants.MORDER, webBean.getOrder()); + request.getSession().setAttribute(Constants.MINVOICE_LINES_COLLECTION,webBean.getLines()); + request.getSession().setAttribute(Constants.SIMPLE_COMMAND,webBean.getSimpleCommand()); + request.getSession().setAttribute(Constants.COMPLEX_COMMAND,webBean.getComplexCommand()); + request.getSession().setAttribute(Constants.WEB_DOCUMENT_HEADER_BEAN, webBean.getHeaderBean()); + request.getSession().setAttribute(Constants.INVOICE_TAX,webBean.getTotalTax()); + request.getSession().setAttribute(Constants.TOTAL_LINES,webBean.getTotalLines()); + request.getSession().setAttribute(Constants.GRAND_TOTAL,webBean.getGrandTotal()); + request.setAttribute(Constants.CURRENCY_SYMBOLE,webBean.getCurrencySymbole()); + + + ForwardConfig forwardConfig = getForward(ctx,webBean,mapping,form); + + ActionForward forward = new ActionForward(forwardConfig.getPath()); + + return forward; + } + + private ForwardConfig getForward(Properties ctx, WebDocumentBean webBean, ActionMapping mapping, ActionForm form) throws OperationException + { + ActionConfig config = mapping.getModuleConfig().findActionConfig("/ViewInvoiceAction"); + + MInvoice invoice = webBean.getInvoice(); + + //vendor invoice -- isSoTrx is false + //customer invoice -- isSoTrx true + + if (webBean.getOrder().getOrderType().equals(UDIOrderTypes.WEBSTORE_ORDER.getOrderType())) + { + //Webstore CI--customer invoice + if (invoice.isSOTrx()) + return getWebstoreCI_Forward(webBean,config); + } + else + { + //VI--vendor invoice + if (!invoice.isSOTrx()) + return getVI_Forward(webBean,config); + + //CI--customer invoice + if (invoice.isSOTrx()) + return getCI_Forward(webBean,config); + } + + // DEFAULT + return config.findForwardConfig(Constants.FINISHED_DO); + + } + + public ForwardConfig getVI_Forward(WebDocumentBean invoiceBean, ActionConfig config) throws OperationException + { + return config.findForwardConfig(Constants.WEBSTORE_INVOICE); + } + + public ForwardConfig getWebstoreCI_Forward(WebDocumentBean invoiceBean, ActionConfig config) throws OperationException + { + MInvoice invoice = invoiceBean.getInvoice(); + + String status = invoice.getDocStatus(); + + if(status.equals(DocumentEngine.STATUS_Completed)) + { + return config.findForwardConfig(Constants.WEBSTORE_INVOICE); + } + + return config.findForwardConfig(Constants.WEBSTORE_INVOICE); + } + + public ForwardConfig getCI_Forward(WebDocumentBean invoiceBean, ActionConfig config) throws OperationException + { + MInvoice invoice = invoiceBean.getInvoice(); + + MOrder order = new MOrder(invoice.getCtx(), invoice.getC_Order_ID(), null); + + + int[] docTypes = MDocType.getAllIDs(MDocType.Table_Name, " ad_client_id="+ Env.getAD_Client_ID(invoice.getCtx()) + " and DOCSUBTYPESO='" + MDocType.DOCSUBTYPESO_POSOrder+ "'", null ); + + + //POS order + if (order.getC_DocType_ID() == docTypes[0]) + return config.findForwardConfig(Constants.PAID_INVOICE); + + String status = invoice.getDocStatus(); + + if (!invoice.isActive()) + return config.findForwardConfig(Constants.CANCEL_INVOICE); + + if(status.equals(DocumentEngine.STATUS_Completed)) + { + return config.findForwardConfig(Constants.WEBSTORE_INVOICE); + } + return config.findForwardConfig(Constants.UNPAID_INVOICE); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/login/ChangePasswordAction.java b/posterita/posterita/src/main/org/posterita/struts/login/ChangePasswordAction.java new file mode 100644 index 0000000000..6f2f5bb636 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/login/ChangePasswordAction.java @@ -0,0 +1,78 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 29, 2005 by din + */ + +package org.posterita.struts.login; + + + +import java.util.Properties; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.core.TmkJSPEnv; + +import org.posterita.Constants; +import org.posterita.beans.ChangePasswordBean; +import org.posterita.businesslogic.LoginManager; +import org.posterita.exceptions.WrongPasswordException; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.user.WebUserInfo; + + + + public class ChangePasswordAction extends BaseDispatchAction + { + + public ActionForward change(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + ChangePasswordBean bean = (ChangePasswordBean) df.getBean(); + Properties ctx = TmkJSPEnv.getCtx(request); + + WebUserInfo userInfo = (WebUserInfo) request.getSession().getAttribute(WebUserInfo.NAME); + + try + { + LoginManager.changePassword(ctx, bean, userInfo); + } + + catch(WrongPasswordException e) + { + postGlobalError("admin.wrongPasswordError",request); + return (new ActionForward(mapping.getInput())); + + } + + + return mapping.findForward(Constants.CHANGE); + + } + + } + + diff --git a/posterita/posterita/src/main/org/posterita/struts/login/GoToHomePageAction.java b/posterita/posterita/src/main/org/posterita/struts/login/GoToHomePageAction.java new file mode 100644 index 0000000000..cfd3097ab0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/login/GoToHomePageAction.java @@ -0,0 +1,111 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 26, 2005 by praveen + * + */ +package org.posterita.struts.login; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MStore; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.ApplicationParametersBean; +import org.posterita.businesslogic.StoreManager; +import org.posterita.businesslogic.core.ApplicationManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.lib.UdiConstants; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class GoToHomePageAction extends BaseDispatchAction +{ + public static String GO_TO_HOMEPAGE = "goToHomePage"; + public ActionForward goToHomePage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + try + { + Properties ctx = Env.getCtx(); + MStore store = StoreManager.getDefaultStore(ctx); + ApplicationManager.setApplicationParametersInContext(ctx, store.get_ID()); + request.getSession().setAttribute(Constants.APP_NAME, store.getName()); + ctx = TmkJSPEnv.getCtx(request); + String forward = Env.getContext(ctx, UdiConstants.DEFAULT_FORWARD); + + return mapping.findForward(forward); + } + catch(Exception ex) + { + postGlobalError("error.store.default", ex.getMessage(), request); + return mapping.findForward(CHOOSE_APPLICATION); + } + } + + public static final String CHOOSE_APPLICATION = "chooseApplication"; + public ActionForward setApplicationParameters(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + DefaultForm df = (DefaultForm) form; + ApplicationParametersBean bean = (ApplicationParametersBean) df.getBean(); + + Integer storeId = bean.getStoreId(); + + // Store not defined, should go to default store or choose from different stores + if (storeId == null) + { + return goToHomePage(mapping, form, request, response); + } + + Properties ctx = TmkJSPEnv.getCtx(request); // Get default context from system + + MStore store = new MStore(ctx, storeId, null); + + if (store.get_ID() == 0) + { + //TODO: Add error message showing no store error to user + mapping.findForward(CHOOSE_APPLICATION); + } + + request.getSession().setAttribute(Constants.APP_NAME, store.getName()); + ApplicationManager.setApplicationParametersInContext(ctx, storeId); + + ctx = TmkJSPEnv.getCtx(request); + + return mapping.findForward(UdiConstants.DEFAULT_FORWARD); + } + + public static final String INIT_CHOOSE_APPLICATION = "initChooseApplication"; + public ActionForward initChooseApplication(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ArrayList appList = ApplicationManager.getAvailableApplications(); + servlet.getServletContext().setAttribute(Constants.WEB_APPLICATIONS, appList); + + return mapping.findForward(INIT_CHOOSE_APPLICATION); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/login/LoginAction.java b/posterita/posterita/src/main/org/posterita/struts/login/LoginAction.java new file mode 100644 index 0000000000..d5d67ea0c7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/login/LoginAction.java @@ -0,0 +1,472 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ +package org.posterita.struts.login; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MSession; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.WebUser; +import org.posterita.Constants; +import org.posterita.beans.ChangePasswordBean; +import org.posterita.beans.LoginBean; +import org.posterita.beans.TerminalBean; +import org.posterita.beans.UserBean; +import org.posterita.businesslogic.LoginManager; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.businesslogic.core.ApplicationManager; +import org.posterita.core.Configuration; +import org.posterita.core.MenuItem; +import org.posterita.core.SessionStorage; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.EmailNotFoundException; +import org.posterita.exceptions.InvalidPasswordLengthException; +import org.posterita.exceptions.InvalidRoleException; +import org.posterita.exceptions.NotLoggedInException; +import org.posterita.exceptions.UserInactiveException; +import org.posterita.exceptions.UserNotFoundException; +import org.posterita.exceptions.WrongPasswordException; +import org.posterita.lib.UdiConstants; +import org.posterita.model.MWebMenu; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.user.WebUserInfo; + +public class LoginAction extends BaseDispatchAction +{ + + LoginManager bd = new LoginManager(); + Properties ctx = null; + + public static final String LOGIN_USER = "loginUser"; + public ActionForward loginUser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd !=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + LoginBean bean = (LoginBean) df.getBean(); + ctx = TmkJSPEnv.getCtx(request); + + WebUserInfo wuInfo = null; + MenuItem menus = null; + ArrayList topMenusList; + ArrayList leftMenusList; + + try + { + //Checking username and password + + //TODO + wuInfo = bd.loginUser(ctx, bean); + + Configuration config = Configuration.getConfiguration(request); + + ArrayList menuList = MenuManager.getMenus(ctx, request); + + //filter menulist based on configuration + for(MWebMenu menu : menuList) + { + String name = menu.getName(); + + if("smenu.credit.sales".equalsIgnoreCase(name) && !config.isAllowCreditSales()) + { + menuList.remove(menu); + continue; + } + + if("smenu.customer.returned.order".equalsIgnoreCase(name) && !config.isAllowCustomerReturnOrder()) + { + menuList.remove(menu); + continue; + } + } + + + menus = MenuManager.buildMenuTree(ctx, menuList); + topMenusList = menus.getTopMenus(); + leftMenusList = menus.getLeftMenus(); + + //Adding the switch user menu + Object userId = request.getSession().getAttribute(Constants.ADMIN_USER_ID); + + if(userId != null) + { + MWebMenu menu = new MWebMenu(ctx,0,null); + menu.setName("Switch User"); + menu.setMenuLink("LoginUserAction.do?action=loginUser&userId=" + userId); + + //MenuItem menuItem = new MenuItem(menu); + leftMenusList.add(new MenuItem(menu)); + } + + + } + catch(UserNotFoundException unfe) + { + postGlobalError("login.passwordError",request); + return (mapping.getInputForward()); + } + catch(NotLoggedInException e) + { + postGlobalError("login.passwordError",request); + return (mapping.getInputForward()); + } + catch(InvalidRoleException ire) + { + postGlobalError("error.role.invalid", request); + return (mapping.getInputForward()); + } + catch(UserInactiveException unae) + { + postGlobalError("login.userInactive",request); + return (mapping.getInputForward()); + } + + HttpSession session = request.getSession(); + MSession cSession = MSession.get (ctx, request.getRemoteAddr(), request.getRemoteHost(), session.getId()); + + if (cSession != null) + cSession.setWebStoreSession(true); + + //Set breadcrumb to empty + + request.getSession().setAttribute(Constants.BREADCRUMB, null); + + request.getSession().setAttribute(WebUserInfo.NAME, wuInfo); + request.getSession().setAttribute(Constants.MENUS, menus); + request.getSession().setAttribute(Constants.TOP_MENUS, topMenusList); + request.getSession().setAttribute(Constants.LEFT_MENUS, leftMenusList); + SessionStorage.putOrg(ctx, request); + + + return mapping.findForward(LOGIN_USER); + + } + + public static final String LOGOUT = "logout"; + public ActionForward logout(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + HttpSession session = request.getSession(); + Properties ctx = TmkJSPEnv.getCtx(request); + + WebUserInfo wuInfo = (WebUserInfo)session.getAttribute(WebUserInfo.NAME); + + int storeId = Env.getContextAsInt(ctx, UdiConstants.WSTORE_CTX_PARAM); + + if (wuInfo != null) + { + WebUser wu = wuInfo.getUser(); + if (wu != null) + wu.logout(); + + session.removeAttribute(WebUserInfo.NAME); + session.setMaxInactiveInterval(0); + } + + try + { + ApplicationManager.setApplicationParametersInContext(ctx, storeId); + return mapping.findForward(UdiConstants.DEFAULT_FORWARD); + } + catch(Exception ex) + { + postGlobalError("error.store.default", ex.getMessage(), request); + return mapping.findForward(CHOOSE_APPLICATION); + } + } + + public static final String SUCCESS = "success"; + public static final String CHOOSEPOS = "choosePOS"; + public static final String CREATEPOSORDER = "createPOSOrder"; + public ActionForward success(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + DefaultForm df = (DefaultForm) form; + LoginBean bean = (LoginBean) df.getBean(); + + Properties ctx = TmkJSPEnv.getCtx(request); + + HttpSession session = request.getSession(); + WebUserInfo info = null; + WebUser wu; + + try + { + wu = bd.checkLoginPassword(ctx, bean); + + info = bd.login(ctx, wu); + + + + MSession cSession = MSession.get (ctx, request.getRemoteAddr(), request.getRemoteHost(), session.getId()); + + if (cSession != null) + cSession.setWebStoreSession(true); + + session.setAttribute (WebUserInfo.NAME, info); + + SessionStorage.putMenus(ctx, request); + + + } + catch(UserNotFoundException unfe) + { + postGlobalError("login.passwordError",request); + return (mapping.getInputForward()); + } + catch(NotLoggedInException e) + { + postGlobalError("login.passwordError",request); + return (mapping.getInputForward()); + } + catch(InvalidRoleException ire) + { + postGlobalError("error.role.invalid", request); + return (mapping.getInputForward()); + } + catch(UserInactiveException unae) + { + postGlobalError("login.userInactive",request); + return (mapping.getInputForward()); + } + + // Should be removed after backward compatibility achieved + POSTerminalManager.migrateOldPOSTerminal(ctx); + + String strPosId = POSTerminalManager.getTerminalFromCookie(request); + int posId = 0; + boolean isValidPOSId = false; + + if(strPosId != null) + { + try + { + posId = Integer.parseInt(strPosId); + isValidPOSId = POSTerminalManager.isPOSTerminalAccessible(ctx, posId); + } + catch(Exception ex) + {} + } + + if(!isValidPOSId) + { + int adOrgId = Env.getAD_Org_ID(ctx); + ArrayList list = POSTerminalManager.getAllActiveTerminals(ctx, adOrgId, null); + request.getSession().setAttribute(Constants.POSTERMINALS,list); + return mapping.findForward(CHOOSEPOS); + } + else + { + SessionStorage.setPOSTerminal(ctx, posId, request); + String currSymboleSales = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + String currSymbolePurchase=POSTerminalManager.getDefaultPurchaseCurrency(ctx).getCurSymbol(); + request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales); + request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE_PURCHASE,currSymbolePurchase); + return mapping.findForward(CREATEPOSORDER); + } + } + + public ActionForward password(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + DefaultForm df = (DefaultForm) form; + UserBean bean = (UserBean) df.getBean(); + Properties ctx = TmkJSPEnv.getCtx(request); + boolean ok = false; + + MessageResources resources = (MessageResources) request.getAttribute(Globals.MESSAGES_KEY); + + String subject = resources.getMessage("login.password.emailTitle"); + String content = resources.getMessage("login.password.emailSubject"); + + try + { + ok = bd.sendPassword(ctx, bean, subject, content); + } + catch(EmailNotFoundException e) + { + postGlobalError("login.emailNotFound",request); + return (new ActionForward(mapping.getInput())); + } + catch(UserNotFoundException une) + { + postGlobalError("login.userNotFound",request); + return (new ActionForward(mapping.getInput())); + + } + + if(ok == false) + { + postGlobalError("email.send.error",request); + return mapping.getInputForward(); + } + else + { + return mapping.findForward(Constants.PASSWORD); + } + } + + public static final String CHANGE_USER_PASSWORD="changeUserPassword"; + public ActionForward changeUserPassword(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd !=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + ChangePasswordBean bean = (ChangePasswordBean) df.getBean(); + Properties ctx = TmkJSPEnv.getCtx(request); + + WebUserInfo userInfo = (WebUserInfo) request.getSession().getAttribute(WebUserInfo.NAME); + + try + { + LoginManager.changePassword(ctx,bean,userInfo); + } + catch(InvalidPasswordLengthException e2) + { + postGlobalError("error.wrong.password.length", request); + return mapping.getInputForward(); + } + catch(WrongPasswordException e) + { + postGlobalError("admin.wrongPasswordError",request); + return (new ActionForward(mapping.getInput())); + } + + return mapping.findForward(CHANGE_USER_PASSWORD); + } + + + + //----------------------------------Refactoring LoginAction----------------------------------- + + public static final String VALIDATE_USER = "validateUser"; + /** + * We check whether the name & password supplied is valid + * Result: + * If valid we forward to choose role + * else we forward to login page witn appropriate login error + */ + public ActionForward validateUser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + LoginBean bean = (LoginBean) df.getBean(); + + HttpSession session = request.getSession(); + WebUserInfo info = null; + WebUser wu = null; + + // validate user + try + { + wu = bd.checkLoginPassword(ctx, bean); + + info = bd.login(ctx, wu); + + MSession cSession = MSession.get (ctx, request.getRemoteAddr(), request.getRemoteHost(), session.getId()); + + if (cSession != null) + cSession.setWebStoreSession(true); + + session.setAttribute (WebUserInfo.NAME, info); + + ArrayList myRoles = RoleManager.getMyRoles(ctx); + + if(myRoles.size() == 1) + { + KeyNamePair pair = (KeyNamePair) myRoles.get(0); + + Env.setContext(ctx,"#AD_Role_ID", pair.getKey()); + + SessionStorage.putMenus(ctx,request); + SessionStorage.putOrg(ctx, request); + + return mapping.findForward(LOGIN_SUCCESS); + } + + + } + catch(UserNotFoundException unfe) + { + postGlobalError("login.passwordError",request); + return (mapping.getInputForward()); + } + catch(NotLoggedInException e) + { + postGlobalError("login.passwordError",request); + return (mapping.getInputForward()); + } + catch(InvalidRoleException ire) + { + postGlobalError("error.role.invalid", request); + return (mapping.getInputForward()); + } + catch(UserInactiveException unae) + { + postGlobalError("login.userInactive",request); + return (mapping.getInputForward()); + } + + return mapping.findForward(INIT_CHOOSE_ROLE); + } + + + public static final String INIT_CHOOSE_ROLE = "initChooseRole"; + /** + * We get all the roles assign to the user and all orgs + * accessible by the user + */ + + + + + public static final String LOGIN_SUCCESS = "loginSuccess"; + /** + * We load all the menus + */ + public ActionForward loginSuccess(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd !=null) + return fwd; + + return mapping.findForward(LOGIN_SUCCESS); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/login/POSLoginAction.java b/posterita/posterita/src/main/org/posterita/struts/login/POSLoginAction.java new file mode 100644 index 0000000000..3872f4a870 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/login/POSLoginAction.java @@ -0,0 +1,209 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 25, 2006 + */ + + +package org.posterita.struts.login; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MSession; +import org.compiere.util.Env; +import org.compiere.util.WebUser; +import org.posterita.Constants; +import org.posterita.beans.LoginBean; +import org.posterita.beans.TerminalBean; +import org.posterita.businesslogic.LoginManager; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.core.Configuration; +import org.posterita.core.SessionStorage; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.DuplicatePINException; +import org.posterita.exceptions.InvalidPINException; +import org.posterita.exceptions.InvalidRoleException; +import org.posterita.exceptions.NotLoggedInException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.UserInactiveException; +import org.posterita.exceptions.UserNotFoundException; +import org.posterita.model.MWebMenu; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.user.WebUserInfo; + + +public class POSLoginAction extends BaseDispatchAction +{ + LoginManager bd = new LoginManager(); + public static final String SUCCESS = "success"; + public static final String CHOOSEPOS = "choosePOS"; + public static final String CREATEPOSORDER = "createPOSOrder"; + public static final String CREATEPOSORDERSCREEN = "createPOSOrderScreen"; + // public static final String SUCCESS_WSTORE_USER = "successWStoreUser"; + public ActionForward success(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + LoginBean bean = (LoginBean) df.getBean(); + + Properties ctx = TmkJSPEnv.getCtx(request); + + HttpSession session = request.getSession(); + WebUserInfo info = null; + WebUser wu; + + try + { + if(bean.getUserPIN()!=null) + { + bean=bd.getUserNameFromPIN(ctx,bean.getUserPIN()); + } + + wu = bd.checkLoginPassword(ctx, bean);/////////////// + + info = bd.login(ctx, wu); + + MSession cSession = MSession.get (ctx, request.getRemoteAddr(), request.getRemoteHost(), session.getId()); + + if (cSession != null) + cSession.setWebStoreSession(false); + + session.setAttribute (WebUserInfo.NAME, info); + + Configuration config = Configuration.getConfiguration(request); + config.save(response); + + SessionStorage.putMenus(ctx, request); + } + catch(InvalidPINException e) + { + postGlobalError("error.invalid.pin",request); + return (mapping.getInputForward()); + } + catch(DuplicatePINException e) + { + postGlobalError("error.duplicate.pin",request); + return (mapping.getInputForward()); + } + catch(UserNotFoundException unfe) + { + postGlobalError("login.passwordError",request); + return (mapping.getInputForward()); + } + catch(NotLoggedInException e) + { + postGlobalError("login.passwordError",request); + return (mapping.getInputForward()); + } + catch(InvalidRoleException ire) + { + postGlobalError("error.role.invalid", request); + return (mapping.getInputForward()); + } + catch(UserInactiveException unae) + { + postGlobalError("login.userInactive",request); + return (mapping.getInputForward()); + } + + // Should be removed after backward compatibility achieved + POSTerminalManager.migrateOldPOSTerminal(ctx); + + + String strTerminalId = POSTerminalManager.getTerminalFromCookie(request); + boolean isValidPOSId = false; + int terminalId = 0; + + if(strTerminalId != null) + { + try + { + terminalId= Integer.parseInt(strTerminalId); + isValidPOSId = POSTerminalManager.isPOSTerminalAccessible(ctx, terminalId); + } + catch(Exception ex) + {} + } + + if(!isValidPOSId) + { + int adOrgId = Env.getAD_Org_ID(ctx); + ArrayList list = POSTerminalManager.getAllActiveTerminals(ctx, adOrgId, null); + request.getSession().setAttribute(Constants.POSTERMINALS, list); + return mapping.findForward(CHOOSEPOS); + } + else + { + SessionStorage.putLoginSession(ctx, request, response, terminalId); + boolean isCashSalesAllowed = MenuManager.isCashSalesAllowed(ctx, Env.getAD_Role_ID(ctx)); + + if(isCashSalesAllowed) + { + return mapping.findForward(CREATEPOSORDERSCREEN); + } + else + { + return mapping.findForward(CREATEPOSORDER); + } + } + } + + public ActionForward choosePOS(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + + String strTerminalId = df.getPosId(); + + int terminalId = 0; + + try + { + terminalId = Integer.parseInt(strTerminalId); + } + catch (Exception ex) + { + throw new OperationException("Invalid terminal"); + } + + SessionStorage.putLoginSession(ctx, request, response, terminalId); + + return mapping.findForward(CHOOSEPOS); + } + +} + diff --git a/posterita/posterita/src/main/org/posterita/struts/menu/CloseMenuAction.java b/posterita/posterita/src/main/org/posterita/struts/menu/CloseMenuAction.java new file mode 100644 index 0000000000..b571a5092f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/menu/CloseMenuAction.java @@ -0,0 +1,89 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 28, 2005 by din + */ + +package org.posterita.struts.menu; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.Constants; +import org.posterita.beans.MenuItemBean; +import org.posterita.businesslogic.MenuManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.SystemException; +import org.posterita.keyname.MenuKeyNamePair; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class CloseMenuAction extends BaseDispatchAction +{ + + public static final String CLOSE_MENU= "closeMenuItems"; + public ActionForward closeMenuItems(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + MenuItemBean bean = (MenuItemBean) df.getBean(); + + MenuManager.saveMenu(ctx,bean); + + request.getSession().setAttribute(Constants.MENUS,bean); + + return mapping.findForward(CLOSE_MENU); + } + + public static final String INIT_MENU= "initMenuItems"; + public ActionForward initMenuItems(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList menus = MenuKeyNamePair.getKeyNamePairs(ctx); + + + + request.getSession().setAttribute(Constants.MENUS, menus); + + return mapping.findForward(INIT_MENU); + } + } + + diff --git a/posterita/posterita/src/main/org/posterita/struts/menu/MenuAction.java b/posterita/posterita/src/main/org/posterita/struts/menu/MenuAction.java new file mode 100644 index 0000000000..787906dc11 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/menu/MenuAction.java @@ -0,0 +1,275 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.struts.menu; + +import java.awt.Menu; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.PO; +import org.posterita.Constants; +import org.posterita.beans.MenuItemBean; +import org.posterita.businesslogic.MenuManager; +import org.posterita.core.MenuItem; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.factory.POSMenuFactory; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + + +public class MenuAction extends BaseDispatchAction +{ + public static final String GET_MENU_ITEMS = "getMenuItems"; + public static final String GET_POS_MENU_ITEMS = "getPOSMenuItems"; + + public ActionForward getMenuItems(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + MenuItemBean bean = (MenuItemBean) df.getBean(); + + MenuItem rootMenuItem = (MenuItem)request.getSession().getAttribute(Constants.MENUS); + + if(rootMenuItem == null) + { + //TODO: Display error message or should kick to right store + return mapping.findForward(CHOOSE_APPLICATION); + } + + ArrayList subMenus = new ArrayList(); + if(bean.getMenuId()==null) + { + PO po = POSMenuFactory.getFactoryInstance(ctx).get(ctx, POSMenuFactory.PMENU_SALES_ID); + bean.setMenuId(po.get_ID()); + } + + if(bean.getMenuId()!= null) + { + subMenus = rootMenuItem.getSubMenus(bean.getMenuId().intValue()); + } + + //subgrouping menus + ArrayList menuItems = subMenus; + HashMap> categoryMap = new HashMap>(); + + StringWriter sw = new StringWriter(); + PrintWriter out = new PrintWriter(sw); + ElementBean elementBean = null; + + String category = ""; + String imgSrc = "images/newUI/"; + ArrayList list = null; + ArrayList categories = new ArrayList(); + + //group menus + for(MenuItem menuItem : menuItems) + { + category = menuItem.getCategory(); + category = (category==null)? "" : category; + + if(!categories.contains(category)) + { + categories.add(category); + } + + list = categoryMap.get(category); + + if(list==null) + { + list = new ArrayList(); + } + + list.add(menuItem); + categoryMap.put(category,list); + + } + + //display groups + + Iterator iter = categories.iterator(); + + + while(iter.hasNext()) + { + //---------------------------------------------------------------------------------------------------------------------- + imgSrc = "images/newUI/"; + out.print("

    "); + out.print("
    "); + out.print(""); + out.print(""); + out.print("
    "); //top + out.print("
    "); + out.print("
    "); + out.print("
    "); + out.print("

    "); + + category = iter.next(); + list = categoryMap.get(category); + + if((category != null)&&(category.length() != 0)) + { + if(category.contains("order")) + { + imgSrc = imgSrc + "hicon-salesorder.gif"; + } + else if(category.contains("cash")) + { + imgSrc = imgSrc + "hicon-cashbook.gif"; + } + else if(category.contains("till")) + { + imgSrc = imgSrc + "hicon-tillmgt.gif"; + } + else + { + imgSrc = imgSrc + "spacer.gif"; + } + out.print(""); + + elementBean = ElementManager.getMsg(ctx,category); + out.print(elementBean.getName()); + }//if + else + { + out.print(""); + } + + out.print("

    "); + out.print("
    "); //salesOrder + + out.print(""); + out.print("
    "); //posSubNavContainer + out.print("
    "); //center-content + out.print("
    "); + out.print(""); + out.print(""); + out.print("
    "); + + if((category != null)&&(category.length() != 0)) + { + out.print("
    "); //liquid-round + }//if + + } + + out.flush(); + + String menu = sw.toString(); + + request.getSession().setAttribute(Constants.MENU_ITEMS, menu); + return mapping.findForward(GET_POS_MENU_ITEMS); + } + + public static final String INIT_EDIT_LINKSTATUS = "initEditLinkStatus"; + public ActionForward initEditLinkStatus(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList menuKeyNamePairs = MenuManager.getClosableMenus(ctx); + + request.getSession().setAttribute(Constants.MENU_LIST, menuKeyNamePairs); + + return mapping.findForward(INIT_EDIT_LINKSTATUS); + } + + public static final String SELECT_LINK_TO_EDIT = "selectLinkToEdit"; + public ActionForward selectLinkToEdit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + MenuItemBean bean = (MenuItemBean) df.getBean(); + + MenuItemBean bean2 = MenuManager.getMenu(ctx, bean.getMenuId().intValue()); + + df.populate(bean2); + + return mapping.findForward(SELECT_LINK_TO_EDIT); + } + + public static final String EDIT_MENU = "editMenu"; + public ActionForward editMenu(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + MenuItemBean bean = (MenuItemBean) df.getBean(); + + MenuItemBean editedMenu = MenuManager.editMenu(ctx, bean); + + request.getSession().setAttribute(Constants.MENU, editedMenu); + + return mapping.findForward(EDIT_MENU); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/struts/order/CompletePOSOrderAction.java b/posterita/posterita/src/main/org/posterita/struts/order/CompletePOSOrderAction.java new file mode 100644 index 0000000000..53195712f4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/order/CompletePOSOrderAction.java @@ -0,0 +1,72 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 27-Mar-2006 + */ + + +package org.posterita.struts.order; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MOrder; + +import org.posterita.Constants; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.OrderReferenceManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; + + +public class CompletePOSOrderAction extends ViewOrderAction +{ + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + WebDocumentBean webBean = null; + + Integer posOrderId=(Integer) request.getSession().getAttribute(Constants.CURRENT_POS_ORDER_ID); + + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,posOrderId); + + MOrder completedPOSOrder=POSManager.completePOSOrder(ctx,posOrderId, null); + webBean = OrderReferenceManager.getWebOrderBean(ctx,completedPOSOrder); + + + request.getSession().setAttribute(Constants.WEB_ORDER_BEAN, webBean); + + return super.execute(mapping,form,request,response); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/order/ViewOrderAction.java b/posterita/posterita/src/main/org/posterita/struts/order/ViewOrderAction.java new file mode 100644 index 0000000000..0b31d0e623 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/order/ViewOrderAction.java @@ -0,0 +1,307 @@ +/* + * Created on Mar 4, 2005 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.posterita.struts.order; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.config.ActionConfig; +import org.apache.struts.config.ForwardConfig; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MOrder; +import org.compiere.model.MUser; +import org.compiere.process.DocumentEngine; +import org.compiere.util.Env; + +import org.posterita.Constants; +import org.posterita.beans.DocumentBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.OrderReferenceManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.order.UDIOrderTypes; +import org.posterita.struts.core.BaseAction; +import org.posterita.struts.core.DefaultForm; + + +public class ViewOrderAction extends BaseAction +{ + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + + MessageResources resources = (MessageResources) request.getAttribute(Globals.MESSAGES_KEY); + + //String securityException = resources.getMessage("error.securityException"); + String operationException = resources.getMessage("error.operationException"); + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + DocumentBean bean = (DocumentBean) df.getBean(); + Integer orderID = bean.getDocumentId(); + + // retrieve from cache + WebDocumentBean webBean = null; + + MOrder order = null; + if (orderID!= null) + { + order = new MOrder(ctx, orderID.intValue(), null); + webBean = OrderReferenceManager.getWebOrderBean(ctx,order); + request.getSession().setAttribute(Constants.WEB_ORDER_BEAN, webBean); + } + + + if (webBean == null) + webBean = (WebDocumentBean) request.getSession().getAttribute(Constants.WEB_ORDER_BEAN); + + if (webBean == null) + throw new OperationException(operationException); + + request.getSession().setAttribute(Constants.ME_LOCATION, webBean.getMeLocation()); + request.getSession().setAttribute(Constants.YOU_LOCATION, webBean.getYouLocation()); + request.getSession().setAttribute(Constants.YOU_BP_LOCATION, webBean.getYoubpLocation()); + request.getSession().setAttribute(Constants.ME, webBean.getMe()); + request.getSession().setAttribute(Constants.YOU,webBean.getYou()); + request.getSession().setAttribute(Constants.MORDER, webBean.getOrder()); + request.getSession().setAttribute(Constants.MORDER_LINES_COLLECTION,webBean.getLines()); + request.getSession().setAttribute(Constants.SIMPLE_COMMAND,webBean.getSimpleCommand()); + request.getSession().setAttribute(Constants.COMPLEX_COMMAND,webBean.getComplexCommand()); + request.getSession().setAttribute(Constants.WEB_DOCUMENT_HEADER_BEAN, webBean.getHeaderBean()); + request.getSession().setAttribute(Constants.ORDER_TAX,webBean.getTotalTax()); + request.getSession().setAttribute(Constants.TOTAL_LINES,webBean.getTotalLines()); + request.getSession().setAttribute(Constants.GRAND_TOTAL,webBean.getGrandTotal()); + request.getSession().setAttribute(Constants.ALLOCATION,webBean.getAllocations()); + request.getSession().setAttribute(Constants.SALES_REP, webBean.getSalesRep()); + request.getSession().setAttribute(Constants.IS_PAID, webBean.getIsPaid()); + + ForwardConfig forwardConfig = getForward(ctx,webBean,mapping,form); + + ActionForward forward = new ActionForward(forwardConfig.getPath()); + + return forward; + } + + + private ForwardConfig getForward(Properties ctx, WebDocumentBean webBean, ActionMapping mapping, ActionForm form) throws OperationException + { + ActionConfig config = mapping.getModuleConfig().findActionConfig("/ViewOrderAction"); + + MOrder order = webBean.getOrder(); + + String orderType = order.getOrderType(); + + webBean.setCtx(ctx); + + if (orderType == null) + throw new OperationException("Cannot determine type of order. Type is null"); + + + //Tamak POS Order + if(orderType.equals(UDIOrderTypes.POS_ORDER.getOrderType())) + return getCustomerOrderForward(webBean,config); + + + + //Material Return Order + if(orderType.equals(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())) + return getMROForward(webBean, config); + + // WEBSTORE ORDER + if (orderType.equals(UDIOrderTypes.WEBSTORE_ORDER.getOrderType())) + return getWebstoreOrderForward(ctx, webBean,config); + + // DEFAULT + return config.findForwardConfig(Constants.FINISHED_DO); + } + + + + + + + public ForwardConfig getAllocationOrderForward(WebDocumentBean bean, ActionConfig config) + { + MOrder order = bean.getOrder(); + + String docStatus = order.getDocStatus(); + + if (!order.isActive()) + return config.findForwardConfig(Constants.CANCEL_DO); + + if (docStatus.equals(DocumentEngine.STATUS_Drafted)) + return config.findForwardConfig(Constants.UNFINISHED_AL); + + if (docStatus.equals(DocumentEngine.STATUS_InProgress)) + return config.findForwardConfig(Constants.SWAP_VIN); + + if (docStatus.equals(DocumentEngine.STATUS_Voided)) + return config.findForwardConfig(Constants.UNFINISHED_AL); + + return config.findForwardConfig(Constants.GENERATE_INVOICE); + } + + // same as for customer order + private ForwardConfig getUsedCarPurchaseOrderForward(WebDocumentBean webBean, ActionConfig config) throws OperationException + { + MOrder order = webBean.getOrder(); + + String status = order.getDocStatus(); + + if (status.equals(DocumentEngine.STATUS_Completed)) + return config.findForwardConfig(Constants.PROGRESS_TI); + + if (!order.isActive()) + return config.findForwardConfig(Constants.CANCEL_DO); + + + return config.findForwardConfig(Constants.PROGRESS_TI); + } + + + private ForwardConfig getCustomerOrderForward(WebDocumentBean webBean, ActionConfig config) throws OperationException + { + MOrder order = webBean.getOrder(); + + String status = order.getDocStatus(); + + + if (status.equals(DocumentEngine.STATUS_Drafted)) + { + return config.findForwardConfig(Constants.UNFINISHED_NR); + } + + if(status.equals(DocumentEngine.STATUS_InProgress)) + return config.findForwardConfig(Constants.PROGRESS_NR); + + if (status.equals(DocumentEngine.STATUS_Completed)) + return config.findForwardConfig(Constants.FINISHED_NR); + + + if (!order.isActive()) + return config.findForwardConfig(Constants.CANCEL_DO); + + return config.findForwardConfig(Constants.UNFINISHED_NR); + } + + private ForwardConfig getMROForward(WebDocumentBean webBean, ActionConfig config) + { + MOrder order = webBean.getOrder(); + + if (order.isSOTrx()) + return getSO_MROForward(webBean, config); + + return getPO_MROForward(webBean, config); + } + + + + + private ForwardConfig getSO_MROForward(WebDocumentBean webBean, ActionConfig config) + { + MOrder order = webBean.getOrder(); + + if (!order.isActive()) + { + return config.findForwardConfig(Constants.CANCEL_DO); + } + + return config.findForwardConfig(Constants.PROGRESS_DT); + } + + private ForwardConfig getPO_MROForward(WebDocumentBean orderBean, ActionConfig config) + { + MOrder order = orderBean.getOrder(); + + + if (order == null) + { + + return config.findForwardConfig(Constants.CANCEL_DO); + } + + String status = order.getDocStatus(); + + if (status.equals(DocumentEngine.STATUS_Drafted)) + { + //orderStatusMessage = "status drafted"; + } + + if (!order.isActive()) + return config.findForwardConfig(Constants.CANCEL_DO); + + + return config.findForwardConfig(Constants.PROGRESS_DT); + + } + + private ForwardConfig getWebstoreOrderForward(Properties ctx, WebDocumentBean webBean, ActionConfig config) throws OperationException + { + + int userId = Env.getAD_User_ID(ctx); + new MUser(ctx, userId, null); + + + return getWebstoreSOForward(webBean, config); + } + + public ForwardConfig getWebstoreSOForward(WebDocumentBean orderBean, ActionConfig config) throws OperationException + { + + MOrder order = orderBean.getOrder(); + + + if (order == null) + throw new OperationException("Order cannot be NULL!"); + + + return config.findForwardConfig(Constants.WEBSTORE_PROGRESS_DO); + } + + + public ForwardConfig getPO_SCO_Forward(WebDocumentBean webBean, ActionConfig config) + { + MOrder order = webBean.getOrder(); + + if (order == null) + { + return config.findForwardConfig(Constants.CANCEL_SCO); + } + + if (!order.isActive()) + { + return config.findForwardConfig(Constants.CANCEL_SCO); + } + + + String status = order.getDocStatus(); + + if (status.equals(DocumentEngine.STATUS_Drafted)) + { + return config.findForwardConfig(Constants.UNFINISHED_SCO); + } + + + if (status.equals(DocumentEngine.STATUS_Voided)) + { + return config.findForwardConfig(Constants.PROGRESS_SCO); + } + + + return config.findForwardConfig(Constants.PROGRESS_SCO); + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/BarcodeAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/BarcodeAction.java new file mode 100644 index 0000000000..ed129cba4a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/BarcodeAction.java @@ -0,0 +1,363 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 17-Aug-2006 13:49:29 by praveen + * + */ + +package org.posterita.struts.pos; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.apache.struts.util.MessageResources; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.ItemBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.businesslogic.ProductCart; +import org.posterita.businesslogic.ShoppingcartManager; +import org.posterita.businesslogic.administration.BarcodeManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.InputQuantityLessThanZeroException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.exceptions.QuantityNotAvailableException; +import org.posterita.exceptions.UOMValuePrecisionNotValidException; +import org.posterita.form.OrderLineForm; +import org.posterita.lib.UdiConstants; +import org.posterita.struts.core.DefaultForm; + +import com.lowagie.text.DocumentException; + +public class BarcodeAction extends POSDispatchAction +{ + public ActionForward getBarcodeImage(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + if (fwd !=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + String barcode = df.getBarCode(); + + if(barcode!=null) + { + //send image + BarcodeManager.writeBarcode(barcode,response); + } + + return null; + + } + + //------------------------------------------------------------------------------------------// + /** + * BARCODE IMPLEMENTATION + */ + + public static final String INCREMENT_QTY = "incrementQty"; + public ActionForward incrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + // Bug fix for null pointer + OrderLineForm of = (OrderLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + addToBarcodeCart(mapping,form,request,response); + return getBarcodeCart(mapping,form,request,response); + } + + public static final String DECREMENT_QTY = "decrementQty"; + public ActionForward decrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + // Bug fix for null pointer + OrderLineForm of = (OrderLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + addToBarcodeCart(mapping,form,request,response); + return getBarcodeCart(mapping,form,request,response); + } + + public ActionForward addProduct(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException, ParseException + { + // Bug fix for null pointer + OrderLineForm of = (OrderLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + addToBarcodeCart(mapping,form,request,response); + + return getBarcodeCart(mapping,form,request,response); + } + + public static final String UPDATE_QTY = "updateQty"; + public ActionForward updateQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx=TmkJSPEnv.getCtx(request); + + // Bug fix for null pointer + OrderLineForm of = (OrderLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + OrderLineBean bean = (OrderLineBean) of.getBean(); + Integer product_id = bean.getProductId(); + BigDecimal quantity = bean.getQuantity(); + Integer priceListId = bean.getPriceListId(); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.BARCODE_CART_ITEMS); + StockManager.updateItemFromPOSList(ctx, priceListId, items, product_id, quantity); + + return getBarcodeCart(mapping,form,request,response); + } + + public static final String ADD_TO_BARCODE_CART = "addToBarcodeCart"; + public ActionForward addToBarcodeCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + + + String barcodeCart = Constants.BARCODE_CART; + String barcodeCartItems = Constants.BARCODE_CART_ITEMS; + + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(barcodeCart); + + try + { + if(bean.getProductId()==null && bean.getBarCode()==null) + { + postGlobalError("error.barcode.required", request); + return mapping.getInputForward(); + } + + BigDecimal qty = bean.getQuantity(); + if(qty != null && qty.doubleValue() < 0.0) + { + throw new InputQuantityLessThanZeroException(""); + } + + cartBean = StockManager.addToPOSCart(ctx, bean, cartBean, false,Boolean.parseBoolean(bean.getIfAdd())); + } + catch (InputQuantityLessThanZeroException e) + { + postGlobalError("error.invalid.inputQty", request); + return mapping.getInputForward(); + } + catch (ProductNotFoundException e) + { + postGlobalError("error.product.not.found", e.getMessage(), request); + return mapping.getInputForward(); + } + catch(QuantityNotAvailableException e) + { + postGlobalError("error.quantity.notAvailable", e.getMessage(), request); + return mapping.getInputForward(); + } + + catch(ProductNotOnPriceListException e) + { + postGlobalError("error.product.price.not.found", e.getMessage(), request); + return mapping.getInputForward(); + } + + catch (UOMValuePrecisionNotValidException e) + { + postGlobalError("error.precision", e.getMessage(), request); + return mapping.getInputForward(); + } + + + + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + String currSymboleSales = PriceListManager.getCurrency(ctx, priceListId); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales); + + request.getSession().setAttribute(barcodeCart, cartBean); + request.getSession().setAttribute(barcodeCartItems, cartBean.getItems()); + + df.setQtyAndItem(""); + + return mapping.findForward(ADD_TO_BARCODE_CART); + } + + public ActionForward getBarcodeCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, IOException, ParseException + { + DefaultForm df = (DefaultForm) form; + String orderType = df.getOrderType(); + + String shoppingcartHTML = ShoppingcartManager.getBarcodecartAsHTML(request); + + PrintWriter writer = response.getWriter(); + writer.write(shoppingcartHTML); + + + ActionMessages errors = (ActionMessages) request.getAttribute("org.apache.struts.action.ERROR"); + if(errors != null && !errors.isEmpty()) + { + MessageResources messageResources = getResources(request); + + Iterator iter = errors.get(); + while(iter.hasNext()) + { + ActionMessage message = iter.next(); + String key = message.getKey(); + Object[] values = message.getValues(); + + String errMsg = messageResources.getMessage(key, values); + writer.write(""); + } + + } + + writer.close(); + + return null; + } + + + public static final String COPY_PRODUCT_TO_SHOPPING_CART = "copyProductToShoppingCart"; + public ActionForward copyProductToShoppingCart(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException, ParseException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + HttpSession session = request.getSession(); + ProductCart cart = (ProductCart) session.getAttribute(Constants.PRODUCT_CART); + String shoppingcartHTML = ShoppingcartManager.copyShoppingCartAsHTML(ctx, cart); + + request.getSession().setAttribute(Constants.BARCODE_CART, cart); + request.getSession().setAttribute(Constants.BARCODE_CART_ITEMS, cart.getProducts()); + + return new ActionForward("/initProductBarcodeCart.do"); + } + + public static final String RELOAD_BARCODE_CART = "reloadBarcodeCart"; + public ActionForward reloadBarcodeCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, IOException, ParseException, ApplicationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + + String barcodeCart = Constants.BARCODE_CART; + String barcodeCartItems = Constants.BARCODE_CART_ITEMS; + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(barcodeCart); + ArrayList itemBeans= cartBean.getItems(); + + String priceListIdAsStr = request.getParameter("priceListId"); + String productIdAsStr = request.getParameter("productId"); + int productId = Integer.parseInt(productIdAsStr); + int priceListId = Integer.parseInt(priceListIdAsStr); + + BigDecimal qty = BigDecimal.ZERO; + + for(int i=0; iblackListedList = BlackListedManager.getAllBlackListed(ctx); + request.getSession().setAttribute(Constants.BLACKLISTED_LISTS , blackListedList); + return mapping.findForward(GET_ALL_BLACKLISTED); + } + + public static final String INIT_SEARCH_CHEQUE="initSearchCheque"; + public ActionForward initSearchCheque(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ArrayList Blacklist = new ArrayList(); + request.getSession().setAttribute(Constants.BLACKLISTED_LISTS, Blacklist); + + return mapping.findForward(INIT_SEARCH_CHEQUE); + } + + public static final String SEARCH_CHEQUE="searchCheque"; + public ActionForward searchCheque(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm)form; + + //BlackListedBean bean = (BlackListedBean)df.getBean(); + + ArrayList Blacklist = BlackListedManager.searchChequeNo(ctx, df.getChequeNo()); + + request.getSession().setAttribute(Constants.BLACKLISTED_LISTS, Blacklist); + + return mapping.findForward(SEARCH_CHEQUE); + + } + + public static final String INIT_EDIT_CHEQUE="initEditCheque"; + public ActionForward initEditCheque(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + BlackListForm f = (BlackListForm) form; + f.validate(mapping,request); + + BlackListedBean bean = (BlackListedBean) f.getBean(); + Integer blacklistedID = bean.getBlackListedId(); + + if(blacklistedID==null) + { + throw new OperationException("Cannot edit Cheques. Cause BlacklistedID id cannot be null!"); + } + + bean= BlackListedManager.getBlackListedDetails(ctx, blacklistedID); + f.populate(bean); + + return mapping.findForward(INIT_EDIT_CHEQUE); + } + + + public static final String EDIT_CHEQUE = "editCheque"; + public ActionForward editCheque(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + BlackListForm f = (BlackListForm) form; + BlackListedBean bean=(BlackListedBean)f.getBean(); + + Integer blacklistedID = bean.getBlackListedId(); + if(blacklistedID==null) + { + throw new OperationException("Cannot load Cheque details. Cause BlacklistedId cannot be null!"); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + trx.start(); + + try + { + BlackListedManager.editBlackListed(ctx, bean, trx.getTrxName()); + trx.commit(); + } + catch(OperationException ex) + { + trx.rollback(); + throw ex; + } + finally + { + trx.close(); + } + request.getSession().setAttribute(Constants.BLACKLISTED_DETAILS,bean); + return mapping.findForward(EDIT_CHEQUE); + } + + + public static final String DEACTIVATE_CHEQUE = "deactivateCheque"; + public ActionForward deactivateCheque(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + BlackListForm f=(BlackListForm)form; + f.validate(mapping,request); + + BlackListedBean bean=(BlackListedBean)f.getBean(); + Integer blackListedId = bean.getBlackListedId(); + + if(blackListedId==null) + { + throw new OperationException("Cannot deactivate Blacklisted Cheques. Cause BlackListed id cannot be null!"); + } + + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + try + { + trx.start(); + BlackListedManager.deactivateBListedCheque(ctx, blackListedId.intValue(), trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.deactivate.customer", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(DEACTIVATE_CHEQUE); + } + + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/BpartnerInfoAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/BpartnerInfoAction.java new file mode 100644 index 0000000000..753a9ea75a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/BpartnerInfoAction.java @@ -0,0 +1,98 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Jul 26, 2006 + */ + + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.Constants; +import org.posterita.beans.BPartnerInfoBean; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.POSBpartnerInfoManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.factory.POSMenuFactory; +import org.posterita.struts.core.DefaultForm; + + +public class BpartnerInfoAction extends POSDispatchAction +{ + public static final String GET_BPARTNER_INFO = "getBpartnerInfo"; + public ActionForward getBpartnerInfo(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + BPartnerInfoBean bean=(BPartnerInfoBean) df.getBean(); + + ArrayList list = POSBpartnerInfoManager.getPartnerInfo(ctx,bean.getPartnerName(),bean.getIsCustomer()); + + request.getSession().setAttribute(Constants.BUSINESSPARTNER,list); + request.getSession().removeAttribute(Constants.DEBTORS); + + return mapping.findForward(GET_BPARTNER_INFO); + } + + + public static final String GET_BPARTNER_TRX_DETAILS = "getBpartnerTrxDetails"; + public ActionForward getBpartnerTrxDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + BPartnerInfoBean bean=(BPartnerInfoBean) df.getBean(); + + boolean access=MenuManager.getRoleMenuAccess(ctx,POSMenuFactory.SMENU_VIEW_BPINFO); + if(access==false) + { + postGlobalError("error.access.not.allowed",request); + return new ActionForward(bean.getForward()); + } + + ArrayList list = POSBpartnerInfoManager.getbPartnerTrxDetails(ctx,bean.getBpartnerId(),bean.getIsCustomer()); + ArrayList orderList=POSBpartnerInfoManager.getBpartnerOrderHistory(ctx,bean.getBpartnerId()); + ArrayList infoList = POSBpartnerInfoManager.getPartnerInfo(ctx,bean.getBpartnerId(),bean.getIsCustomer()); + + request.getSession().setAttribute(Constants.BUSINESSPARTNERINFO,infoList); + request.getSession().setAttribute(Constants.BUSINESSPARTNER_TRX_DETAILS,list); + request.getSession().setAttribute(Constants.BUSINESSPARTNER_ORDER_DETAILS,orderList); + + return mapping.findForward(GET_BPARTNER_TRX_DETAILS); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/CashAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/CashAction.java new file mode 100644 index 0000000000..92c61fa298 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/CashAction.java @@ -0,0 +1,184 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Sep 11, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.struts.pos; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MAttachment; +import org.compiere.model.MCash; +import org.posterita.Constants; +import org.posterita.beans.CashBean; +import org.posterita.beans.CashBookBean; +import org.posterita.beans.CashLineBean; +import org.posterita.beans.CashSummaryBean; +import org.posterita.beans.CloseTillBean; +import org.posterita.beans.DateFilterBean; +import org.posterita.beans.POSHistoryBean; +import org.posterita.businesslogic.CashManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.POSHistoryForm; +import org.posterita.struts.core.DefaultForm; + +public class CashAction extends POSDispatchAction +{ + + public static final String INIT_GET_CASH_DETAILS_HISTORY = "initGetCashDetailsHistory"; + public ActionForward initGetCashDetailsHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + POSHistoryForm historyForm = new POSHistoryForm(); + POSHistoryBean bean = (POSHistoryBean)historyForm.getBean(); + + int cashBookId = POSTerminalManager.getCashBookId(ctx); + bean.setCashBookId(cashBookId); + + getCashDetailsHistory(mapping, historyForm, request, response); + ArrayList cashBooks = CashManager.getCashBooks(ctx, null); + + request.getSession().setAttribute(Constants.ACCESSIBLE_CASHBOOKS, cashBooks); + + return mapping.findForward(INIT_GET_CASH_DETAILS_HISTORY); + } + + public static final String GET_CASH_DETAILS_HISTORY = "getCashDetailsHistory"; + public ActionForward getCashDetailsHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm)form; + + Properties ctx = TmkJSPEnv.getCtx(request); + + POSHistoryBean historyBean = (POSHistoryBean)df.getBean(); + + ArrayList cashList = CashManager.getCashDetails(ctx, historyBean.getCashBookId(), historyBean.getMonth(), historyBean.getYear(), null); + + request.getSession().setAttribute(Constants.CASH_DETAILS, cashList); + + return mapping.findForward(GET_CASH_DETAILS_HISTORY); + } + + public static final String GET_CASHLINE_DETAILS = "getCashLineDetails"; + public ActionForward getCashLineDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm)form; + + Properties ctx = TmkJSPEnv.getCtx(request); + + CashBean cashBean = (CashBean)df.getBean(); + + CashSummaryBean cashSummaryBean = CashManager.getCashSummary(ctx, cashBean.getCashId(), null); + ArrayList cashLineList = CashManager.getCashLineHistory(ctx, cashBean.getCashId(), null); + + int cash_id = cashBean.getCashId(); + MAttachment attachment = MAttachment.get(ctx, MCash.Table_ID, cash_id); + CloseTillBean closeTillBean = null; + if(attachment != null) + { + try + { + byte[] data = attachment.getEntryData(0); + if(data != null) + { + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data)); + Object obj = ois.readObject(); + closeTillBean = (CloseTillBean) obj; + } + } + catch (IOException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + catch (ClassNotFoundException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + if(closeTillBean != null) + { + String printData = POSReportManager.endOfTheDayHTMLReport(ctx, closeTillBean); + request.setAttribute(Constants.CLOSE_TILL_PRINT_DATA, printData); + } + + request.setAttribute(Constants.CASH_LINE_DETAILS, cashLineList); + request.setAttribute(Constants.CASH_SUMMARY, cashSummaryBean); + + return mapping.findForward(GET_CASHLINE_DETAILS); + } + + public static final String GET_CASH_SUMMARY_BY_DATE = "getCashSummaryByDate"; + public ActionForward getCashSummaryByDate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm)form; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DateFilterBean dateBean = (DateFilterBean)df.getBean(); + + CashSummaryBean cashSummaryBean = CashManager.getCashSummary(ctx, dateBean.getFromDate(), dateBean.getToDate(), null); + + ArrayList cashLineList = CashManager.getCashLineHistory(ctx, dateBean.getFromDate(), dateBean.getToDate(), null); + + request.setAttribute(Constants.CASH_LINE_DETAILS, cashLineList); + request.setAttribute(Constants.CASH_SUMMARY, cashSummaryBean); + + return mapping.findForward(GET_CASH_SUMMARY_BY_DATE); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/CashBookAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/CashBookAction.java new file mode 100644 index 0000000000..85a32cccba --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/CashBookAction.java @@ -0,0 +1,651 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 22-Mar-2006 + */ + + +package org.posterita.struts.pos; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MAttachment; +import org.compiere.model.MCash; +import org.compiere.model.MCashBook; +import org.compiere.model.MCashLine; +import org.compiere.model.MCurrency; +import org.compiere.util.CLogger; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.CashBookBean; +import org.posterita.beans.CashBookDetailBean; +import org.posterita.beans.CloseTillBean; +import org.posterita.beans.CurrentTillAmountBean; +import org.posterita.beans.UDIBean; +import org.posterita.businesslogic.CashManager; +import org.posterita.businesslogic.ClientManager; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.PrintManager; +import org.posterita.businesslogic.core.AccountingManager; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.CanNotAjdustTillException; +import org.posterita.exceptions.CanNotCloseTillException; +import org.posterita.exceptions.CashBookAlreadyAssignedException; +import org.posterita.exceptions.NoCashJournalPresentException; +import org.posterita.exceptions.NullTransferAmountException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.TerminalLockedException; +import org.posterita.exceptions.TransferAmountExceedsTotalAmountException; +import org.posterita.form.CashBookForm; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.util.PoManager; +import org.posterita.util.TmkPrinterConstants; + + +public class CashBookAction extends BaseDispatchAction +{ + /** Logger */ + private static final CLogger logger = CLogger.getCLogger(CashBookAction.class); + + public static final String GET_CASH_BOOK_DETAILS="getCashBookDetails"; + public ActionForward getCashBookDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + CashBookDetailBean bean = CashManager.getCashBookDetails(ctx, null); + + // Keeping compatibility with view + ArrayList list = new ArrayList(); + list.add(bean); + + request.getSession().setAttribute(Constants.CASH_BOOK, list); + + return mapping.findForward(GET_CASH_BOOK_DETAILS); + } + + + + public static final String ADJUST_CASH_BOOK_ACTION="adjustCashBookAction"; + public ActionForward adjustCashBookAction(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm)form; + CashBookDetailBean bean = (CashBookDetailBean)df.getBean(); + Properties ctx = TmkJSPEnv.getCtx(request); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + MCashLine cashLine = null; + + try + { + trx.start(); + cashLine = CashManager.adjustCashBook(ctx, bean, trx.getTrxName()); + trx.commit(); + } + catch(NullTransferAmountException e) + { + postGlobalError("error.no.transfer.amount",request); + return mapping.getInputForward(); + } + + catch(TransferAmountExceedsTotalAmountException e) + { + postGlobalError("error.transferAmt.exceeds.endingBalance",request); + return mapping.getInputForward(); + } + catch(CanNotAjdustTillException e) + { + postGlobalError("error.cannot.adjust.till",request); + return mapping.getInputForward(); + } + catch(NumberFormatException e) + { + postGlobalError("error.invalid.number",request); + return mapping.getInputForward(); + } + finally + { + trx.rollback(); + trx.close(); + } + + // Keeping compatibility with view + ArrayList list = new ArrayList(); + list.add(bean); + + // Printing + if (cashLine != null) + { + PrintManager.printAdjustCashbookReport(ctx, cashLine); + } + + request.getSession().setAttribute(Constants.CASH_BOOK,list); + + return mapping.findForward(ADJUST_CASH_BOOK_ACTION); + } + + public static final String INIT_CLOSE_TILL="initCloseTill"; + public ActionForward initCloseTill(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + CurrentTillAmountBean tillBean = POSManager.getCurrentTillAmount(ctx); + request.setAttribute(Constants.CURRENT_TILL_AMOUNT_POS,tillBean); + MCurrency currency = POSTerminalManager.getCurrencyOfTerminalCashBook(ctx); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currency.getCurSymbol()); + return mapping.findForward(INIT_CLOSE_TILL); + + } + + public static final String CLOSE_TILL="closeTill"; + public ActionForward closeTill(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, SQLException, IOException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm)form; + CashBookDetailBean bean =(CashBookDetailBean)df.getBean(); + + Properties ctx = TmkJSPEnv.getCtx(request); + CurrentTillAmountBean tillBean=null; + + tillBean = POSManager.getCurrentTillAmount(ctx); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + bean = CashManager.CloseTill(ctx, bean, trx.getTrxName()); + trx.commit(); + } + catch (NoCashJournalPresentException exception) + { + trx.rollback(); + postGlobalError("error.no.cashjournal.present",request); + return mapping.getInputForward(); + } + catch(NullTransferAmountException e) + { + trx.rollback(); + postGlobalError("error.no.transfer.amount",request); + return mapping.getInputForward(); + } + catch(CanNotCloseTillException e) + { + trx.rollback(); + postGlobalError("error.till.already.close",request); + return mapping.getInputForward(); + } + catch (TerminalLockedException exception) + { + trx.rollback(); + postGlobalError("error.terminal.locked", request); + } + catch(NumberFormatException e) + { + trx.rollback(); + postGlobalError("error.invalid.number",request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + + String currency = POSTerminalManager.getDefaultSalesCurrency(ctx) + .getCurSymbol(); + + CloseTillBean closeTillBean = new CloseTillBean(); + closeTillBean.setTillName(tillBean.getPosName()); + closeTillBean.setCurrency(currency); + closeTillBean.setBeginningBalance(bean.getBeginingBalance()); + closeTillBean.setNetCashTrx(bean.getStatementDifference()); + closeTillBean.setBalanceEntered(bean.getTransferAmount()); + closeTillBean.setDifference(bean.getDifferenceAmt()); + closeTillBean.setEndingBalance(bean.getEndingBalance()); + closeTillBean.setCashTotal(tillBean.getCashTotal()); + closeTillBean.setCardTotal(tillBean.getCardTotal()); + closeTillBean.setChequeTotal(tillBean.getChequeTotal()); + closeTillBean.setGrandTotal(tillBean.getTillGrandTotal()); + closeTillBean.setCardAmtEntered(bean.getCardTotal()); + closeTillBean.setCardDifference(bean.getCardDifference()); + closeTillBean.setChequeAmtEntered(bean.getChequeTotal()); + closeTillBean.setChequeDifference(bean.getChequeDifference()); + + //save the CloseTillBean as attachment + int cash_id = bean.getCash_id(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(closeTillBean); + byte[] attachmentData = bos.toByteArray(); + MAttachment attachment = new MAttachment(ctx,MCash.Table_ID,cash_id,null); + attachment.addEntry("Close Till Data", attachmentData); + PoManager.save(attachment); + + String reportName = POSReportManager.endOfTheDayPDF(ctx,closeTillBean); //generates report + String reportURI = ReportManager.getReportURI(reportName,request); //resolves report path + + request.getSession().setAttribute(Constants.END_OF_THE_DAY_DETAILS,closeTillBean); //session as being used for printing + request.setAttribute(Constants.REPORT_URL,reportURI); + + return mapping.findForward(CLOSE_TILL); + } + + public static final String OPEN_CASH_DRAWER="openCashDrawer"; + + public ActionForward openCashDrawer(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + PrintManager.openCashDrawer(ctx); + + return null; + + } + + //--------------------------------------------------------------- + public ActionForward getClosedTillData(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + CloseTillBean bean = (CloseTillBean)request.getSession().getAttribute(Constants.END_OF_THE_DAY_DETAILS); + + if (bean == null) + { + throw new OperationException("Till amount details not available"); + } + + request.getSession().setAttribute(Constants.END_OF_THE_DAY_DETAILS, null); // remove end of day details + + String printingType = POSManager.getPrintingTypeFromCookie(request); + + if (printingType == null) + { + printingType = TmkPrinterConstants.SLIP_PRINTER_9PIN; + } + + if (TmkPrinterConstants.NORMAL_PRINTER.equalsIgnoreCase(printingType)) + { + String reportName = POSReportManager.endOfTheDayPDF(ctx,bean); //generates report + response.setContentType("application/pdf"); + ReportManager.writeReport(reportName, response); + return null; + } + else if (TmkPrinterConstants.SLIP_PRINTER_THERMAL.equals(printingType) + || TmkPrinterConstants.SLIP_PRINTER_9PIN.equals(printingType)) + { + int length = TmkPrinterConstants.PRINTER_9PIN_WIDTH; + if (TmkPrinterConstants.SLIP_PRINTER_THERMAL.equals(printingType)) + { + length = TmkPrinterConstants.PRINTER_SLIP_WIDTH; + } + + String printData = ""; + try + { + //Timestamp ts = new Timestamp(System.currentTimeMillis()); + String data = POSReportManager.endOfTheDayReport(ctx,bean); + // int terminalId = POSTerminalManager.getTerminalId(ctx); + // String salesData = POSReportManager.getDailySalesReport(ctx, ts, terminalId, length, null); + // printData = data + salesData; + printData = data; + } + catch (Exception ex) + { + printData = "Could not get data for the report"; + } + + try + { + response.setContentType("application/octet-stream"); + OutputStream os = response.getOutputStream(); + os.write(printData.getBytes()); + os.flush(); + os.close(); + } + catch (Exception ex) + { + logger.log(Level.SEVERE, "Failed to write to response", ex); + throw new OperationException(ex); + } + } + else + { + logger.log(Level.SEVERE, "Printing Type not defined, PrintingType: " + printingType); + return null; + } + return null; + } + + + //----------------- + + private void populateData(HttpServletRequest request, String trxName) + { + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList accessibleOrgs = OrganisationManager.getUserOrgPairs(ctx, false); + request.getSession().setAttribute(Constants.ACCESSIBLE_ORGS, accessibleOrgs); + } + + public static final String INIT_SEARCH_CASHBOOK = "initSearchCashBook"; + public ActionForward initSearchCashBook(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + request.getSession().setAttribute(Constants.CASHBOOKS, null); + + return mapping.findForward(INIT_SEARCH_CASHBOOK); + } + + + public static final String SEARCH_CASHBOOK = "searchCashBook"; + public ActionForward searchCashBook(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + UDIBean bean = (UDIBean)df.getBean(); + + String searchText = bean.getSearchText(); + + ArrayList cashbookList = CashManager.getCashBooks(ctx, searchText, null); + + request.getSession().setAttribute(Constants.CASHBOOKS, cashbookList); + + return mapping.findForward(SEARCH_CASHBOOK); + } + + public static final String VIEW_CASHBOOK = "viewCashBook"; + public ActionForward viewCashBook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + CashBookForm cashBookForm = (CashBookForm)form; + CashBookBean cashBookBean = (CashBookBean)cashBookForm.getBean(); + + populateData(request, null); + + cashBookBean = CashManager.getCashBook(ctx, cashBookBean.getCashBookId(), null); + + cashBookForm.populate(cashBookBean); + cashBookForm.setAction(VIEW_CASHBOOK); + cashBookForm.setReadOnly(true); + + return mapping.findForward(VIEW_CASHBOOK); + } + + public static final String INIT_CREATE_CASHBOOK = "initCreateCashBook"; + public ActionForward initCreateCashBook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + + int defaultCurrencyId = AccountingManager.getCurrencyId(ctx, Env.getAD_Client_ID(ctx), null); + + CashBookBean cashBookBean = new CashBookBean(); + cashBookBean.setCurrencyId(defaultCurrencyId); + cashBookBean.setIsDefault(false); + cashBookBean.setIsActive(true); + + int orgId = Env.getAD_Org_ID(ctx); + + populateData(request, null); + cashBookBean.setOrgId(orgId); + df.populate(cashBookBean); + df.setAction(CREATE_CASHBOOK); + df.setReadOnly(false); + + return mapping.findForward(INIT_CREATE_CASHBOOK); + } + + public static final String CREATE_CASHBOOK = "createCashBook"; + public ActionForward createCashBook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + CashBookForm cashBookForm = (CashBookForm)form; + CashBookBean cashBookBean = (CashBookBean)cashBookForm.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + if (cashBookBean.getCurrencyId() == null || cashBookBean.getCurrencyId() == 0) + { + // Needed till the ability to chose currency when creating a cash book is not enabled. + // This is the case for the moment since there is no way to define conversion rates + int defaultCurrencyId = AccountingManager.getCurrencyId(ctx, Env.getAD_Client_ID(ctx), null); + cashBookBean.setCurrencyId(defaultCurrencyId); + } + + MCashBook cashBook = CashManager.createUpdateCashBook(ctx, cashBookBean, trx.getTrxName()); + cashBookBean.setCashBookId(cashBook.get_ID()); + trx.commit(); + } + catch (CashBookAlreadyAssignedException cashBookAlreadyAssignedException) + { + postGlobalError("error.deactivate.cashbook", request); + return mapping.getInputForward(); + } + catch (Exception ex) + { + postGlobalError("error.operation", request); + return mapping.getInputForward(); + } + finally + { + trx.rollback(); + trx.close(); + } + + cashBookForm.populate(cashBookBean); + viewCashBook(mapping, form, request, response); + + return mapping.findForward(CREATE_CASHBOOK); + } + + public static final String EDIT_CASHBOOK = "editCashBook"; + public ActionForward editCashBook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + CashBookForm cashBookForm = (CashBookForm)form; + CashBookBean cashBookBean = (CashBookBean)cashBookForm.getBean(); + + populateData(request, null); + cashBookBean = CashManager.getCashBook(ctx, cashBookBean.getCashBookId(), null); + cashBookForm.populate(cashBookBean); + cashBookForm.setAction(SAVE_CASHBOOK); + cashBookForm.setReadOnly(false); + return mapping.findForward(EDIT_CASHBOOK); + } + + public static final String SAVE_CASHBOOK = "saveCashBook"; + public ActionForward saveCashBook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + return createCashBook(mapping, form, request, response); + } + + public static final String COPY_CASHBOOK = "copyCashBook"; + public ActionForward copyCashBook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + CashBookForm cashBookForm = (CashBookForm)form; + CashBookBean cashBookBean = (CashBookBean)cashBookForm.getBean(); + + populateData(request, null); + + cashBookBean = CashManager.getCashBook(ctx, cashBookBean.getCashBookId(), null); + cashBookBean.setCashBookId(0); + + cashBookForm.populate(cashBookBean); + cashBookForm.setAction(SAVE_CASHBOOK); + cashBookForm.setReadOnly(false); + + return mapping.findForward(COPY_CASHBOOK); + } + + + public static final String ACTIVATE_CASHBOOK = "activateCashBook"; + public ActionForward activateCashBook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + CashBookForm cashBookForm = (CashBookForm)form; + CashBookBean cashBookBean = (CashBookBean)cashBookForm.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + CashManager.updateCashBookStatus(ctx, cashBookBean.getCashBookId(), true, trx.getTrxName()); + trx.commit(); + } + catch (Exception ex) + { + postGlobalError("error.operation", request); + } + finally + { + trx.rollback(); + trx.close(); + } + + searchCashBook(mapping, form, request, response); + + return mapping.findForward(SEARCH_CASHBOOK); + } + + + public static final String DEACTIVATE_CASHBOOK = "deactivateCashBook"; + public ActionForward deactivateCashBook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + CashBookForm cashBookForm = (CashBookForm)form; + CashBookBean cashBookBean = (CashBookBean)cashBookForm.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + CashManager.updateCashBookStatus(ctx, cashBookBean.getCashBookId(), false, trx.getTrxName()); + trx.commit(); + } + catch (CashBookAlreadyAssignedException cashBookAlreadyAssignedException) + { + postGlobalError("error.deactivate.cashbook", request); + } + catch (Exception ex) + { + postGlobalError("error.operation", request); + } + finally + { + trx.rollback(); + trx.close(); + } + + searchCashBook(mapping, form, request, response); + + return mapping.findForward(SEARCH_CASHBOOK); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/CommissionAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/CommissionAction.java new file mode 100644 index 0000000000..80b0f8d5de --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/CommissionAction.java @@ -0,0 +1,115 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 7, 2006 + */ + + +package org.posterita.struts.pos; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MCurrency; +import org.posterita.Constants; +import org.posterita.beans.CommissionBean; +import org.posterita.beans.ReportBean; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.CommissionManager; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; + + +public class CommissionAction extends POSDispatchAction +{ + + public static final String GENERATE_COMMISSION="generateCommission"; + public ActionForward generateCommission(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + MCurrency currency = POSTerminalManager.getCurrencyOfTerminalCashBook(ctx); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currency.getCurSymbol()); + + Timestamp fromdate = ReportDateManager.getFromDate(bean); + CommissionManager.generateCommission(ctx,fromdate); + ArrayList list=CommissionManager.getCommissionAmt(ctx); + String reportName = CommissionManager.getCommissionAmtAsCSV(ctx, list); + String reportURI = ReportManager.getReportURI(reportName, request); + + request.getSession().setAttribute(Constants.COMMISSION_AMT,list); + request.getSession().setAttribute(Constants.REPORT_URL, reportURI); + + return mapping.findForward(GENERATE_COMMISSION); + } + + public static final String VIEW_COMMISSION="viewCommission"; + public ActionForward viewCommission(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + ArrayList list=CommissionManager.getCommissionAmt(ctx); + String reportName = CommissionManager.getCommissionAmtAsCSV(ctx, list); + String reportURI = ReportManager.getReportURI(reportName, request); + + request.getSession().setAttribute(Constants.COMMISSION_AMT,list); + request.getSession().setAttribute(Constants.REPORT_URL, reportURI); + + return mapping.findForward(VIEW_COMMISSION); + } + + + public static final String VIEW_COMMISSION_DETAILS="viewCommissionDetails"; + public ActionForward viewCommissionDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + CommissionBean bean = (CommissionBean) df.getBean(); + + ArrayList list=CommissionManager.getCommissionDetails(ctx,bean.getCommissionAmtId()); + request.getSession().setAttribute(Constants.COMMISSION_AMT_DETAILS,list); + + return mapping.findForward(VIEW_COMMISSION_DETAILS); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/CreditOrderAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/CreditOrderAction.java new file mode 100644 index 0000000000..76cc45b166 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/CreditOrderAction.java @@ -0,0 +1,792 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 13, 2006 + */ + + +package org.posterita.struts.pos; + +import java.io.IOException; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MCurrency; +import org.compiere.model.MInOut; +import org.compiere.model.MInvoice; +import org.compiere.model.MOrder; +import org.compiere.model.MPayment; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.compiere.util.WebUser; +import org.posterita.Constants; +import org.posterita.beans.AgingBean; +import org.posterita.beans.BPartnerInfoBean; +import org.posterita.beans.DocumentHistoryBean; +import org.posterita.beans.LoginBean; +import org.posterita.beans.OpenItemBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.PaymentAllocationBean; +import org.posterita.beans.PaymentTypeBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.LoginManager; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.OrderManager; +import org.posterita.businesslogic.OrderReferenceManager; +import org.posterita.businesslogic.POSBpartnerInfoManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.PaymentAllocationManager; +import org.posterita.businesslogic.PaymentManager; +import org.posterita.businesslogic.PaymentTermManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.businesslogic.creditsales.CreditOrderManager; +import org.posterita.core.SessionStorage; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BPartnerNotFoundException; +import org.posterita.exceptions.BPartnerOverCreditLimitException; +import org.posterita.exceptions.CanNotCreatePaymentAllocationException; +import org.posterita.exceptions.DiscountLimitException; +import org.posterita.exceptions.DuplicatePINException; +import org.posterita.exceptions.InsufficientQtyException; +import org.posterita.exceptions.InvalidAddressException; +import org.posterita.exceptions.InvalidPINException; +import org.posterita.exceptions.LimitPriceViolatedException; +import org.posterita.exceptions.MandatoryException; +import org.posterita.exceptions.NoAllocateeInvoiceException; +import org.posterita.exceptions.NoPaymentAmountException; +import org.posterita.exceptions.NotLoggedInException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.TooManyAllocateInvoiceException; +import org.posterita.exceptions.UserInactiveException; +import org.posterita.exceptions.UserNotFoundException; +import org.posterita.factory.POSMenuFactory; +import org.posterita.form.DocumentHistoryForm; +import org.posterita.form.OpenItemForm; +import org.posterita.struts.core.DefaultForm; + + +public class CreditOrderAction extends POSDispatchAction +{ + + + public static final String GET_BPARTNER_PAYMENT_STATUS="getBpartnerPaymentStatus"; + public ActionForward getBpartnerPaymentStatus(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OpenItemBean bean=(OpenItemBean) df.getBean(); + boolean access=MenuManager.getRoleMenuAccess(ctx,POSMenuFactory.SMENU_SETTLE_PAYMENT_ID); + if(access==false) + { + postGlobalError("error.access.not.allowed",request); + return new ActionForward(bean.getForward()); + } + + ArrayList openItemList = null; + ArrayList agingList = null; + ArrayList paymentList = null; + try + { + openItemList=CreditOrderManager.getOpenItems(ctx,bean.getBpartnerId()); + agingList = CreditOrderManager.getAging(ctx,bean.getBpartnerId()); + paymentList = CreditOrderManager.getUnallocatedPayments(ctx,bean.getBpartnerId()); + + } + catch(BPartnerNotFoundException e) + { + postGlobalError("error.customer.not.exists",request); + return mapping.getInputForward(); + } + + + request.getSession().setAttribute(Constants.OPEN_ITEMS,openItemList); + request.getSession().setAttribute(Constants.AGING_ITEMS,agingList); + request.getSession().setAttribute(Constants.UNALLOCATED_PAYMENTS,paymentList); + return mapping.findForward(GET_BPARTNER_PAYMENT_STATUS); + } + + + public static final String MATCH_INVOICE = "matchInvoice"; + public ActionForward matchInvoice(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OpenItemBean bean=(OpenItemBean) df.getBean(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + trx.start(); + PaymentAllocationManager.allocate(ctx,bean.getInvoiceIds(),bean.getPaymentIds(),trx.getTrxName()); + trx.commit(); + } + + catch(TooManyAllocateInvoiceException e) + { + trx.rollback(); + postGlobalError("error.too.many.invoice",request); + return mapping.getInputForward(); + } + catch(CanNotCreatePaymentAllocationException e1) + { + trx.rollback(); + postGlobalError("error.allocation.amt.exceeds.openamt",request); + return mapping.getInputForward(); + } + catch(NoAllocateeInvoiceException e2) + { + trx.rollback(); + postGlobalError("error.no.invoice.to.allocate",request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + ArrayList openItemList=CreditOrderManager.getOpenItems(ctx,bean.getBpartnerId()); + ArrayList agingList = CreditOrderManager.getAging(ctx,bean.getBpartnerId()); + ArrayList paymentList = CreditOrderManager.getUnallocatedPayments(ctx,bean.getBpartnerId()); + + request.getSession().setAttribute(Constants.UNALLOCATED_PAYMENTS,paymentList); + request.getSession().setAttribute(Constants.OPEN_ITEMS,openItemList); + request.getSession().setAttribute(Constants.AGING_ITEMS,agingList); + + df.setInvoiceIds(null); + df.setPaymentIds(null); + + return mapping.findForward(MATCH_INVOICE); + } + + + public static final String INIT_GET_BPARTNER_PAYMENT_STATUS = "initGetBpartnerPaymentStatus"; + public ActionForward initGetBpartnerPaymentStatus(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + //DefaultForm df= (DefaultForm) form; + ArrayList list = POSBpartnerInfoManager.getPartnerInfo(ctx,true); + request.getSession().removeAttribute(Constants.UNALLOCATED_PAYMENTS); + request.getSession().removeAttribute(Constants.OPEN_ITEMS); + request.getSession().removeAttribute(Constants.AGING_ITEMS); + request.getSession().setAttribute(Constants.BUSINESSPARTNER,list); + return mapping.findForward(INIT_GET_BPARTNER_PAYMENT_STATUS); + } + + + public static final String INIT_CREATE_PAYMENT = "initCreatePayment"; + public ActionForward initCreatePayment(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + // Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OpenItemBean bean=(OpenItemBean) df.getBean(); + request.getSession().setAttribute(Constants.CREDIT_INVOICE_INFO,bean); + return mapping.findForward(INIT_CREATE_PAYMENT); + } + + public static final String CREATE_PAYMENT = "createPayment"; + public ActionForward createPayment(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OpenItemBean bean=(OpenItemBean) df.getBean(); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + PaymentTypeBean pBean =null; + + HashMap map = new HashMap(); + map.put("Cash",MPayment.TENDERTYPE_Cash); + map.put("Card",MPayment.TENDERTYPE_CreditCard); + map.put("Cheque",MPayment.TENDERTYPE_Check); + + bean.setTenderType(map.get(bean.getTrxType())); + + try + { + trx.start(); + + pBean = CreditOrderManager.createPayment(ctx,bean,trx.getTrxName()); + + MCurrency currency = POSTerminalManager.getCurrencyOfTerminalCashBook(ctx); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currency.getCurSymbol()); + + trx.commit(); + if(!pBean.getPaymentType().equalsIgnoreCase("cash")) + { + MPayment payment = new MPayment(ctx,pBean.getId(),null); + PaymentManager.completePayment(ctx,payment); + request.getSession().removeAttribute(Constants.OPEN_ITEMS); + request.getSession().removeAttribute(Constants.AGING_ITEMS); + trx.close(); + return new ActionForward("/ViewWebstorePaymentAction.do?action=viewOrder&documentId="+payment.get_ID()); + } + } + catch(NoPaymentAmountException ex) + { + trx.rollback(); + postGlobalError("error.paymentamount.mandatory",request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + } + finally + { + trx.close(); + } + + request.getSession().removeAttribute(Constants.OPEN_ITEMS); + request.getSession().removeAttribute(Constants.AGING_ITEMS); + + + return new ActionForward("/ViewWebstoreCashPaymentAction.do?action=viewOrder&documentId="+pBean.getId()); + //return mapping.findForward(CREATE_PAYMENT); + } + + + public static final String GET_PAYMENT_DETAILS_FOR_INVOICE = "getPaymentDetailsForInvoice"; + public ActionForward getPaymentDetailsForInvoice(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OpenItemBean bean=(OpenItemBean) df.getBean(); + ArrayList cashPaymentList = CreditOrderManager.getAllCashPaymentForInvoice(ctx,bean.getInvoiceId()); + ArrayList cardChqPaymentList=CreditOrderManager.getAllPaymentForInvoice(ctx,bean.getInvoiceId()); + request.getSession().setAttribute(Constants.CASH_PAYMENT_LIST,cashPaymentList); + request.getSession().setAttribute(Constants.CARD_CHQ_PAYMENT_LIST,cardChqPaymentList); + request.getSession().setAttribute(Constants.INVOICE_GRAND_TOTAL,bean.getPaidAmt()); + return mapping.findForward(GET_PAYMENT_DETAILS_FOR_INVOICE); + } + + + + + public static final String GET_CRDITORDER_DISC_DETAILS="getCreditOrderDiscDetails"; + public ActionForward getCreditOrderDiscDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + Integer bPartnerId = bean.getBpartnerId(); + MOrder order=null; + String toBeShipped=bean.getToBeShipped(); + if(toBeShipped==null) + { + toBeShipped=(String)request.getSession().getAttribute(Constants.TO_BE_SHIPPED); + bean.setToBeShipped(toBeShipped); + } + if(toBeShipped==null) + { + toBeShipped="true"; + } + + if(bPartnerId==null) + { + postGlobalError("error.required.bpartnerId",request); + return mapping.getInputForward(); + } + if(BPartnerManager.isBPartnerPresent(ctx,bPartnerId,null) == false) + { + postGlobalError("error.customer.not.exists",request); + return mapping.getInputForward(); + } + + if(bean.getOrderId()!=null) + { + order = new MOrder(ctx, bean.getOrderId(), null); + } + + df.populate(new OrderLineBean()); + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.CREDIT_ORDER_SHOPPING_CART); + if(cartBean==null) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + request.getSession().setAttribute(Constants.CREDIT_ORDER_SHOPPING_CART, cartBean); + request.getSession().setAttribute(Constants.PRESENT_CREDIT_ORDER,order); + request.getSession().setAttribute(Constants.CREDITORDER_BPARTNER,bPartnerId); + request.getSession().setAttribute(Constants.TO_BE_SHIPPED,bean.getToBeShipped()); + request.getSession().setAttribute(Constants.CREDIT_ORDER_SHOPPING_CART_ITEMS, cartBean.getItems()); + return mapping.findForward(GET_CRDITORDER_DISC_DETAILS); + } + + public static final String CREATE_CREDIT_ORDER="createCreditOrder"; + public ActionForward createCreditOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + + if(cartBean==null ||cartBean.getItems() == null||cartBean.getItems().size()==0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + String toBeShipped=bean.getToBeShipped(); + if(toBeShipped==null) + { + toBeShipped=(String)request.getSession().getAttribute(Constants.TO_BE_SHIPPED); + bean.setToBeShipped(toBeShipped); + } + if(toBeShipped==null) + { + toBeShipped="true"; + } + + Integer bPartnerId = bean.getBpartnerId(); + if(bPartnerId==null) + { + bPartnerId = (Integer) request.getSession().getAttribute(Constants.CREDITORDER_BPARTNER); + bean.setBpartnerId(bPartnerId); + } + + if(bPartnerId==null) + { + postGlobalError("error.required.bpartnerId",request); + return mapping.getInputForward(); + } + + if(BPartnerManager.isBPartnerPresent(ctx,bean.getBpartnerId(),null) == false) + { + postGlobalError("error.customer.not.exists",request); + return mapping.getInputForward(); + } + + BigDecimal discountAllowed = (BigDecimal) request.getSession().getAttribute( Constants.DISCOUNT_ALLOWED ); + bean.setUserDiscount( discountAllowed ); + MOrder previousOrder= null; + previousOrder=(MOrder)request.getSession().getAttribute(Constants.PRESENT_CREDIT_ORDER); + + if(previousOrder!=null) + { + bean.setOrderId(Integer.valueOf(previousOrder.get_ID())); + } + else + { + bean.setOrderId(null); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + MOrder creditOrder=null; + try + { + trx.start(); + creditOrder= CreditOrderManager.createCreditOrder(ctx,bean,cartBean.getItems(),trx.getTrxName()); + trx.commit(); + } + catch (DiscountLimitException e) + { + trx.rollback(); + postGlobalError("error.discountLimit.exceeded",request); + return mapping.getInputForward(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + + catch(MandatoryException e2) + { + trx.rollback(); + postGlobalError("error.bpartner.no.payment.term",request); + return mapping.getInputForward(); + } + catch(InsufficientQtyException e3) + { + trx.rollback(); + postGlobalError("error.insufficient.qty",e3.getMessage(),request); + return mapping.getInputForward(); + } + catch(LimitPriceViolatedException e3) + { + trx.rollback(); + postGlobalError("error.limit.price.violated",e3.getMessage(),request); + return mapping.getInputForward(); + } + + catch(OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + request.getSession().removeAttribute( Constants.DISCOUNT_ALLOWED ); + } + bean.setOrderId(Integer.valueOf(creditOrder.get_ID())); + df.populate(new OrderLineBean()); + WebDocumentBean webBean =null; + try + { + webBean = OrderReferenceManager.getWebOrderBean(ctx, creditOrder); + } + catch(InvalidAddressException e) + { + postGlobalError("error.invalid.address",request); + return mapping.getInputForward(); + } + + ArrayList list = POSManager.populateOrderLines(ctx,creditOrder); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,Integer.valueOf(creditOrder.get_ID())); + request.getSession().setAttribute(Constants.PRESENT_CREDIT_ORDER,creditOrder); + request.getSession().setAttribute(Constants.ORDER_LINE_BEAN,bean); + request.getSession().setAttribute(Constants.CREDITORDER_BPARTNER,bPartnerId); + request.setAttribute(Constants.POS_ORDER_LINES,list); + request.getSession().removeAttribute(Constants.PRESENT_CREDIT_ORDER); + request.getSession().removeAttribute(Constants.PRESENT_CREDIT_ORDER_ID); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + return mapping.findForward(CREATE_CREDIT_ORDER); + } + + + public static final String COMPLETE_CREDIT_ORDER="completeCreditOrder"; + public ActionForward completeCreditOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean b = (OrderLineBean) df.getBean(); + + OrderLineBean bean=(OrderLineBean) request.getSession().getAttribute(Constants.ORDER_LINE_BEAN); + bean.setAmountGiven(b.getAmountGiven()); + bean.setAmountRefunded(b.getAmountRefunded()); + + Integer orderId = (Integer) request.getSession().getAttribute(Constants.CURRENT_POS_ORDER_ID); + + if (orderId == null) + { + return mapping.getInputForward(); + } + MOrder completedCreditOrder=null; + + if(OrderManager.isOrderEmpty(ctx,orderId.intValue(),null)) + { + postGlobalError("error.pos.no.orderline",request); + request.getSession().removeAttribute(Constants.SHOPPING_CART); + request.getSession().removeAttribute(Constants.SHOPPING_CART_ITEMS); + + return mapping.getInputForward(); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + trx.start(); + completedCreditOrder=CreditOrderManager.completeCreditOrder(ctx,orderId.intValue(), trx.getTrxName()); + trx.commit(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(OperationException e2) + { + trx.rollback(); + throw e2; + } + finally + { + trx.close(); + } + + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx, completedCreditOrder); + ArrayList list = POSManager.populateOrderLines(ctx,completedCreditOrder); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,completedCreditOrder.get_ID()); + request.setAttribute(Constants.POS_ORDER_LINES,list); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.SHOPPING_CART); + request.getSession().removeAttribute(Constants.SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_POS_ORDER_ID); + request.getSession().removeAttribute(Constants.CREDITORDER_BPARTNER); + request.getSession().removeAttribute(Constants.SHIPMENT_REQUIRED); + request.getSession().removeAttribute(Constants.TO_BE_SHIPPED); + // String reportName = POSReportManager.getInvoicePDFReport(ctx,completedCreditOrder.getC_Invoice_ID(),null); + // String reportURI = ReportManager.getReportURI(reportName,request); + //request.getSession().setAttribute(Constants.REPORT_URL,reportURI); + return mapping.findForward(COMPLETE_CREDIT_ORDER); + } + + public ActionForward validateAdvanceOrderPIN(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException + { + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + String userPIN = df.getUserPIN(); + + LoginBean bean = null; + LoginManager loginManager = new LoginManager(); + String script = null; + + try + { + bean = loginManager.getUserNameFromPIN(ctx, userPIN); + WebUser wu = loginManager.checkLoginPassword(ctx, bean); + + int roleId = Env.getAD_Role_ID(ctx); + + BigDecimal discountAllowed = RoleManager.getDiscountAllowed(ctx, roleId, null); + + if(discountAllowed != Env.ZERO) + { + script = "setAction(document.forms[0],'GetCreditOrderDiscDetailsAction.do','getCreditOrderDiscDetails');" + + "disableButtons();"; + + request.getSession().setAttribute(Constants.DISCOUNT_ALLOWED, discountAllowed); + } + else + { + script = "PINError('It seems that you are not authorised to give discounts.');"; + } + } + catch (DuplicatePINException e) + { + script = "PINError('It seems that you are not authorised to give discounts.');"; + } + catch (InvalidPINException e) + { + script = "PINError('It seems that you are not authorised to give discounts.');"; + } + catch (UserNotFoundException e) + { + + } + catch (UserInactiveException e) + { + + } + catch (NotLoggedInException e) + { + + } + catch (SQLException e) + { + throw new OperationException(e); + } + catch (OperationException e) + { + throw new OperationException(e); + } + + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + + public static final String GET_ALLOCATION_DETAILS_FOR_PARTNER = "getAllocationDetailsForPartner"; + public ActionForward getAllocationDetailsForPartner(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + PaymentAllocationBean bean=(PaymentAllocationBean) df.getBean(); + ArrayList allocationList = CreditOrderManager.viewAllocation(ctx,bean.getPartnerName(),bean.getInvoiceNo(),bean.getIsCustomer(),bean.getIsVendor()); + request.getSession().setAttribute(Constants.PAYMENT_ALLOCATIONS,allocationList); + return mapping.findForward(GET_ALLOCATION_DETAILS_FOR_PARTNER); + } + + public static final String INIT_CREATE_CREDIT_ORDER = "initCreateCreditOrder"; + public ActionForward initCreateCreditOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + ArrayList list = PaymentTermManager.getAllActivePaymentTerm(ctx); + request.getSession().setAttribute (Constants.PAYMENT_TERM,list); + return mapping.findForward(INIT_CREATE_CREDIT_ORDER); + } + + + public static final String CREATE_SHIPMENT_CREDIT_ORDER = "createShipmentForCreditOrder"; + public ActionForward createShipmentForCreditOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DocumentHistoryForm dhf = (DocumentHistoryForm) form; + DocumentHistoryBean bean = (DocumentHistoryBean) dhf.getBean(); + MInOut shipment=CreditOrderManager.createAndCompleteShipment(ctx,bean.getInvoiceId()); + return new ActionForward("/ViewMinOutAction.do?action=viewOrder&documentId="+shipment.get_ID()); + } + + + + public static final String GET_MULTIPLE_INVOICE_FOR_PAYMENT = "getMultipleInvoicesForPayment"; + public ActionForward getMultipleInvoicesForPayment(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + OpenItemForm oif= (OpenItemForm) form; + OpenItemBean bean=(OpenItemBean) oif.getBean(); + ArrayList list=null; + try + { + list= PaymentAllocationManager.getInvoiceToAllocate(ctx,bean.getInvoiceIds(),null); + } + catch(NoAllocateeInvoiceException e2) + { + postGlobalError("error.no.invoice.to.allocate",request); + return mapping.getInputForward(); + } + request.getSession().setAttribute (Constants.INVOICE_FOR_ALLOCATION,list); + return mapping.findForward(GET_MULTIPLE_INVOICE_FOR_PAYMENT); + } + + //---------------------------------------------------------------------------------------------- + // Methods related to purchasing + public static final String INIT_GET_CREDITOR_PAYMENT_STATUS = "initGetCreditorPaymentStatus"; + public ActionForward initGetCreditorPaymentStatus(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + //DefaultForm df= (DefaultForm) form; + ArrayList list = POSBpartnerInfoManager.getPartnerInfo(ctx,true); + request.getSession().removeAttribute(Constants.UNALLOCATED_PAYMENTS); + request.getSession().removeAttribute(Constants.OPEN_ITEMS); + request.getSession().removeAttribute(Constants.AGING_ITEMS); + request.getSession().setAttribute(Constants.BUSINESSPARTNER,list); + return mapping.findForward(INIT_GET_CREDITOR_PAYMENT_STATUS); + } + + public static final String GET_CREDITOR_PAYMENT_STATUS = "getCreditorPaymentStatus"; + public ActionForward getCreditorPaymentStatus(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OpenItemBean bean=(OpenItemBean) df.getBean(); + boolean access=MenuManager.getRoleMenuAccess(ctx,POSMenuFactory.SMENU_SETTLE_GRN_PAYMENT_ID); + if(access==false) + { + postGlobalError("error.access.not.allowed",request); + return new ActionForward(bean.getForward()); + } + + ArrayList openItemList = null; + ArrayList agingList = null; + ArrayList paymentList = null; + + try + { + openItemList = CreditOrderManager.getOpenItems(ctx,bean.getBpartnerId()); + agingList = CreditOrderManager.getAging(ctx,bean.getBpartnerId()); + paymentList = CreditOrderManager.getUnallocatedPayments(ctx,bean.getBpartnerId()); + + } + catch(BPartnerNotFoundException e) + { + postGlobalError("error.vendor.not.exists",request); + mapping.findForward(GET_CREDITOR_PAYMENT_STATUS); + } + + + request.getSession().setAttribute(Constants.OPEN_ITEMS,openItemList); + request.getSession().setAttribute(Constants.AGING_ITEMS,agingList); + request.getSession().setAttribute(Constants.UNALLOCATED_PAYMENTS,paymentList); + + return mapping.findForward(GET_CREDITOR_PAYMENT_STATUS); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/CurrencyAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/CurrencyAction.java new file mode 100644 index 0000000000..d49d18fae5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/CurrencyAction.java @@ -0,0 +1,268 @@ +package org.posterita.struts.pos; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.logging.Level; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MCurrency; +import org.compiere.util.CLogger; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.CurrencyBean; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.CurrencyForm; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.util.PoManager; + +public class CurrencyAction extends BaseDispatchAction +{ + private static CLogger logger = CLogger.getCLogger(CurrencyAction.class); + + public static final String VIEW_CURRENCY = "viewCurrency"; + public ActionForward updateCurrency(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + CurrencyForm currencyForm = (CurrencyForm) form; + CurrencyBean currencyBean = (CurrencyBean) currencyForm.getBean(); + + Properties ctx = TmkJSPEnv.getCtx(request); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + if((currencyBean.getCurrencyId() != 0) && (currencyBean.getCurrencyId() != null)) + { + MCurrency currency = MCurrency.get(ctx, currencyBean.getCurrencyId()); + + if(currencyBean.getRoundOffFactor().doubleValue() < 0) + { + postGlobalError("error.round.off.cannot.be.negative", request); + return mapping.getInputForward(); + } + + currency.setRoundOffFactor(currencyBean.getRoundOffFactor()); + currency.setStdPrecision(currencyBean.getStdPrecision()); + currency.setIsActive(currencyBean.getIsActive()); + PoManager.save(currency); + } + trx.commit(); + //postGlobalMessage("success.currency.updated.successfully", request); + } + + catch(OperationException e) + { + trx.rollback(); + logger.log(Level.SEVERE, e.getMessage()); + postGlobalError("error.process", e.getMessage(), request); + } + + finally + { + trx.close(); + } + + request.getSession().removeAttribute(Constants.CURRENCY_LIST); + request.getSession().setAttribute(Constants.CURRENCY, currencyBean); + return mapping.getInputForward(); + } + + + public static final String LIST_CURRENCIES = "listCurrencies"; + public ActionForward listCurrencies(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + CurrencyForm currencyForm = (CurrencyForm) form; + CurrencyBean currencyBean = (CurrencyBean) currencyForm.getBean(); + + Properties ctx = TmkJSPEnv.getCtx(request); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + ArrayList list = new ArrayList(); + list = getAllCurrencies(ctx, currencyBean.getIsoCode(), trx.getTrxName()); + + request.getSession().setAttribute(Constants.CURRENCY_LIST, list); + return mapping.findForward(LIST_CURRENCIES); + + } + + public static final String UPDATE_CURRENCY = "updateCurrency"; + public ActionForward viewCurrency(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + Integer currencyId = Integer.valueOf(request.getParameter("currencyId")); + String next =request.getParameter("isNext"); + Boolean isNext= null; + if ("true".equals(next)) + { + isNext = true; + } + else if ("false".equals(next)) + { + isNext = false; + } + + CurrencyForm currencyForm = (CurrencyForm)form; + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.CURRENCY_LIST); + + CurrencyBean currencyBean = new CurrencyBean(); + currencyBean = getCurrencyBean(ctx, list, currencyId, isNext, trx.getTrxName()); + currencyForm.populate(currencyBean); + + request.getSession().setAttribute(Constants.CURRENCY, currencyBean); + + return mapping.findForward(UPDATE_CURRENCY); + } + + /** + * Retrieves all currencies or search for currency by ISO_Code + * @param ctx Context + * @param isoCode Currency ISO Code. Search for currency by ISO Code + * @param trxName Transaction Name + * @return ArrayList of type CurrencyBean + */ + public ArrayList getAllCurrencies(Properties ctx, String isoCode, String trxName) + { + String whereClause = "C_Currency_Id IS NOT NULL ORDER BY ISO_CODE"; + + if(isoCode != null) + { + whereClause = "ISO_CODE = '" + isoCode.toUpperCase() + "'"; + } + + int[] currencyIds = MCurrency.getAllIDs(MCurrency.Table_Name, whereClause, null); + + ArrayList list = new ArrayList(); + + if((currencyIds == null) || (currencyIds.length == 0)) + { + return list; + } + + for(int id : currencyIds) + { + CurrencyBean currencyBean = new CurrencyBean(); + MCurrency currency = new MCurrency(ctx, id, trxName ); + currencyBean.setCurrencyId(currency.getC_Currency_ID()); + currencyBean.setIsActive(currency.isActive()); + currencyBean.setIsoCode(currency.getISO_Code()); + currencyBean.setCurSymbol(currency.getCurSymbol()); + currencyBean.setRoundOffFactor(currency.getRoundOffFactor()); + currencyBean.setStdPrecision(currency.getStdPrecision()); + currencyBean.setDescription(currency.getDescription()); + + list.add(currencyBean); + } + + return list; + } + + /** + * Get a specific currencyBean from an ArrayList of CurrencyBean + * @param ctx Context + * @param list Arraylist of type CurrencyBean + * @param currencyId + * @param isNext used to keep track of next CurrencyBean relative to bean having currencyId + * @return CurrencyBean + * @throws OperationException + */ + public static CurrencyBean getCurrencyBean(Properties ctx, + ArrayList list, Integer currencyId, Boolean isNext, String trxName) throws OperationException + { + int index = -1; + + if (currencyId == null || currencyId == 0) + { + return new CurrencyBean(); + } + else + { + if (list != null) + { + Iterator iter = list.iterator(); + + while (iter.hasNext()) + { + CurrencyBean currBean = iter.next(); + if (currBean.getCurrencyId().equals(currencyId)) + { + index = list.indexOf(currBean); + } + } + if (index != -1) + { + if (isNext!=null) + { + if (isNext) + { + int nextIndex = (index + 1)%list.size(); + index = nextIndex; + } + else + { + int previousIndex = (index-1)%list.size(); + if (previousIndex < 0) + { + previousIndex += list.size(); + } + index = previousIndex; + } + } + return list.get(index); + } + else + { + throw new OperationException("no currency not found in search list"); + } + } + else + { + return getCurrencyBean(ctx, currencyId, trxName); + } + } + } + + + public static CurrencyBean getCurrencyBean(Properties ctx, Integer currencyId, String trxName) + { + CurrencyBean currencyBean = new CurrencyBean(); + MCurrency currency = MCurrency.get(ctx, currencyId); + currencyBean.setCurrencyId(currency.getC_Currency_ID()); + currencyBean.setIsActive(currency.isActive()); + currencyBean.setCurSymbol(currency.getCurSymbol()); + currencyBean.setIsoCode(currency.getISO_Code()); + currencyBean.setStdPrecision(currency.getStdPrecision()); + currencyBean.setRoundOffFactor(currency.getRoundOffFactor()); + + return currencyBean; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/CustomPOSReportAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/CustomPOSReportAction.java new file mode 100644 index 0000000000..e62690903e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/CustomPOSReportAction.java @@ -0,0 +1,361 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 24-Jul-2006 15:53:04 by praveen + * + */ + +package org.posterita.struts.pos; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.compiere.model.MAttribute; +import org.compiere.model.MAttributeSet; +import org.compiere.model.MElementValue; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.ReportBean; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.businesslogic.performanceanalysis.CustomPOSReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.BarChart; +import org.posterita.core.PieChart; +import org.posterita.core.RandomStringGenerator; +import org.posterita.core.SessionStorage; +import org.posterita.core.TabularReport; +import org.posterita.core.TimeSeriesChart; +import org.posterita.core.TimestampConvertor; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.SalesReportForm; + +public class CustomPOSReportAction extends POSDispatchAction +{ + public static final String INIT_CUSTOM_REPORT = "initCustomReport"; + public ActionForward initCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + SalesReportForm reportForm = (SalesReportForm) form; + + //setting defaults + String chartType = PieChart.CHART_TYPE; + String accountId = "41000"; + String timePeriod = ReportDateManager.TODAY; + String salesGroup = Constants.REVENUE_RECOGNITION; + String dateRange = Constants.FIXED_DATE_RANGE; + + reportForm.setChartType(chartType); + reportForm.setAccountId(accountId); + reportForm.setTimePeriod(timePeriod); + reportForm.setSalesGroup(salesGroup); + reportForm.setDateRange(dateRange); + reportForm.setFromDate(""); + reportForm.setToDate(""); + + reportForm.validate(mapping,request); + + ReportBean reportBean = (ReportBean) reportForm.getBean(); + + SessionStorage.putSalesGroupFilter(ctx,request,reportBean); + + return mapping.findForward(INIT_CUSTOM_REPORT); + } + + + public static final String GET_CUSTOM_REPORT = "getCustomReport"; + public ActionForward getCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + SalesReportForm reportForm = (SalesReportForm) form; + ReportBean bean = (ReportBean) reportForm.getBean(); + + //validate form + ActionMessages messages = validate(form); + if(!messages.isEmpty()) + { + saveErrors(request, messages); + return mapping.getInputForward(); + } + + final Integer TAX_DUE = Constants.TAX_DUE; + final Integer TAX_CREDIT = Constants.TAX_CREDIT; + final Integer PROFIT_MARGIN = Constants.PROFIT_MARGIN; + + Timestamp fromDate = null; + Timestamp toDate = null; + String dateRange = bean.getDateRange(); + String timePeriod = bean.getTimePeriod(); + String chartType = bean.getChartType(); + String salesGroup = bean.getSalesGroup(); + String priceQtyFilter = bean.getPriceQtyFilter(); + Integer account_id = bean.getAccountId(); + + String filename = RandomStringGenerator.randomstring(); + String reportPath = ReportManager.getReportPath(filename); + + String title = ""; + String subtitle = ""; + int height = 600; + int width = 700; + + //setting from and to dates + if(dateRange.endsWith(Constants.FIXED_DATE_RANGE)) + { + if(timePeriod == null) + { + throw new OperationException("Invalid Parameter for timePeriod. TimePeriod is null"); + } + + fromDate = ReportDateManager.getStartDateForPeriod(timePeriod); + toDate = ReportDateManager.getEndDateForPeriod(timePeriod); + + subtitle = "For " + timePeriod; + } + else if(dateRange.endsWith(Constants.CUSTOM_DATE_RANGE)) + { + fromDate = ReportDateManager.getFromDate(bean); + toDate = ReportDateManager.getToDate(bean); + + subtitle = "For period:"+fromDate+" to "+toDate; + } + else + { + throw new OperationException("Invalid Parameter for dateRange :" + dateRange); + } + + //setting title + String str = null; + boolean isProfitMargin = (account_id.equals( PROFIT_MARGIN )); + + if(isProfitMargin) + { + str = "Profit Margin"; + } + else + { + int[] ids = MElementValue.getAllIDs(MElementValue.Table_Name,"AD_CLIENT_ID ="+ Env.getAD_Client_ID(ctx) + " AND VALUE ='"+ account_id + "'",null); + + if(ids==null || ids.length==0) + { + throw new OperationException("Unable to resolve account type!"); + } + else + { + MElementValue elementValue = new MElementValue(ctx,ids[0],null); + str = elementValue.getName(); + }//else + }//else + + + + boolean isTaxDue = (account_id.equals( TAX_DUE )); + boolean isTaxCredit = (account_id.equals( TAX_CREDIT )); + + if(isTaxCredit || isTaxDue) + { + title = str; + } + else + { + title = str + " by "; + + if( + salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)|| + salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET) || + salesGroup.equalsIgnoreCase(Constants.PRODUCT) || + salesGroup.equalsIgnoreCase(Constants.GROUP1) || + salesGroup.equalsIgnoreCase(Constants.GROUP2) || + salesGroup.equalsIgnoreCase(Constants.CUSTOMER) + ) + { + title = title + salesGroup; + } + else + { + String[] s = salesGroup.split("_"); + + if(s.length!=2) + { + throw new OperationException("Cannot generate sql. Unknown salesGroup parameter:"+salesGroup); + } + + int attributeSetId = Integer.parseInt(s[0]); + int attributeId = Integer.parseInt(s[1]); + + String attributeSetName = null; + String attributeName = null; + + attributeSetName = MAttributeSet.get(ctx,attributeSetId).getName(); + attributeName = new MAttribute(ctx,attributeId,null).getName(); + + title = title + attributeName + " For " + attributeSetName; + + }//else + + }//else + + + //drawing chart + if(chartType.equals(PieChart.CHART_TYPE)) + { + PieChart pieChart = CustomPOSReportManager.generatePieChart(ctx,title,subtitle,account_id.intValue(), fromDate, toDate, salesGroup,priceQtyFilter); + pieChart.saveChartAsJPEG(reportPath+".jpg",width,height); + } + else if(chartType.equals(BarChart.CHART_TYPE)) + { + BarChart barChart = CustomPOSReportManager.generateBarChart(ctx,title,subtitle,account_id.intValue(), fromDate, toDate,salesGroup,priceQtyFilter); + barChart.saveChartAsJPEG(reportPath+".jpg",width,height); + } + else if(chartType.equals(TimeSeriesChart.CHART_TYPE)) + { + //draw timeseries + TimeSeriesChart timeSeriesChart = CustomPOSReportManager.generateTimeSeriesChart(ctx,title,subtitle,account_id.intValue(), fromDate, toDate,salesGroup,priceQtyFilter); + timeSeriesChart.saveChartAsJPEG(reportPath+".jpg",width,height); + } + else if(chartType.equals("Tabular")) + { + //constructing the table + TabularReport tReport = CustomPOSReportManager.generateTabularReport( ctx, title, subtitle, account_id.intValue(), fromDate, toDate, salesGroup, priceQtyFilter ); + + String csvReport = CSVReportManager.generateCSVReport(ctx,tReport.getReportData()); + String csvURI = ReportManager.getReportURI(csvReport,request); + + request.getSession().removeAttribute(Constants.REPORT_URL); + request.getSession().setAttribute(Constants.TABULAR_REPORT_DATA,tReport.toString()); + request.getSession().setAttribute(Constants.CSV_FILE,csvURI); + request.getSession().setAttribute(Constants.DISPLAY_REPORT,""); + + //------------------------------------------------------------------------------------------------------------------- + tReport = CustomPOSReportManager.generateTabularReportGroupByDate(ctx,title,subtitle,account_id.intValue(), fromDate, toDate,salesGroup,priceQtyFilter); + csvReport = CSVReportManager.generateCSVReport(ctx,tReport.getReportData()); + csvURI = ReportManager.getReportURI(csvReport,request); + + request.getSession().removeAttribute(Constants.REPORT_URL); + request.getSession().setAttribute(Constants.TABULAR_REPORT_DATA2,tReport.toString()); + request.getSession().setAttribute(Constants.CSV_FILE2,csvURI); + request.getSession().setAttribute(Constants.DISPLAY_REPORT,""); + + return mapping.findForward(GET_CUSTOM_REPORT); + + + } + else + { + throw new OperationException("Invalid Chart type:" + chartType); + } + + String imgURL = ReportManager.getReportURI(filename+".jpg",request); + + request.getSession().setAttribute(Constants.REPORT_URL,imgURL); + request.getSession().removeAttribute(Constants.TABULAR_REPORT_DATA); + request.getSession().setAttribute(Constants.DISPLAY_REPORT,""); + + + + return mapping.findForward(GET_CUSTOM_REPORT); + } + + + //---------------------------------------------------------------------------------------------------- + public static ActionMessages validate(ActionForm form) throws OperationException, ApplicationException + { + ActionMessages messages = new ActionMessages(); + ActionMessage message = null; + boolean error = false; + + SalesReportForm reportForm = (SalesReportForm) form; + ReportBean bean = (ReportBean) reportForm.getBean(); + + String fromDate = bean.getFromDate(); + String toDate = bean.getToDate(); + String dateRange = bean.getDateRange(); + String timePeriod = bean.getTimePeriod(); + + + if(dateRange.endsWith(Constants.FIXED_DATE_RANGE)) + { + if(timePeriod == null) + { + throw new OperationException("Invalid Parameter for timePeriod. Time Period is null."); + } + } + else if(dateRange.endsWith(Constants.CUSTOM_DATE_RANGE)) + { + + if((fromDate == null)||(fromDate == "")) + { + message = new ActionMessage("error.required.fromDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if((toDate == null)||(toDate == "")) + { + message = new ActionMessage("error.required.toDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if(!error) + { + + + Timestamp date1 = ReportDateManager.getFromDate(bean); + Timestamp date2 = ReportDateManager.getToDate(bean); + + if(date2.getTime()<= date1.getTime()) + { + message = new ActionMessage("error.invalid.period"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + } + } + else + { + throw new OperationException("Invalid Parameter for dateRange :" + dateRange); + } + + return messages; + + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/CustomerReturnOrderAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/CustomerReturnOrderAction.java new file mode 100644 index 0000000000..518e4480cf --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/CustomerReturnOrderAction.java @@ -0,0 +1,78 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 22-Sep-2006 11:43:05 by praveen + * + */ + +package org.posterita.struts.pos; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.exceptions.ApplicationException; + +public class CustomerReturnOrderAction extends POSDispatchAction +{ + public static final String CREATE_CUSTOMER_RETURN_ORDER = "createCustomerReturnOrder"; + public static final String ADD_TO_SHOPPING_CART = "addToShoppingCart"; + public static final String INCREMENT_QTY = "incrementQty"; + public static final String DECREMENT_QTY = "decrementQty"; + public static final String DELETE_ORDERLINE = "deleteOrderline"; + + public ActionForward addToShoppingCart(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(ADD_TO_SHOPPING_CART); + } + + public ActionForward incrementQty(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(INCREMENT_QTY); + } + + public ActionForward decrementQty(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(DECREMENT_QTY); + } + + public ActionForward deleteOrderline(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(DELETE_ORDERLINE); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/DocumentAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/DocumentAction.java new file mode 100644 index 0000000000..960702ae48 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/DocumentAction.java @@ -0,0 +1,292 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 17, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.struts.pos; + +import java.io.File; +import java.io.IOException; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MInventory; +import org.compiere.print.ReportEngine; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.utils.DBUtils; +import org.posterita.Constants; +import org.posterita.beans.DocumentBean; +import org.posterita.beans.InventoryBean; +import org.posterita.businesslogic.stock.InventoryManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.RandomStringGenerator; +import org.posterita.core.TabularReport; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.InventoryForm; +import org.posterita.struts.core.DefaultForm; + +import com.lowagie.text.DocumentException; + +public class DocumentAction extends POSDispatchAction +{ + public static final String VIEW_ORDER_DOCUMENT_PDF = "viewOrderDocumentPDF"; + public ActionForward viewOrderDocumentPDF(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + DocumentBean bean = (DocumentBean) df.getBean(); + String reportName = RandomStringGenerator.randomstring() + ".pdf"; + String reportPath = ReportManager.getReportPath(reportName); + + ReportEngine reportEngine = ReportEngine.get(ctx, ReportEngine.ORDER, bean.getDocumentId().intValue()); + reportEngine.createPDF(new File(reportPath)); + + String reportURI = ReportManager.getReportURI(reportPath,request); + request.setAttribute(Constants.DOCUMENT_PDF, reportURI); + + return mapping.findForward(VIEW_ORDER_DOCUMENT_PDF); + } + + public static final String VIEW_INVOICE_DOCUMENT_PDF = "viewInvoiceDocumentPDF"; + public ActionForward viewInvoiceDocumentPDF(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + DocumentBean bean = (DocumentBean) df.getBean(); + String reportName = RandomStringGenerator.randomstring() + ".pdf"; + String reportPath = ReportManager.getReportPath(reportName); + + ReportEngine reportEngine = ReportEngine.get(ctx, ReportEngine.INVOICE, bean.getDocumentId().intValue()); + reportEngine.createPDF(new File(reportPath)); + + String reportURI = ReportManager.getReportURI(reportPath,request); + request.setAttribute(Constants.DOCUMENT_PDF, reportURI); + + return mapping.findForward(VIEW_INVOICE_DOCUMENT_PDF); + } + + public static final String VIEW_SHIPMENT_DOCUMENT_PDF = "viewShipmentDocumentPDF"; + public ActionForward viewShipmentDocumentPDF(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + DocumentBean bean = (DocumentBean) df.getBean(); + String reportName = RandomStringGenerator.randomstring() + ".pdf"; + String reportPath = ReportManager.getReportPath(reportName); + + ReportEngine reportEngine = ReportEngine.get(ctx, ReportEngine.SHIPMENT, bean.getDocumentId().intValue()); + reportEngine.createPDF(new File(reportPath)); + + String reportURI = ReportManager.getReportURI(reportPath,request); + request.setAttribute(Constants.DOCUMENT_PDF, reportURI); + + return mapping.findForward(VIEW_SHIPMENT_DOCUMENT_PDF); + } + + public static String VIEW_PAYMENT_DOCUMENT_PDF = "viewPaymentDocumentPDF"; + public ActionForward viewPaymentDocumentPDF(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + DocumentBean bean = (DocumentBean) df.getBean(); + String reportName = RandomStringGenerator.randomstring() + ".pdf"; + String reportPath = ReportManager.getReportPath(reportName); + + ReportEngine reportEngine = ReportEngine.get(ctx, ReportEngine.REMITTANCE, bean.getDocumentId().intValue()); + reportEngine.createPDF(new File(reportPath)); + + String reportURI = ReportManager.getReportURI(reportPath,request); + request.setAttribute(Constants.DOCUMENT_PDF, reportURI); + + return mapping.findForward(VIEW_SHIPMENT_DOCUMENT_PDF); + } + + + + +/* public static String VIEW_PAYMENT_DOCUMENT_PDF = "viewPaymentDocumentPDF"; + public ActionForward viewPaymentDocumentPDF(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + DocumentBean bean = (DocumentBean) df.getBean(); + + String pdfPath = POSReportManager.getPaymentPDFReport(ctx, bean.getDocumentId(), null); + pdfPath = ReportManager.getReportURI(pdfPath,request); + + request.setAttribute(Constants.DOCUMENT_PDF, pdfPath); + + return mapping.findForward(VIEW_PAYMENT_DOCUMENT_PDF); + } +*/ + + /*public static String VIEW_INVOICEFROMORDER_DOCUMENT_PDF = "viewInvoiceFromOrderDocumentPDF"; + public ActionForward viewInvoiceFromOrderDocumentPDF(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + DocumentBean bean = (DocumentBean) df.getBean(); + + String pdfPath = POSReportManager.getInvoiceFromOrderPDFReport(ctx, bean.getDocumentId(), null); + pdfPath = ReportManager.getReportURI(pdfPath,request); + + request.setAttribute(Constants.DOCUMENT_PDF, pdfPath); + + return mapping.findForward(VIEW_INVOICEFROMORDER_DOCUMENT_PDF); + }*/ + + /*========================================================================*/ + + public static final String VIEW_INVENTORY_DOCUMENT_PDF = "viewInventoryDocumentPDF"; + + /** + * Generate Inventory Document after Inventory count + * @param mapping + * @param form + * @param request + * @param response + * @throws ApplicationException + * @throws OperationException + * @throws DocumentException + * @throws IOException + * @return + * @throws SQLException + * @throws ParseException + */ + + public ActionForward viewInventoryDocumentPDF(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, DocumentException, IOException, SQLException, ParseException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + + ArrayList reportData = InventoryManager.getInventoryReportData(ctx, bean.getInventoryId(), null); + + String title = ""; + + MInventory inv = MInventory.get(ctx, bean.getInventoryId()); + + if(inv.getDescription() == null) + { + title = "Inventory Adjustment Report"; + } + else + { + title = inv.getDescription(); + } + + String subtitle = null; + + String sql = "Select Name from AD_Org where AD_org_ID=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + + pstmt = DB.prepareStatement(sql.toString(), null); + pstmt.setInt(1, Env.getAD_Org_ID(ctx)); + + try + { + rs = pstmt.executeQuery(); + + if (rs.next()) + { + subtitle = rs.getString(1); + } + + } + catch(SQLException e) + { + throw new OperationException(e); + } + finally + { + DBUtils.close(rs); + DBUtils.close(pstmt); + } + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle(title); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + response.setContentType("x-application/pdf"); + response.setHeader("Content-Disposition","inline;filename=Inventory"+System.currentTimeMillis()+".pdf"); + response.getOutputStream().write(tReport.getPDFData()); + + return null; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/DunningAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/DunningAction.java new file mode 100644 index 0000000000..d88ca91438 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/DunningAction.java @@ -0,0 +1,80 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 27, 2006 + */ + + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.Constants; +import org.posterita.beans.DunningBean; +import org.posterita.businesslogic.POSBpartnerInfoManager; +import org.posterita.businesslogic.administration.DunningManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; + + +public class DunningAction extends POSDispatchAction +{ + + public static final String INIT_PRINT_DUNNING = "initPrintDunning"; + public ActionForward initPrintDunning(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DunningManager.associateAllBpartnerWithDunning(ctx); + ArrayList list = POSBpartnerInfoManager.getPartnerInfo(ctx,true); + + request.getSession().setAttribute(Constants.DEBTORS,list); + request.getSession().removeAttribute(Constants.BUSINESSPARTNER); + + return mapping.findForward(INIT_PRINT_DUNNING); + } + + public static final String PRINT_DUNNING_LETTERS="printDunningLetters"; + public ActionForward printDunningLetters(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + DunningBean bean=(DunningBean) df.getBean(); + + DunningManager.printDunningLetters(ctx,bean); + return mapping.findForward(PRINT_DUNNING_LETTERS); + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/EditBulkProductFromFileAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/EditBulkProductFromFileAction.java new file mode 100644 index 0000000000..258521634f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/EditBulkProductFromFileAction.java @@ -0,0 +1,265 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 28, 2006 + */ + + +package org.posterita.struts.pos; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.Trx; + +import org.posterita.Constants; +import org.posterita.beans.ProductBean; +import org.posterita.businesslogic.EditBulkProductFromFileManager; +import org.posterita.businesslogic.POSProductManager; +import org.posterita.businesslogic.ProductCart; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BarcodeAlreadyExistsException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductAlreadyExistException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.TaxRateNotDefineException; +import org.posterita.struts.core.DefaultForm; + + +public class EditBulkProductFromFileAction extends POSDispatchAction +{ + + /*public static final String VIEW_ALL_POS_PRODUCTS_FOR_UPDATE="viewAllPOSProductsForUpdate"; + public ActionForward viewAllPOSProductsForUpdate(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + ProductBean bean = (ProductBean) df.getBean(); + ArrayList list=null; + + try + { + list = new ArrayList(); + list = POSProductManager.viewAllProducts(ctx,bean.getProductName(),null); + + } + catch(ProductNotFoundException e1) + { + postGlobalError("error.product.not.defined.client",request); + + } + + request.setAttribute(Constants.POS_PRODUCTS_FOR_UPDATE,list); + return mapping.findForward(VIEW_ALL_POS_PRODUCTS_FOR_UPDATE); + } + + public static final String CREATE_CSV_FILE="createCSVFile"; + public ActionForward createCSVFile(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + ProductCart cart = (ProductCart) request.getSession().getAttribute(Constants.PRODUCT_CART); + + if(cart==null) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return new ActionForward("/jsp/pos/viewAllPOSProductsForUpdate.jsp"); + } + String fileName= EditBulkProductFromFileManager.createCSVFile(ctx, cart.getProductIDs()); + String fileURI = ReportManager.getReportURI(fileName,request); + + request.getSession().setAttribute(Constants.FILE_FOR_UPDATE,fileURI); + return mapping.findForward(CREATE_CSV_FILE); + } + + public static final String UPDATE_ALL_PRODUCTS="updateAllProducts"; + public ActionForward updateAllProducts(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + request.getSession().removeAttribute(Constants.PRODUCT_CREATED); + DefaultForm df = (DefaultForm) form; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + EditBulkProductFromFileManager.updateAllProducts(ctx,df.getFile(),trx.getTrxName()); + trx.commit(); + } + catch(ProductAlreadyExistException e) + { + trx.rollback(); + postGlobalError("error.duplicate.product",e.getMessage(),request); + return mapping.getInputForward(); + + } + catch(BarcodeAlreadyExistsException e) + { + trx.rollback(); + postGlobalError("error.duplicate.barcode",e.getMessage(),request); + return mapping.getInputForward(); + } + catch(NumberFormatException e) + { + trx.rollback(); + postGlobalError("error.invalid.number",request); + return mapping.getInputForward(); + } + catch(TaxRateNotDefineException e) + { + trx.rollback(); + postGlobalError("tax.rate.not.defined",e.getMessage(),request); + return mapping.getInputForward(); + } + catch(Exception e) + { + trx.rollback(); + postGlobalError("error.in.file",request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(UPDATE_ALL_PRODUCTS); + + } + + public static final String VIEW_CART = "viewCart"; + public ActionForward viewCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ProductCart cart = (ProductCart) request.getSession().getAttribute(Constants.PRODUCT_CART); + + if( cart == null ) + { + throw new OperationException( "Cart is empty" ); + } + + ArrayList productList = EditBulkProductFromFileManager.getProductList( ctx, cart.getProductIDs() ); + request.getSession().setAttribute( Constants.PRODUCT_CART_ITEMS, productList ); + + return mapping.findForward(VIEW_CART); + } + + public static final String REMOVE = "remove"; + public ActionForward remove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + ProductBean bean = (ProductBean) df.getBean(); + + Integer productId = bean.getProductId(); + + ProductCart cart = (ProductCart) request.getSession().getAttribute(Constants.PRODUCT_CART); + + if( cart == null ) + { + throw new OperationException( "Cart is empty" ); + } + + cart.removeProduct( productId.intValue() ); + + ArrayList productList = EditBulkProductFromFileManager.getProductList( ctx, cart.getProductIDs() ); + request.getSession().setAttribute( Constants.PRODUCT_CART_ITEMS, productList ); + request.getSession().setAttribute( Constants.PRODUCT_CART, cart); + + return mapping.findForward(REMOVE); + } + + + //------------------------------------------------------------------------------------------------------------------------------------------------ + public static final String ADD_TO_CART = "addToCart"; + public ActionForward addToCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + ProductBean bean = (ProductBean) df.getBean(); + + Integer productId = bean.getProductId(); + + ProductCart cart = (ProductCart) request.getSession().getAttribute(Constants.PRODUCT_CART); + + if( cart == null ) + { + cart = new ProductCart( ctx ); + } + + cart = EditBulkProductFromFileManager.addToCart( ctx, cart, productId.intValue() ); + request.getSession().setAttribute(Constants.PRODUCT_CART, cart); + + String script = "setCartCounter("+ cart.getNoOfProducts() +");productAdded("+ productId +")"; + + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public ActionForward clearCart (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + HttpSession session = request.getSession(); + session.removeAttribute(Constants.PRODUCT_CART); + + String script = "clearAll();"; + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + */ +} + diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/FastMovingItemReportAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/FastMovingItemReportAction.java new file mode 100644 index 0000000000..dd7a13a665 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/FastMovingItemReportAction.java @@ -0,0 +1,126 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.Constants; +import org.posterita.beans.ReportBean; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.core.TimestampConvertor; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; + +public class FastMovingItemReportAction extends POSDispatchAction +{ + public static final String GET_CURRENT_DAY_REPORT = "getCurrentDayReport"; + public ActionForward getCurrentDayReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + + Timestamp toDate = new Timestamp(cal.getTimeInMillis()); + + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp fromDate = new Timestamp(cal.getTimeInMillis()); + + ArrayList list=POSReportManager.getMaxMinSoldProducts(ctx,"desc",fromDate,toDate); + request.getSession().setAttribute(Constants.MAX_SOLD_ITEMS,list); + + return mapping.findForward(GET_CURRENT_DAY_REPORT); + } + + public static final String GET_CURRENT_MONTH_REPORT = "getCurrentMonthReport"; + public ActionForward getCurrentMonthReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + + Timestamp toDate = new Timestamp(cal.getTimeInMillis()); + + cal.set(Calendar.DATE,1); + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp fromDate = new Timestamp(cal.getTimeInMillis()); + + ArrayList list=POSReportManager.getMaxMinSoldProducts(ctx,"desc",fromDate,toDate); + request.getSession().setAttribute(Constants.MAX_SOLD_ITEMS,list); + + return mapping.findForward(GET_CURRENT_MONTH_REPORT); + } + + public static final String GET_CUSTOM_REPORT = "getCustomReport"; + public ActionForward getCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + Timestamp fromDate = ReportDateManager.getFromDate(bean); + Timestamp toDate = ReportDateManager.getToDate(bean); + + ArrayList list=POSReportManager.getMaxMinSoldProducts(ctx,"desc",fromDate,toDate); + request.getSession().setAttribute(Constants.MAX_SOLD_ITEMS,list); + + return mapping.findForward(GET_CUSTOM_REPORT); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/GetReportAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/GetReportAction.java new file mode 100644 index 0000000000..556cad2b30 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/GetReportAction.java @@ -0,0 +1,103 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 31-Jul-2006 10:08:46 by praveen + * + */ + +package org.posterita.struts.pos; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.MimeType; + +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; + +public class GetReportAction extends POSAction +{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException + { + + DefaultForm df = (DefaultForm) form; + String reportName = df.getReportName(); + + if(reportName==null) + { + throw new OperationException("Invalid parameter! ReportName cannot be null."); + } + + String mimeType = null; + + if(reportName.endsWith(".csv")) + { + mimeType = "text/comma-separated-values"; + } + else + { + mimeType = MimeType.getMimeType(reportName); + } + + String reportPath = ReportManager.getReportPath(reportName); + + File f = new File(reportPath); + + if(!f.exists()) + { + throw new OperationException("Unable to load " + reportName + ". Cause file not found."); + } + + try + { + response.setContentType(mimeType); + + FileInputStream fis = new FileInputStream(f); + BufferedInputStream bis = new BufferedInputStream(fis); + BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); + + //Transfer bytes from bis to bos + byte[] buf = new byte[1024]; + int len; + while ((len = bis.read(buf)) > 0) + { + bos.write(buf, 0, len); + } + bis.close(); + + bos.flush(); + bos.close(); + + } + catch (Exception e) + { + throw new OperationException(e); + } + + return null; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/GoodsReceiveNoteAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/GoodsReceiveNoteAction.java new file mode 100644 index 0000000000..f344f0c1fb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/GoodsReceiveNoteAction.java @@ -0,0 +1,90 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 22-Sep-2006 11:41:54 by praveen + * + */ + +package org.posterita.struts.pos; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.exceptions.ApplicationException; + +public class GoodsReceiveNoteAction extends POSDispatchAction +{ + public static final String CREATE_GOODS_RECEIVE_NOTE = "createGoodsReceiveNote"; + public static final String ADD_TO_SHOPPING_CART = "addToShoppingCart"; + public static final String DELETE_ORDERLINES = "deleteOrderlines"; + + public static final String INCREMENT_QTY = "incrementQty"; + public static final String DECREMENT_QTY = "decrementQty"; + public static final String DELETE_ORDERLINE = "deleteOrderline"; + + public ActionForward addToShoppingCart(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(ADD_TO_SHOPPING_CART); + } + + public ActionForward deleteOrderlines(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(DELETE_ORDERLINES); + } + + //----------------------------------------------------------------------------------------------------------- + + public ActionForward incrementQty(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(INCREMENT_QTY); + } + + public ActionForward decrementQty(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(DECREMENT_QTY); + } + + public ActionForward deleteOrderline(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(DELETE_ORDERLINE); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/GoodsReturnNoteAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/GoodsReturnNoteAction.java new file mode 100644 index 0000000000..cbeb8303f8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/GoodsReturnNoteAction.java @@ -0,0 +1,77 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 22-Sep-2006 11:42:25 by praveen + * + */ + +package org.posterita.struts.pos; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.exceptions.ApplicationException; + +public class GoodsReturnNoteAction extends POSDispatchAction +{ + public static final String CREATE_GOODS_RETURN_NOTE = "createGoodsReturnNote"; + public static final String ADD_TO_SHOPPING_CART = "addToShoppingCart"; + public static final String INCREMENT_QTY = "incrementQty"; + public static final String DECREMENT_QTY = "decrementQty"; + public static final String DELETE_ORDERLINE = "deleteOrderline"; + + public ActionForward addToShoppingCart(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(ADD_TO_SHOPPING_CART); + } + + public ActionForward incrementQty(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(INCREMENT_QTY); + } + + public ActionForward decrementQty(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(DECREMENT_QTY); + } + + public ActionForward deleteOrderline(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(DELETE_ORDERLINE); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/ImportCustomerAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/ImportCustomerAction.java new file mode 100644 index 0000000000..3d3dae6117 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/ImportCustomerAction.java @@ -0,0 +1,85 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.Trx; + +import org.posterita.Constants; +import org.posterita.beans.CustomerBean; +import org.posterita.businesslogic.administration.ImportCustomerManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BarcodeAlreadyExistsException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductAlreadyExistException; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + +public class ImportCustomerAction extends BaseDispatchAction +{ + public static final String IMPORT_POS_CUSTOMER ="importPOSCustomer"; + public ActionForward importPOSCustomer(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + + ArrayList list = new ArrayList(); + + try + { + list=ImportCustomerManager.importCustomer(ctx, df.getFile(), null); + } + + catch(Exception e) + { + String message = e.getMessage(); + int index = message.indexOf("csv"); + String filename = message.substring(0,index+3); + String error = message.substring(index+3); + postGlobalError("error.process", error, request); + String csvURI = ReportManager.getReportURI(filename,request); + request.getSession().setAttribute(Constants.IMPORT_FAIL_CSV_FILE, csvURI); + return mapping.getInputForward(); + } + + request.getSession().setAttribute(Constants.CUSTOMER_CREATED,list); + // return mapping.findForward(IMPORT_POS_CUSTOMER); + return mapping.getInputForward(); + + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/ImportPOSProductAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/ImportPOSProductAction.java new file mode 100644 index 0000000000..a9cc3933ef --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/ImportPOSProductAction.java @@ -0,0 +1,118 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on May 16, 2006 + */ + + +package org.posterita.struts.pos; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.Constants; +import org.posterita.beans.ProductBean; +import org.posterita.businesslogic.ImportPosProductManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.StoreManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + +public class ImportPOSProductAction extends BaseDispatchAction +{ + public static final String IMPORT_POS_PRODUCT ="importPOSProducts"; + public ActionForward importPOSProducts(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping,form,request,response); + if (fwd!=null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + request.getSession().removeAttribute(Constants.PRODUCT_CREATED); + DefaultForm df = (DefaultForm) form; + ArrayList list=new ArrayList(); + request.getSession().removeAttribute(Constants.IMPORT_FAIL_CSV_FILE); + String salesPListId = df.getSalesPriceListId(); + String purchasePListId = df.getPurchasePriceListId(); + + int purchasePriceListId = StoreManager.getPriceListId(ctx); + int salesPriceListId = POSTerminalManager.getSOPriceListId(ctx); + + if (salesPListId != null) + { + try + { + int soPriceListId = Integer.valueOf(salesPListId); + salesPriceListId = soPriceListId; + } + catch (NumberFormatException e) + { + + } + } + if (purchasePListId != null) + { + try + { + int poPriceListId = Integer.valueOf(purchasePListId); + purchasePriceListId = poPriceListId; + } + catch (NumberFormatException e) + { + } + } + try + { + list=ImportPosProductManager.importSingleProducts(ctx,df.getFile(), salesPriceListId, purchasePriceListId, null); + } + catch(Exception e) + { + + String message = e.getMessage(); + int index = message.indexOf("csv"); + String filename = message.substring(0,index+3); + String error = message.substring(index+3); + postGlobalError("error.process", error, request); + String csvURI = ReportManager.getReportURI(filename,request); + request.getSession().setAttribute(Constants.IMPORT_FAIL_CSV_FILE, csvURI); + return mapping.getInputForward(); + } + finally + { + } + + request.getSession().setAttribute(Constants.PRODUCT_CREATED,list); + return mapping.findForward(IMPORT_POS_PRODUCT); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/InventoryAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/InventoryAction.java new file mode 100644 index 0000000000..9d2d5f77fb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/InventoryAction.java @@ -0,0 +1,472 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Dec 4, 2006 + */ + + +package org.posterita.struts.pos; + +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MInventory; +import org.compiere.process.DocumentEngine; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.InventoryBean; +import org.posterita.beans.InventoryCartBean; +import org.posterita.beans.InventoryLineBean; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.businesslogic.stock.InventoryCartManager; +import org.posterita.businesslogic.stock.InventoryManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.CannotCreateInventoryLineException; +import org.posterita.exceptions.NoCheckBoxSelectedException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.form.InventoryForm; +import org.posterita.form.InventoryLineForm; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + +public class InventoryAction extends BaseDispatchAction +{ + + public static final String CREATE_INVENTORY="createInventory"; + public ActionForward createInventory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + MInventory inventory=null; + + if(bean.getBarCode()!=null && bean.getProductId()==null) + { + int productId=StockManager.getProductIdFromBarCode(ctx,bean.getBarCode()); + bean.setProductId(productId); + } + + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + if(bean.getInventoryId()==null || bean.getInventoryId()==0) + { + inventory=InventoryManager.createInventory(ctx,bean.getDescription(),null); + bean.setInventoryId(inventory.get_ID()); + } + if(bean.getDescription()!=null) + { + MInventory inventory2=new MInventory(ctx,bean.getInventoryId(),null); + inventory2.setDescription(bean.getDescription()); + inventory2.save(); + } + + + InventoryManager.addInventoryLine(ctx,bean.getInventoryId(),bean.getProductId(), new BigDecimal(0), new BigDecimal(1), true,null); + trx.commit(); + } + catch(CannotCreateInventoryLineException e) + { + trx.rollback(); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + postGlobalError("error.cannot.create.inventory.line",request); + return mapping.getInputForward(); + } + catch(ProductNotFoundException e) + { + postGlobalError("error.product.name.required",request); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + return mapping.getInputForward(); + } + + catch(OperationException e) + { + trx.rollback(); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + throw new OperationException(e); + } + finally + { + trx.close(); + } + + If.populate(bean); + + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + + return mapping.findForward(CREATE_INVENTORY); + } + + public static final String SAVE_COUNT_QTY="saveCountQty"; + public ActionForward saveCountQty(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + InventoryManager.saveCountQtyInInventoryLine(ctx,bean.getInventoryLineId(), bean.getQtyCsv(), bean.getQtyCount(), trx.getTrxName()); + trx.commit(); + } + catch(OperationException e) + { + trx.rollback(); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + throw new OperationException(e); + } + finally + { + trx.close(); + } + + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.WHOLE_INVENTORY_LINE_LIST,list); + return mapping.findForward(SAVE_COUNT_QTY); + } + + + public static final String COMPLETE_INVENTORY="completeInventory"; + public ActionForward completeInventory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + InventoryManager.completeStockAdjustment(ctx,bean.getInventoryId()); + + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.COMPLETED_INVENTORY_LINE_LIST,list); + request.removeAttribute(Constants.INVENTORY_LINE_LIST); + request.removeAttribute(Constants.WHOLE_INVENTORY_LINE_LIST); + return mapping.findForward(COMPLETE_INVENTORY); + } + + + public static final String VIEW_INVENTORY_HISTORY="viewInventoryHistory"; + public ActionForward viewInventoryHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm If = (DefaultForm)form; + + Properties ctx =TmkJSPEnv.getCtx(request); + ArrayList list = InventoryManager.viewInventoryHistory(ctx); + request.setAttribute(Constants.INVENTORY_HISTORY_LIST,list); + return mapping.findForward(VIEW_INVENTORY_HISTORY); + } + + public ActionForward getInventoryHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm If = (DefaultForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + + Properties ctx =TmkJSPEnv.getCtx(request); + ArrayList list = InventoryManager.viewInventory(ctx, bean.getDocStatus(), bean.getMonth(), bean.getYear()); + request.setAttribute(Constants.INVENTORY_HISTORY_LIST,list); + return mapping.findForward(VIEW_INVENTORY_HISTORY); + } + + public ActionForward searchProductInInventory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm If = (DefaultForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + ArrayList list = null; + + Properties ctx =TmkJSPEnv.getCtx(request); + try + { + list = InventoryManager.searchProductInInventory(ctx, bean.getProductId(), bean.getBarCode()); + } + catch(Exception e) + { + postComplexGlobalError("error.notfound", new Object[]{e.getMessage()}, request); + } + request.setAttribute(Constants.INVENTORY_HISTORY_LIST, list); + return mapping.findForward(VIEW_INVENTORY_HISTORY); + } + + public static final String DELETE_INVENTORY="deleteInventory"; + public ActionForward deleteInventory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + InventoryManager.deleteInventory(ctx,bean.getInventoryId().intValue()); + InventoryCartManager.clearInventorycart(ctx, request); + ArrayList list = InventoryManager.viewInventoryHistory(ctx); + request.setAttribute(Constants.INVENTORY_HISTORY_LIST,list); + return mapping.findForward(DELETE_INVENTORY); + } + + public static final String DELETE_INVENTORY_LINE="deleteInventoryLine"; + public ActionForward deleteInventoryLine(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + InventoryManager.deleteInventoryLine(ctx,bean.getInventoryId().intValue(),bean.getInventoryLineId().intValue()); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + + return mapping.findForward(DELETE_INVENTORY_LINE); + } + + public static final String VIEW_INVENTORY="viewInventory"; + public ActionForward viewInventory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryLineForm If = (InventoryLineForm)form; + InventoryLineBean bean = (InventoryLineBean) If.getBean(); + + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + If.populate(bean); + if(InventoryManager.getInventoryDocStatus(ctx,bean.getInventoryId()).equals(DocumentEngine.STATUS_Drafted)) + { + InventoryCartBean cartBean = null; + + for (InventoryLineBean inventoryLineBean : list) + { + cartBean = StockManager.addToInventoryCart(ctx, inventoryLineBean, cartBean, false, true); + bean.setDocStatus(inventoryLineBean.getDocStatus()); + bean.setDocumentNo(inventoryLineBean.getDocumentNo()); + } + + If.populate(bean); + request.getSession().setAttribute(Constants.INVENTORY_CART_ITEMS, cartBean.getItems()); + request.getSession().setAttribute(Constants.INVENTORY_CART, cartBean); + request.getSession().setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + + Env.setContext(ctx, Constants.INVENTORY_ID, bean.getInventoryId()); + Env.setContext(ctx, Constants.DESCRIPTION, bean.getDescription()); + request.getSession().setAttribute(Constants.DOC_NO, bean.getDocumentNo()); + request.getSession().setAttribute(Constants.DOC_STATUS, bean.getDocStatus()); + + return new ActionForward("/initInventoryCart.do"); + } + else + { + request.setAttribute(Constants.COMPLETED_INVENTORY_LINE_LIST,list); + return new ActionForward("/CompletedAdjustmentStock.do"); + } + + } + + public static final String CREATE_WHOLE_INVENTORY="createWholeInventory"; + public ActionForward createWholeInventory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + MInventory inventory=null; + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { trx.start(); + if(bean.getInventoryId()==null || bean.getInventoryId()==0) + { + inventory=InventoryManager.createInventory(ctx,bean.getDescription(),trx.getTrxName()); + bean.setInventoryId(inventory.get_ID()); + } + + InventoryManager.addAllProductsInventoryLine(ctx,bean.getInventoryId(),trx.getTrxName()); + + trx.commit(); + } + catch(OperationException e) + { + trx.rollback(); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + throw new OperationException(e); + } + finally + { + trx.close(); + } + + ArrayList list = InventoryManager.getInventoryLines(ctx, inventory.getM_Inventory_ID()); + InventoryCartBean cartBean = null; + + for (InventoryLineBean inventoryLineBean : list) + { + cartBean = StockManager.addToInventoryCart(ctx, inventoryLineBean, cartBean, false, true); + } + + request.getSession().setAttribute(Constants.INVENTORY_CART_ITEMS, cartBean.getItems()); + request.getSession().setAttribute(Constants.INVENTORY_CART, cartBean); + request.getSession().setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + + Env.setContext(ctx, Constants.INVENTORY_ID, inventory.getM_Inventory_ID()); + Env.setContext(ctx, Constants.DESCRIPTION, inventory.getDescription()); + request.getSession().setAttribute(Constants.DOC_NO, inventory.getDocumentNo()); + request.getSession().setAttribute(Constants.DOC_STATUS, inventory.getDocStatus()); + + return new ActionForward("/initInventoryCart.do"); + } + + public static final String CREATE_CSV_FILE_FOR_INVENTORY="createCSVFileForInventory"; + public ActionForward createCSVFileForInventory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + String reportName = InventoryManager.createCSVForInventory(ctx,list); + String reportURI=ReportManager.getReportURI(reportName,request); + response.sendRedirect(reportURI); + return null; + + } + + + public static final String MERGE_INVENTORY_TO_CREATE_ONE="mergeInventoryToCreateOne"; + public ActionForward mergeInventoryToCreateOne(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryForm If = (InventoryForm)form; + InventoryBean bean = (InventoryBean) If.getBean(); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + MInventory inventory =null; + try + { + inventory = InventoryManager.mergeInventory(ctx,bean,null); + trx.commit(); + } + catch(NoCheckBoxSelectedException e) + { + trx.rollback(); + ArrayList list = InventoryManager.viewInventoryHistory(ctx); + request.setAttribute(Constants.INVENTORY_HISTORY_LIST,list); + postGlobalError("error.no.checkbox.selected",request); + return mapping.getInputForward(); + } + catch(CannotCreateInventoryLineException e1) + { + trx.rollback(); + ArrayList list = InventoryManager.viewInventoryHistory(ctx); + request.setAttribute(Constants.INVENTORY_HISTORY_LIST,list); + postGlobalError("error.cannot.create.inventory.line",request); + return mapping.getInputForward(); + } + + catch(OperationException e2) + { + trx.rollback(); + throw new OperationException(e2); + } + finally + { + trx.close(); + } + + ArrayList list = InventoryManager.getInventoryLines(ctx, inventory.getM_Inventory_ID()); + InventoryCartBean cartBean = null; + + for (InventoryLineBean inventoryLineBean : list) + { + cartBean = StockManager.addToInventoryCart(ctx, inventoryLineBean, cartBean, false, true); + } + + request.getSession().setAttribute(Constants.INVENTORY_CART_ITEMS, cartBean.getItems()); + request.getSession().setAttribute(Constants.INVENTORY_CART, cartBean); + request.getSession().setAttribute(Constants.INVENTORY_ID, inventory.getM_Inventory_ID()); + + Env.setContext(ctx, Constants.INVENTORY_ID, inventory.getM_Inventory_ID()); + Env.setContext(ctx, Constants.DESCRIPTION, inventory.getDescription()); + request.getSession().setAttribute(Constants.DOC_NO, inventory.getDocumentNo()); + request.getSession().setAttribute(Constants.DOC_STATUS, inventory.getDocStatus()); + + return new ActionForward("/initInventoryCart.do"); + + } +} + \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/InventoryCartAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/InventoryCartAction.java new file mode 100644 index 0000000000..14b9de5b46 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/InventoryCartAction.java @@ -0,0 +1,674 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * + * @author shameem + */ + +package org.posterita.struts.pos; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.apache.struts.upload.FormFile; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MInventory; +import org.compiere.model.MInventoryLine; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.compiere.utils.DBUtils; +import org.posterita.Constants; +import org.posterita.beans.InventoryCartBean; +import org.posterita.beans.InventoryLineBean; +import org.posterita.beans.ItemBean; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.businesslogic.stock.InventoryCartManager; +import org.posterita.businesslogic.stock.InventoryManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.TabularReport; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.CannotCreateInventoryLineException; +import org.posterita.exceptions.InputQuantityLessThanZeroException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.exceptions.QuantityNotAvailableException; +import org.posterita.exceptions.UOMValuePrecisionNotValidException; +import org.posterita.form.InventoryLineForm; +import org.posterita.struts.core.DefaultForm; + +import com.lowagie.text.DocumentException; + +public class InventoryCartAction extends POSDispatchAction +{ + private static final CLogger logger = CLogger.getCLogger(InventoryCartAction.class); + + public static final String INCREMENT_QTY = "incrementQty"; + public ActionForward incrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + // Bug fix for null pointer + InventoryLineForm of = (InventoryLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + addToInventoryCart(mapping,form,request,response); + return getInventoryCart(mapping,form,request,response); + } + + public static final String DECREMENT_QTY = "decrementQty"; + public ActionForward decrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + // Bug fix for null pointer + InventoryLineForm of = (InventoryLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + addToInventoryCart(mapping,form,request,response); + return getInventoryCart(mapping,form,request,response); + } + + public ActionForward addProduct(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException, ParseException + { + // Bug fix for null pointer + InventoryLineForm of = (InventoryLineForm) form; + if(of.getQtyCount() == null) + { + of.setQtyCount("1"); + } + + addToInventoryCart(mapping,form,request,response); + + return getInventoryCart(mapping,form,request,response); + } + + public static final String UPDATE_QTY = "updateQty"; + public ActionForward updateQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx=TmkJSPEnv.getCtx(request); + + // Bug fix for null pointer + InventoryLineForm of = (InventoryLineForm) form; + if(of.getQtyCount() == null) + { + of.setQtyCount("1"); + } + + InventoryLineBean bean = (InventoryLineBean) of.getBean(); + Integer product_id = bean.getProductId(); + bean.setQtyCount(new BigDecimal(of.getQtyCount())); + Integer priceListId = bean.getPriceListId(); + of.populate(bean); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.INVENTORY_CART_ITEMS); + StockManager.updateItemFromInventoryList(ctx, priceListId, items, product_id, bean.getQtyCount().intValue()); + request.getSession().setAttribute(Constants.INVENTORY_CART_ITEMS, items); + + return getInventoryCart(mapping, form, request, response); + } + + + public static final String ADD_TO_INVENTORY_CART = "addToInventoryCart"; + public ActionForward addToInventoryCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + InventoryLineForm df = (InventoryLineForm) form; + InventoryLineBean bean = (InventoryLineBean) df.getBean(); + + String inventoryCart = Constants.INVENTORY_CART; + String inventoryCartItems = Constants.INVENTORY_CART_ITEMS; + + InventoryCartBean cartBean = (InventoryCartBean) request.getSession().getAttribute(inventoryCart); + + try + { + if(bean.getProductId()==null && bean.getBarCode()==null) + { + postGlobalError("error.barcode.required", request); + return mapping.getInputForward(); + } + + BigDecimal qty = bean.getQtyCount(); + if(qty != null && qty.doubleValue() < 0.0) + { + throw new InputQuantityLessThanZeroException(""); + } + + cartBean = StockManager.addToInventoryCart(ctx, bean, cartBean,true,Boolean.parseBoolean(bean.getIfAdd())); + } + catch (InputQuantityLessThanZeroException e) + { + postGlobalError("error.invalid.inputQty", request); + return mapping.getInputForward(); + } + catch (ProductNotFoundException e) + { + postGlobalError("error.product.not.found", e.getMessage(), request); + return mapping.getInputForward(); + } + catch(QuantityNotAvailableException e) + { + postGlobalError("error.quantity.notAvailable", e.getMessage(), request); + return mapping.getInputForward(); + } + + catch(ProductNotOnPriceListException e) + { + postGlobalError("error.product.price.not.found", e.getMessage(), request); + return mapping.getInputForward(); + } + + catch (UOMValuePrecisionNotValidException e) + { + postGlobalError("error.precision", e.getMessage(), request); + return mapping.getInputForward(); + } + + String currSymboleSales = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales); + + + request.getSession().setAttribute(inventoryCart, cartBean); + request.getSession().setAttribute(inventoryCartItems, cartBean.getItems()); + + df.setQtyAndItem(""); + + return mapping.findForward(ADD_TO_INVENTORY_CART); + } + + public ActionForward getInventoryCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, IOException, ParseException + { + DefaultForm df = (DefaultForm) form; + + String shoppingcartHTML = InventoryCartManager.getInventoryCartAsHTML(request); + + PrintWriter writer = response.getWriter(); + writer.write(shoppingcartHTML); + + + ActionMessages errors = (ActionMessages) request.getAttribute("org.apache.struts.action.ERROR"); + if(errors != null && !errors.isEmpty()) + { + MessageResources messageResources = getResources(request); + + Iterator iter = errors.get(); + while(iter.hasNext()) + { + ActionMessage message = iter.next(); + String key = message.getKey(); + Object[] values = message.getValues(); + + String errMsg = messageResources.getMessage(key, values); + writer.write(""); + } + + } + + writer.close(); + + return null; + } + + public static final String RELOAD_CART = "reloadCart"; + public ActionForward reloadCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + return getInventoryCart(mapping,form,request,response); + } + + public ActionForward clearCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + + Properties ctx = TmkJSPEnv.getCtx(request); + Object inventoryIdAsStr = request.getSession().getAttribute(Constants.INVENTORY_ID); + Integer inventoryId = 0; + + if(inventoryIdAsStr != null) + { + inventoryId = Integer.parseInt(inventoryIdAsStr.toString()); + } + + + if(inventoryId != 0) + { + MInventory inventory = new MInventory(ctx, inventoryId,null); + inventory.delete(true); + } + + InventoryCartManager.clearInventorycart(ctx, request); + + return getInventoryCart(mapping, form, request, response); + } + + public static final String AUTO_SAVE_INVENTORY_LINES = "autoSaveInventoryLines"; + public ActionForward autoSaveInventoryLines(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd=init(mapping,form,request,response); + + if(fwd!=null) + { + return fwd; + } + + String inventoryCart = Constants.INVENTORY_CART; + String inventoryCartItems = Constants.INVENTORY_CART_ITEMS; + + InventoryCartBean cartBean = (InventoryCartBean) request.getSession().getAttribute(inventoryCart); + + Properties ctx=TmkJSPEnv.getCtx(request); + + String description = request.getParameter("description"); + String priceListIdAsStr = request.getParameter("priceListId"); + String inventoryIdAsStr = request.getParameter("inventoryId"); + int priceListId = Integer.parseInt(priceListIdAsStr); + int inventoryId = Integer.parseInt(inventoryIdAsStr); + + DefaultForm df = (DefaultForm)form; + InventoryLineBean bean = (InventoryLineBean) df.getBean(); + bean.setPriceListId(priceListId); + bean.setDescription(description); + bean.setInventoryId(inventoryId); + df.populate(bean); + + String docNo = null; + String docStatus = null; + String docInfo = null; + + MInventory inventory=null; + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.INVENTORY_CART_ITEMS); + + if(bean.getInventoryId() == null || bean.getInventoryId() == 0) + { + inventory= InventoryCartManager.createInventory(ctx,bean.getDescription(),null); + docNo = inventory.getDocumentNo(); + docStatus = inventory.getDocStatus(); + docInfo = inventory.getDocumentInfo(); + bean.setDocumentNo(docNo); + bean.setInventoryId(inventory.get_ID()); + } + else + { + MInventory inventory2 = new MInventory(ctx, bean.getInventoryId(),null); + inventory2.setDescription(description); + docNo = inventory2.getDocumentNo(); + docStatus = inventory2.getDocStatus(); + docInfo = inventory2.getDocumentInfo(); + inventory2.save(); + + InventoryCartManager.deleteInventoryLines(ctx, inventory2.getM_Inventory_ID()); + } + + + try + { + trx.start(); + + for (ItemBean itemBean : items) + { + InventoryCartManager.addInventoryLine(ctx, bean.getInventoryId(), itemBean.getProductId() , itemBean.getQtyBook(), itemBean.getQtyCount(), itemBean.getQtyCsv(), true, trx.getTrxName()); + } + + trx.commit(); + } + catch(CannotCreateInventoryLineException e) + { + trx.rollback(); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.getSession().setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.getSession().setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + postGlobalError("error.cannot.create.inventory.line",request); + return mapping.getInputForward(); + } + catch(ProductNotFoundException e) + { + postGlobalError("error.product.name.required",request); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.getSession().setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.getSession().setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + return mapping.getInputForward(); + } + + catch(OperationException e) + { + trx.rollback(); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.setAttribute(Constants.INVENTORY_ID,bean.getInventoryId()); + throw new OperationException(e); + } + finally + { + trx.close(); + } + + df.populate(bean); + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.getSession().setAttribute(Constants.DOC_NO, docNo); + request.getSession().setAttribute(Constants.DOC_STATUS, docStatus); + request.getSession().setAttribute(Constants.INVENTORY_LINE_LIST,list); + request.getSession().setAttribute(Constants.INVENTORY_ID, bean.getInventoryId()); + request.getSession().setAttribute(Constants.DESCRIPTION, description); + + Env.setContext(ctx, Constants.INVENTORY_ID, bean.getInventoryId()); + Env.setContext(ctx, Constants.DESCRIPTION, description); + + request.getSession().setAttribute(Constants.INVENTORY_ID, bean.getInventoryId()); + + if((MInventory.DOCSTATUS_Drafted).equals(docStatus)) + { + docStatus = "DRAFTED"; + } + + if((MInventory.DOCSTATUS_Completed).equals(docStatus)) + { + docStatus = "COMPLETED"; + } + + if((MInventory.DOCSTATUS_Closed).equals(docStatus)) + { + docStatus = "CLOSED"; + } + + StringBuffer sb = new StringBuffer(); + sb.append("{"); + sb.append("inventoryID: \"" + bean.getInventoryId() + "\""); + sb.append(", docNo: \"" + docNo + "\""); + sb.append(", docStatus: \"" + docStatus + "\""); + sb.append(", docInfo: \"" + docInfo + "\""); + sb.append(", description: \"" + bean.getDescription() + "\""); + sb.append("}"); + + PrintWriter writer = response.getWriter(); + writer.print( sb.toString() ); + writer.flush(); + writer.close(); + + return null; + } + + public static final String GENERATE_INVENTORY_CSV = "generateInventoryCSV"; + public ActionForward generateInventoryCSV(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryLineForm If = (InventoryLineForm)form; + InventoryLineBean bean = (InventoryLineBean) If.getBean(); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.INVENTORY_CART_ITEMS); + String reportName = InventoryCartManager.createCSVForInventory(ctx,items); + String reportURI = ReportManager.getReportURI(reportName,request); + response.sendRedirect(reportURI); + + return null; + + } + + public ActionForward printInventory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException, SQLException, DocumentException, ParseException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + InventoryLineBean bean = (InventoryLineBean) df.getBean(); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + String description = Env.getContext(ctx, Constants.DESCRIPTION); + + String inventoryCart = Constants.INVENTORY_CART; + String inventoryCartItems = Constants.INVENTORY_CART_ITEMS; + + InventoryCartBean cartBean = (InventoryCartBean) request.getSession().getAttribute(inventoryCart); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.INVENTORY_CART_ITEMS); + ArrayList reportData = InventoryCartManager.getInventoryData(ctx, items, trx.getTrxName()); + + String title = description; + String subtitle = null; + byte printData[] = null; + + String sql = "Select Name from AD_Org where AD_org_ID=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + + pstmt = DB.prepareStatement(sql, null); + pstmt.setInt(1, Env.getAD_Org_ID(ctx)); + + try + { + rs = pstmt.executeQuery(); + + if (rs.next()) + { + subtitle = rs.getString(1); + } + + } + catch(SQLException e) + { + throw new OperationException(e); + } + finally + { + DBUtils.close(rs); + DBUtils.close(pstmt); + } + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle(title); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + printData = tReport.getInventoryData(); + response.setContentType("application/pdf"); + + OutputStream os = response.getOutputStream(); + os.write(printData); + os.flush(); + os.close(); + + return null; + + } + + public static final String COMPLETE_INVENTORY_ADJUSTMENT="completeInventoryAdjustment"; + public ActionForward completeInventoryAdjustment(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + InventoryLineForm If = (InventoryLineForm)form; + InventoryLineBean bean = (InventoryLineBean) If.getBean(); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.INVENTORY_CART_ITEMS); + + try + { + + if(bean.getInventoryId() == null || bean.getInventoryId()==0) + { + MInventory inventory= InventoryCartManager.createInventory(ctx,bean.getDescription(),null); + bean.setInventoryId(inventory.get_ID()); + bean.setDocumentNo(inventory.getDocumentNo()); + bean.setDocStatus(inventory.getDocStatus()); + inventory.save(); + + trx.start(); + + for (ItemBean itemBean : items) + { + InventoryCartManager.addInventoryLine(ctx, bean.getInventoryId(), itemBean.getProductId() , itemBean.getQtyBook(), itemBean.getQtyCount(), itemBean.getQtyCsv(), true, trx.getTrxName()); + } + + trx.commit(); + + InventoryManager.completeStockAdjustment(ctx,bean.getInventoryId()); + } + else + { + InventoryCartManager.deleteInventoryLines(ctx, bean.getInventoryId()); + + trx.start(); + + for (ItemBean itemBean : items) + { + InventoryCartManager.addInventoryLine(ctx, bean.getInventoryId(), itemBean.getProductId() , itemBean.getQtyBook(), itemBean.getQtyCount(), itemBean.getQtyCsv(), true, trx.getTrxName()); + } + + trx.commit(); + + + + InventoryManager.completeStockAdjustment(ctx,bean.getInventoryId()); + } + + } + catch (OperationException e) + { + trx.rollback(); + trx.close(); + } + + request.setAttribute(Constants.DOC_NO, null); + request.setAttribute(Constants.DOC_STATUS, null); + + request.setAttribute("cartTotalCsv", null); + request.setAttribute("cartTotalBook", null); + request.setAttribute("cartTotalCount", null); + + ArrayList list = InventoryManager.getInventoryLines(ctx,bean.getInventoryId()); + request.setAttribute(Constants.COMPLETED_INVENTORY_LINE_LIST, list); + + request.setAttribute(Constants.INVENTORY_LINE_LIST, null); + request.setAttribute(Constants.INVENTORY_ID, null); + + InventoryCartManager.clearInventorycart(ctx, request); + + return mapping.findForward(COMPLETE_INVENTORY_ADJUSTMENT); + } + + public static final String ADD_STOCK_SHEETS = "addStockSheets"; + public ActionForward addStockSheets(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + FormFile file = df.getFile(); + + if(file.getFileName().trim().equals("")) + { + postGlobalError("error.file.not.found", request); + return mapping.getInputForward(); + } + + Properties ctx =TmkJSPEnv.getCtx(request); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + InventoryLineForm If = (InventoryLineForm)form; + InventoryLineBean bean = (InventoryLineBean) If.getBean(); + request.getSession().removeAttribute(Constants.IMPORT_FAIL_CSV_FILE); + + String inventoryCart = Constants.INVENTORY_CART; + String inventoryCartItems = Constants.INVENTORY_CART_ITEMS; + + ArrayList items = (ArrayList) request.getSession().getAttribute(inventoryCartItems); + + InventoryCartBean cartBean = (InventoryCartBean) request.getSession().getAttribute(inventoryCart); + + try + { + cartBean = InventoryCartManager.addItemsFromCsv(ctx, file, bean, cartBean, trx.getTrxName()); + } + catch(Exception e) + { + + String message = e.getMessage(); + + + if(message != null) + { + int index = message.indexOf("csv"); + String filename = message.substring(0,index+3); + String error = message.substring(index+3); + postGlobalError("error.process", error, request); + String csvURI = ReportManager.getReportURI(filename,request); + request.getSession().setAttribute(Constants.IMPORT_FAIL_CSV_FILE, csvURI); + } + else + { + postGlobalError("error.process", e.toString() , request); + } + + return new ActionForward("/jsp/pos/inventoryImportErrors.jsp"); + } + finally + { + + } + + request.getSession().setAttribute(inventoryCart, cartBean); + request.getSession().setAttribute(inventoryCartItems, cartBean.getItems()); + + return new ActionForward("/initInventoryCart.do"); + + } + + public ActionForward newInventoryCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx =TmkJSPEnv.getCtx(request); + InventoryCartManager.clearInventorycart(ctx, request); + return new ActionForward("/initInventoryCart.do"); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSAction.java new file mode 100644 index 0000000000..4e704ac2bb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSAction.java @@ -0,0 +1,50 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.exceptions.ApplicationException; +import org.posterita.struts.core.BaseAction; + +public class POSAction extends BaseAction +{ + public static final String POS_LOGIN = "posLogin"; + + public final ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = super.init(mapping,form,request,response); + + if(fwd!=null) + { + return mapping.findForward(POS_LOGIN); + } + + return fwd; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSAttributesAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSAttributesAction.java new file mode 100644 index 0000000000..a2e96fcf59 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSAttributesAction.java @@ -0,0 +1,140 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on May 23, 2006 by ashley +* +*/ + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.AttributeValueDetailBean; +import org.posterita.beans.ProductKeywordsBean; +import org.posterita.businesslogic.AttributeValuesManager; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.form.EditAttributeForm; +import org.posterita.struts.core.DefaultForm; + +public class POSAttributesAction extends POSDispatchAction +{ + public static final String INIT_VIEW_ATTRIBUTEVALUES = "initViewAttributeValues"; + public ActionForward initViewAttributeValues(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList attributeList = AttributeValuesManager.getAttributes(ctx); + + request.getSession().setAttribute(Constants.ATTRIBUTE_LIST, attributeList); + + return mapping.findForward(INIT_VIEW_ATTRIBUTEVALUES); + } + + public static final String LIST_ATTRIBUTEVALUES = "listAttributeValues"; + public ActionForward listAttributeValues(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm)form; + + AttributeValueDetailBean attrValBean = (AttributeValueDetailBean)df.getBean(); + + ArrayList attributeValuesList = AttributeValuesManager.getAttributeValues(ctx, attrValBean.getAttributeId().intValue()); + + request.setAttribute(Constants.ATTRIBUTE_VALUES_LIST, attributeValuesList); + + return mapping.findForward(LIST_ATTRIBUTEVALUES); + } + + public static final String INIT_EDIT_ATTRIBUTEVALUE = "initEditAttributeValue"; + public ActionForward initEditAttributeValue(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + return mapping.findForward(INIT_EDIT_ATTRIBUTEVALUE); + } + + public static final String EDIT_ATTRIBUTEVALUE = "editAttributeValue"; + /*public ActionForward editAttributeValue(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + EditAttributeForm df = (EditAttributeForm)form; + ActionErrors errors = df.validate(mapping,request); + + if(!errors.isEmpty()) + { + postGlobalError("error.required","New Name",request); + return mapping.getInputForward(); + } + + AttributeValueDetailBean attrBean = (AttributeValueDetailBean)df.getBean(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + + try + { + trx.start(); + int newAttrValueId = AttributeValuesManager.changeAttributeValue(ctx, attrBean.getAttributeValueId().intValue(), attrBean.getNewName(), trx.getTrxName()); + ProductManager.updateProductsAttribute(ctx, attrBean.getAttributeValueId().intValue(), newAttrValueId, attrBean.getAttributeId().intValue(), trx.getTrxName()); + trx.commit(); + } + catch(Exception ex) + { + trx.rollback(); + postGlobalError("error.updating.attribute", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + + return mapping.findForward(EDIT_ATTRIBUTEVALUE); + } */ + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSDispatchAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSDispatchAction.java new file mode 100644 index 0000000000..9b740400e7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSDispatchAction.java @@ -0,0 +1,46 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + + + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.struts.core.BaseDispatchAction; + +public class POSDispatchAction extends BaseDispatchAction +{ + + public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + TmkJSPEnv.getCtx(request); + return super.init(mapping, form, request, response); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSGoodsAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSGoodsAction.java new file mode 100644 index 0000000000..3dad34919a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSGoodsAction.java @@ -0,0 +1,1457 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 27-Apr-2006 + */ + + +package org.posterita.struts.pos; + +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MBPartner; +import org.compiere.model.MInOut; +import org.compiere.model.MOrder; +import org.compiere.model.MPayment; +import org.compiere.model.MProduct; +import org.compiere.process.DocAction; +import org.compiere.process.DocumentEngine; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.ItemBean; +import org.posterita.beans.OrderBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.POSSupplierBean; +import org.posterita.beans.ProductBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.OrderManager; +import org.posterita.businesslogic.OrderReferenceManager; +import org.posterita.businesslogic.POSGoodsManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSProductManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.SessionStorage; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BPartnerNoLocationException; +import org.posterita.exceptions.BPartnerOverCreditLimitException; +import org.posterita.exceptions.InputQuantityLessThanZeroException; +import org.posterita.exceptions.InvalidOrderIDException; +import org.posterita.exceptions.NoOrderLineFoundException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.exceptions.QuantityNotAvailableException; +import org.posterita.exceptions.UOMValuePrecisionNotValidException; +import org.posterita.form.OrderLineForm; +import org.posterita.form.POSProductForm; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; +import org.posterita.struts.core.DefaultForm; + + +public class POSGoodsAction extends POSDispatchAction +{ + public static final String CREATE_POS_GOODS_RECEIVE_NOTE="createPOSGoodsReceiveNote"; + public ActionForward createPOSGoodsReceiveNote(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd= init(mapping,form,request,response); + + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + Integer bPartnerId = bean.getBpartnerId(); + String supplierRef = bean.getDescription(); + + MOrder previousOrder= null; + previousOrder=(MOrder)request.getSession().getAttribute(Constants.PRESENT_GRN_ORDER); + + if(previousOrder!=null) + { + bean.setOrderId(Integer.valueOf(previousOrder.get_ID())); + } + else + { + bean.setOrderId(null); + } + + if( bPartnerId == null ) + { + //see if we have previously saved bpartnerId + bPartnerId= (Integer) request.getSession().getAttribute(Constants.B_PARTNER_ID); + } + else + { + //set the new bpartnerId in session + request.getSession().setAttribute(Constants.B_PARTNER_ID, bPartnerId); + } + + if( supplierRef == null ) + { + //see if we have previously saved supplierRef + supplierRef=(String) request.getSession().getAttribute(Constants.DESCRIPTION); + } + else + { + //set new supplierRef in session + request.getSession().setAttribute(Constants.DESCRIPTION, supplierRef); + } + + if( bPartnerId == null ) + { + postGlobalError("error.required.supplierName", request); + return mapping.getInputForward(); + } + + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART); + + if(cartBean == null||cartBean.getItems() == null||cartBean.getItems().size() == 0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + MOrder goodsReceiveNote = null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + goodsReceiveNote = POSGoodsManager.createGoodsReceiveNote(ctx,bean,cartBean.getItems(),bPartnerId,supplierRef,trx.getTrxName()); + trx.commit(); + } + catch(BPartnerNoLocationException ex) + { + trx.rollback(); + postGlobalError("error.bpartner.nolocation", request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + throw (e); + } + finally + { + trx.close(); + } + + // Reset transaction as it has already been committed and closed + goodsReceiveNote.set_TrxName(null); + + bean.setOrderId(Integer.valueOf(goodsReceiveNote.get_ID())); + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx,goodsReceiveNote); + ArrayList list = POSManager.populateOrderLines(ctx,goodsReceiveNote); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + + request.getSession().setAttribute(Constants.GOODS_RECEIVE_NOTE_ID,goodsReceiveNote.get_ID()); + request.setAttribute(Constants.GOODS_RECEIVE_NOTE_LINES,list); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); +/* SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean);*/ + request.getSession().removeAttribute(Constants.PRESENT_GRN_ORDER); + request.getSession().removeAttribute(Constants.PRESENT_GRN_ORDER_ID); + + return mapping.findForward(CREATE_POS_GOODS_RECEIVE_NOTE); + } + + public static final String COMPLETE_GOODS_RECEIVE_NOTE="completeGoodsReceiveNote"; + public ActionForward completeGoodsReceiveNote(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + //OrderLineBean bean=(OrderLineBean) df.getBean(); + Integer goodsReceiveNoteId=(Integer) request.getSession().getAttribute(Constants.GOODS_RECEIVE_NOTE_ID); + + MOrder completedGRN=null; + + Trx trx =Trx.get(TrxPrefix.getPrefix(),true); + + if(goodsReceiveNoteId==null) + { + postGlobalError("error.no.order.exists",request); + return mapping.getInputForward(); + } + + try + { + trx.start(); + completedGRN=POSGoodsManager.createAndCompletePODocuments(ctx,goodsReceiveNoteId,null); + trx.commit(); + } + catch(NoOrderLineFoundException e) + { + trx.rollback(); + postGlobalError("error.pos.no.orderline",request); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + throw new OperationException("Could not complete documents. Reason: " + e); + + } + finally + { + trx.close(); + } + + + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx,completedGRN); + ArrayList list = POSManager.populateOrderLines(ctx,completedGRN); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + + //request.getSession().setAttribute(Constants.GOODS_RECEIVE_NOTE_ID,completedGRN.get_ID()); + request.setAttribute(Constants.GOODS_RECEIVE_NOTE_LINES,list); + /*request.removeAttribute(Constants.POS_ORDER_LINES);*/ + + + + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_ID); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.PRESENT_GRN_ORDER); + request.getSession().removeAttribute(Constants.PRESENT_GRN_ORDER_ID); + + request.removeAttribute(Constants.DESCRIPTION); + + return mapping.findForward(COMPLETE_GOODS_RECEIVE_NOTE); + } + + + public static final String CREATE_POS_GOODS_RETURN_NOTE="createPOSGoodsReturnNote"; + public ActionForward createPOSGoodsReturnNote(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + + Integer bPartnerId = bean.getBpartnerId(); + String supplierRef = bean.getDescription(); + BigDecimal quantity = bean.getQuantity(); + + if( bPartnerId == null ) + { + //see if we have previously saved bpartnerId + bPartnerId= (Integer) request.getSession().getAttribute(Constants.B_PARTNER_ID); + } + else + { + //set the new bpartnerId in session + request.getSession().setAttribute(Constants.B_PARTNER_ID, bPartnerId); + } + + if ( quantity == null) + { + throw new OperationException("Quantity cannot be null"); + } + if( quantity.equals(0) == true) + { + throw new OperationException("Quantity cannot be zero"); + } + + if( supplierRef == null ) + { + //see if we have previously saved supplierRef + supplierRef=(String) request.getSession().getAttribute(Constants.DESCRIPTION); + } + else + { + //set new supplierRef in session + request.getSession().setAttribute(Constants.DESCRIPTION, supplierRef); + } + + if( bPartnerId == null ) + { + postGlobalError("error.required.supplierName", request); + return mapping.getInputForward(); + } + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + //ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART); + + if(items == null || items.size() == 0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + MOrder previousOrder= null; + previousOrder=(MOrder)request.getSession().getAttribute(Constants.PRESENT_GOODS_RET_ORDER); + + if(previousOrder!=null) + { + bean.setOrderId(Integer.valueOf(previousOrder.get_ID())); + } + else + { + bean.setOrderId(null); + } + MOrder goodsReturnNote=null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + bean.getDescription(); + try + { + trx.start(); + goodsReturnNote= POSGoodsManager.createGoodsReturnNote(ctx,bean,items,bPartnerId,supplierRef,trx.getTrxName()); + trx.commit(); + + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + + catch(BPartnerNoLocationException ex) + { + trx.rollback(); + postGlobalError("error.bpartner.nolocation", request); + return mapping.getInputForward(); + } + catch (OperationException e) + { + trx.rollback(); + throw new OperationException("Could not create goods return note: Reason :" + e); + } + finally + { + trx.close(); + } + bean.setOrderId(Integer.valueOf(goodsReturnNote.get_ID())); + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx,goodsReturnNote); + ArrayList list = POSManager.populateOrderLines(ctx,goodsReturnNote); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + request.setAttribute(Constants.GOODS_RETURN_NOTE_LINES,list); + request.getSession().setAttribute(Constants.GOODS_RETURN_NOTE_ID,goodsReturnNote.get_ID()); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + request.getSession().removeAttribute(Constants.PRESENT_GOODS_RET_ORDER); + request.getSession().removeAttribute(Constants.PRESENT_GOODS_RET_ORDER_ID); + + return mapping.findForward(CREATE_POS_GOODS_RETURN_NOTE); + } + + + public static final String COMPLETE_GOODS_RETURN_NOTE="completeGoodsReturnNote"; + public ActionForward completeGoodsReturnNote(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + //OrderLineBean bean=(OrderLineBean) df.getBean(); + Integer goodsReturnNoteId=(Integer) request.getSession().getAttribute(Constants.GOODS_RETURN_NOTE_ID); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + MOrder completedGRetN=null; + + + if(goodsReturnNoteId==null) + { + postGlobalError("error.no.order.exists",request); + return mapping.getInputForward(); + } + + try + { + trx.start(); + completedGRetN=POSGoodsManager.createAndCompletePODocuments(ctx,goodsReturnNoteId,null);//same sort of order i.e. sales Order + trx.commit(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(NoOrderLineFoundException e) + { + trx.rollback(); + postGlobalError("error.pos.no.orderline",request); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS); + return mapping.getInputForward(); + } + + catch(OperationException e) + { + trx.rollback(); + throw new OperationException("Could not complete documents. Reason : " + e); + } + finally + { + trx.close(); + } + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx,completedGRetN); + ArrayList list = POSManager.populateOrderLines(ctx,completedGRetN); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + request.setAttribute(Constants.GOODS_RETURN_NOTE_LINES,list); + //request.getSession().setAttribute(Constants.GOODS_RETURN_NOTE_ID,completedGRetN.get_ID()); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_ID); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.PRESENT_GOODS_RET_ORDER); + request.getSession().removeAttribute(Constants.PRESENT_GOODS_RET_ORDER_ID); + + + request.removeAttribute(Constants.DESCRIPTION); + + return mapping.findForward(COMPLETE_GOODS_RETURN_NOTE); + } + + //public static final String GET_ALL_VENDORS="getAllVendors"; + public ActionForward getAllVendors(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + HttpSession session = request.getSession(); + + DefaultForm df = (DefaultForm) form; + OrderLineBean b = (OrderLineBean) df.getBean(); + + OrderLineForm f = (OrderLineForm) form; + OrderLineBean bean = new OrderLineBean(); + + Integer bPartnerId = (Integer) session.getAttribute(Constants.B_PARTNER_ID); + String description = (String) session.getAttribute(Constants.DESCRIPTION); + + bean.setBpartnerId(bPartnerId); + bean.setDescription(description); + + f.populate(bean); + + ArrayList list=POSGoodsManager.getAllSuppliers(ctx); + + session.setAttribute(Constants.BP_LIST,list); + return mapping.findForward(POSGoodsManager.getForward(ctx,b.getIsSales())); + } + + public static final String ADD_TO_SHOPPING_CART = "addToShoppingCart"; + public ActionForward addToShoppingCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + + String orderType = bean.getOrderType(); + String shoppingCart = null; + String shoppingCartItem = null; + + if(orderType.equals(Constants.GOODS_RECEIVE_NOTE)) + { + shoppingCart = Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART; + shoppingCartItem = Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS; + + } + else if(orderType.equals(Constants.GOODS_RETURN_NOTE)) + { + shoppingCart = Constants.GOODS_RETURN_NOTE_SHOPPING_CART; + shoppingCartItem = Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS; + + + } + else if(orderType.equals(Constants.CUSTOMER_RETURN_ORDER)) + { + shoppingCart = Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART; + shoppingCartItem = Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS; + + + } + + String currSymboleSales = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales); + + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(shoppingCart); + + try + { + //POSManager.getQtyAndItem(bean); + if(bean.getProductId()==null && bean.getBarCode()==null) + { + postGlobalError("error.barcode.required", request); + return mapping.getInputForward(); + } + + if(bean.getQuantity().doubleValue() <= 0) + { + postGlobalError("error.invalid.inputQty", request); + return mapping.getInputForward(); + } + + cartBean = StockManager.addToPOSCart(ctx, bean, cartBean,Boolean.parseBoolean(bean.getIsSales()),Boolean.parseBoolean(bean.getIfAdd())); + } + catch (InputQuantityLessThanZeroException e1) + { + postGlobalError("error.invalid.inputQty", request); + return mapping.getInputForward(); + } + catch (ProductNotFoundException e2) + { + postGlobalError("error.product.not.found", e2.getMessage(), request); + return mapping.getInputForward(); + } + catch(QuantityNotAvailableException e3) + { + postGlobalError("error.quantity.notAvailable", e3.getMessage(), request); + return mapping.getInputForward(); + } + + catch(ProductNotOnPriceListException e4) + { + postGlobalError("error.product.price.not.found", e4.getMessage(), request); + return mapping.getInputForward(); + } + + catch (UOMValuePrecisionNotValidException e) + { + postGlobalError("error.precision", e.getMessage(), request); + return mapping.getInputForward(); + } + request.getSession().setAttribute(Constants.DESCRIPTION, bean.getDescription()); + bean.setDescription(bean.getDescription()); + request.getSession().setAttribute(shoppingCart, cartBean); + request.getSession().setAttribute(shoppingCartItem, cartBean.getItems()); + request.getSession().setAttribute(Constants.B_PARTNER_ID,bean.getBpartnerId()); + + df.setQtyAndItem(""); + + return mapping.findForward(ADD_TO_SHOPPING_CART); + } + + public static final String SET_SUPPLIER="setSupplier"; + public ActionForward setSupplier(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + //Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + POSSupplierBean bean = (POSSupplierBean)df.getBean(); + request.getSession().setAttribute(Constants.B_PARTNER_ID,bean.getBpartnerId()); + return mapping.findForward(SET_SUPPLIER); + } + + //NOTE:this does not select the actualy product category of compiere,its gets all the revenue recognitions + //revenue reco is used to categorise the proucts + /*public static final String GET_PRODUCT_CATEGORY="getProductCategory"; + public ActionForward getProductCategory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + //warning if no productid is passed as a parameter the form + // will not return you the bean, it will be null. + + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + POSProductForm pf = (POSProductForm)form; + pf.validate(mapping, request); + + ProductBean bean = (ProductBean) pf.getBean(); + + bean = POSProductManager.viewPOSProduct(ctx,bean.getProductId(), null); + bean.setProductType(MProduct.PRODUCTTYPE_Item); + pf.populate(bean); + + ArrayList list = POSGoodsManager.getAllRevenueRecos(ctx); + ArrayList supList=POSGoodsManager.getAllSuppliers(ctx); + ArrayList taxList=POSGoodsManager.getAllTaxCategory(ctx); + + ArrayList uomList = POSProductManager.getUoms(ctx, null); + + request.getSession().setAttribute(Constants.BP_LIST,supList); + request.getSession().setAttribute(Constants.PRODUCT_CATEGORY_ID,list); + request.getSession().setAttribute(Constants.TAX_CATEGORY_ID,taxList); + request.getSession().setAttribute(Constants.UOM_LIST, uomList); + + return mapping.findForward(GET_PRODUCT_CATEGORY); + }*/ + + + public static final String CREATE_CUSTOMER_RETURN_ORDER="createCustomerReturnOrder"; + public ActionForward createCustomerReturnOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + HttpSession session = request.getSession(); + Integer bPartnerId = bean.getBpartnerId(); + + if( bPartnerId == null) + { + bPartnerId = (Integer) request.getSession().getAttribute(Constants.B_PARTNER_ID); + } + else + { + request.getSession().setAttribute(Constants.B_PARTNER_ID, bPartnerId); + } + + BigDecimal qty = bean.getQuantity(); + + if ( (qty == null) || (qty.doubleValue() <= 0) ) + { + postGlobalError("error.invalid.inputQty", request); + return mapping.getInputForward(); + } + + + String reason = bean.getDescription(); + + if( reason == null ) + { + reason = (String) session.getAttribute(Constants.DESCRIPTION); + + if( reason == null ) + { + postGlobalError("error.reason.required", request); + return mapping.getInputForward(); + } + } + else + { + session.setAttribute(Constants.DESCRIPTION, reason); + } + MOrder previousOrder= null; + previousOrder=(MOrder)request.getSession().getAttribute(Constants.PRESENT_CUSTOMER_RET_ORDER); + + if(previousOrder!=null) + { + bean.setOrderId(Integer.valueOf(previousOrder.get_ID())); + } + else + { + bean.setOrderId(null); + } + + String posOrderDocNumber = (String) request.getSession().getAttribute(Constants.POS_ORDER_DOC_NUMBER); + Integer paymentTermId =(Integer) request.getSession().getAttribute(Constants.CREDIT_PAYMENT_TERM_ID); + String orderType = (String) request.getSession().getAttribute(Constants.ORDER_TYPE); + + if(posOrderDocNumber!=null) + bean.setDocumentNo(posOrderDocNumber); + if(orderType!=null) + bean.setOrderType(orderType); + if(paymentTermId!=null) + bean.setPaymentTermId(paymentTermId); + if(bPartnerId==null) + bPartnerId=Integer.valueOf(POSTerminalManager.getCashBPartner(ctx).get_ID()); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + //ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART); + + if(items == null || items.size() == 0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + MOrder customerReturnOrder=null; + MInOut materitalReceipt = null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + + /* + // Materital Receipt + String Description = "Test Material Receipt"; + int C_DocType_ID = 1000029; + int C_BPartner_ID = 1000000; + int M_Product_ID = 1000002; + BigDecimal Qty = BigDecimal.ONE; + int M_Warehouse_ID = 1000001; + boolean IsSOTrx = false; + String trxName = trx.getTrxName(); + + if(bPartnerId != 0) + { + C_BPartner_ID = bPartnerId; + } + + materitalReceipt = MinOutManager.createMateritalReceipt(ctx, C_DocType_ID, C_BPartner_ID, M_Warehouse_ID, IsSOTrx, trxName); + + ArrayList list = cartBean.getItems(); + + for (ItemBean itemBean : list) + { + MinOutManager.createMaterialReceiptLine(ctx, materitalReceipt.get_ID(), itemBean.getProductId(), new BigDecimal(itemBean.getQty()), trxName); + } + + // End Material Receipt + */ + + customerReturnOrder= POSGoodsManager.createCustomerReturn(ctx,bean,items,bPartnerId,reason,trx.getTrxName()); + trx.commit(); + } + catch(BPartnerNoLocationException ex) + { + trx.rollback(); + postGlobalError("error.bpartner.nolocation", request); + return mapping.getInputForward(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + throw new OperationException("Could not create customer return order!! Reason : " + e); + } + finally + { + trx.close(); + } + + bean.setOrderId(Integer.valueOf(customerReturnOrder.get_ID())); + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx,customerReturnOrder); + ArrayList list = POSManager.populateOrderLines(ctx,customerReturnOrder); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + + if(customerReturnOrder.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_OnCredit)) + { + ElementBean title=ElementManager.getMsg(ctx,"credit.memo"); + request.getSession().setAttribute(Constants.ORDER_TITLE,title.getName()); + } + + else + { + ElementBean title=ElementManager.getMsg(ctx,"customer.returned.order"); + request.getSession().setAttribute(Constants.ORDER_TITLE,title.getName()); + } + + + request.getSession().setAttribute(Constants.CUSTOMER_RETURN_ORDER_ID,customerReturnOrder.get_ID()); + request.setAttribute(Constants.CUSTOMER_RETURN_ORDER_LINES,list); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + return mapping.findForward(CREATE_CUSTOMER_RETURN_ORDER); + } + + public static final String COMPLETE_CUSTOMER_RETURN_ORDER="completeCustomerReturnOrder"; + public ActionForward completeCustomerReturnOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + + Integer customerReturnOrderId=(Integer)request.getSession().getAttribute(Constants.CUSTOMER_RETURN_ORDER_ID); + MOrder completedCustomerReturn=null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + if(customerReturnOrderId==null) + { + postGlobalError("error.no.order.exists",request); + return mapping.getInputForward(); + } + + try + { + trx.start(); + completedCustomerReturn=POSGoodsManager.completeCustomerReturnOrder(ctx,customerReturnOrderId.intValue(),trx.getTrxName()); + trx.commit(); + } + catch(NoOrderLineFoundException e) + { + trx.rollback(); + postGlobalError("error.pos.no.orderline",request); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS); + return mapping.getInputForward(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + + catch(OperationException e) + { + trx.rollback(); + throw new OperationException("Could not complete customer return order!! Reason : " + e); + } + finally + { + trx.close(); + } + + + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx,completedCustomerReturn); + ArrayList list = POSManager.populateOrderLines(ctx,completedCustomerReturn); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + + //request.getSession().setAttribute(Constants.CUSTOMER_RETURN_ORDER_ID,completedCustomerReturn.get_ID()); + request.setAttribute(Constants.CUSTOMER_RETURN_ORDER_LINES,list); + /*request.removeAttribute(Constants.POS_ORDER_LINES);*/ + + + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + if(completedCustomerReturn.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_OnCredit)) + { + ElementBean title=ElementManager.getMsg(ctx,"credit.memo"); + request.getSession().setAttribute(Constants.ORDER_TITLE,title.getName()); + } + + else + { + ElementBean title=ElementManager.getMsg(ctx,"customer.returned.order"); + request.getSession().setAttribute(Constants.ORDER_TITLE,title.getName()); + } + + + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.DESCRIPTION); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_ID); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + + request.getSession().removeAttribute(Constants.ORDER_TYPE); + request.getSession().removeAttribute(Constants.POS_ORDER_DOC_NUMBER); + request.getSession().removeAttribute(Constants.CREDIT_PAYMENT_TERM_ID); + + return mapping.findForward(COMPLETE_CUSTOMER_RETURN_ORDER); + } + + public static final String COMPLETE_POS_ORDER="completePOSOrder"; + public static final String VIEW_POS_ORDERS="viewPOSOrders"; + public static final String COMPLETED_CREDIT_ORDER="completedCreditOrder"; + + + public ActionForward viewPOSOrders(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + MOrder order= new MOrder(ctx,bean.getOrderId(),null); + String status = order.getDocStatus(); + + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx,order); + + ArrayList list = POSManager.populateOrderLines(ctx,order); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + ActionForward forward=null; + + if(UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType().equals(order.getOrderType())) + { + if( status.equals(DocAction.STATUS_Drafted) ) + { + int c_BPartner_Id = order.getC_BPartner_ID(); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.GOODS_RECEIVE_NOTE_LINES, list ); + request.getSession().setAttribute( Constants.GOODS_RECEIVE_NOTE_ID , Integer.valueOf(order.get_ID()) ); + forward = new ActionForward("/DraftedGoodsReceiveNote.do"); + } + else + { + request.getSession().setAttribute(Constants.GOODS_RECEIVE_NOTE,order); + request.setAttribute(Constants.GOODS_RECEIVE_NOTE_LINES,list); + forward= mapping.findForward(COMPLETE_GOODS_RECEIVE_NOTE); + } + } + else if(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType().equals(order.getOrderType())) + { + if( status.equals(DocAction.STATUS_Drafted) ) + { + + int c_BPartner_Id = order.getC_BPartner_ID(); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.GOODS_RETURN_NOTE_LINES, list ); + request.getSession().setAttribute( Constants.GOODS_RETURN_NOTE_ID, Integer.valueOf(order.get_ID()) ); + + forward = new ActionForward("/DraftedGoodsReturnNote.do"); + } + else + { + request.getSession().setAttribute(Constants.GOODS_RETURN_NOTE,order); + request.setAttribute(Constants.GOODS_RETURN_NOTE_LINES,list); + forward= mapping.findForward(COMPLETE_GOODS_RETURN_NOTE); + } + + } + else if(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType().equals(order.getOrderType())|| UDIOrderTypes.CREDIT_MEMO.getOrderType().equals(order.getOrderType())) + { + if(order.getPaymentRule().equalsIgnoreCase(MOrder.PAYMENTRULE_OnCredit)) + { + ElementBean title=ElementManager.getMsg(ctx,"credit.memo"); + request.getSession().setAttribute(Constants.ORDER_TITLE,title.getName()); + } + + else + { + ElementBean title=ElementManager.getMsg(ctx,"customer.returned.order"); + request.getSession().setAttribute(Constants.ORDER_TITLE,title.getName()); + } + if( status.equals(DocAction.STATUS_Drafted) ) + { + + int c_BPartner_Id = order.getC_BPartner_ID(); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.CUSTOMER_RETURN_ORDER_LINES, list ); + request.getSession().setAttribute( Constants.CUSTOMER_RETURN_ORDER_ID, Integer.valueOf(order.get_ID()) ); + + + forward = new ActionForward("/DraftedCustomerReturnOrder.do"); + } + else + { + + request.getSession().setAttribute(Constants.CUSTOMER_RETURN_ORDER,order); + request.setAttribute(Constants.CUSTOMER_RETURN_ORDER_LINES,list); + forward= mapping.findForward(COMPLETE_CUSTOMER_RETURN_ORDER); + } + } + else if(UDIOrderTypes.WEBSTORE_ORDER.getOrderType().equals(order.getOrderType())) + { + + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER,order); + request.setAttribute(Constants.POS_ORDER_LINES,list); + request.setAttribute(Constants.ORDER_NAME,"Webstore Order"); + + forward= mapping.findForward(COMPLETE_POS_ORDER); + } + + else if(UDIOrderTypes.POS_ORDER.getOrderType().equals(order.getOrderType())) + { + if( status.equals(DocAction.STATUS_Drafted) ) + { + int c_BPartner_Id = order.getC_BPartner_ID(); + + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.POS_ORDER_LINES, list ); + request.getSession().setAttribute( Constants.CURRENT_POS_ORDER_ID , Integer.valueOf(order.get_ID()) ); + forward = new ActionForward("/DraftedPOSOrder.do"); + } + else if( status.equals(DocAction.STATUS_InProgress) ) + { + int c_BPartner_Id = order.getC_BPartner_ID(); + + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.POS_ORDER_LINES, list ); + request.setAttribute(Constants.ORDER_NAME,"POS Order"); + request.getSession().setAttribute( Constants.CURRENT_POS_ORDER_ID , Integer.valueOf(order.get_ID()) ); + forward= mapping.findForward(COMPLETE_POS_ORDER); + } + else + { + if( status.equals(DocAction.STATUS_Completed) ) + { //setting card & check tendered amount + BigDecimal cardTendered = POSManager.getPayment(ctx,order.get_ID(),MPayment.TENDERTYPE_CreditCard,null); + BigDecimal chequeTendered = POSManager.getPayment(ctx,order.get_ID(),MPayment.TENDERTYPE_Check,null); + + request.setAttribute(Constants.CARD_AMT_TENDERED, cardTendered); + request.setAttribute(Constants.CHEQUE_AMT_TENDERED, chequeTendered); + } + + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER,order); + request.setAttribute(Constants.POS_ORDER_LINES,list); + request.setAttribute(Constants.ORDER_NAME,"POS Order"); + forward= mapping.findForward(COMPLETE_POS_ORDER); + } + } + else if(UDIOrderTypes.CREDIT_ORDER.getOrderType().equals(order.getOrderType())) + { + if( status.equals(DocAction.STATUS_Drafted) ) + { + int c_BPartner_Id = order.getC_BPartner_ID(); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.POS_ORDER_LINES, list ); + request.getSession().setAttribute( Constants.CURRENT_POS_ORDER_ID , Integer.valueOf(order.get_ID()) ); + + forward = new ActionForward("/DraftedCreditOrder.do"); + } + else + { + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER,order); + request.setAttribute(Constants.POS_ORDER_LINES,list); + forward= mapping.findForward(COMPLETED_CREDIT_ORDER); + } + } + else + { + String msg = "Unknown orderType : " + order.getOrderType(); + throw new OperationException(msg); + } + if(order.getPaymentRule().equals(UdiConstants.PAYMENTRULE_MIXED)) + { + POSManager.getAmountForMixedPayment(ctx,order,webBean); + } + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + df.populate(new OrderLineBean()); + return forward; + + } + + public static final String VIEW_COMPLETED_POS_ORDER = "viewCompletedPOSOrder"; + public ActionForward viewCompletedPOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + MOrder order= new MOrder(ctx,bean.getOrderId(),null); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx,order); + + + + ArrayList list = POSManager.populateOrderLines(ctx,order); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER,order); + request.setAttribute(Constants.POS_ORDER_LINES,list); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + return mapping.findForward(VIEW_COMPLETED_POS_ORDER); + } + + public static final String GET_TAX_CATEGORY="getTaxCategory"; + public ActionForward getTaxCategory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + //DefaultForm df = (DefaultForm)form; + ArrayList taxList=POSGoodsManager.getAllTaxCategory(ctx); + + request.getSession().setAttribute(Constants.TAX_CATEGORY_ID,taxList); + return mapping.findForward(GET_TAX_CATEGORY); + } + + public static final String INCREMENT_QTY = "incrementQty"; + public ActionForward incrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + bean.setQuantity(new BigDecimal(1)); + + addToShoppingCart(mapping,form,request,response); + return getShoppingCart(mapping,form,request,response); + } + + public static final String DECREMENT_QTY = "decrementQty"; + public ActionForward decrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + bean.setQuantity(new BigDecimal(1)); + + addToShoppingCart(mapping,form,request,response); + return getShoppingCart(mapping,form,request,response); + } + + public ActionForward getShoppingCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException + { + DefaultForm df = (DefaultForm) form; + String orderType = df.getOrderType(); + + if(orderType == null) + { + throw new OperationException("Cannot lookup for shopping cart! Cause orderType is null."); + } + + HashMap map = new HashMap(); + + map.put(Constants.GOODS_RECEIVE_NOTE, "/jsp/pos/goodsReceiveShoppingCart.jsp"); + map.put(Constants.GOODS_RETURN_NOTE, "/jsp/pos/goodsReturnShoppingCart.jsp"); + map.put(Constants.CUSTOMER_RETURN_ORDER,"/jsp/pos/customerReturnShoppingCart.jsp"); + + String url = map.get(orderType); + if(url == null) + { + throw new OperationException("Cannot lookup for shopping cart! Cause no shopping cart is define for orderType:" + orderType); + } + + return new ActionForward(url); + } + + + public static final String CREATE_CUSTOMER_RETURN_FROM_POSORDER="createCustomerReturnFromPOSOrder"; + public ActionForward createCustomerReturnFromPOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + ShoppingCartBean cart =null; + OrderBean orderBean; + try + { + orderBean = POSManager.getPOSOrderDetail(ctx,bean.getDocumentNo()); + + if(orderBean==null) + { + postGlobalError("error.orderid.notpresent",request); + return mapping.getInputForward(); + } + + if(!orderBean.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType())) + { + postGlobalError("error.only.pos.order.supported",request); + return mapping.getInputForward(); + } + + if(orderBean.getDocStatus().equalsIgnoreCase(DocumentEngine.STATUS_Drafted)) + { + postGlobalError("error.pos.order.not.completed",request); + return mapping.getInputForward(); + } + + cart = POSManager.getShoppingCartForOrder(ctx,orderBean.getOrderId(),null); + } + catch(InvalidOrderIDException e) + { + postGlobalError("error.orderid.notpresent",request); + return mapping.getInputForward(); + } + + if(orderBean.getOrderType().equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + ElementBean title=ElementManager.getMsg(ctx,"credit.memo"); + request.getSession().setAttribute(Constants.ORDER_TITLE,title.getName()); + } + + else + { + ElementBean title=ElementManager.getMsg(ctx,"customer.returned.order"); + request.getSession().setAttribute(Constants.ORDER_TITLE,title.getName()); + } + + int bpartnerId = orderBean.getBpartnerId().intValue(); + MBPartner partner = BPartnerManager.loadBPartner(ctx, bpartnerId,null); + String partnerName = partner.getName() + " " + partner.getName2(); + partnerName = partnerName.trim(); + + df.setPartnerName(partnerName); + df.setBpartnerId(orderBean.getBpartnerId().toString()); + + request.getSession().setAttribute(Constants.B_PARTNER_ID,orderBean.getBpartnerId()); + request.getSession().setAttribute(Constants.ORDER_TYPE,orderBean.getOrderType()); + request.getSession().setAttribute(Constants.POS_ORDER_DOC_NUMBER,bean.getDocumentNo()); + request.getSession().setAttribute(Constants.CREDIT_PAYMENT_TERM_ID,orderBean.getPaymentTermId()); + request.getSession().setAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART,cart); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART_ITEMS,cart.getItems()); + return mapping.findForward(CREATE_CUSTOMER_RETURN_FROM_POSORDER); + } + + + //--------------------------------------------------credit order------------------------------------------------------------ + public static final String LOAD_CREDIT_ORDER="loadCreditOrder"; + public ActionForward loadCreditOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + ShoppingCartBean cart =null; + OrderBean orderBean; + + try + { + orderBean = POSManager.getPOSOrderDetail(ctx,bean.getDocumentNo()); + + if(orderBean==null) + { + postGlobalError("error.orderid.notpresent",request); + return mapping.getInputForward(); + } + + if(!orderBean.getOrderType().equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER.getOrderType()) && !orderBean.getOrderType().equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + postGlobalError("error.only.credit.order.supported",request); + return mapping.getInputForward(); + } + + if(orderBean.getDocStatus().equalsIgnoreCase(DocumentEngine.STATUS_Drafted)) + { + postGlobalError("error.credit.order.not.completed",request); + return mapping.getInputForward(); + } + + cart = POSManager.getShoppingCartForOrder(ctx,orderBean.getOrderId(),null); + } + catch(InvalidOrderIDException e) + { + postGlobalError("error.orderid.notpresent",request); + return mapping.getInputForward(); + } + + int bpartnerId = orderBean.getBpartnerId().intValue(); + MBPartner partner = BPartnerManager.loadBPartner(ctx, bpartnerId,null); + String partnerName = partner.getName() + " " + partner.getName2(); + partnerName = partnerName.trim(); + + df.setPartnerName(partnerName); + df.setBpartnerId(orderBean.getBpartnerId().toString()); + + request.getSession().setAttribute(Constants.B_PARTNER_ID,orderBean.getBpartnerId()); + request.getSession().setAttribute(Constants.ORDER_TYPE,orderBean.getOrderType()); + request.getSession().setAttribute(Constants.POS_ORDER_DOC_NUMBER,bean.getDocumentNo()); + request.getSession().setAttribute(Constants.CREDIT_PAYMENT_TERM_ID,orderBean.getPaymentTermId()); + request.getSession().setAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART,cart); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART_ITEMS,cart.getItems()); + return mapping.findForward(LOAD_CREDIT_ORDER); + } + + //####################### Deletion of orders #######################// + //deleteGoodsReturnOrder + //deleteGoodsReceiveOrder + //deleteCustomerReturnOrder + + public static final String DELETE_GOODS_RETURN_ORDER = "deleteGoodsReturnOrder"; + public static final String DELETE_GOODS_RECEIVE_ORDER = "deleteGoodsReceiveOrder"; + public static final String DELETE_CUSTOMER_RETURN_ORDER = "deleteCustomerReturnOrder"; + + public ActionForward deleteGoodsReturnOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + Integer orderId = (Integer) request.getSession().getAttribute( Constants.GOODS_RETURN_NOTE_ID ); + + if( orderId == null ) + { + throw new OperationException("Cannot delete order. Reason: order ID not found!"); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + OrderManager.deleteDraftedOrder(ctx, orderId.intValue(), null); + trx.commit(); + } + catch(OperationException ex) + { + trx.rollback(); + postGlobalError("error.order.delete", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + //remove previously set values + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.GOODS_RETURN_NOTE_ID); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + request.getSession().removeAttribute(Constants.DESCRIPTION); + + //return mapping.findForward(DELETE_GOODS_RETURN_ORDER); + return new ActionForward( "/GetAllPOSVendor.do?action=getAllVendors&isSales=false" ); + } + + public ActionForward deleteGoodsReceiveOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + Integer orderId = (Integer) request.getSession().getAttribute( Constants.GOODS_RECEIVE_NOTE_ID ); + + if( orderId == null ) + { + throw new OperationException("Cannot delete order. Reason: order ID not found!"); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + OrderManager.deleteDraftedOrder(ctx, orderId.intValue(), null); + trx.commit(); + } + catch(OperationException ex) + { + trx.rollback(); + postGlobalError("error.order.delete", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + //remove previously set values + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.GOODS_RECEIVE_NOTE_ID); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + request.getSession().removeAttribute(Constants.DESCRIPTION); + + //GetAllPOSVendor.do?action=getAllVendors&isSales=false + //return mapping.findForward(DELETE_GOODS_RECEIVE_ORDER); + return new ActionForward( "/GetAllPOSVendor.do?action=getAllVendors&isSales=true" ); + } + + public ActionForward deleteCustomerReturnOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + Integer orderId = (Integer) request.getSession().getAttribute( Constants.CUSTOMER_RETURN_ORDER_ID ); + + if( orderId == null ) + { + throw new OperationException("Cannot delete order. Reason: order ID not found!"); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + OrderManager.deleteDraftedOrder(ctx, orderId.intValue(), null); + trx.commit(); + } + catch(OperationException ex) + { + trx.rollback(); + postGlobalError("error.order.delete", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + //remove previously set values + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.CUSTOMER_RETURN_ORDER_ID); + request.getSession().removeAttribute(Constants.B_PARTNER_ID); + request.getSession().removeAttribute(Constants.DESCRIPTION); + + request.getSession().removeAttribute(Constants.ORDER_TYPE); + request.getSession().removeAttribute(Constants.POS_ORDER_DOC_NUMBER); + request.getSession().removeAttribute(Constants.CREDIT_PAYMENT_TERM_ID); + + return mapping.findForward(DELETE_CUSTOMER_RETURN_ORDER); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSInfoAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSInfoAction.java new file mode 100644 index 0000000000..5137a8d86e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSInfoAction.java @@ -0,0 +1,208 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + +import java.io.FileNotFoundException; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.posterita.Constants; +import org.posterita.beans.POSInfoBean; +import org.posterita.beans.ReportBean; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.TabularReport; +import org.posterita.core.TimestampConvertor; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; + +import com.lowagie.text.DocumentException; + +public class POSInfoAction extends POSDispatchAction +{ + public static final String GET_CURRENT_DAY_REPORT = "getCurrentDayReport"; + public ActionForward getCurrentDayReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Timestamp fromDate = TimestampConvertor.getCurrentDateTimestamp(); + Timestamp toDate = TimestampConvertor.getCurrentDateTimeTimestamp(); + + ArrayList list = POSManager.getPOSInfo(ctx, fromDate, toDate, null); + request.getSession().setAttribute(Constants.POS_INFO,list); + + return mapping.findForward(GET_CURRENT_DAY_REPORT); + } + + public static final String GET_CURRENT_MONTH_REPORT = "getCurrentMonthReport"; + public ActionForward getCurrentMonthReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + + Timestamp toDate = new Timestamp(cal.getTimeInMillis()); + + cal.set(Calendar.DATE,1); + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp fromDate =new Timestamp(cal.getTimeInMillis()); + + ArrayList list = POSManager.getPOSInfo(ctx, fromDate, toDate, null); + request.getSession().setAttribute(Constants.POS_INFO, list); + + return mapping.findForward(GET_CURRENT_MONTH_REPORT); + } + + public static final String GET_CUSTOM_REPORT = "getCustomReport"; + public ActionForward getCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, FileNotFoundException, DocumentException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + ReportBean bean = (ReportBean) df.getBean(); + + String title = "POS Info"; + String subtitle = ""; + + String dateRange = bean.getDateRange(); + String timePeriod = bean.getTimePeriod(); + + Timestamp fromDate = null; + Timestamp toDate = null; + + //setting from and to dates + if(dateRange.endsWith(Constants.FIXED_DATE_RANGE)) + { + if(timePeriod==null) + { + throw new OperationException("Invalid Parameter for timePeriod. timePeriod is NULL"); + } + + Date startDate = ReportDateManager.getStartDateForPeriod(timePeriod); + Date endDate = ReportDateManager.getEndDateForPeriod(timePeriod); + + + fromDate = new Timestamp(startDate.getTime()); + toDate = new Timestamp(endDate.getTime()); + + subtitle = "For " + timePeriod; + } + else if(dateRange.endsWith(Constants.CUSTOM_DATE_RANGE)) + { + boolean error = false; + ActionMessages messages = new ActionMessages(); + ActionMessage message = null; + + + if((bean.getFromDate()==null)||(bean.getFromDate()=="")) + { + message = new ActionMessage("error.required.fromDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if((bean.getToDate()==null)||(bean.getToDate()=="")) + { + message = new ActionMessage("error.required.toDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if(error) + { + saveErrors(request, messages); + return mapping.getInputForward(); + } + else + { + fromDate = ReportDateManager.getFromDate(bean); + toDate = ReportDateManager.getToDate(bean); + + } + + + subtitle = "For period:"+fromDate+" to "+toDate; + } + else + { + throw new OperationException("Invalid Parameter for dateRange :" + dateRange); + } + + ArrayList reportData = POSManager.getPOSInfoReportData(ctx, fromDate, toDate, null); + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle(title); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + String csvReport = CSVReportManager.generateCSVReport(ctx,reportData); + String csvURI = ReportManager.getReportURI(csvReport,request); + + String pdfReport = tReport.createPDFReport(); + String pdfURI = ReportManager.getReportURI(pdfReport,request); + + request.getSession().setAttribute(Constants.TABULAR_REPORT_DATA,tReport.toString()); + request.getSession().setAttribute(Constants.CSV_FILE,csvURI); + + request.getSession().setAttribute(Constants.PDF_FILE,pdfURI); + + return mapping.findForward(GET_CUSTOM_REPORT); + + + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSOrderAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSOrderAction.java new file mode 100644 index 0000000000..fa2672247d --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSOrderAction.java @@ -0,0 +1,2213 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 14-Mar-2006 + */ +package org.posterita.struts.pos; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.logging.Level; + +import javax.management.relation.RoleNotFoundException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MBPartner; +import org.compiere.model.MCurrency; +import org.compiere.model.MOrder; +import org.compiere.model.MPayment; +import org.compiere.model.MPriceList; +import org.compiere.model.MRole; +import org.compiere.print.ReportEngine; +import org.compiere.util.CLogger; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.compiere.util.WebUser; +import org.posterita.Constants; +import org.posterita.beans.CheckoutBean; +import org.posterita.beans.CurrentTillAmountBean; +import org.posterita.beans.ItemBean; +import org.posterita.beans.LoginBean; +import org.posterita.beans.OrderBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.POSInfoBean; +import org.posterita.beans.RemoveSessionBean; +import org.posterita.beans.ReportBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.LoginManager; +import org.posterita.businesslogic.OrderManager; +import org.posterita.businesslogic.OrderReferenceManager; +import org.posterita.businesslogic.POSGoodsManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.PrintManager; +import org.posterita.businesslogic.ShoppingcartManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.businesslogic.administration.UserManager; +import org.posterita.businesslogic.creditsales.CreditOrderManager; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.Configuration; +import org.posterita.core.SessionStorage; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.core.businesslogic.ElementManager; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BPartnerNoLocationException; +import org.posterita.exceptions.BPartnerOverCreditLimitException; +import org.posterita.exceptions.DiscountLimitException; +import org.posterita.exceptions.DuplicatePINException; +import org.posterita.exceptions.InputQuantityLessThanZeroException; +import org.posterita.exceptions.InsufficientQtyException; +import org.posterita.exceptions.InvalidAddressException; +import org.posterita.exceptions.InvalidPINException; +import org.posterita.exceptions.InvalidTenderedAmountException; +import org.posterita.exceptions.LimitPriceViolatedException; +import org.posterita.exceptions.NoOrderLineSelectedException; +import org.posterita.exceptions.NotLoggedInException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.exceptions.QuantityNotAvailableException; +import org.posterita.exceptions.UOMValuePrecisionNotValidException; +import org.posterita.exceptions.UserInactiveException; +import org.posterita.exceptions.UserNotFoundException; +import org.posterita.form.CheckoutForm; +import org.posterita.form.OrderLineForm; +import org.posterita.form.RemoveSessionForm; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; +import org.posterita.struts.core.DefaultForm; +import org.posterita.util.TmkPrinterConstants; + +public class POSOrderAction extends POSDispatchAction +{ + /** Logger */ + private static final CLogger logger = CLogger.getCLogger(POSOrderAction.class); + + public static final String CREATE_POS_ORDER="createPOSOrder"; + public ActionForward createPOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + + if(cartBean==null ||cartBean.getItems() == null||cartBean.getItems().size()==0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + String[] discountPercentage = df.getDiscountPercent(); + String[] actualPrice = df.getActualPrice(); + + double d = 0.0d; + + if(( discountPercentage != null ) && ( discountPercentage.length != 0 )) + { + for(String s : discountPercentage) + { + if(s == null || s == "") + { + continue; + } + + try + { + d = Double.parseDouble(s); + + if(d < 0) + { + postGlobalError("error.discount.nagative",request); + return mapping.getInputForward(); + } + } + catch (NumberFormatException e) + { + postGlobalError("errors.double","Discount(s)",request); + return mapping.getInputForward(); + } + } + + for(String s : actualPrice) + { + if(s == null || s == "") + { + continue; + } + + try + { + Double.parseDouble(s); + } + catch (NumberFormatException e) + { + postGlobalError("errors.double","Price(s)",request); + return mapping.getInputForward(); + } + } + } + + + + Integer bPartnerId = bean.getBpartnerId(); + + if(bPartnerId==null) + bPartnerId = (Integer) request.getSession().getAttribute(Constants.BPARTNER); + + if(bPartnerId==null) + { + String orderType = df.getOrderType(); + if(orderType!=null && orderType.equalsIgnoreCase( Constants.POS_ORDER_CUSTOMER_COMPULSORY )) + { + postGlobalError("error.required" ,"customer" ,request); + return mapping.getInputForward(); + } + + bPartnerId=Integer.valueOf(POSTerminalManager.getCashBPartner(ctx).get_ID()); + } + else + { + boolean isBPartnerPresent = BPartnerManager.isBPartnerPresent(ctx,bPartnerId.intValue(),null); + + if( !isBPartnerPresent ) + { + postGlobalError("error.pos.invalid.customerID",request); + return mapping.getInputForward(); + } + } + + // VALIDATING DISCOUNT AUTHORISATION <========= + BigDecimal discountAllowed = (BigDecimal) request.getSession().getAttribute(Constants.DISCOUNT_ALLOWED); + + + bean.setUserDiscount(discountAllowed); + bean.setBpartnerId(bPartnerId); + + //check if the order is alredy created + MOrder previousOrder= null; + previousOrder=(MOrder)request.getSession().getAttribute(Constants.PRESENT_POS_ORDER); + + if(previousOrder!=null) + { + bean.setOrderId(Integer.valueOf(previousOrder.get_ID())); + } + else + { + bean.setOrderId(null); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + MOrder posOrder=null; + try + { + trx.start(); + posOrder= POSManager.createPOSOrder(ctx,bean,cartBean.getItems(),trx.getTrxName()); + trx.commit(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(BPartnerNoLocationException ex) + { + trx.rollback(); + postGlobalError("error.bpartner.nolocation", request); + return mapping.getInputForward(); + } + catch(InvalidTenderedAmountException e) + { + trx.rollback(); + postGlobalError("error.pos.incorrect.tendered.amount",request); + return mapping.getInputForward(); + } + catch (DiscountLimitException e) + { + trx.rollback(); + postGlobalError("error.discountLimit.exceeded",request); + return mapping.getInputForward(); + } + catch(InsufficientQtyException e3) + { + trx.rollback(); + postGlobalError("error.insufficient.qty",e3.getMessage(),request); + return mapping.getInputForward(); + } + catch(LimitPriceViolatedException e3) + { + trx.rollback(); + postGlobalError("error.limit.price.violated",e3.getMessage(),request); + return mapping.getInputForward(); + } + + finally + { + trx.close(); + } + + // Reset transaction as it has already been committed and closed + posOrder.set_TrxName(null); + + bean.setOrderId(Integer.valueOf(posOrder.get_ID())); + + df.populate(new OrderLineBean()); + WebDocumentBean webBean =null; + try + { + webBean = OrderReferenceManager.getWebOrderBean(ctx, posOrder); + } + catch(InvalidAddressException e) + { + postGlobalError("error.invalid.address",request); + return mapping.getInputForward(); + } + + if(posOrder.getPaymentRule().equals(UdiConstants.PAYMENTRULE_MIXED)) + { + if(bean.getPaymentByCash()!=null) + webBean.setPaymentByCash(bean.getPaymentByCash()); + if(bean.getPaymentByCard()!=null) + webBean.setPaymentByCard(bean.getPaymentByCard()); + if(bean.getPaymentByChq()!=null) + webBean.setPaymentbyCheque(bean.getPaymentByChq()); + } + + + ArrayList list = POSManager.populateOrderLines(ctx,posOrder); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,Integer.valueOf(posOrder.get_ID())); + request.getSession().setAttribute(Constants.PRESENT_POS_ORDER,posOrder); + request.getSession().setAttribute(Constants.ORDER_LINE_BEAN,bean); + request.getSession().setAttribute(Constants.BPARTNER,bPartnerId); + request.setAttribute(Constants.POS_ORDER_LINES,list); + request.getSession().removeAttribute(Constants.PRESENT_POS_ORDER); + request.getSession().removeAttribute(Constants.PRESENT_POS_ORDER_ID); + + + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + //remove any previously set discount + request.getSession().removeAttribute(Constants.DISCOUNT_ALLOWED); + + return mapping.findForward(CREATE_POS_ORDER); + } + + public static final String COMPLETE_POS_ORDER="completePOSOrder"; + public ActionForward completePOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean b = (OrderLineBean) df.getBean(); + + OrderLineBean bean=(OrderLineBean) request.getSession().getAttribute(Constants.ORDER_LINE_BEAN); + + + if(bean==null) + { + bean = new OrderLineBean(); + } + bean.setAmountGiven(b.getAmountGiven()); + bean.setAmountRefunded(b.getAmountRefunded()); + + Integer orderId = (Integer) request.getSession().getAttribute(Constants.CURRENT_POS_ORDER_ID); + MOrder completedPOSOrder=null; + + + if(orderId==null) + { + postGlobalError("error.no.order.exists",request); + return mapping.getInputForward(); + } + + + if(OrderManager.isOrderEmpty(ctx,orderId.intValue(),null)) + { + postGlobalError("error.pos.no.orderline",request); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + return mapping.getInputForward(); + } + + + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + completedPOSOrder=POSManager.completePOSOrder(ctx,orderId.intValue(),bean,null); + trx.commit(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + MOrder posOrder = new MOrder(ctx,orderId.intValue(),null); + ArrayList list = POSManager.populateOrderLines(ctx,posOrder); + request.setAttribute(Constants.POS_ORDER_LINES,list); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(InvalidTenderedAmountException e) + { + trx.rollback(); + MOrder posOrder = new MOrder(ctx,orderId.intValue(),null); + ArrayList list = POSManager.populateOrderLines(ctx,posOrder); + request.setAttribute(Constants.POS_ORDER_LINES,list); + postGlobalError("error.required.amount.given",request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + MOrder posOrder = new MOrder(ctx,orderId.intValue(),null); + ArrayList list = POSManager.populateOrderLines(ctx,posOrder); + request.setAttribute(Constants.POS_ORDER_LINES,list); + throw e; + } + finally + { + trx.close(); + } + + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx, completedPOSOrder); + + if(completedPOSOrder.getPaymentRule().equals(UdiConstants.PAYMENTRULE_MIXED)) + { + POSManager.getAmountForMixedPayment(ctx,completedPOSOrder,webBean); + } + + ArrayList list = POSManager.populateOrderLines(ctx,completedPOSOrder); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,completedPOSOrder.get_ID()); + request.setAttribute(Constants.POS_ORDER_LINES,list); + + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + /*request.removeAttribute(Constants.POS_ORDER_LINES);*/ + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.BPARTNER); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_POS_ORDER_ID); + + + //fix for invoke partial pos order + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + request.getSession().removeAttribute(Constants.PRESENT_POS_ORDER); + request.getSession().removeAttribute( Constants.PRESENT_POS_ORDER_ID ); + + //setting card & check tendered amount + BigDecimal cardTendered = POSManager.getPayment(ctx,completedPOSOrder.get_ID(),MPayment.TENDERTYPE_CreditCard,trx.getTrxName()); + BigDecimal chequeTendered = POSManager.getPayment(ctx,completedPOSOrder.get_ID(),MPayment.TENDERTYPE_Check,trx.getTrxName()); + + request.setAttribute(Constants.CARD_AMT_TENDERED, cardTendered); + request.setAttribute(Constants.CHEQUE_AMT_TENDERED, chequeTendered); + + return mapping.findForward(COMPLETE_POS_ORDER); + } + + + public static final String COMPLETE_POS_ORDER_PRINT_INVOICE="completePOSOrderPrintInvoice"; + public ActionForward completePOSOrderPrintInvoice(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean b = (OrderLineBean) df.getBean(); + + OrderLineBean bean=(OrderLineBean) request.getSession().getAttribute(Constants.ORDER_LINE_BEAN); + bean.setAmountGiven(b.getAmountGiven()); + bean.setAmountRefunded(b.getAmountRefunded()); + + Integer orderId = (Integer) request.getSession().getAttribute(Constants.CURRENT_POS_ORDER_ID); + MOrder completedPOSOrder=null; + + + if(OrderManager.isOrderEmpty(ctx,orderId.intValue(),null)) + { + postGlobalError("error.pos.no.orderline",request); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + + return mapping.getInputForward(); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + completedPOSOrder = POSManager.completePOSOrder(ctx,orderId.intValue(),bean,null); + trx.commit(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx, completedPOSOrder); + + if(completedPOSOrder.getPaymentRule().equals(UdiConstants.PAYMENTRULE_MIXED)) + { + POSManager.getAmountForMixedPayment(ctx,completedPOSOrder,webBean); + } + + ArrayList list = POSManager.populateOrderLines(ctx,completedPOSOrder); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,completedPOSOrder.get_ID()); + request.setAttribute(Constants.POS_ORDER_LINES,list); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + /*request.removeAttribute(Constants.POS_ORDER_LINES);*/ + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_POS_ORDER_ID); + + return mapping.findForward(COMPLETE_POS_ORDER_PRINT_INVOICE); + } + + + public static final String CREATE_AND_COMPLETE_POS_ORDER="createAndCompletePOSOrder"; + public ActionForward createAndCompletePOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + bean.getPaymentByCash(); + bean.getPaymentByCard(); + bean.getPaymentByChq(); + + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + + if(cartBean==null ||cartBean.getItems() == null||cartBean.getItems().size()==0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + //MOrder posOrder=(MOrder) request.getSession().getAttribute(Constants.CURRENT_POS_ORDER); + + Integer bPartnerId = bean.getBpartnerId(); + + if(bPartnerId==null) + bPartnerId = (Integer) request.getSession().getAttribute(Constants.BPARTNER); + + if(bPartnerId==null) + { + bPartnerId=Integer.valueOf(POSTerminalManager.getCashBPartner(ctx).get_ID()); + } + else + { + boolean isBPartnerPresent = BPartnerManager.isBPartnerPresent(ctx,bPartnerId.intValue(),null); + + if( !isBPartnerPresent ) + { + postGlobalError("error.pos.invalid.customerID",request); + return mapping.getInputForward(); + } + } + + bean.setBpartnerId(bPartnerId); + + MOrder completedPOSOrder = null; + + try + { + completedPOSOrder = POSManager.createAndCompletePOSOrder(ctx,bean,cartBean.getItems()); + } + catch(BPartnerOverCreditLimitException e1) + { + + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(BPartnerNoLocationException ex) + { + postGlobalError("error.bpartner.nolocation", request); + return mapping.getInputForward(); + } + catch (DiscountLimitException e) + { + postGlobalError("error.discountLimit.exceeded",request); + return mapping.getInputForward(); + } + + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx, completedPOSOrder); + + ArrayList list = POSManager.populateOrderLines(ctx,completedPOSOrder); + WebDocumentBean documentBean=POSManager.calculateOrderTotals(list); + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,completedPOSOrder.get_ID()); + request.setAttribute(Constants.POS_ORDER_LINES,list); + + /*request.removeAttribute(Constants.POS_ORDER_LINES);*/ + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_POS_ORDER_ID); + + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + return mapping.findForward(CREATE_AND_COMPLETE_POS_ORDER); + } + + public static final String GET_POS_PAYMENT_DETAILS="getPOSPaymentDetails"; + public ActionForward getPOSPaymentDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + MOrder order=null; + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + df.populate(new OrderLineBean()); + if(bean.getBpartnerId()!=null) + request.getSession().setAttribute(Constants.BPARTNER, bean.getBpartnerId()); + + else if(bean.getOrderId()!=null) + { + order = new MOrder(ctx, bean.getOrderId(), null); + bean.setBpartnerId(order.getC_BPartner_ID()); + request.getSession().setAttribute(Constants.BPARTNER, bean.getBpartnerId()); + + } + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + if(cartBean==null) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + request.getSession().setAttribute(Constants.PRESENT_POS_ORDER,order); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART, cartBean); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART_ITEMS, cartBean.getItems()); + return mapping.findForward(GET_POS_PAYMENT_DETAILS); + } + + public static final String GET_POS_CUSTOMERS="getPOSCustomers"; + public ActionForward getPOSCustomers(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + //Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + //OrderLineBean bean=(OrderLineBean) df.getBean(); + df.populate(new OrderLineBean()); + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + + if(cartBean == null||cartBean.getItems() == null||cartBean.getItems().size() == 0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART, cartBean); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART_ITEMS, cartBean.getItems()); + + + return mapping.findForward(GET_POS_CUSTOMERS); + } + + public ActionForward deletePOSOrderLine(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + String forward = null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + forward = POSManager.deleteOrderLines(ctx,bean.getPosOrderLineIds(),trx.getTrxName()); + trx.commit(); + } + catch (NoOrderLineSelectedException e) + { + trx.rollback(); + SessionStorage.putPOSOrderInfo(ctx,bean,request,forward); + + postGlobalError("error.order.noOrderline.selected",request); + return mapping.getInputForward(); + } + catch(OperationException ex) + { + trx.rollback(); + throw new OperationException("Could not delete orderline. Reason : " + ex); + } + finally + { + trx.close(); + } + + Integer orderId = getCurrentOrderId(mapping, form, request, response); + //validating order + //if lines == 0 goto createpartialOrder + + //reload shopping cart + ShoppingCartBean cart = POSManager.getShoppingCartForOrder(ctx,orderId.intValue(),null); + String shoppingCart = null; + String shoppingCartItem = null; + String input = null; + + String orderType = bean.getOrderType(); + + if(orderType.equals(Constants.POS_ORDER)) + { + input = "/CreatePOSOrder.do"; + + shoppingCart = Constants.SHOPPING_ORDER_CART; + shoppingCartItem = Constants.SHOPPING_ORDER_CART_ITEMS; + } + else if(orderType.equals(Constants.GOODS_RECEIVE_NOTE)) + { + input = "/GetAllPOSVendor.do?action=getAllVendors&isSales=true"; + + shoppingCart = Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART; + shoppingCartItem = Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS; + } + else if(orderType.equals(Constants.GOODS_RETURN_NOTE)) + { + input = "/GetAllPOSVendor.do?action=getAllVendors&isSales=false"; + + shoppingCart = Constants.GOODS_RETURN_NOTE_SHOPPING_CART; + shoppingCartItem = Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS; + } + else if(orderType.equals(Constants.CUSTOMER_RETURN_ORDER)) + { + input = "/CustomerReturnOrder.do"; + + shoppingCart = Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART; + shoppingCartItem = Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS; + } + else + { + + } + + request.getSession().setAttribute(shoppingCart,cart); + request.getSession().setAttribute(shoppingCartItem,cart.getItems()); + + + if(OrderManager.isOrderEmpty(ctx,orderId.intValue(),null)) + { + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(shoppingCart); + request.getSession().removeAttribute(shoppingCartItem); + return new ActionForward(input); + } + + SessionStorage.putPOSOrderInfo(ctx,bean,request,forward); + df.populate(new OrderLineBean()); + return mapping.findForward(forward); + } + + public static final String VIEW_POS_INFO="viewPOSInfo"; + public ActionForward viewPOSInfo(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + + Timestamp fromdate = ReportDateManager.getFromDate(bean); + Timestamp todate = ReportDateManager.getToDate(bean); + + ArrayList list = POSManager.getPOSInfo(ctx, fromdate, todate, null); + request.getSession().setAttribute(Constants.POS_INFO,list); + //df.populate(new OrderLineBean()); + + return mapping.findForward(VIEW_POS_INFO); + } + + + + public static final String INCREMENT_QTY = "incrementQty"; + public ActionForward incrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + // Bug fix for null pointer + OrderLineForm of = (OrderLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + addToShoppingCart(mapping,form,request,response); + return getShoppingCart(mapping,form,request,response); + } + + public static final String DECREMENT_QTY = "decrementQty"; + public ActionForward decrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + // Bug fix for null pointer + OrderLineForm of = (OrderLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + addToShoppingCart(mapping,form,request,response); + return getShoppingCart(mapping,form,request,response); + } + + public ActionForward addProduct(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException, ParseException + { + // Bug fix for null pointer + OrderLineForm of = (OrderLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + addToShoppingCart(mapping,form,request,response); + + return getShoppingCart(mapping,form,request,response); + } + + + public static final String ADD_TO_SHOPPING_CART = "addToShoppingCart"; + public ActionForward addToShoppingCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + // ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + String orderType = bean.getOrderType(); + + if (orderType==null) + { orderType=(String)request.getSession().getAttribute(Constants.ORDER_TYPE); + bean.setOrderType(orderType); + df.populate(bean); + } + + String shoppingCart = Constants.SHOPPING_ORDER_CART; + String shoppingCartItem = Constants.SHOPPING_ORDER_CART_ITEMS; + String path=null; + + if (orderType.equalsIgnoreCase(Constants.POS_ORDER)) + { + path="/jsp/pos/createPOSOrder.jsp"; + } + if (orderType.equalsIgnoreCase(Constants.POS_ORDER_WITHOUT_ADVANCED)) + { + path="/jsp/pos/createPOSOrderWithoutAdvance.jsp"; + } + if (orderType.equalsIgnoreCase(Constants.QUICK_POS_ORDER)) + { + path="/jsp/pos/createPOSOrder3.jsp"; + } + if (orderType.equalsIgnoreCase(Constants.POS_ORDER_CUSTOMER_COMPULSORY)) + { + path="/jsp/pos/createPOSOrder2.jsp"; + } + else if(orderType.equalsIgnoreCase(Constants.CREDIT_ORDER)) + { + path="/jsp/pos/createCreditOrder.jsp"; + } + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(shoppingCart); + + try + { + // POSManager.getQtyAndItem(bean); + if(bean.getProductId()==null && bean.getBarCode()==null) + { + postGlobalError("error.barcode.required", request); + return new ActionForward(path); + } + + BigDecimal qty = bean.getQuantity(); + if(qty != null && qty.doubleValue() < 0.0) + { + throw new InputQuantityLessThanZeroException(""); + } + + cartBean = StockManager.addToPOSCart(ctx, bean, cartBean,true,Boolean.parseBoolean(bean.getIfAdd())); + + try + { + // cartBean = ComputeTotalLinePriceForDiscount(request, cartBean); + } + catch (Exception e) + { + e.printStackTrace(); + } + + } + catch (InputQuantityLessThanZeroException e) + { + postGlobalError("error.invalid.inputQty", request); + return new ActionForward(path); + } + catch (ProductNotFoundException e) + { + postGlobalError("error.product.not.found", e.getMessage(), request); + return new ActionForward(path); + } + catch(QuantityNotAvailableException e) + { + postGlobalError("error.quantity.notAvailable", e.getMessage(), request); + return new ActionForward(path); + } + + catch(ProductNotOnPriceListException e) + { + postGlobalError("error.product.price.not.found", e.getMessage(), request); + return new ActionForward(path); + } + + catch (UOMValuePrecisionNotValidException e) + { + postGlobalError("error.precision", e.getMessage(), request); + return new ActionForward(path); + } + + BigDecimal cartTotal = StockManager.setGrandTotal(cartBean.getItems()); + + String currSymboleSales = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol(); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales); + request.getSession().setAttribute(Constants.ORDER_TYPE,orderType); + + + request.getSession().setAttribute(shoppingCart, cartBean); + request.getSession().setAttribute(shoppingCartItem, cartBean.getItems()); + request.getSession().setAttribute(Constants.SHOPPING_CART_TOTAL, cartTotal); + request.getSession().setAttribute(Constants.B_PARTNER_ID,bean.getBpartnerId()); + + df.setQtyAndItem(""); + + return new ActionForward(path); + //return mapping.findForward(ADD_TO_SHOPPING_CART); + } + + public static final String GET_CURRENT_TILL_AMOUNT="getCurrentTillAmount"; + + public ActionForward getCurrentTillAmount(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + //DefaultForm df= (DefaultForm) form; + + CurrentTillAmountBean bean = POSManager.getCurrentTillAmount(ctx); + MCurrency currency = POSTerminalManager.getCurrencyOfTerminalCashBook(ctx); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currency.getCurSymbol()); + request.getSession().setAttribute(Constants.CURRENT_TILL_AMOUNT,bean); + return mapping.findForward(GET_CURRENT_TILL_AMOUNT); + } + + public static final String OPEN_CASH_DRAWER="openCashDrawer"; + + public ActionForward openCashDrawer(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + String cmd = PrintManager.getOpenDrawerCmd(); + + response.setContentType("application/octet-stream"); + OutputStream os = response.getOutputStream(); + os.write(cmd.getBytes()); + os.flush(); + os.close(); + + return null; + //return mapping.findForward(OPEN_CASH_DRAWER); + } + + public static final String REPRINT_ORDER="reprintOrder"; + + public ActionForward reprintOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df= (DefaultForm) form; + + OrderLineBean bean=(OrderLineBean)df.getBean(); + + OrderManager.rePrintOrder(ctx,bean.getOrderId()); + + return mapping.findForward(REPRINT_ORDER); + } + + public static final String DELETE_ORDER="deleteOrder"; + public ActionForward deleteOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df= (DefaultForm) form; + + OrderBean orderBean = (OrderBean)df.getBean(); + + try + { + OrderManager.deleteDraftedOrder(ctx, orderBean.getOrderId(), null); + } + catch(OperationException ex) + { + MOrder posOrder = new MOrder(ctx,orderBean.getOrderId(),null); + ArrayList list = POSManager.populateOrderLines(ctx,posOrder); + request.setAttribute(Constants.POS_ORDER_LINES,list); + postGlobalError("error.order.delete", request); + return mapping.getInputForward(); + } + return mapping.findForward(DELETE_ORDER); + } + + public static Integer getCurrentOrderId(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) + { + DefaultForm f = (DefaultForm)form; + + String orderType = f.getOrderType(); + Integer orderId = null; + + if(orderType.equals(Constants.POS_ORDER)) + { + orderId = (Integer) request.getSession().getAttribute(Constants.CURRENT_POS_ORDER_ID); + } + + if(orderType.equals(Constants.GOODS_RECEIVE_NOTE)) + { + orderId = (Integer) request.getSession().getAttribute(Constants.GOODS_RECEIVE_NOTE_ID); + } + + if(orderType.equals(Constants.GOODS_RETURN_NOTE)) + { + orderId = (Integer) request.getSession().getAttribute(Constants.GOODS_RETURN_NOTE_ID); + } + + if(orderType.equals(Constants.CUSTOMER_RETURN_ORDER)) + { + orderId = (Integer) request.getSession().getAttribute(Constants.CUSTOMER_RETURN_ORDER_ID); + } + + return orderId; + } + + public static final String DELETE_POS_ORDER = "deletePOSOrder"; + public ActionForward deletePOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + Integer orderId = (Integer) request.getSession().getAttribute( Constants.CURRENT_POS_ORDER_ID ); + + if( orderId == null ) + { + throw new OperationException("Cannot delete order. Reason: order ID not found!"); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + OrderManager.deleteDraftedOrder(ctx, orderId.intValue(), trx.getTrxName()); + trx.commit(); + } + catch(OperationException ex) + { + trx.rollback(); + MOrder posOrder = new MOrder(ctx,orderId.intValue(),null); + ArrayList list = POSManager.populateOrderLines(ctx,posOrder); + request.setAttribute(Constants.POS_ORDER_LINES,list); + postGlobalError("error.order.delete", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + //remove previously set values + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART); + request.getSession().removeAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_POS_ORDER_ID); + request.getSession().removeAttribute(Constants.CREDIT_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.CREDIT_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.CREDITORDER_BPARTNER); + + return mapping.findForward(DELETE_POS_ORDER); + } + + public ActionForward getShoppingCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, IOException, ParseException + { + DefaultForm df = (DefaultForm) form; + String orderType = df.getOrderType(); + + String shoppingcartHTML = ShoppingcartManager.getShoppingcartAsHTML(request, orderType); + + PrintWriter writer = response.getWriter(); + writer.write(shoppingcartHTML); + + + ActionMessages errors = (ActionMessages) request.getAttribute("org.apache.struts.action.ERROR"); + if(errors != null && !errors.isEmpty()) + { + MessageResources messageResources = getResources(request); + + Iterator iter = errors.get(); + while(iter.hasNext()) + { + ActionMessage message = iter.next(); + String key = message.getKey(); + Object[] values = message.getValues(); + + String errMsg = messageResources.getMessage(key, values); + writer.write(""); + } + + } + + writer.close(); + + return null; + } + + public ActionForward getBarcodeCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, IOException, ParseException + { + DefaultForm df = (DefaultForm) form; + String orderType = df.getOrderType(); + + String shoppingcartHTML = ShoppingcartManager.getBarcodecartAsHTML(request); + + PrintWriter writer = response.getWriter(); + writer.write(shoppingcartHTML); + + + ActionMessages errors = (ActionMessages) request.getAttribute("org.apache.struts.action.ERROR"); + if(errors != null && !errors.isEmpty()) + { + MessageResources messageResources = getResources(request); + + Iterator iter = errors.get(); + while(iter.hasNext()) + { + ActionMessage message = iter.next(); + String key = message.getKey(); + Object[] values = message.getValues(); + + String errMsg = messageResources.getMessage(key, values); + writer.write(""); + } + + } + + writer.close(); + + return null; + } + + public ActionForward validateAdvanceOrderPIN(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException + { + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + String userPIN = df.getUserPIN(); + + LoginBean bean = null; + LoginManager loginManager = new LoginManager(); + String script = null; + String errorMsg = ElementManager.getMsg(ctx,"not.authorised.to.give.discount").getName(); + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + + if (cartBean == null || cartBean.getItems().size() == 0) + { + script = "PINError('No items in cart')"; + } + else + { + try + { + bean = loginManager.getUserNameFromPIN(ctx, userPIN); + WebUser wu = loginManager.checkLoginPassword(ctx, bean); + + int roleId = Env.getAD_Role_ID(ctx); + BigDecimal discountAllowed = RoleManager.getDiscountAllowed(ctx, roleId, null); + + if(discountAllowed != Env.ZERO) + { + script = "setAction(document.forms[0],'GetPOSPaymentDetailsAction.do','getPOSPaymentDetails');" + + "disableButtons();"; + + request.getSession().setAttribute(Constants.DISCOUNT_ALLOWED, discountAllowed); + } + else + { + script = "PINError('" + errorMsg + "');" ; + } + } + catch (DuplicatePINException e) + { + script = "PINError('" + errorMsg + "');" ; + } + catch (InvalidPINException e) + { + script = "PINError('" + errorMsg + "');" ; + } + catch (UserNotFoundException e) + { + script = "PINError('" + errorMsg + "');" ; + } + catch (UserInactiveException e) + { + script = "PINError('" + errorMsg + "');" ; + } + catch (NotLoggedInException e) + { + script = "PINError('" + errorMsg + "');" ; + } + catch (SQLException e) + { + throw new OperationException(e); + } + catch (OperationException e) + { + throw new OperationException(e); + } + } + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public ActionForward skipValidation(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException + { + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + LoginBean bean = null; + LoginManager loginManager = new LoginManager(); + String script = null; + String errorMsg = ElementManager.getMsg(ctx,"not.authorised.to.give.discount").getName(); + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + + if (cartBean == null || cartBean.getItems().size() == 0) + { + script = "PINError('No items in cart')"; + } + else + { + try + { + int roleId = Env.getAD_Role_ID(ctx); + + BigDecimal discountAllowed = RoleManager.getDiscountAllowed(ctx, roleId, null); + + if(discountAllowed != Env.ZERO) + { + script = "setAction(document.forms[0],'GetPOSPaymentDetailsAction.do','getPOSPaymentDetails');" + + "disableButtons();"; + + request.getSession().setAttribute(Constants.DISCOUNT_ALLOWED, discountAllowed); + } + else + { + script = "PINError('" + errorMsg + "');" ; + } + } + catch (OperationException e) + { + throw new OperationException(e); + } + } + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public ActionForward validateAdvanceOrderPIN2(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException + { + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + String userPIN = df.getUserPIN(); + + LoginBean bean = null; + LoginManager loginManager = new LoginManager(); + String script = null; + + try + { + bean = loginManager.getUserNameFromPIN(ctx, userPIN); + WebUser wu = loginManager.checkLoginPassword(ctx, bean); + + int roleId = Env.getAD_Role_ID(ctx); + + BigDecimal discountAllowed = RoleManager.getDiscountAllowed(ctx, roleId, null); + + if(discountAllowed != Env.ZERO) + { + script = "setAction(document.forms[0],'GetPOSPaymentDetailsAction2.do','getPOSPaymentDetails');" + + "disableButtons();"; + + request.getSession().setAttribute(Constants.DISCOUNT_ALLOWED, discountAllowed); + } + else + { + script = "PINError('It seems that you are not authorised to give discounts.');" ; + } + } + catch (DuplicatePINException e) + { + script = "PINError('It seems that you are not authorised to give discounts.');" ; + } + catch (InvalidPINException e) + { + script = "PINError('It seems that you are not authorised to give discounts.');" ; + } + catch (UserNotFoundException e) + { + script = "PINError('It seems that you are not authorised to give discounts.');" ; + } + catch (UserInactiveException e) + { + script = "PINError('It seems that you are not authorised to give discounts.');" ; + } + catch (NotLoggedInException e) + { + script = "PINError('It seems that you are not authorised to give discounts.');" ; + } + catch (SQLException e) + { + throw new OperationException(e); + } + catch (OperationException e) + { + throw new OperationException(e); + } + + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public ActionForward getPrintOrderData(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException, ApplicationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + + Integer C_Order_ID = bean.getOrderId(); + + if(C_Order_ID == null) + return null; + + String printingType = POSManager.getPrintingTypeFromCookie(request); + boolean cashDrawerPresent = POSManager.getCashDrawerStatusFromCookie(request); + + if (printingType == null) + { + printingType = TmkPrinterConstants.SLIP_PRINTER_9PIN; + } + + byte printData[] = null; + byte [] openCashDrawer = {10,27,112,48,55,1}; + + String args = "showFooter=true;lineLength=40;priceWithVat=true;showDiscount=true;showLogo=false;showBarcode=false;"; + + if (TmkPrinterConstants.SLIP_PRINTER_9PIN.equalsIgnoreCase(printingType)) + { + String data = PrintManager.getPrintData(ctx, C_Order_ID, args, null); + response.setContentType("application/octet-stream"); + printData = data.getBytes(); + } + else if (TmkPrinterConstants.SLIP_PRINTER_THERMAL.equalsIgnoreCase(printingType)) + { + args = "showFooter=true;lineLength=64;priceWithVat=true;showDiscount=true;showLogo=false;showBarcode=false;"; + String data = PrintManager.getPrintData(ctx, C_Order_ID, args, null); + response.setContentType("application/octet-stream"); + printData = data.getBytes(); + } + else if (TmkPrinterConstants.NORMAL_PRINTER.equalsIgnoreCase(printingType)) + { + printData = PrintManager.getPDFData(ctx, ReportEngine.ORDER, C_Order_ID); + response.setContentType("application/pdf"); + } + else + { + logger.log(Level.SEVERE, "Printing Type not defined, PrintingType: " + printingType); + return null; + } + + OutputStream os = response.getOutputStream(); + + if(bean.getOpenDrawer() && cashDrawerPresent) + { + os.write(openCashDrawer); + } + + os.write(printData); + os.flush(); + os.close(); + + + return null; + } + + public static final String GET_ORDER_SHOPPING_CART="getOrderShoppingCart"; + public ActionForward getOrderShoppingCart(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException, ApplicationException + { + + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + ActionForward forward=null; + + Integer orderId = bean.getOrderId(); + MOrder order = new MOrder(ctx,orderId,null); + + ShoppingCartBean cart = (ShoppingCartBean)request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + if(cart == null) + { + cart = POSManager.getShoppingCartForOrder(ctx, order.get_ID(), null); + } + + + int c_BPartner_Id = order.getC_BPartner_ID(); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + + if((Constants.POS_ORDER_WITHOUT_ADVANCED).equalsIgnoreCase(df.getOrderType())) + { + cart = POSManager.getShoppingCartForOrder(ctx, order.get_ID(), null); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.SHOPPING_ORDER_CART , cart ); + request.getSession().setAttribute( Constants.SHOPPING_ORDER_CART_ITEMS , cart.getItems() ); + request.getSession().setAttribute( Constants.PRESENT_POS_ORDER , order ); + request.getSession().setAttribute( Constants.PRESENT_POS_ORDER_ID , Integer.valueOf(order.get_ID()) ); + + forward = new ActionForward("/CreatePOSOrderWithoutAdvanced.do"); + + df.populate(new OrderLineBean()); + return forward; + } + + if((Constants.POS_ORDER_CUSTOMER_COMPULSORY).equalsIgnoreCase(df.getOrderType())) + { + cart = POSManager.getShoppingCartForOrder(ctx, order.get_ID(), null); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.SHOPPING_ORDER_CART , cart ); + request.getSession().setAttribute( Constants.SHOPPING_ORDER_CART_ITEMS , POSManager.getItemBean(cart.getItems()) ); + request.getSession().setAttribute( Constants.PRESENT_POS_ORDER , order ); + request.getSession().setAttribute( Constants.PRESENT_POS_ORDER_ID , Integer.valueOf(order.get_ID()) ); + + forward = new ActionForward("/CreatePOSOrder2.do"); + + df.populate(new OrderLineBean()); + return forward; + } + + if(order.getOrderType().equals(UDIOrderTypes.POS_ORDER.getOrderType())) + { + cart = POSManager.getShoppingCartForOrder(ctx, order.get_ID(), null); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.SHOPPING_ORDER_CART , cart ); + request.getSession().setAttribute( Constants.SHOPPING_ORDER_CART_ITEMS , POSManager.getItemBean(cart.getItems())); + request.getSession().setAttribute( Constants.PRESENT_POS_ORDER , order ); + request.getSession().setAttribute( Constants.PRESENT_POS_ORDER_ID , Integer.valueOf(order.get_ID()) ); + df.populate(new OrderLineBean()); + forward = new ActionForward("/CreatePOSOrder.do"); + } + else if(order.getOrderType().equals(UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType())) + { + cart = (ShoppingCartBean)request.getSession().getAttribute(Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART , cart ); + + if (cart != null) + { + request.getSession().setAttribute( Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS , cart.getItems() ); + request.getSession().setAttribute( Constants.PRESENT_GRN_ORDER , order ); + request.getSession().setAttribute( Constants.PRESENT_GRN_ORDER_ID , Integer.valueOf(order.get_ID()) ); + } + + forward = new ActionForward("/GetAllPOSVendor.do?action=getAllVendors&isSales=true"); + } + else if(order.getOrderType().equals(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType())) + { + cart = (ShoppingCartBean)request.getSession().getAttribute(Constants.GOODS_RETURN_NOTE_SHOPPING_CART); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.GOODS_RETURN_NOTE_SHOPPING_CART, cart ); + request.getSession().setAttribute( Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS,cart.getItems() ); + request.getSession().setAttribute( Constants.PRESENT_GOODS_RET_ORDER , order ); + request.getSession().setAttribute( Constants.PRESENT_GOODS_RET_ORDER_ID , Integer.valueOf(order.get_ID()) ); + + forward = new ActionForward("/GetAllPOSVendor.do?action=getAllVendors&isSales=false"); + } + else if(order.getOrderType().equals(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType())) + { + cart = (ShoppingCartBean)request.getSession().getAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART); + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART, cart ); + request.getSession().setAttribute( Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS, POSManager.getItemBean(cart.getItems()) ); + request.getSession().setAttribute( Constants.PRESENT_CUSTOMER_RET_ORDER , order ); + request.getSession().setAttribute( Constants.PRESENT_CUSTOMER_RET_ORDER_ID , Integer.valueOf(order.get_ID()) ); + + forward = new ActionForward("/CustomerReturnOrder.do"); + + } + else if(order.getOrderType().equals(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + cart = (ShoppingCartBean)request.getSession().getAttribute(Constants.CREDIT_ORDER_SHOPPING_CART); + request.getSession().setAttribute(Constants.CREDITORDER_BPARTNER, Integer.valueOf(c_BPartner_Id)); + request.getSession().setAttribute( Constants.CREDIT_ORDER_SHOPPING_CART , cart ); + request.getSession().setAttribute( Constants.CREDIT_ORDER_SHOPPING_CART_ITEMS , POSManager.getItemBean(cart.getItems()) ); + request.getSession().setAttribute( Constants.PRESENT_CREDIT_ORDER , order ); + request.getSession().setAttribute( Constants.PRESENT_CREDIT_ORDER_ID , Integer.valueOf(order.get_ID()) ); + forward = new ActionForward("/InitCreateCreditOrderAction.do?action=initCreateCreditOrder"); + + } + + else if(order.getOrderType().equals(UDIOrderTypes.CREDIT_MEMO.getOrderType())) + { + cart = (ShoppingCartBean)request.getSession().getAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART); + OrderBean orderBean = POSManager.getPOSOrderDetail(ctx,order.getDocumentNo()); + int bpartnerId = orderBean.getBpartnerId().intValue(); + MBPartner partner = BPartnerManager.loadBPartner(ctx, bpartnerId,null); + String partnerName = partner.getName() + " " + partner.getName2(); + partnerName = partnerName.trim(); + + df.setPartnerName(partnerName); + df.setBpartnerId(orderBean.getBpartnerId().toString()); + + request.getSession().setAttribute(Constants.B_PARTNER_ID,orderBean.getBpartnerId()); + request.getSession().setAttribute(Constants.ORDER_TYPE,orderBean.getOrderType()); + request.getSession().setAttribute(Constants.POS_ORDER_DOC_NUMBER,bean.getDocumentNo()); + request.getSession().setAttribute(Constants.CREDIT_PAYMENT_TERM_ID,orderBean.getPaymentTermId()); + if (cart != null) + { + request.getSession().setAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART,cart); + request.getSession().setAttribute(Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS,cart.getItems()); + } + forward = new ActionForward("/CreditMemoAction.do"); + + } + else + { + String msg = "Unknown orderType : " + order.getOrderType(); + throw new OperationException(msg); + } + df.populate(new OrderLineBean()); + return forward; + } + + public static final String GET_CUSTOMER_RETURN_ORDER_SHOPPING_CART = "getCustomerReturnOrderShoppingCart"; + public ActionForward getCustomerReturnOrderShoppingCart(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException, ApplicationException + { + getOrderShoppingCart(mapping,form,request,response); + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + Integer bpartnerId = (Integer) request.getSession().getAttribute(Constants.B_PARTNER_ID); + + MBPartner partner = BPartnerManager.loadBPartner(ctx, bpartnerId.intValue(),null); + String partnerName = partner.getName() + " " + partner.getName2(); + partnerName = partnerName.trim(); + + df.setPartnerName(partnerName); + df.setBpartnerId(bpartnerId.toString()); + + return mapping.findForward(GET_CUSTOMER_RETURN_ORDER_SHOPPING_CART); + } + + public static final String GET_CUSTOMER_RETURN_ORDER_SHOPPING_CART2 = "getCustomerReturnOrderShoppingCart2"; + public ActionForward getCustomerReturnOrderShoppingCart2(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException, ApplicationException + { + getOrderShoppingCart(mapping,form,request,response); + + /* + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + Integer bpartnerId = (Integer) request.getSession().getAttribute(Constants.B_PARTNER_ID); + + MBPartner partner = BPartnerManager.loadBPartner(ctx, bpartnerId.intValue(),null); + String partnerName = partner.getName() + " " + partner.getName2(); + partnerName = partnerName.trim(); + + df.setPartnerName(partnerName); + df.setBpartnerId(bpartnerId.toString()); + */ + + return mapping.findForward(GET_CUSTOMER_RETURN_ORDER_SHOPPING_CART2); + } + + public static final String GET_CREDIT_MEMO_SHOPPING_CART = "getCreditMemoShoppingCart"; + public ActionForward getCreditMemoShoppingCart(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException, ApplicationException + { + getCustomerReturnOrderShoppingCart(mapping,form,request,response); + return mapping.findForward(GET_CREDIT_MEMO_SHOPPING_CART); + } + + public static final String REMOVE_SESSION_FOR_NEW_OREDR="removeSessionForNewOrder"; + public ActionForward removeSessionForNewOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + + Properties ctx=TmkJSPEnv.getCtx(request); + RemoveSessionForm df = (RemoveSessionForm) form; + RemoveSessionBean bean = (RemoveSessionBean) df.getBean(); + + SessionStorage.removeSession(ctx,request); + String forwd =POSManager.getForward(ctx,bean.getOrderType()); + + + return new ActionForward(forwd); + } + + //---------------------------------------------------------------------------------------------- + + public static final String UPDATE_QTY = "updateQty"; + public ActionForward updateQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx=TmkJSPEnv.getCtx(request); + + // Bug fix for null pointer + OrderLineForm of = (OrderLineForm) form; + if(of.getQuantity() == null) + { + of.setQuantity("1"); + } + + OrderLineBean bean = (OrderLineBean) of.getBean(); + Integer product_id = bean.getProductId(); + BigDecimal quantity = bean.getQuantity(); + Integer priceListId = bean.getPriceListId(); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + StockManager.updateItemFromPOSList(ctx, priceListId, items, product_id, quantity); + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART); + cartBean.setItems(items); + BigDecimal cartTotal = StockManager.setGrandTotal(items); + request.getSession().setAttribute(Constants.SHOPPING_CART_TOTAL, cartTotal); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART_ITEMS, items); + + if(quantity.doubleValue() == 0.0d) + { + request.getSession().setAttribute(Constants.SHOPPING_CART_DISCOUNTED_TOTAL, Env.ZERO); + } + return getShoppingCart(mapping,form,request,response); + } + + public static final String RELOAD_CART = "reloadCart"; + public ActionForward reloadCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + return getShoppingCart(mapping,form,request,response); + } + + public static final String UPDATE_PRICELIST = "updatePriceList"; + public ActionForward updatePriceList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx=TmkJSPEnv.getCtx(request); + + OrderLineForm of = (OrderLineForm) form; + OrderLineBean bean = (OrderLineBean) of.getBean(); + + Integer priceListId = bean.getPriceListId(); + int oldPriceListId = ShoppingcartManager.getPriceList(request); + + if(oldPriceListId != priceListId) + { + try + { + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + StockManager.setPOSItemPrices(ctx, priceListId, items, true); + request.getSession().setAttribute(Constants.SHOPPING_ORDER_CART_ITEMS, items); + request.getSession().setAttribute(Constants.ORDER_PRICE_LIST, priceListId); + } + catch(ProductNotOnPriceListException e) + { + postGlobalError("error.product.price.not.found", e.getMessage(), request); + } + catch(OperationException e) + { + postGlobalError("error.process", e.getMessage(), request); + } + } + + return getShoppingCart(mapping,form,request,response); + } + + public static final String RESET_USER = "resetUser"; + public ActionForward resetUser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx=TmkJSPEnv.getCtx(request); + OrderLineForm of = (OrderLineForm) form; + OrderLineBean bean = (OrderLineBean) of.getBean(); + + StringBuffer sb = new StringBuffer(); + + try + { + MRole role = new MRole(ctx, bean.getRoleId(), null); + float discountAllowed = role.getUserDiscount().floatValue(); + boolean overrideLimit = role.isOverwritePriceLimit(); + boolean discountUptoPriceLimit = role.isDiscountUptoLimitPrice(); + boolean discountOnTotal = role.isDiscountAllowedOnTotal(); + + CheckoutForm cf = (CheckoutForm) request.getSession().getAttribute("CheckoutForm"); + if(cf == null) + { + cf = new CheckoutForm(); + } + + cf.setDiscountLimit(discountAllowed + ""); + cf.setIsOverwritePriceLimit(overrideLimit + ""); + cf.setIsDiscountOnTotal(discountOnTotal + ""); + cf.setIsDiscountUptoLimitPrice(discountUptoPriceLimit + ""); + + request.getSession().setAttribute("CheckoutForm", cf); + + sb.append("{ roleId:").append(role.getAD_Role_ID()).append(","); + sb.append("discountLimit:").append(discountAllowed).append(","); + sb.append("overrideLimit:").append(overrideLimit).append(","); + sb.append("discountOnTotal:").append(discountOnTotal).append(","); + sb.append("discountUptoPriceLimit:").append(discountUptoPriceLimit).append("}"); + + } + catch (Exception e) + { + sb.append("{error:'" + e.getMessage() + "'}"); + } + + PrintWriter writer = response.getWriter(); + writer.write(sb.toString()); + writer.close(); + + return null; + } + + + public static final String VALIDATE_PIN = "validatePIN"; + public ActionForward validatePIN(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + String pin = request.getParameter("pin"); + Properties ctx=TmkJSPEnv.getCtx(request); + + StringBuffer sb = new StringBuffer(); + + try + { + int ad_role_id = UserManager.getRoleId(ctx, pin, null); + float discountAllowed = UserManager.getDiscountAllowed(ctx, pin, null).floatValue(); + boolean overrideLimit = UserManager.isOverridePriceLimitAllowed(ctx, pin, null); + boolean discountUptoPriceLimit = UserManager.isDiscountUptoPriceLimit(ctx, pin, null); + boolean discountOnTotal = UserManager.isDiscountAllowedOnTotal(ctx, pin, null); + + CheckoutForm cf = (CheckoutForm) request.getSession().getAttribute("CheckoutForm"); + if(cf == null) + { + cf = new CheckoutForm(); + } + + cf.setDiscountLimit(discountAllowed + ""); + cf.setIsOverwritePriceLimit(overrideLimit + ""); + cf.setIsDiscountOnTotal(discountOnTotal + ""); + cf.setIsDiscountUptoLimitPrice(discountUptoPriceLimit + ""); + + request.getSession().setAttribute("CheckoutForm", cf); + + sb.append("{ roleId:").append(ad_role_id).append(","); + sb.append("discountLimit:").append(discountAllowed).append(","); + sb.append("overrideLimit:").append(overrideLimit).append(","); + sb.append("discountOnTotal:").append(discountOnTotal).append(","); + sb.append("discountUptoPriceLimit:").append(discountUptoPriceLimit).append("}"); + + } + catch (UserNotFoundException e) + { + sb.append("{error:'Invalid PIN!'}"); + } + catch (RoleNotFoundException e) + { + sb.append("{error:'Invalid PIN!'}"); + } + + PrintWriter writer = response.getWriter(); + writer.write(sb.toString()); + writer.close(); + + return null; + } + + /** + * This method is called from the order screens + * Parameters supplied are: + * 1. amountTendered + * 2. cardNo + * 3. chequeNo + * 4. cashAmt + * 5. chequeAmt + * 6. cardAmount + * 7. bpartnerId + * 8. tenderType + * 9. discounts + * 10. orderType + * 11. discountLimit + */ + public static final String CHECKOUT = "checkout"; + public ActionForward checkout(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + CheckoutForm cf = (CheckoutForm) form; + CheckoutBean bean = (CheckoutBean) cf.getBean(); + String input = ""; + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + int c_order_id = -1; + + try + { + trx.start(); + //Bug fix for credit sales + //set order type to credit order if tender type is credit + /* + if("Credit".equals(bean.getTenderType()) && + UDIOrderTypes.POS_ORDER.getOrderType().compareTo(bean.getOrderType()) == 0) + { + bean.setOrderType(UDIOrderTypes.CREDIT_ORDER.getOrderType()); + } + */ + + if(UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType().equalsIgnoreCase(bean.getOrderType())) + { + input = "/CreatePOSOrderScreen.do"; + c_order_id = POSManager.createGoodsReceiveNote(ctx, bean, request, trx.getTrxName()); + } + + if(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType().equalsIgnoreCase(bean.getOrderType())) + { + input = "/CreatePOSOrderScreen.do"; + c_order_id = POSManager.createGoodsReturnNote(ctx, bean, request, trx.getTrxName()); + } + + if(UDIOrderTypes.POS_ORDER.getOrderType().equalsIgnoreCase(bean.getOrderType()) + || UDIOrderTypes.CREDIT_ORDER.getOrderType().equalsIgnoreCase(bean.getOrderType())) + { + input = "/CreatePOSOrderScreen.do"; + //get shopping cart items + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + c_order_id = POSManager.checkoutOrder(ctx, bean, items, trx.getTrxName()); + } + + /* + if(UDIOrderTypes.CREDIT_ORDER.getOrderType().equalsIgnoreCase(bean.getOrderType())) + { + input = "/CreatePOSOrderScreen.do"; + //get shopping cart items + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + c_order_id = POSManager.checkoutOrder(ctx, bean, items, trx.getTrxName()); + } + */ + + if(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType().equalsIgnoreCase(bean.getOrderType())) + { + input = "/CreatePOSOrderScreen.do"; + //get shopping cart items + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_ORDER_CART_ITEMS); + c_order_id = POSManager.createCustomerReturnOrder(ctx, bean, request, trx.getTrxName()); + } + + trx.commit(); + } + catch (Exception e) + { + trx.rollback(); + postGlobalError("error.process", e.getMessage(), request); + e.printStackTrace(); + + return new ActionForward(input); + } + finally + { + trx.close(); + } + + ShoppingcartManager.clearShoppingcart(request); + request.getSession().removeAttribute(Constants.BPARTNER_ID); + request.getSession().removeAttribute(Constants.BPARTNER_NAME); + request.getSession().removeAttribute(Constants.BPARTNER_CREDIT); + request.getSession().removeAttribute(Constants.ORDER_PRICE_LIST); + //return mapping.findForward(CHECKOUT); + return new ActionForward("/ViewPOSOrder.do?orderType=" + bean.getOrderType() + "&orderId=" + c_order_id); + } + + public ActionForward clearCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ShoppingcartManager.clearShoppingcart(request); + + return getShoppingCart(mapping, form, request, response); + } + + public static String SET_DISCOUNT = "setDiscount"; + public ActionForward setDiscount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + CheckoutForm cf = (CheckoutForm) form; + CheckoutBean bean = (CheckoutBean) cf.getBean(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + trx.start(); + POSManager.setDiscount(ctx, bean, request, trx.getTrxName()); + trx.commit(); + } + catch (DiscountLimitException e) + { + postGlobalError("error.process", e.getMessage(), request); + trx.rollback(); + } + catch(OperationException e) + { + postGlobalError("error.process", e.getMessage(), request); + trx.rollback(); + } + finally + { + trx.close(); + } + return new ActionForward("/CreatePOSOrderScreen.do"); + } + + public ActionForward setQuickDiscount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + CheckoutForm cf = (CheckoutForm) form; + CheckoutBean bean = (CheckoutBean) cf.getBean(); + StringBuffer sb = new StringBuffer(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + trx.start(); + POSManager.setQuickDiscount(ctx, bean, request, trx.getTrxName()); + sb.append("{status: 'OK'}"); + trx.commit(); + } + catch (DiscountLimitException e) + { + trx.rollback(); + sb.append("{error:'" + e.getMessage() + "'}"); + + } + catch(OperationException e) + { + trx.rollback(); + sb.append("{error:'" + e.getMessage() + "'}"); + } + finally + { + trx.close(); + } + + PrintWriter writer = response.getWriter(); + writer.write(sb.toString()); + writer.close(); + + return null; + + } + + + public static final String LOAD_ORDER_SCREEN = "loadOrderScreen"; + public ActionForward loadOrderScreen(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + Object isSales = request.getParameter(Constants.IS_SOTRX); + if (isSales == null) + { + return mapping.getInputForward(); + } + String isSO = String.valueOf(isSales); + Boolean isSOTrx = Boolean.valueOf(isSO); + Configuration config = Configuration.getConfiguration(request); + + DefaultForm df = (DefaultForm) form; + String orderType = df.getOrderType(); + + if(orderType == null) + { + if (isSOTrx) + { + orderType = UDIOrderTypes.POS_ORDER.getOrderType(); + } + else + { + orderType = UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType(); + } + } + else + { + if(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType().equals(orderType)) + { + isSOTrx = false; + config.setPaymentRule(Constants.PAYMENT_RULE_CREDIT); + } + + if(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType().equals(orderType)) + { + isSOTrx = true; + config.setPaymentRule(Constants.PAYMENT_RULE_CREDIT); + } + } + + config.setOrderType(orderType); + config.setIsSOTrx(isSOTrx); + + return new ActionForward("/CreatePOSOrderScreen.do"); + } + + + public static final String LOAD_ADVANCED_ORDER_SCREEN = "loadAdvancedOrderScreen"; + public ActionForward loadAdvancedOrderScreen(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + Object isSO = request.getParameter(Constants.IS_SOTRX); + Boolean isSOTrx = Boolean.valueOf(String.valueOf(isSO)); + Object pListId = request.getSession().getAttribute(Constants.ORDER_PRICE_LIST); + Integer priceListId = PriceListManager.getDefaultPriceListId(ctx, isSOTrx); + try + { + if (pListId != null) + { + String prListId = String.valueOf(pListId); + priceListId = Integer.valueOf(prListId); + } + } + catch (NumberFormatException e) + { + } + + int roleId = Env.getAD_Role_ID(ctx); + float discountAllowed = RoleManager.getDiscountAllowed(ctx, roleId, null).floatValue(); + boolean isAllowedOverridePriceLimit = RoleManager.isOverridePriceLimitAllowed(ctx, roleId, null); + + String orderType = String.valueOf(request.getSession().getAttribute(Constants.ORDER_TYPE)); + + return new ActionForward("/CreateAdvancedPOSOrderScreen.do?discountAllowed="+discountAllowed+ + "&isAllowedOverridePriceLimit="+isAllowedOverridePriceLimit+"&orderType="+orderType+"&priceListId="+ priceListId); + } + + public ActionForward saveBPartnerInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if (fwd!=null) + { + return fwd; + } + + Properties ctx=TmkJSPEnv.getCtx(request); + String bp = String.valueOf(request.getParameter("bPartnerId")); + String plId = String.valueOf(request.getParameter("priceListId")); + try + { + Integer bPartnerId = Integer.valueOf(bp); + String name = String.valueOf(request.getParameter("name")); + String creditLimit = String.valueOf(request.getParameter("creditLimit")); + Integer priceListId = Integer.valueOf(plId); + + request.getSession().setAttribute(Constants.ORDER_PRICE_LIST, priceListId); + request.getSession().setAttribute(Constants.BPARTNER_ID, bPartnerId); + request.getSession().setAttribute(Constants.BPARTNER_NAME, name); + request.getSession().setAttribute(Constants.BPARTNER_CREDIT, creditLimit); + } + catch (NumberFormatException e) + { + } + + return null; + } + + public static ShoppingCartBean ComputeTotalLinePriceForDiscount(HttpServletRequest request, ShoppingCartBean cartBean) throws Exception + { + CheckoutBean checkoutBean = (CheckoutBean) request.getSession().getAttribute(Constants.CHECKOUT_BEAN); + + if(checkoutBean == null) + { + return cartBean; + } + + BigDecimal[] totalLinePrices = checkoutBean.getDiscountedPrice(); + BigDecimal[] qtyPerLine = checkoutBean.getQtyPerLine(); + + ArrayList itemList = cartBean.getItems(); + Iterator itr = itemList.iterator(); + + for(int i=0; i< totalLinePrices.length; i++) + { + ItemBean itemBean = cartBean.getItems().get(i); + BigDecimal totalLinePrice = itemBean.getPrice(); + + + //When increasing or decreasing quantity after giving discount on percentage, give the same percentage + //discount on this new totalLine + if (itemBean.getIsDiscountOnPercentage()) + { + if (itemBean.getDiscountPercent().doubleValue() > 0) + { + totalLinePrice = totalLinePrice.multiply(((Env.ONEHUNDRED.subtract(itemBean.getDiscountPercent()))).divide(Env.ONEHUNDRED)); + totalLinePrice = totalLinePrice.setScale(2, RoundingMode.HALF_UP); + + } + } + + //When increasing or decreasing quantity, if discount was given on total line, retain the same + //total value if quantity of this item is not changed + else if (itemBean.getIsDiscountOnTotal() && (qtyPerLine[i].compareTo(itemBean.getQty()) == 0)) + { + totalLinePrice = totalLinePrices[i]; + } + else if (!itemBean.getIsDiscountOnInclUnitPrice()) + { + itemBean.setDiscountPercent(Env.ZERO); + } + + itemBean.setPrice(totalLinePrice); + + } + + cartBean.setItems(itemList); + return cartBean; + } + +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSPriceListAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSPriceListAction.java new file mode 100644 index 0000000000..88d511584f --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSPriceListAction.java @@ -0,0 +1,152 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 19, 2005 by praveen + * + */ +package org.posterita.struts.pos; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.Env; +import org.compiere.util.Trx; + +import org.posterita.Constants; +import org.posterita.beans.EditPriceBean; +import org.posterita.beans.PriceListBean; +import org.posterita.beans.ProductPriceBean; +import org.posterita.businesslogic.ProductCart; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.SystemException; +import org.posterita.form.PriceListForm; +import org.posterita.lib.UdiConstants; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class POSPriceListAction extends BaseDispatchAction +{ + public static final String INIT_PRICE_LIST = "initPriceList"; + public ActionForward initPriceList(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + String searchText = df.getSearchText(); + + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + int priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null); + + ArrayList productPriceList = PriceListManager.getProductPriceList(ctx, priceListVersionId, searchText, null, null); + + request.getSession().setAttribute(Constants.POS_SALES_PRICE_LIST, productPriceList); + request.getSession().setAttribute(Constants.PRICE_LIST, productPriceList); + return mapping.findForward(INIT_PRICE_LIST); + } + + public static final String INIT_EDIT_PRICE_LIST = "initEditPriceList"; + public ActionForward initEditPriceList(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + PriceListForm df = (PriceListForm) form; + + df.validate(mapping,request); + + PriceListBean bean = (PriceListBean) df.getBean(); + + if(bean.getProductIds() == null || bean.getProductIds().length == 0) + { + postGlobalError("error.product.not.selected", request); + return mapping.getInputForward(); + } + + request.getSession().setAttribute(Constants.PRODUCT_IDS, bean.getProductIds()); + + + return mapping.findForward(INIT_EDIT_PRICE_LIST); + } + + public static final String EDIT_PRICELIST = "editPriceList"; + public ActionForward editPriceList(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException, SystemException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + EditPriceBean bean = (EditPriceBean) df.getBean(); + + BigDecimal priceEntered = bean.getPrice(); + + ProductCart cart = (ProductCart) request.getSession().getAttribute(Constants.PRODUCT_CART); + Integer productIds[] = cart.getProductIDs(); + + + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + int priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + + try + { + trx.start(); + PriceListManager.editProductPrices(ctx,productIds, priceListVersionId, priceEntered, trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + throw e; + } + catch (SystemException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + + return mapping.findForward(EDIT_PRICELIST); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSProductAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSProductAction.java new file mode 100644 index 0000000000..67c7cd09df --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSProductAction.java @@ -0,0 +1,1035 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on May 22, 2006 + */ + + +package org.posterita.struts.pos; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MLocator; +import org.compiere.model.MProduct; +import org.compiere.model.MProductPrice; +import org.compiere.model.MStorage; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.ProductBean; +import org.posterita.beans.ProductDetailsBean; +import org.posterita.beans.ProductSalesInfoBean; +import org.posterita.beans.ProductSalesSummaryBean; +import org.posterita.businesslogic.POSGoodsManager; +import org.posterita.businesslogic.POSProductManager; +import org.posterita.businesslogic.ProductCart; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.administration.WarehouseManager; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.RandomStringGenerator; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BarcodeAlreadyExistsException; +import org.posterita.exceptions.CannotInactivateProductException; +import org.posterita.exceptions.InvalidBarcodeException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductAlreadyExistException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.form.POSProductForm; +import org.posterita.lib.UdiConstants; +import org.posterita.struts.core.DefaultForm; + + + +public class POSProductAction extends POSDispatchAction +{ + public static final String CREATE_OR_UPDATE_PRODUCT = "createOrUpdateProduct"; + public ActionForward createOrUpdateProduct(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + { + return fwd; + } + + Properties ctx=TmkJSPEnv.getCtx(request); + POSProductForm pf = (POSProductForm)form; + ProductBean bean = (ProductBean)pf.getBean(); + ProductBean productBean = new ProductBean(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + POSProductManager.createOrUpdateProduct(ctx,bean,trx.getTrxName()); + productBean = POSProductManager.viewPOSProduct(ctx, bean.getProductId(), trx.getTrxName()); + + postGlobalMessage("message.product.saved", request); + trx.commit(); + } + catch(ProductAlreadyExistException e1) + { + postGlobalError("error.product.already.exists",request); + trx.rollback(); + return mapping.getInputForward(); + } + catch(BarcodeAlreadyExistsException e2) + { + postGlobalError("error.barcode.already.exists",request); + trx.rollback(); + return mapping.getInputForward(); + } + catch(NumberFormatException e3) + { + postGlobalError("error.numberformatexception.price",request); + trx.rollback(); + trx.close(); + return mapping.getInputForward(); + } + catch(OperationException e) + { + postGlobalError("error.process", e.getMessage(), request); + trx.rollback(); + trx.close(); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.VIEW_POS_PRODUCTS); + if (list == null) + { + list = new ArrayList(); + } + list.add(productBean); + ArrayList productPriceLists = PriceListManager.getProductPriceLists(ctx, bean.getProductId(), bean.getOrgId(), null); + request.getSession().setAttribute(Constants.PRODUCT_PRICE_LISTS, productPriceLists); + + pf.populate(productBean); + return mapping.findForward(CREATE_OR_UPDATE_PRODUCT); + } + + public static final String VIEW_PRODUCT = "viewProduct"; + public ActionForward viewProduct(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + { + return fwd; + } + Properties ctx=TmkJSPEnv.getCtx(request); + POSProductForm pf = (POSProductForm)form; + Integer productId = Integer.valueOf(request.getParameter("productId")); + String next =request.getParameter("isNext"); + + Boolean isNext= null; + if ("true".equals(next)) + { + isNext = true; + } + else if ("false".equals(next)) + { + isNext = false; + } + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.VIEW_POS_PRODUCTS); + ProductBean bean = null; + + bean = POSProductManager.getProductBean(ctx, list, productId, isNext); + pf.populate(bean); + + ArrayList productPriceLists = PriceListManager.getProductPriceLists(ctx, productId, bean.getOrgId(), null); + ArrayList uomList = POSProductManager.getUoms(ctx, null); + ArrayList taxList = POSGoodsManager.getAllTaxCategory(ctx); + + request.getSession().setAttribute(Constants.UOM_LIST, uomList); + request.getSession().setAttribute(Constants.EXISTING_BAR_CODE,bean.getBarCode()); + request.getSession().setAttribute(Constants.TAX_CATEGORY_ID,taxList); + request.getSession().setAttribute(Constants.PRODUCT_PRICE_LISTS, productPriceLists); + + return mapping.findForward(VIEW_PRODUCT); + } + + + /*public static final String UPDATE_PRODUCT_DETAILS="updateProductDetails"; + public ActionForward updateProductDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + ProductBean bean = (ProductBean)df.getBean(); + bean.setFile(df.getFile()); + String existingBarCode = (String)request.getSession().getAttribute(Constants.EXISTING_BAR_CODE); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + POSProductManager.editProduct(ctx,bean,existingBarCode,trx.getTrxName()); + trx.commit(); + } + catch(BarcodeAlreadyExistsException e1) + { + + trx.rollback(); + postGlobalError("error.barcode.already.exists",request); + return mapping.getInputForward(); + } + catch(CannotInactivateProductException e2) + { + trx.rollback(); + postGlobalError("error.product.cannot.inactivate", e2.getMessage(), request); + return mapping.getInputForward(); + + } + catch(InvalidContentTypeException e3) + { + trx.rollback(); + postGlobalError("error.invalid.content", e3.getMessage(), request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + ProductBean productBean= POSProductManager.viewPOSProduct(ctx,bean.getProductId().intValue(), null); + + ArrayList list = new ArrayList(); + list.add(productBean); + + refreshProductList(request, list); + + request.getSession().setAttribute(Constants.PRODUCT_DETAILS,productBean); + return mapping.findForward(UPDATE_PRODUCT_DETAILS); + }*/ + + public static final String VIEW_ALL_POS_PRODUCTS="viewAllPOSProducts"; + public static final String LIST_PRICE_LISTS = "listPriceLists"; + public ActionForward viewAllPOSProducts(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + ProductBean bean = (ProductBean) df.getBean(); + ArrayList list=null; + + String fromDeletePriceOnPriceList = request.getParameter("isFromDeletePriceOnPriceList"); + Integer priceListId; + Integer priceListVersionId; + + //Check if user just clicked on the delete price on priceList submenu + if(fromDeletePriceOnPriceList != null && fromDeletePriceOnPriceList.equals("true")) + { + priceListId = Integer.valueOf(request.getParameter("priceListId")); + priceListVersionId = PriceListManager.getPriceListVersionID(ctx, priceListId, null); + + list = new ArrayList(); + + list = POSProductManager.getProductBeans(ctx, priceListVersionId, null); + + if(list.isEmpty()) + { + postGlobalError("error.no.product.found.on.pricelist", request); + request.setAttribute(Constants.IS_FROM_DELETE_PRODUCT_PRICE, "true"); + return mapping.findForward(LIST_PRICE_LISTS); + } + else + { + request.getSession().setAttribute(Constants.PRICE_LIST_VERSION_ID, priceListVersionId); + request.setAttribute(Constants.IS_FROM_DELETE_PRODUCT_PRICE, "true"); + } + } + else + { + try + { + list=new ArrayList(); + list=POSProductManager.viewAllProducts(ctx,bean.getProductName(),bean.getBarCode(), bean.getDescription()); + + } + catch(ProductNotFoundException e1) + { + postGlobalError("error.product.not.defined.client",request); + return mapping.getInputForward(); + + } + } + + //for export + ArrayList exportProductData = null; + try + { + exportProductData = POSProductManager.getExportData(ctx, list); + } + catch (IOException e) + { + postGlobalError("error.process",request); + return mapping.getInputForward(); + } + String csvReport = CSVReportManager.generateCSVReport(ctx,exportProductData); + String csvURI = ReportManager.getReportURI(csvReport,request); + + request.getSession().setAttribute(Constants.CSV_FILE,csvURI); + request.getSession().setAttribute(Constants.VIEW_POS_PRODUCTS,list); + return mapping.findForward(VIEW_ALL_POS_PRODUCTS); + } + + + public static final String VIEW_POS_PRODUCT_DETAIL="viewPOSProductDetails"; + public static final String ERROR_VIEW_PRODUCT_DETAIL = "errorViewProductDetails"; + + public ActionForward viewPOSProductDetailInfo(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + ProductDetailsBean bean = (ProductDetailsBean) df.getBean(); + + try + { + int productId = bean.getProductId().intValue(); + ProductDetailsBean prodDetailsBean = ProductManager.getProductDetailInfo(ctx, productId, null); + + request.setAttribute(Constants.PRODUCT_DETAIL_INFO, prodDetailsBean); + + return mapping.findForward(VIEW_POS_PRODUCT_DETAIL); + } + catch(Exception ex) + { + return mapping.findForward(ERROR_VIEW_PRODUCT_DETAIL); + } + } + + public ActionForward validateProductName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + DefaultForm df = (DefaultForm) form; + String productName = df.getProductName(); + Properties ctx=TmkJSPEnv.getCtx(request); + + boolean isNameInvalid = (ProductManager.getSimilarProduct(ctx, productName, null) != 0); + + response.setContentType("text/plain"); + PrintWriter out = response.getWriter(); + out.print(isNameInvalid); + out.flush(); + out.close(); + + return null; + } + + public ActionForward validateProductBarcode(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + DefaultForm df = (DefaultForm) form; + String barcode = df.getBarCode(); + Properties ctx=TmkJSPEnv.getCtx(request); + + boolean isBarcodeValid = ProductManager.isBarCodePresent(ctx, barcode, null); + + response.setContentType("text/plain"); + PrintWriter out = response.getWriter(); + out.print(isBarcodeValid); + out.flush(); + out.close(); + + return null; + } + + public static final String SEARCH_POS_PRODUCTS = "searchPOSProducts" ; + + public ActionForward searchPOSProducts (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + viewAllPOSProducts(mapping, form, request, response); + + return mapping.findForward(SEARCH_POS_PRODUCTS); + } + + + public ActionForward addAllProducts (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + Properties ctx=TmkJSPEnv.getCtx(request); + HttpSession session = request.getSession(); + + ProductCart cart = (ProductCart) session.getAttribute(Constants.PRODUCT_CART); + ArrayList productList = (ArrayList) session.getAttribute(Constants.VIEW_POS_PRODUCTS); + + if(productList == null) + { + return mapping.findForward(VIEW_ALL_POS_PRODUCTS); + } + + if(cart == null) + { + cart = new ProductCart(ctx); + } + + for(ProductBean bean:productList) + { + Integer productId = bean.getProductId(); + + if(productId == null) continue; + if(cart.hasProduct(productId.intValue())) continue; + + cart.addProduct(productId.intValue()); + } + + session.setAttribute(Constants.PRODUCT_CART,cart); + + return mapping.findForward(VIEW_ALL_POS_PRODUCTS); + + } + + public ActionForward addToCart (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + ProductBean bean = (ProductBean) df.getBean(); + + Integer productId = bean.getProductId(); + HttpSession session = request.getSession(); + + ProductCart cart = (ProductCart) session.getAttribute(Constants.PRODUCT_CART); + + if( cart == null ) + { + cart = new ProductCart( ctx ); + } + + cart.addProduct( productId.intValue() ); + session.setAttribute(Constants.PRODUCT_CART, cart); + + String script = "productAdded("+ productId +");setCartCounter("+ cart.getNoOfProducts() +")"; + + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public ActionForward removeFromCart (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + ProductBean bean = (ProductBean) df.getBean(); + + Integer productId = bean.getProductId(); + HttpSession session = request.getSession(); + + ProductCart cart = (ProductCart) session.getAttribute(Constants.PRODUCT_CART); + + if( cart == null ) + { + cart = new ProductCart( ctx ); + } + + cart.removeProduct( productId.intValue() ); + session.setAttribute(Constants.PRODUCT_CART, cart); + + String script = "productRemoved("+ productId +");setCartCounter("+ cart.getNoOfProducts() +")"; + + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public ActionForward clearCart (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + HttpSession session = request.getSession(); + session.removeAttribute(Constants.PRODUCT_CART); + request.getSession().removeAttribute(Constants.VIEW_POS_PRODUCTS); + + String script = "clearAll();"; + PrintWriter writer = response.getWriter(); + writer.print( script ); + writer.flush(); + writer.close(); + + return null; + } + + public static final String VIEW_CART = "viewCart"; + public ActionForward viewCart(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + HttpSession session = request.getSession(); + ProductCart cart = (ProductCart) session.getAttribute(Constants.PRODUCT_CART); + + ArrayList productList = null; + + if(cart != null) + { + productList = cart.getProducts(); + session.setAttribute(Constants.PRODUCT_DETAILS, productList); + } + + return mapping.findForward(VIEW_CART); + } + + public static final String REMOVE = "remove"; + public ActionForward remove(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + HttpSession session = request.getSession(); + ProductCart cart = (ProductCart) session.getAttribute(Constants.PRODUCT_CART); + + DefaultForm df = (DefaultForm) form; + ProductBean bean = (ProductBean) df.getBean(); + Integer productId = bean.getProductId(); + + if(cart != null) + { + cart.removeProduct( productId.intValue() ); + session.setAttribute(Constants.PRODUCT_CART, cart); + } + + return mapping.findForward(REMOVE); + } + + //---------------------------------------------------------------------------------------------------------------------------------------------------- + + public static final String EXPORT_CSV = "exportCSV"; + public ActionForward exportCSV(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + HttpSession session = request.getSession(); + ProductCart cart = (ProductCart) session.getAttribute(Constants.PRODUCT_CART); + + if(cart == null) + { + String msg = "Cannot print barcode. Reason: cart is empty!"; + throw new OperationException( msg ); + } + + String reportName = POSProductManager.getProductCartAsCSV( ctx, cart ); + String reportURI = ReportManager.getReportURI( reportName, request ); + response.sendRedirect(reportURI); + + //return mapping.findForward(EXPORT_CSV); + return null; + } + + + public static final String PRINT_BARCODE = "printBarcode"; + public ActionForward printBarcode(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + HttpSession session = request.getSession(); + ProductCart cart = (ProductCart) session.getAttribute(Constants.PRODUCT_CART); + + if(cart == null) + { + String msg = "Cannot print barcode. Reason: cart is empty!"; + throw new OperationException( msg ); + } + + String printData = POSProductManager.getPrintBarcodeData( ctx, cart, null ); + //send it to client + + String filename = RandomStringGenerator.randomstring() + ".txt"; + String filepath = ReportManager.getReportPath( filename ); + + FileOutputStream fos = new FileOutputStream( new File( filepath ) ); + fos.write( printData.getBytes() ); + fos.flush(); + fos.close(); + + String fileURL = ReportManager.getReportURI( filename, request ); + response.sendRedirect( fileURL ); + + return null; + } + +// public static final String GENERATE_PROD_PDF ="generateproductpdf"; +// public ActionForward generateproductpdf(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException +// { +// ActionForward fwd = init(mapping,form,request,response); +// if (fwd!=null) +// return fwd; +// +// Properties ctx = TmkJSPEnv.getCtx(request); +// +// String reportName=POSProductManager.productcatalogue(ctx); +// +// ReportManager.writeReport(reportName, response); +// +// +// return null; +// } +// + + public static final String VIEW_PRODUCT_SALES_DETAILS = "viewProductSalesDetails"; + public ActionForward viewProductSalesDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + HttpSession session = request.getSession(); + + DefaultForm df = (DefaultForm) form; + ProductBean bean = (ProductBean) df.getBean(); + Integer productId = bean.getProductId(); + + ProductSalesSummaryBean summaryBean = POSProductManager.getProductSalesInfoSummary( ctx, productId.intValue(), null ); + ArrayList salesDetails = POSProductManager.getProductSalesInfoDetails( ctx, productId.intValue(), null ); + + ProductSalesSummaryBean[] bucket = POSProductManager.getSalesBucket(ctx, productId.intValue(), null); + + + session.setAttribute( Constants.PRODUCT_SALES_SUMMARY, summaryBean ); + session.setAttribute( Constants.PRODUCT_SALES_DETAILS, salesDetails ); + session.setAttribute( Constants.PRODUCT_SALES_BUCKET, bucket ); + + return mapping.findForward( VIEW_PRODUCT_SALES_DETAILS ); + } + + + public static final String UPDATE_BULK_PRODUCT_DETAILS="updateBulkProductDetails"; + public ActionForward updateBulkProductDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + df.validate(mapping,request); + + ProductBean bean = (ProductBean)df.getBean(); + bean.setFile(df.getFile()); + + ProductCart cart = (ProductCart) request.getSession().getAttribute(Constants.PRODUCT_CART); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + Integer[] productIds = cart.getProductIDs(); + + try + { + trx.start(); + POSProductManager.editBulkProduct(ctx,productIds,bean,trx.getTrxName()); + trx.commit(); + } + catch(BarcodeAlreadyExistsException e1) + { + + trx.rollback(); + postGlobalError("error.barcode.already.exists",request); + return mapping.getInputForward(); + } + catch(CannotInactivateProductException e2) + { + trx.rollback(); + postGlobalError("error.product.cannot.inactivate", e2.getMessage(), request); + return mapping.getInputForward(); + + } + finally + { + trx.close(); + } + + + ArrayList list = new ArrayList(); + + for(int product_id : productIds) + { + ProductBean productBean = POSProductManager.viewPOSProduct(ctx, product_id, null); + list.add(productBean); + } + refreshProductList(request, list); + + return mapping.findForward(UPDATE_BULK_PRODUCT_DETAILS); + } + + + public static final String INIT_UPDATE_BULK_PRODUCT_DETAILS = "initUpdateBulkProductDetails"; + public ActionForward initUpdateBulkProductDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException + { + Properties ctx=TmkJSPEnv.getCtx(request); + ArrayList taxList = POSGoodsManager.getAllTaxCategory(ctx); + + request.setAttribute(Constants.TAX_CATEGORY_ID,taxList); + return mapping.findForward(INIT_UPDATE_BULK_PRODUCT_DETAILS); + } + + /*public static final String VIEW_PRODUCT = "viewProduct"; + public ActionForward viewProduct(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + viewProductForUpdate(mapping,form,request,response); + + return mapping.findForward(VIEW_PRODUCT); + }*/ + + public static final String ACTIVATE_PRODUCT = "activateProduct"; + public ActionForward activateProduct(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + df.validate(mapping,request); + + ProductBean bean = (ProductBean)df.getBean(); + Integer productId = bean.getProductId(); + + ProductManager.activateProducts(ctx, new Integer[]{productId},null); + + ProductBean productBean= POSProductManager.viewPOSProduct(ctx,bean.getProductId().intValue(), null); + ArrayList list = new ArrayList(); + list.add(productBean); + + // Refresh product list + refreshProductList(request, list); + + return mapping.findForward(ACTIVATE_PRODUCT); + } + + public static final String DEACTIVATE_PRODUCT = "deactivateProduct"; + public ActionForward deactivateProduct(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + df.validate(mapping,request); + + ProductBean bean = (ProductBean)df.getBean(); + Integer productId = bean.getProductId(); + + try + { + ProductManager.inactivateProducts(ctx, new Integer[]{productId},null); + } + catch(CannotInactivateProductException e2) + { + postGlobalError("error.product.cannot.inactivate", e2.getMessage(), request); + return mapping.getInputForward(); + } + + ProductBean productBean= POSProductManager.viewPOSProduct(ctx,bean.getProductId().intValue(), null); + ArrayList list = new ArrayList(); + list.add(productBean); + + // Refresh product list + refreshProductList(request, list); + + return mapping.findForward(DEACTIVATE_PRODUCT); + } + + public static final String PRICE_CHECK = "priceCheck"; + public ActionForward priceCheck(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd=init(mapping,form,request,response); + + if(fwd!=null) + { + return fwd; + } + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + String barcode = df.getBarCode(); + + ProductBean productBean = null; + try + { + productBean = POSProductManager.getProduct(ctx, barcode, null); + request.setAttribute(Constants.PRODUCT_DETAILS, productBean); + } + catch (InvalidBarcodeException e) + { + postGlobalError("error.invalid.barcode", "barcode", request); + return mapping.getInputForward(); + } + catch (ProductNotFoundException e) + { + postGlobalError("error.notfound", "Product", request); + return mapping.getInputForward(); + } + + return mapping.findForward(PRICE_CHECK); + } + + + /** + * This method is called to update product list present in session + * @param request + * @param list + */ + private void refreshProductList(HttpServletRequest request, ArrayList productList) + { + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.VIEW_POS_PRODUCTS); + if(list == null) + { + return; + } + + if(!list.isEmpty()) + { + for(ProductBean bean : productList) + { + int index = list.indexOf(bean); + if(index != -1) + { + list.set(index, bean); + } + } + + request.getSession().setAttribute(Constants.VIEW_POS_PRODUCTS, list); + } + + } + + + public static final String GET_PRODUCT_DETAILS = "getProductDetails"; + public ActionForward getProductDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException, IOException + { + ActionForward fwd=init(mapping,form,request,response); + + if(fwd!=null) + { + return fwd; + } + + Properties ctx=TmkJSPEnv.getCtx(request); + + String productIdAsStr = request.getParameter("productId"); + String priceListIdAsStr = request.getParameter("priceListId"); + int productId = Integer.parseInt(productIdAsStr); + int priceListId = Integer.parseInt(priceListIdAsStr); + + Env.setContext(ctx, UdiConstants.PRICELIST_CTX_PARAM, priceListId); + String currSymbol = PriceListManager.getCurrency(ctx, priceListId); + + ProductBean details = POSProductManager.viewPOSProduct(ctx, productId, priceListId, null); + + StringBuffer sb = new StringBuffer(); + sb.append("{"); + sb.append("name: \"" + details.getProductName() + "\""); + sb.append(", id: \"" + details.getProductId() + "\""); + sb.append(", description: \"" + details.getDescription() + "\""); + sb.append(", barcode: '" + details.getBarCode() + "'"); + sb.append(", taxCategory: '" + details.getTaxCategoryName() + "'"); + sb.append(", productCategory: '" + details.getProductCategoryName() + "'"); + sb.append(", priceStd: '" + details.getPriceStandard() + "'"); + sb.append(", priceList: '" + details.getPriceList() + "'"); + sb.append(", priceLimit: '" + details.getPriceLimit() + "'"); + sb.append(", priceListID: '" + details.getPriceListId() + "'"); + sb.append(", taxRate: '" + details.getTaxRate() + "'"); + sb.append(", isTaxIncluded: '" + details.getIsTaxIncluded() + "'"); + sb.append(", currSymbol: '" + currSymbol + "'"); + sb.append(", stockQty: '" + details.getQtyOnHand() + "'"); + sb.append(", unitsPerPack: '" + details.getUnitsPerPack() + "'"); + sb.append("}"); + + PrintWriter writer = response.getWriter(); + writer.print( sb.toString() ); + writer.flush(); + writer.close(); + + return null; + } + + public static final String GET_PRODUCT_DETAILS_FOR_INVENTORY = "getProductDetailsForInventory"; + public ActionForward getProductDetailsForInventory(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException, IOException + { + ActionForward fwd=init(mapping,form,request,response); + + if(fwd!=null) + { + return fwd; + } + + Properties ctx=TmkJSPEnv.getCtx(request); + + String productIdAsStr = request.getParameter("productId"); + String priceListIdAsStr = request.getParameter("priceListId"); + int productId = Integer.parseInt(productIdAsStr); + int priceListId = Integer.parseInt(priceListIdAsStr); + + Env.setContext(ctx, UdiConstants.PRICELIST_CTX_PARAM, priceListId); + String currSymbol = PriceListManager.getCurrency(ctx, priceListId); + + ProductBean details = POSProductManager.viewPOSProductForInventory(ctx, productId, priceListId, null); + + StringBuffer sb = new StringBuffer(); + sb.append("{"); + sb.append("name: '" + details.getProductName() + "'"); + sb.append(", id: '" + details.getProductId() + "'"); + sb.append(", description: '" + details.getDescription() + "'"); + sb.append(", barcode: '" + details.getBarCode() + "'"); + sb.append(", taxCategory: '" + details.getTaxCategoryName() + "'"); + sb.append(", productCategory: '" + details.getProductCategoryName() + "'"); + sb.append(", priceStd: '" + details.getPriceStandard() + "'"); + sb.append(", priceList: '" + details.getPriceList() + "'"); + sb.append(", priceLimit: '" + details.getPriceLimit() + "'"); + sb.append(", priceListID: '" + details.getPriceListId() + "'"); + sb.append(", taxRate: '" + details.getTaxRate() + "'"); + sb.append(", currSymbol: '" + currSymbol + "'"); + sb.append(", stockQty: '" + details.getQtyOnHand() + "'"); + sb.append("}"); + + PrintWriter writer = response.getWriter(); + writer.print( sb.toString() ); + writer.flush(); + writer.close(); + + return null; + } + + public static final String POS_SUB_MENU_ITEMS = "POSSubMenuItems"; + public ActionForward deleteProductPricesOnPriceList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd=init(mapping,form,request,response); + + if(fwd!=null) + { + return fwd; + } + + ArrayList list = new ArrayList(); + list = (ArrayList)request.getSession().getAttribute(Constants.VIEW_POS_PRODUCTS); + + Iterator itr = list.iterator(); + Integer productId; + Integer priceListVersionId = (Integer)request.getSession().getAttribute(Constants.PRICE_LIST_VERSION_ID); + Properties ctx = TmkJSPEnv.getCtx(request); + + while(itr.hasNext()) + { + ProductBean productBean = itr.next(); + if (productBean != null) + { + productId = productBean.getProductId(); + + if(productId != null && productId != 0 && priceListVersionId != null) + { + MProductPrice productPrice = MProductPrice.get(ctx, priceListVersionId, productId, null); + productPrice.delete(true); + } + } + } + + return mapping.findForward(POS_SUB_MENU_ITEMS); + } + + public static String GET_CREATE_PRODUCT_FORM = "getCreateProductForm"; + public ActionForward getCreateProductForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + viewProduct(mapping, form, request, response); + + return mapping.findForward(GET_CREATE_PRODUCT_FORM); + } + + public static final String VIEW_PRODUCT_SALES_SUMMARY = "viewProductSalesSummary"; + public ActionForward viewProductSalesSummary(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + HttpSession session = request.getSession(); + + String productIdStr = request.getParameter("productId"); + + if(productIdStr != null && !productIdStr.equals("")) + { + int productIdInt = Integer.parseInt(productIdStr); + StringBuffer sb = new StringBuffer(); + + ProductSalesSummaryBean[] summaryBeans = POSProductManager.getSalesBucket( ctx, productIdInt, null ); + + int warehouseId = WarehouseManager.getDefaultWarehouse(ctx).getM_Warehouse_ID(); + MLocator locator = MLocator.get(ctx, warehouseId, "", "0", "0", "0"); + BigDecimal qtyAvailable = MStorage.getQtyAvailable(warehouseId, locator.get_ID(), productIdInt, 0, null); + + MProduct product = new MProduct(ctx, productIdInt, null); + + sb.append("{"); + sb.append("name:'" + product.getName() + "'"); + sb.append(", id:'" + product.getM_Product_ID() + "'"); + sb.append(", qtyOnHand:'" + qtyAvailable + "'"); + + for(int i = 0; i < summaryBeans.length; i++) + { + if(i != 2 || i != 3) // skip sales figures for 2 and 3 months + { + sb.append(", qtySold" + i +":'" + summaryBeans[i].getQtySold() + "'"); + sb.append(", totalAmt" + i + ":'" + summaryBeans[i].getTotalAmount() + "'"); + } + } + + sb.append("}"); + + PrintWriter writer = response.getWriter(); + writer.print( sb.toString() ); + writer.flush(); + writer.close(); + + } + return null; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSReportAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSReportAction.java new file mode 100644 index 0000000000..0f1b1b465e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSReportAction.java @@ -0,0 +1,1602 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 9, 2006 + */ + + +package org.posterita.struts.pos; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperPrint; + +import org.apache.ecs.XhtmlDocument; +import org.apache.ecs.xhtml.tr; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.compiere.model.MProcess; +import org.compiere.model.MProcessPara; +import org.compiere.model.MProduct; +import org.compiere.print.MPrintFormat; +import org.compiere.print.PrintData; +import org.compiere.print.ReportEngine; +import org.compiere.process.ProcessInfo; +import org.compiere.report.ReportStarter; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.MimeType; +import org.compiere.utils.DBUtils; +import org.posterita.Constants; +import org.posterita.beans.POSHistoryBean; +import org.posterita.beans.ReportBean; +import org.posterita.beans.StockMovementBean; +import org.posterita.businesslogic.POSProductManager; +import org.posterita.businesslogic.POSStockManager; +import org.posterita.businesslogic.ProcessManager; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.businesslogic.performanceanalysis.POSSalesReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.businesslogic.stock.InventoryManager; +import org.posterita.businesslogic.stock.MMovementManager; +import org.posterita.core.TabularReport; +import org.posterita.core.TabularReport2; +import org.posterita.core.TabularReportMerge; +import org.posterita.core.TimestampConvertor; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.factory.WebComponentFactory; +import org.posterita.form.POSHistoryForm; +import org.posterita.form.ReportForm; +import org.posterita.form.SellingItemForm; +import org.posterita.form.StockEnquiryForm; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.util.PathInfo; + +import com.lowagie.text.DocumentException; + + +public class POSReportAction extends BaseDispatchAction +{ + + public static final String GET_MIN_SOLD_ITEMS="getMinSoldItems"; + public static HashMap monthMap = new HashMap(); + + public ActionForward getMinSoldItems(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + + Timestamp fromdate = ReportDateManager.getFromDate(bean); + Timestamp todate = ReportDateManager.getToDate(bean); + + ArrayList list=POSReportManager.getMaxMinSoldProducts(ctx,"asc",fromdate,todate); + request.getSession().setAttribute(Constants.MIN_SOLD_ITEMS,list); + + return mapping.findForward(GET_MIN_SOLD_ITEMS); + } + + + public static final String GET_MAX_SOLD_ITEMS="getMaxSoldItems"; + public ActionForward getMaxSoldItems(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + + Timestamp fromdate = ReportDateManager.getFromDate(bean); + Timestamp todate = ReportDateManager.getToDate(bean); + + ArrayList list=POSReportManager.getMaxMinSoldProducts(ctx,"desc",fromdate,todate); + request.getSession().setAttribute(Constants.MAX_SOLD_ITEMS,list); + + return mapping.findForward(GET_MAX_SOLD_ITEMS); + } + + public static final String GET_STOCK_MOVEMENT="getStockMovement"; + public ActionForward getStockMovement(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + + Timestamp fromdate = ReportDateManager.getFromDate(bean); + Timestamp todate = ReportDateManager.getToDate(bean); + + ArrayList list=POSReportManager.getStockMovementReport(ctx,fromdate,todate); + request.getSession().setAttribute(Constants.STOCK_MOVEMENT,list); + + return mapping.findForward(GET_STOCK_MOVEMENT); + } + + + public static final String INIT_POS_HISTORY="initPOSHistory"; + public ActionForward initPOSHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + ArrayList orderTypeList=POSReportManager.getAllOrderTypes(ctx); + ArrayList paymentRuleList=POSReportManager.getAllPaymentRule(ctx); + request.getSession().setAttribute(Constants.ORDER_TYPES,orderTypeList); + request.getSession().setAttribute(Constants.PAYMENT_RULES,paymentRuleList); + request.setAttribute(Constants.ALL_ORDER_HISTORY,"allOrderHistory"); + getPOSHistory(mapping,new POSHistoryForm(),request,response); + + return mapping.findForward(INIT_POS_HISTORY); + } + + + public static final String GET_POS_HISTORY="getPOSHistory"; + + public ActionForward getPOSHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + POSHistoryBean bean = (POSHistoryBean) df.getBean(); + + if(bean.getHistoryType()==null) + { + String historyType = (String)request.getAttribute(Constants.ALL_ORDER_HISTORY); + bean.setHistoryType(historyType); + } + + if(bean.getHistoryType()==null || !bean.getHistoryType().equalsIgnoreCase(Constants.ALL_ORDER_HISTORY)) + { + if(bean.getOrderType()==null) + { + String orderType=(String)request.getSession().getAttribute(Constants.POS_HISTORY_ORDER_TYPE); + bean.setOrderType(orderType); + } + } + ArrayList list=POSReportManager.getOrderHistory(ctx,bean.getOrderType(),bean.getDocStatus(),bean.getMonth(),bean.getYear(),bean.getPaymentRule(),null); + request.setAttribute(Constants.POS_HISTORY,list); + if(bean.getOrderType()!=null) + { + request.getSession().setAttribute(Constants.POS_HISTORY_ORDER_TYPE,bean.getOrderType()); + } + else + { + String orderType=(String)request.getSession().getAttribute(Constants.POS_HISTORY_ORDER_TYPE); + request.getSession().setAttribute(Constants.POS_HISTORY_ORDER_TYPE,orderType); + } + + + return mapping.findForward(GET_POS_HISTORY); + } + + //----------------------------------------------------------------------------------------------------- + + public static final String GET_CUSTOM_REPORT = "getCustomReport"; + public static final String GET_CUSTOM_MOVING_ITEMS = "getCustomMovingItems"; + public ActionForward getCustomFastSlowMovingItems(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + + String title = " Moving Items Report"; + String subtitle = "subtitle"; + + String reportType = bean.getReportType(); + if(reportType.equalsIgnoreCase("asc")) + { + title = "Slow" + title; + } + else if(reportType.equalsIgnoreCase("desc")) + { + title = "Fast" + title; + } + else + { + throw new OperationException("invalid report type: " + reportType); + } + + String dateRange = bean.getDateRange(); + String timePeriod = bean.getTimePeriod(); + + Timestamp fromDate = null; + Timestamp toDate = null; + + //setting from and to dates + if(dateRange.endsWith(Constants.FIXED_DATE_RANGE)) + { + if(timePeriod==null) + { + throw new OperationException("Invalid Parameter for timePeriod. timePeriod is null"); + } + + Date startDate = ReportDateManager.getStartDateForPeriod(timePeriod); + Date endDate = ReportDateManager.getEndDateForPeriod(timePeriod); + + fromDate = new Timestamp(startDate.getTime()); + toDate = new Timestamp(endDate.getTime()); + + subtitle = "For " + timePeriod; + } + else if(dateRange.endsWith(Constants.CUSTOM_DATE_RANGE)) + { + boolean error = false; + ActionMessages messages = new ActionMessages(); + ActionMessage message = null; + + + if((bean.getFromDate()==null)||(bean.getFromDate()=="")) + { + message = new ActionMessage("error.required.fromDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if((bean.getToDate()==null)||(bean.getToDate()=="")) + { + message = new ActionMessage("error.required.toDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if(error) + { + saveErrors(request, messages); + return mapping.getInputForward(); + } + else + { + fromDate = ReportDateManager.getFromDate(bean); + toDate = ReportDateManager.getToDate(bean); + + } + + + subtitle = "For period:"+fromDate+" to "+toDate; + } + else + { + throw new OperationException("Invalid Parameter for dateRange :" + dateRange); + } + + + ArrayList reportData = POSReportManager.getMaxMinSoldProductReportData(ctx,reportType,fromDate,toDate); + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle(title); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + String csvReport = CSVReportManager.generateCSVReport(ctx,reportData); + String csvURI = ReportManager.getReportURI(csvReport,request); + + request.getSession().setAttribute(Constants.TABULAR_REPORT_DATA,tReport.toString()); + request.getSession().setAttribute(Constants.CSV_FILE,csvURI); + + return mapping.findForward(GET_CUSTOM_REPORT); + } + + //Partial POS History action + public static final String INIT_PARTIAL_POS_HISTORY="initPartialPOSHistory"; + public ActionForward initPartialPOSHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + ArrayList list=POSReportManager.getAllOrderTypes(ctx); + request.getSession().setAttribute(Constants.ORDER_TYPES,list); + + getPartialPOSHistory(mapping,new POSHistoryForm(),request,response); + + return mapping.findForward(INIT_PARTIAL_POS_HISTORY); + } + + + public static final String GET_PARTIAL_POS_HISTORY="getPartialPOSHistory"; + public ActionForward getPartialPOSHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + POSHistoryBean bean = (POSHistoryBean) df.getBean(); + + String orderType = UDIOrderTypes.POS_ORDER.getOrderType(); + + ArrayList list=POSReportManager.getPartialOrderHistory(ctx,orderType,bean.getMonth(),bean.getYear()); + request.getSession().setAttribute(Constants.POS_HISTORY,list); + + return mapping.findForward(GET_PARTIAL_POS_HISTORY); + } + + public static final String GET_SALES_REPORT = "getSalesReport"; + public ActionForward getSalesOrPurchaseReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + df.validate(mapping, request); + + ReportBean bean = (ReportBean) df.getBean(); + + String isSalesRPT = bean.getIsSalesReport(); + + boolean isSalesReport = Boolean.parseBoolean(isSalesRPT); + + String title = "Sales Report"; + + if(!(isSalesReport)) + { + title = "Purchase Report"; + } + + String subtitle = "subtitle"; + + + String dateRange = bean.getDateRange(); + String timePeriod = bean.getTimePeriod(); + + Timestamp fromDate = null; + Timestamp toDate = null; + + Date startDate = null; + Date endDate = null; + + //setting from and to dates + if(dateRange.endsWith(Constants.FIXED_DATE_RANGE)) + { + if(timePeriod==null) + { + throw new OperationException("Invalid Parameter for timePeriod. timePeriod is null"); + } + + startDate = ReportDateManager.getStartDateForPeriod(timePeriod); + endDate = ReportDateManager.getEndDateForPeriod(timePeriod); + + fromDate = new Timestamp(startDate.getTime()); + toDate = new Timestamp(endDate.getTime()); + + subtitle = "For " + timePeriod + ": " + startDate; + } + else if(dateRange.endsWith(Constants.CUSTOM_DATE_RANGE)) + { + boolean error = false; + ActionMessages messages = new ActionMessages(); + ActionMessage message = null; + + + if((bean.getFromDate()==null)||(bean.getFromDate()=="")) + { + message = new ActionMessage("error.required.fromDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if((bean.getToDate()==null)||(bean.getToDate()=="")) + { + message = new ActionMessage("error.required.toDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if(error) + { + saveErrors(request, messages); + return mapping.getInputForward(); + } + else + { + fromDate = ReportDateManager.getFromDate(bean); + toDate = ReportDateManager.getToDate(bean); + + } + + + subtitle = "For period:"+fromDate+" to "+toDate; + } + else + { + throw new OperationException("Invalid Parameter for dateRange :" + dateRange); + } + boolean isFullDetails = false; + + if (Constants.FULL_DETAILS.equals(bean.getFullDetails())) + { + isFullDetails = true; + } + + ArrayList reportData = POSSalesReportManager.getSalesOrPurchaseReportData(ctx, bean, null); + + //constructing the table + TabularReport2 tReport = new TabularReport2(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle(title); + tReport.setSubtitle(subtitle); + tReport.setFromDate(fromDate); + tReport.setSalesReport(isSalesReport); + tReport.setFullDetails(isFullDetails); + tReport.setToDate(toDate); + tReport.createReport(); + + String csvReport = CSVReportManager.generateCSVReport(ctx,reportData); + String csvURI = ReportManager.getReportURI(csvReport,request); + + String pdfReport = tReport.createPDFReport(); + String pdfURI = ReportManager.getReportURI(pdfReport,request); + + request.getSession().setAttribute(Constants.TABULAR_REPORT_DATA,tReport.toString()); + request.getSession().setAttribute(Constants.CSV_FILE,csvURI); + request.getSession().setAttribute(Constants.PDF_FILE,pdfURI); + + return mapping.findForward(GET_SALES_REPORT); + } + + public static final String GET_DETAILED_SALES_REPORT = "getDetailedSalesReport"; + public ActionForward getDetailedSalesReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, ParseException, FileNotFoundException, DocumentException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + String salesType = request.getParameter("salesType"); + String date1 = request.getParameter("date1"); + String date2 = request.getParameter("date2"); + boolean isSalesReport = Boolean.parseBoolean(request.getParameter("isSalesReport")); + + Timestamp fromDate = TimestampConvertor.getTimestamp(date1, TimestampConvertor.XML_DATE_PATTERN); + Timestamp toDate = TimestampConvertor.getTimestamp(date2, TimestampConvertor.XML_DATE_PATTERN); + // sales types + // 1 -> Sales Excluding VAT + // 2 -> Credit Note Excluding VAT + // 3 -> Exempt Sales + // 4 -> Exempt Credit Note + + ArrayList list = null; + try + { + list =POSSalesReportManager.getDetailedSalesReport(ctx, salesType, isSalesReport, fromDate, toDate, null); + } + catch (OperationException e) + { + postGlobalError("error.process",e.getMessage(),request); + return mapping.getInputForward(); + } + request.getSession().setAttribute(Constants.DETAILED_SALES_REPORT,list); + + return mapping.findForward(GET_DETAILED_SALES_REPORT); + } + + public static String GET_MONTHLY_SALES_REPORT = "getMonthlySalesReport"; + public ActionForward getMonthlySalesReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, ParseException, FileNotFoundException, DocumentException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + String productName = request.getParameter("productName"); + + String orgIds = getOrgIds(ctx, request); + + String date1 = request.getParameter("date1"); + String date2 = request.getParameter("date2"); + + Timestamp d1 = TimestampConvertor.getTimestamp(date1, TimestampConvertor.XML_DATE_PATTERN); + Timestamp d2 = TimestampConvertor.getTimestamp(date2, TimestampConvertor.XML_DATE_PATTERN); + + Calendar fd = Calendar.getInstance(); + fd.setTimeInMillis(d1.getTime()); + fd.set(Calendar.DATE, 1); + + Calendar td = Calendar.getInstance(); + td.setTimeInMillis(d2.getTime()); + td.set(Calendar.DATE, td.getMaximum(Calendar.DAY_OF_MONTH)); + + Timestamp fromDate = new Timestamp(fd.getTimeInMillis()); + Timestamp toDate = new Timestamp(td.getTimeInMillis()); + + // Timestamp fromDate = TimestampConvertor.getTimestamp(date1, TimestampConvertor.XML_DATE_PATTERN); + //Timestamp toDate = TimestampConvertor.getTimestamp(date2, TimestampConvertor.XML_DATE_PATTERN); + + int[] productIds = ProductManager.getProducts(ctx, productName, Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM), null, null, null); + + if (productIds == null || productIds.length == 0) + { + throw new OperationException ("no products found with product name " + productName); + } + ArrayList reportData = null; + try + { + reportData = new ArrayList(); + Object[] header = {"Month", "Qty Sold"}; + reportData.add(header); + int precision = ProductManager.getUOMPrecision(ctx, productIds[0]); + + HashMap monthQtyMap = POSProductManager.getOrderQtyInfoPerProduct(ctx, true, productIds[0], + orgIds, fromDate, toDate, null); + + reportData = POSReportManager.formatStockSalesReportData(reportData, monthQtyMap, + fromDate, toDate, precision); + } + catch (OperationException e) + { + postGlobalError("error.process",e.getMessage(),request); + return mapping.getInputForward(); + } + + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle("Monthly Sales Report from " + date1 + " to "+date2 ); + tReport.setSubtitle("Product: "+productName); + tReport.setFromDate(fromDate); + tReport.setToDate(toDate); + tReport.createReport("SalesReportAction.do?action=getSalesDetailsPerProduct", productIds[0]); + + request.getSession().setAttribute(Constants.MONTHLY_SALES_REPORT_DATA,tReport.toString()); + + + return mapping.findForward(GET_MONTHLY_SALES_REPORT); + } + + public static String GET_SALES_DETAILS_PER_PRODUCT = "getSODetailsPerProduct"; + public ActionForward getSalesDetailsPerProduct(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + String productId = request.getParameter("productId"); + + String orgIds = getOrgIds(ctx, request); + + String date1 = request.getParameter("date1"); + String date2 = request.getParameter("date2"); + + Timestamp fromDate = TimestampConvertor.getTimestamp(date1, TimestampConvertor.BIRTH_DATE); + Timestamp toDate = TimestampConvertor.getTimestamp(date2, TimestampConvertor.BIRTH_DATE); + + ArrayList list = null; + try + { + list = POSSalesReportManager.getOrderDetailsPerProduct(ctx, true, productId, orgIds, fromDate, toDate); + } + catch (OperationException e) + { + postGlobalError("error.process",e.getMessage(),request); + return mapping.getInputForward(); + } +/* request.getSession().setAttribute(Constants.DETAILED_SALES_REPORT_PER_PRODUCT,list);*/ + request.getSession().setAttribute(Constants.POS_HISTORY,list); + request.getSession().setAttribute(Constants.POS_HISTORY_ORDER_TYPE,UDIOrderTypes.POS_ORDER.getOrderType()); + + return mapping.findForward(GET_SALES_DETAILS_PER_PRODUCT); + } + + public static String GET_GRN_DETAILS_PER_PRODUCT = "getPODetailsPerProduct"; + public ActionForward getGRNDetailsPerProduct(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + String productId = request.getParameter("productId"); + + String orgIds = getOrgIds(ctx, request); + + String date1 = request.getParameter("date1"); + String date2 = request.getParameter("date2"); + + Timestamp fromDate = TimestampConvertor.getTimestamp(date1, TimestampConvertor.BIRTH_DATE); + Timestamp toDate = TimestampConvertor.getTimestamp(date2, TimestampConvertor.BIRTH_DATE); + + ArrayList list = null; + try + { + list = POSSalesReportManager.getOrderDetailsPerProduct(ctx, false, productId, orgIds, fromDate, toDate); + } + catch (OperationException e) + { + postGlobalError("error.process",e.getMessage(),request); + return mapping.getInputForward(); + } + request.getSession().setAttribute(Constants.POS_HISTORY,list); + request.getSession().setAttribute(Constants.POS_HISTORY_ORDER_TYPE,UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType()); + + return mapping.findForward(GET_GRN_DETAILS_PER_PRODUCT); + } + + /*********************************************************************************/ + + public static final String INIT_BEST_SELLING_REPORT = "initBestSellingReport"; + + /** + * Initialise Best Selling Items Report + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws ApplicationException + * @throws OperationException + */ + public ActionForward initBestSellingReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + SellingItemForm reportForm = (SellingItemForm) form; + + //setting defaults + String timePeriod = ReportDateManager.TODAY; + String dateRange = Constants.FIXED_DATE_RANGE; + + reportForm.setTimePeriod(timePeriod); + reportForm.setDateRange(dateRange); + reportForm.setFromDate(""); + reportForm.setToDate(""); + + reportForm.validate(mapping,request); + + return mapping.findForward(INIT_BEST_SELLING_REPORT); + } + + + public static final String GET_BEST_SELLING_ITEMS = "getBestSellingItems"; + + /** + * Generate Best Selling Items + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws ApplicationException + * @throws OperationException + * @throws DocumentException + * @throws IOException + * @throws SQLException + * @throws ParseException + */ + public ActionForward getBestSellingItems(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, DocumentException, IOException, SQLException, ParseException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + SellingItemForm sf = (SellingItemForm)form; + ReportBean bean = (ReportBean) sf.getBean(); + + String dateRange = bean.getDateRange(); + String timePeriod = bean.getTimePeriod(); + Timestamp fromDate = null; + Timestamp toDate = null; + + //setting from and to dates + if(dateRange.endsWith(Constants.FIXED_DATE_RANGE)) + { + if(timePeriod == null) + { + throw new OperationException("Invalid Parameter for timePeriod. TimePeriod is null"); + } + + fromDate = ReportDateManager.getStartDateForPeriod(timePeriod); + toDate = ReportDateManager.getEndDateForPeriod(timePeriod); + + } + else if(dateRange.endsWith(Constants.CUSTOM_DATE_RANGE)) + { + fromDate = ReportDateManager.getFromDate(bean); + toDate = ReportDateManager.getToDate(bean); + + } + else + { + throw new OperationException("Invalid Parameter for dateRange :" + dateRange); + } + + + ArrayList reportData = POSReportManager.getBestSellingItemsData(ctx, fromDate, toDate, null); + + String title = "BEST 100 SELLING ITEMS"; + String subtitle = null; + + String sql = "Select Upper(Name) from AD_Org where AD_org_ID=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + + pstmt = DB.prepareStatement(sql.toString(), null); + pstmt.setInt(1, Env.getAD_Org_ID(ctx)); + + try + { + rs = pstmt.executeQuery(); + + if (rs.next()) + { + subtitle = rs.getString(1); + } + + } + catch(SQLException e) + { + throw new OperationException(e); + } + finally + { + DBUtils.close(rs); + DBUtils.close(pstmt); + } + + SimpleDateFormat dateFormat2 = new SimpleDateFormat("dd-MMM-yyyy"); + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle(title); + tReport.setFromDate(fromDate); + tReport.setToDate(toDate); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + response.setContentType("x-application/pdf"); + response.setHeader("Content-Disposition","inline;filename=BestSellingItemsReport("+System.currentTimeMillis()+").pdf"); + response.getOutputStream().write(tReport.getSellingItemsData()); + + + return mapping.findForward(GET_BEST_SELLING_ITEMS); + } + + public static final String INIT_STOCK_ENQUIRY_REPORT = "initStockEnquiryReport"; + + public ActionForward initStockEnquiryReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + StockEnquiryForm reportForm = (StockEnquiryForm) form; + + //setting defaults + String timePeriod = ReportDateManager.TODAY; + String dateRange = Constants.FIXED_DATE_RANGE; + + reportForm.setTimePeriod(timePeriod); + reportForm.setDateRange(dateRange); + reportForm.setFromDate(""); + reportForm.setToDate(""); + + reportForm.validate(mapping,request); + + return mapping.findForward(INIT_STOCK_ENQUIRY_REPORT); + } + + public static final String GET_STOCK_ENQUIRY_REPORT = "getStockEnquiryReport"; + + + /** + * Get Stock Enquiry Report + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws ApplicationException + * @throws OperationException + * @throws DocumentException + * @throws IOException + * @throws SQLException + * @throws ParseException + */ + public ActionForward getStockEnquiryReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, DocumentException, IOException, SQLException, ParseException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + StockEnquiryForm sf = (StockEnquiryForm)form; + ReportBean bean = (ReportBean) sf.getBean(); + + String dateRange = bean.getDateRange(); + String timePeriod = bean.getTimePeriod(); + Timestamp fromDate = null; + Timestamp toDate = null; + + //setting from and to dates + if(dateRange.endsWith(Constants.FIXED_DATE_RANGE)) + { + if(timePeriod == null) + { + throw new OperationException("Invalid Parameter for timePeriod. TimePeriod is null"); + } + + fromDate = ReportDateManager.getStartDateForPeriod(timePeriod); + toDate = ReportDateManager.getEndDateForPeriod(timePeriod); + + } + else if(dateRange.endsWith(Constants.CUSTOM_DATE_RANGE)) + { + fromDate = ReportDateManager.getFromDate(bean); + toDate = ReportDateManager.getToDate(bean); + + } + else + { + throw new OperationException("Invalid Parameter for dateRange :" + dateRange); + } + + ArrayList reportData = POSReportManager.getStockEnquiryData(ctx, fromDate, toDate, null); + + String title = "STOCK ENQUIRY REPORT"; + String subtitle = null; + + String sql = "Select Upper(Name) from AD_Org where AD_org_ID=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + + pstmt = DB.prepareStatement(sql.toString(), null); + pstmt.setInt(1, Env.getAD_Org_ID(ctx)); + + try + { + rs = pstmt.executeQuery(); + + if (rs.next()) + { + subtitle = rs.getString(1); + } + + } + catch(SQLException e) + { + throw new OperationException(e); + } + finally + { + DBUtils.close(rs); + DBUtils.close(pstmt); + } + + SimpleDateFormat dateFormat2 = new SimpleDateFormat("dd-MMM-yyyy"); + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle(title); + tReport.setFromDate(fromDate); + tReport.setToDate(toDate); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + response.setContentType("x-application/pdf"); + response.setHeader("Content-Disposition","inline;filename=StockEnquiryReport("+System.currentTimeMillis()+").pdf"); + response.getOutputStream().write(tReport.getStockEnquiryData()); + + + return mapping.findForward(GET_STOCK_ENQUIRY_REPORT); + } + + public static final String GET_STOCK_SALES_REPORT = "getStockSalesReport"; + public ActionForward getStockSalesReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SQLException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + + if (fwd!=null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + + ReportForm sf = (ReportForm)form; + ReportBean bean = (ReportBean) sf.getBean(); + + Integer productId = bean.getProductId(); + String description = bean.getDescription(); + String barCode = bean.getBarCode(); + Integer orgId = bean.getOrgId(); + + String fromDate = bean.getFromDate(); + String toDate = bean.getToDate(); + + Timestamp thisDate = TimestampConvertor.getCurrentDateTimeTimestamp(); + Timestamp startDate = thisDate; + Timestamp endDate = thisDate; + + String productName = bean.getProductName(); + + HashSet orgIds = (HashSet)request.getSession().getAttribute(Constants.STOCK_SALES_REPORT_ORGS); + if (orgIds == null) + { + orgIds = new HashSet(); + } + orgIds.add(orgId); + + if (fromDate != null) + { + startDate = TimestampConvertor.getTimestamp(fromDate, TimestampConvertor.BIRTH_DATE); + } + if (toDate != null) + { + endDate = TimestampConvertor.getTimestamp(toDate, TimestampConvertor.BIRTH_DATE); + } + Timestamp oldFromDate = (Timestamp)request.getSession().getAttribute(Constants.FROM_DATE); + Timestamp oldToDate = (Timestamp)request.getSession().getAttribute(Constants.TO_DATE); + + if (!startDate.equals(oldFromDate) || !endDate.equals(oldToDate)) + { + clear(request, true); + clear(request, false); + } + + description = description == null? "":description; + barCode = barCode == null?"": barCode; + + ArrayList reportSalesData = getReportData(request, true, orgId); + ArrayList reportStockData = getReportData(request, false, orgId); + + HashSet productSalesCompleteSet = (HashSet) request.getSession().getAttribute(Constants.PRODUCT_SALES_COMPLETE_SET); + HashSet productStockCompleteSet = (HashSet) request.getSession().getAttribute(Constants.PRODUCT_STOCK_COMPLETE_SET); + + + HashMap> prodOrgStockMap = (HashMap>)request.getSession().getAttribute(Constants.PRODUCT_ORG_STOCK_MAP); + HashMap> prodOrgSalesMap = (HashMap>)request.getSession().getAttribute(Constants.PRODUCT_ORG_SALES_MAP); + + + productSalesCompleteSet = productSalesCompleteSet == null? new HashSet() : productSalesCompleteSet; + productStockCompleteSet = productStockCompleteSet == null? new HashSet() : productStockCompleteSet; + prodOrgStockMap = prodOrgStockMap == null? new HashMap>() : prodOrgStockMap; + prodOrgSalesMap = prodOrgSalesMap == null? new HashMap>() : prodOrgSalesMap; + + + ArrayList salesBackup = POSReportManager.doBackup(reportSalesData); + ArrayList stockBackup = POSReportManager.doBackup(reportStockData); + + + if (orgId != null) + { + boolean isComplete = false; + if (orgId == 0) + { + isComplete = true; + } + try + { + + int[] productIds = null ; + + if (productName == null) + { + productIds = ProductManager.getProducts(ctx, "", description, barCode, null); + if (productIds.length == 0) + { + throw new OperationException("no products found matching that description and/or barcode"); + } + } + else + { + productIds = new int[]{productId}; + } + + clear(request, !isComplete); + + if (orgId == 0) + { + + for (int prodId: productIds) + { + reportSalesData = POSReportManager.getStockSalesReportComplete(ctx, productSalesCompleteSet, true, reportSalesData, prodId, orgId, startDate, endDate); + reportStockData = POSReportManager.getStockSalesReportComplete(ctx, productStockCompleteSet,false, reportStockData, prodId, orgId, startDate, endDate); + } + } + else + { + + for (int prodId: productIds) + { + reportSalesData = POSReportManager.getStockSalesReport(ctx, prodOrgSalesMap, reportSalesData, true, prodId, orgId, startDate, endDate); + reportStockData = POSReportManager.getStockSalesReport(ctx, prodOrgStockMap,reportStockData, false, prodId, orgId, startDate, endDate); + } + } + } + catch (OperationException e) + { + reportStockData = stockBackup; + reportSalesData = salesBackup; + + if (orgId != 0) + { + request.getSession().setAttribute(Constants.SALES_REPORT_LIST, reportSalesData); + request.getSession().setAttribute(Constants.STOCK_REPORT_LIST, reportStockData); + } + else + { + request.getSession().setAttribute(Constants.SALES_REPORT_LIST_COMPLETE, reportSalesData); + request.getSession().setAttribute(Constants.STOCK_REPORT_LIST_COMPLETE, reportStockData); + + } + postGlobalError("error.process",e.getMessage(),request); + return mapping.getInputForward(); + } + + //constructing the table + TabularReportMerge tReport = new TabularReportMerge("Stock Sales Report", 2); + tReport.setFromDate(startDate); + tReport.setToDate(endDate); + tReport.setSortable(false); + tReport.setStyle("display"); + try + { + if (orgId == 0) + { + tReport.createReport(reportSalesData, Constants.SALES_TYPE, "Sales (Qty Sold)"); + tReport.createReport(reportStockData, Constants.STOCK_TYPE, "Stock (Qty On Hand)"); + } + else + { + tReport.createReport(reportSalesData, Constants.SALES_TYPE, "Sales (Qty Sold)"); + tReport.createReport(reportStockData, Constants.STOCK_TYPE, "Stock (Qty On Hand)"); + } + } + catch (OperationException e) + { + postGlobalError("error.process",e.getMessage(),request); + return mapping.getInputForward(); + } + request.getSession().setAttribute(Constants.STOCK_SALES_REPORT_DATA,tReport.toString()); + request.getSession().setAttribute(Constants.STOCK_SALES_REPORT_ORGS, orgIds); + + if (orgId != 0) + { + request.getSession().setAttribute(Constants.SALES_REPORT_LIST, reportSalesData); + request.getSession().setAttribute(Constants.STOCK_REPORT_LIST, reportStockData); + request.getSession().setAttribute(Constants.PRODUCT_ORG_STOCK_MAP, prodOrgStockMap); + request.getSession().setAttribute(Constants.PRODUCT_ORG_SALES_MAP, prodOrgSalesMap); + + } + else + { + request.getSession().setAttribute(Constants.SALES_REPORT_LIST_COMPLETE, reportSalesData); + request.getSession().setAttribute(Constants.STOCK_REPORT_LIST_COMPLETE, reportStockData); + request.getSession().setAttribute(Constants.PRODUCT_SALES_COMPLETE_SET, productSalesCompleteSet); + request.getSession().setAttribute(Constants.PRODUCT_STOCK_COMPLETE_SET, productStockCompleteSet); + } + } + + request.getSession().setAttribute(Constants.FROM_DATE, startDate); + request.getSession().setAttribute(Constants.TO_DATE, endDate); + + return mapping.findForward(GET_STOCK_SALES_REPORT); + + } + + public static final String CLEAR_STOCK_SALES_REPORT = "clearStockSalesReport"; + public ActionForward clearStockSalesReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, DocumentException, IOException, SQLException, ParseException + { + ActionForward fwd= init(mapping,form,request,response); + + if (fwd!=null) + { + return fwd; + } + + clear(request, true); + clear(request, false); + request.getSession().removeAttribute(Constants.STOCK_SALES_REPORT_ORGS); + request.getSession().removeAttribute(Constants.STOCK_SALES_REPORT_DATA); + + return mapping.findForward(GET_STOCK_SALES_REPORT); + } + + private void clear(HttpServletRequest request, boolean isComplete) + { + if (!isComplete) + { + request.getSession().removeAttribute(Constants.PRODUCT_ORG_STOCK_MAP); + request.getSession().removeAttribute(Constants.PRODUCT_ORG_SALES_MAP); + request.getSession().removeAttribute(Constants.SALES_REPORT_LIST); + request.getSession().removeAttribute(Constants.STOCK_REPORT_LIST); + } + else + { + request.getSession().removeAttribute(Constants.PRODUCT_SALES_COMPLETE_SET); + request.getSession().removeAttribute(Constants.PRODUCT_STOCK_COMPLETE_SET); + request.getSession().removeAttribute(Constants.SALES_REPORT_LIST_COMPLETE); + request.getSession().removeAttribute(Constants.STOCK_REPORT_LIST_COMPLETE); + } + } + + private ArrayList getReportData(HttpServletRequest request, boolean isSales, int orgId) + { + + if (isSales) + { + if (orgId == 0) + { + return (ArrayList) request.getSession().getAttribute(Constants.SALES_REPORT_LIST_COMPLETE); + } + else + { + return (ArrayList)request.getSession().getAttribute(Constants.SALES_REPORT_LIST); + } + } + else + { + if (orgId == 0) + { + return (ArrayList) request.getSession().getAttribute(Constants.STOCK_REPORT_LIST_COMPLETE); + } + else + { + return (ArrayList)request.getSession().getAttribute(Constants.STOCK_REPORT_LIST); + } + } + } + + public ActionForward getMonthlyStockReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, ParseException, FileNotFoundException, DocumentException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + String productName = request.getParameter("productName"); + String orgIds = getOrgIds(ctx, request); + String date1 = request.getParameter("date1"); + String date2 = request.getParameter("date2"); + + Timestamp d1 = TimestampConvertor.getTimestamp(date1, TimestampConvertor.XML_DATE_PATTERN); + Timestamp d2 = TimestampConvertor.getTimestamp(date2, TimestampConvertor.XML_DATE_PATTERN); + + Calendar fd = Calendar.getInstance(); + fd.setTimeInMillis(d1.getTime()); + fd.set(Calendar.DATE, 1); + + Calendar td = Calendar.getInstance(); + td.setTimeInMillis(d2.getTime()); + td.set(Calendar.DATE, td.getMaximum(Calendar.DAY_OF_MONTH)); + + Timestamp fromDate = new Timestamp(fd.getTimeInMillis()); + Timestamp toDate = new Timestamp(td.getTimeInMillis()); + + int[] productIds = ProductManager.getProducts(ctx, productName, Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM), null, null, null); + + if (productIds == null || productIds.length == 0) + { + throw new OperationException ("no products found with product name " + productName); + } + ArrayList reportData = null; + try + { + reportData = new ArrayList(); + Object[] header = new Object[]{"Month", "Qty Sold", "GRN", "Stock Adjustments"}; + reportData.add(header); + + HashMap monthQtySales = POSProductManager.getOrderQtyInfoPerProduct(ctx, true, productIds[0], + orgIds, fromDate, toDate, null); + + reportData = POSReportManager.formatStockSalesReportData(reportData, monthQtySales, fromDate, toDate, 2); + + HashMap monthQtyGRN = POSProductManager.getOrderQtyInfoPerProduct(ctx, false, productIds[0], + orgIds, fromDate, toDate, null); + + reportData = POSReportManager.formatStockSalesReportData(reportData, monthQtyGRN,fromDate, toDate, 2); + + HashMap monthStockAdjust = POSStockManager.getMonthlyStockAdjustments(ctx, + productIds[0], orgIds, fromDate, toDate, null); + reportData = POSReportManager.formatStockSalesReportData(reportData, monthStockAdjust,fromDate, toDate, 2); + + } + catch (OperationException e) + { + postGlobalError("error.process",e.getMessage(),request); + return mapping.getInputForward(); + } + + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle("Monthly Stock and Sales Report from " + date1 + " to "+date2 ); + tReport.setSubtitle("Product: "+productName); + tReport.setFromDate(fromDate); + tReport.setToDate(toDate); + tReport.createReport("SalesReportAction.do?action=getGRNDetailsPerProduct", productIds[0]); // need to find another way to generate reports with links on data + + request.getSession().setAttribute(Constants.MONTHLY_SALES_REPORT_DATA,tReport.toString()); + + + return mapping.findForward(GET_MONTHLY_SALES_REPORT); + } + + public static String GET_STOCK_ADJUSTMENTS_PER_PRODUCT = "getStockAdjustmentsPerProduct"; + public ActionForward getStockAdjustmentsPerProduct(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + String prodId = request.getParameter("productId"); + String orgIds = getOrgIds(ctx, request); + int productId = Integer.parseInt(prodId); + String date1 = request.getParameter("date1"); + String date2 = request.getParameter("date2"); + Timestamp fromDate = TimestampConvertor.getTimestamp(date1, TimestampConvertor.BIRTH_DATE); + Timestamp toDate = TimestampConvertor.getTimestamp(date2, TimestampConvertor.BIRTH_DATE); + MProduct product = MProduct.get(ctx, productId); + + ArrayList reportData = new ArrayList(); + + + reportData = POSStockManager.getStockAdjustments(ctx, reportData, productId, orgIds, fromDate, toDate, null); + + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle("Stock Adjustments Report from " + date1 + " to "+date2 ); + tReport.setSubtitle("Product: "+product.getName()); + tReport.setFromDate(fromDate); + tReport.setToDate(toDate); + tReport.createReport(ctx, productId); + + request.getSession().setAttribute(Constants.STOCK_ADJUSTMENTS_REPORT_DATA,tReport.toString()); + + + return mapping.findForward(GET_STOCK_ADJUSTMENTS_PER_PRODUCT); + } + + public static final String VIEW_INVENTORY_HISTORY="viewInventoryHistory"; + public ActionForward viewInventoryHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + + Properties ctx = TmkJSPEnv.getCtx(request); + String prodId = request.getParameter("productId"); + String org_Id = request.getParameter("orgId"); + int orgId = Integer.parseInt(org_Id); + int productId = Integer.parseInt(prodId); + + String date1 = request.getParameter("date1"); + String date2 = request.getParameter("date2"); + + Timestamp fromDate = TimestampConvertor.getTimestamp(date1, TimestampConvertor.XML_DATE_PATTERN); + Timestamp toDate = TimestampConvertor.getTimestamp(date2, TimestampConvertor.XML_DATE_PATTERN); + + ArrayList list = InventoryManager.viewInventoryHistory(ctx,orgId, productId, fromDate, toDate, null); + request.setAttribute(Constants.INVENTORY_HISTORY_LIST,list); + return mapping.findForward(VIEW_INVENTORY_HISTORY); + } + + public static final String VIEW_INVENTORY_MOVE_HISTORY = "viewInventoryMoveHistory"; + public ActionForward viewInventoryMoveHistory(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + Properties ctx = TmkJSPEnv.getCtx(request); + String prodId = request.getParameter("productId"); + String orgId = request.getParameter("orgId"); + String type = request.getParameter("type"); + int productId = Integer.parseInt(prodId); + String date1 = request.getParameter("date1"); + String date2 = request.getParameter("date2"); + + Timestamp fromDate = TimestampConvertor.getTimestamp(date1, TimestampConvertor.XML_DATE_PATTERN); + Timestamp toDate = TimestampConvertor.getTimestamp(date2, TimestampConvertor.XML_DATE_PATTERN); + + ArrayList list = MMovementManager.getMMovement(ctx, orgId, type, productId, fromDate, toDate); + + request.setAttribute(Constants.INVENTORY_MOVE_HISTORY, list); + return mapping.findForward(VIEW_INVENTORY_MOVE_HISTORY); + } + + private String getOrgIds(Properties ctx, HttpServletRequest request) + { + HashSet orgIdSet = (HashSet)request.getSession().getAttribute(Constants.STOCK_SALES_REPORT_ORGS); + StringBuffer orgIds = new StringBuffer(); + Iterator iter = orgIdSet.iterator(); + while (iter.hasNext()) + { + Integer orgId = iter.next(); + + if (orgId ==0) + { + return Env.getContext(ctx,UdiConstants.ROLE_EDITABLE_ORGS_CTX_PARAM); + } + else + { + orgIds = orgIds.append(orgId); + if (iter.hasNext()) + { + orgIds = orgIds.append(","); + } + } + } + + return orgIds.toString(); + } + + + public static final String GENERATE_REPORT_INPUT = "generateReportInput"; + public ActionForward generateReportInput(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + + if (fwd!=null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + StringBuffer componentList = new StringBuffer(); + String processDescription = null; + String processComment = null; + + int processId = 0; + try + { + processId = Integer.valueOf(request.getParameter("processId")); + MProcess process = MProcess.get(ctx, processId); + MProcessPara[] processPara = process.getParameters(); + processDescription = process.getDescription(); + processComment = process.getHelp(); + + for (MProcessPara parameter:processPara) + { + tr component = new tr(); + try + { + component = (tr)WebComponentFactory.getWebComponent(ctx, parameter); + } + catch (Exception e) + { + postGlobalError("error.process", e.getMessage(), request); + return mapping.getInputForward(); + + } + componentList.append(component.toString()); + } + } + catch (NumberFormatException e) + { + return mapping.getInputForward(); + } + request.getSession().setAttribute(Constants.PROCESS_ID, processId); + request.getSession().setAttribute(Constants.REPORT_DESCRIPTION, processDescription); + request.getSession().setAttribute(Constants.REPORT_COMMENT, processComment); + request.getSession().setAttribute(Constants.WEB_COMPONENTS, componentList.toString()); + return mapping.findForward(GENERATE_REPORT_INPUT); + } + + + public static final String GENERATE_REPORT_OUTPUT = "generateReportOutput"; + public ActionForward generateReportOutput(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + + String reportType = df.getReportType(); + // Load process + int processId = Integer.valueOf(request.getSession().getAttribute(Constants.PROCESS_ID).toString()); + MProcess process = MProcess.get(ctx, processId); + + Map map = request.getParameterMap(); + ProcessInfo pi = null; + // Create a new process instance and populate its parameters with the web user's input + try + { + pi = POSReportManager.createProcessInstance(ctx, processId, map, null); + } + catch (OperationException e) + { + postGlobalError("error.process",e.getMessage(), request); + return mapping.getInputForward(); + } + try + { + ProcessManager.startProcess(ctx, process.getClassname(), pi, null); + } + catch (InstantiationException e) + { + return mapping.getInputForward(); + } + catch (IllegalAccessException e) + { + return mapping.getInputForward(); + } + catch (ClassNotFoundException e) + { + return mapping.getInputForward(); + } + + if (POSReportManager.isJasperReport(process.getClassname())) + { + JasperPrint jasperPrint = ReportStarter.getJasperPrint(); + if (Constants.HTML.equals(reportType)) + { + XhtmlDocument doc = new XhtmlDocument(); + File file = File.createTempFile ("Jasper", ".html", new File(PathInfo.PROJECT_HOME)); + JasperExportManager.exportReportToHtmlFile(jasperPrint, file.getAbsolutePath()); + + StringBuffer contents = new StringBuffer(); + try + { + BufferedReader input = new BufferedReader(new FileReader(file)); + try + { + String line = null; + while (( line = input.readLine()) != null){ + contents.append(line); + contents.append(System.getProperty("line.separator")); + } + } + finally + { + input.close(); + } + } + catch (IOException ex) + { + ex.printStackTrace(); + } + PrintWriter writer = response.getWriter(); + writer.write(contents.toString()); + doc.output(writer); + writer.flush(); + writer.close(); + } + if (Constants.PDF.equals(reportType)) + { + response.setContentType(MimeType.getMimeType(".pdf")); + response.setHeader("Content-Disposition:", "attachment;filename=\""+process.getName()+".pdf\""); + byte[] pdfData = JasperExportManager.exportReportToPdf(jasperPrint); + response.getOutputStream().write(pdfData); + } + } + else + { + MPrintFormat printFormat = POSReportManager.loadPrintFormat(ctx, process, null); + PrintData printData = POSReportManager.getPrintData(ctx, printFormat, pi); + + ReportEngine reportEngine = POSReportManager.getReportEngine(ctx, printFormat, pi); + + if (Constants.PDF.equals(reportType)) + { + response.setContentType(MimeType.getMimeType(".pdf")); + response.setHeader("Content-Disposition:", "attachment;filename=\""+process.getName()+".pdf\""); + + byte[] pdfData = reportEngine.createPDFData(); + response.getOutputStream().write(pdfData); + } + if (Constants.CSV.equals(reportType)) + { + response.setContentType(MimeType.getMimeType(".csv")); + response.setHeader("Content-Disposition:", "attachment;filename=\""+process.getName()+".csv\""); + PrintWriter writer = new PrintWriter(response.getOutputStream()); + reportEngine.createCSV(writer, ',', printFormat.getLanguage()); + } + if (Constants.HTML.equals(reportType)) + { + PrintWriter printWriter = new PrintWriter(response.getOutputStream()); + HashMap paramMap = POSReportManager.getReportParameters(ctx, pi.getAD_PInstance_ID(), null); + POSReportManager.createHTML(printWriter, process.getName(), paramMap, printData, printFormat); + } + } + response.getOutputStream().flush(); + response.getOutputStream().close(); + return null; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSRoleAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSRoleAction.java new file mode 100644 index 0000000000..4d8a4de4a8 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSRoleAction.java @@ -0,0 +1,361 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MOrg; +import org.compiere.model.MRole; +import org.compiere.model.MRoleOrgAccess; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.RoleBean; +import org.posterita.businesslogic.MenuManager; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.core.MenuItem; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.NoCheckBoxSelectedException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.RoleAlreadyExistsException; +import org.posterita.exceptions.SystemException; +import org.posterita.form.RoleForm; +import org.posterita.lib.UdiConstants; +import org.posterita.struts.core.DefaultForm; + +public class POSRoleAction extends POSDispatchAction +{ + public static final String CREATE_ROLE = "createRole"; + public static final String INIT_ROLE = "initRole"; + public static final String LIST_ROLES = "listRoles"; + public static final String VIEW_ROLE = "viewRole"; + public static final String DELETE_ROLE = "deleteRole"; + + public ActionForward createRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + RoleBean bean = (RoleBean) df.getBean(); + + + //Create Role and assign menus + MRole role; + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + try + { + trx.start(); + role = RoleManager.createRole(ctx, bean.getOrgId(), bean.getName(),bean.getIsAccessAllOrgs(), bean.getCheckBox(), bean.getUserDiscount(), bean.getIsOverwritePriceLimit(), bean.getIsDiscountAllowedOnTotal(), bean.getIsDiscountUptoLimitPrice(), bean.getCanCreateOrder(), bean.getCanAlterOrder(), bean.getCanViewOrder(), trx.getTrxName()); + trx.commit(); + ArrayList menus = MenuManager.getMenus(ctx, role.get_ID()); + MenuItem rootItem = MenuManager.buildMenuTree(ctx, menus); + + request.getSession().setAttribute(Constants.ROLE,bean); + request.getSession().setAttribute(Constants.ROLE_MENUS, rootItem.getSubMenus()); + } + catch (RoleAlreadyExistsException e) + { + trx.rollback(); + postGlobalError("error.role.already.exists",request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(CREATE_ROLE); + + } + + public ActionForward initRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + //ArrayList menuList = MenuKeyNamePair.getKeyNamePairs(ctx); + + //String menu = MenuItem.getMenu(ctx, null); + + //request.getSession().setAttribute(Constants.MENUS,menu); + + ArrayList menus = MenuManager.getMenusForOrganisationType(ctx); + MenuItem rootItem = MenuManager.buildMenuTree(ctx, menus); + + //request.getSession().setAttribute(Constants.ROLE,bean); + request.getSession().setAttribute(Constants.ROLE_MENUS, rootItem.getSubMenus()); + + return mapping.findForward(CREATE_ROLE); + + } + + public ActionForward listRoles(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + ArrayList roles = new ArrayList(); + + if (df.getFirst() != null && df.getFirst().equals("1")) + { + request.getSession().setAttribute(Constants.ALL_ROLES,roles); + return mapping.findForward(LIST_ROLES); + } + else + roles = RoleManager.getRoles(ctx, df.getName()); + + request.getSession().setAttribute(Constants.ALL_ROLES,roles); + + return mapping.findForward(LIST_ROLES); + + } + + public ActionForward deleteRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + Integer roleId = Integer.valueOf(df.getRoleId()); + + RoleManager.deleteRole(ctx,roleId.intValue()); + + return mapping.findForward(DELETE_ROLE); + } + + + public ActionForward viewRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + Integer roleId = Integer.valueOf(df.getRoleId()); + + RoleBean bean = RoleManager.getRole(ctx,roleId.intValue()); + + //ArrayList menus = MenuItem.getMenu(ctx,roleId.intValue()); + + //request.getSession().setAttribute(Constants.MENUS,menus); + + ArrayList menus = MenuManager.getMenus(ctx, roleId.intValue()); + MenuItem rootItem = MenuManager.buildMenuTree(ctx, menus); + + request.getSession().setAttribute(Constants.ROLE_MENUS, rootItem.getSubMenus()); + request.getSession().setAttribute(Constants.ROLE,bean); + + return mapping.findForward(VIEW_ROLE); + + } + + private static final String INIT_EDIT_ROLE = "initEditRole"; + public ActionForward initEditRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm)form; + + Integer roleId = Integer.valueOf(df.getRoleId()); + + RoleBean bean = RoleManager.getRole(ctx,roleId.intValue()); + MenuItem menuItem = RoleManager.getAvailableMenus(ctx, roleId); + + request.getSession().setAttribute(Constants.ROLE_MENUS, menuItem.getSubMenus()); + request.getSession().setAttribute(Constants.ROLE,bean); + + return mapping.findForward(INIT_EDIT_ROLE); + } + + + private static final String INIT_ROLE_ORG_ACCESS = "initRoleOrgAccess"; + public ActionForward initEditRoleOrgAccess(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + RoleForm rf = (RoleForm) form; + + RoleBean bean = (RoleBean) rf.getBean(); + + ArrayList list = RoleManager.getRoleOrgAccess(ctx, bean.getRoleId()); + RoleBean myRoleBean = RoleManager.getRole(ctx, bean.getRoleId()); + + request.getSession().setAttribute(Constants.ROLE_ORG_ACCESS_LIST, list); + request.getSession().setAttribute(Constants.ROLE, myRoleBean); + + + return mapping.findForward(INIT_ROLE_ORG_ACCESS); + } + + private static final String EDIT_ROLE_ORG_ACCESS = "editRoleOrgAccess"; + public ActionForward editRoleOrgAccess(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + //RoleBean bean = (RoleBean) rf.getBean(); + + ArrayList roleBeanList = df.getRoleOrgAccessList(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + trx.start(); + + + try + { + RoleManager.editRoleOrgAccess(ctx, roleBeanList, trx.getTrxName()); + trx.commit(); + } + catch(OperationException ex) + { + trx.rollback(); + postGlobalError("error.role.org.access.edit", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(EDIT_ROLE_ORG_ACCESS); + } + + + public static final String EDIT_ROLE = "editRole"; + public ActionForward editRole(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, SystemException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm)form; + + RoleBean roleBean = (RoleBean)df.getBean(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + trx.start(); + try + { + RoleManager.editRole(ctx, roleBean.getRoleId(), roleBean.getName(), roleBean.getIsAccessAllOrgs(), roleBean.getCheckBox(), roleBean.getUserDiscount(), roleBean.getIsOverwritePriceLimit(), roleBean.getIsDiscountUptoLimitPrice(), roleBean.getIsDiscountAllowedOnTotal() ,trx.getTrxName()); + trx.commit(); + } + catch(RoleAlreadyExistsException ex) + { + trx.rollback(); + postGlobalError("error.role.already.exists",request); + return mapping.getInputForward(); + } + catch (NoAccessToEditObjectException e) + { + trx.rollback(); + postGlobalError("error.no.edit.access", request); + return mapping.getInputForward(); + } + catch(NoCheckBoxSelectedException e) + { + trx.rollback(); + postGlobalError("error.no.checkbox.selected",request); + return mapping.getInputForward(); + } + catch(OperationException ex) + { + trx.rollback(); + postGlobalError("error.role.edit", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + RoleBean bean = RoleManager.getRole(ctx, roleBean.getRoleId()); + ArrayList menus = MenuManager.getMenus(ctx, roleBean.getRoleId()); + MenuItem rootItem = MenuManager.buildMenuTree(ctx, menus); + + request.getSession().setAttribute(Constants.ROLE_MENUS, rootItem.getSubMenus()); + request.getSession().setAttribute(Constants.ROLE, bean); + + ArrayList roles = RoleManager.getRoles(ctx, null); + + request.getSession().setAttribute(Constants.ALL_ROLES,roles); + + return mapping.findForward(EDIT_ROLE); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSSalesReportAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSSalesReportAction.java new file mode 100644 index 0000000000..078edc6ef6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSSalesReportAction.java @@ -0,0 +1,290 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 17-Jul-2006 14:12:03 by praveen + * + */ + +package org.posterita.struts.pos; + +import java.awt.Color; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MAttribute; +import org.compiere.model.MAttributeSet; +import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.plot.XYPlot; +import org.posterita.Constants; +import org.posterita.beans.ReportBean; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.businesslogic.performanceanalysis.SalesAnalysisReportManager; +import org.posterita.core.PieChart; +import org.posterita.core.RandomStringGenerator; +import org.posterita.core.SessionStorage; +import org.posterita.core.TimeSeriesChart; +import org.posterita.core.TimestampConvertor; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.SalesReportForm; +import org.posterita.struts.core.DefaultForm; + +public class POSSalesReportAction extends POSDispatchAction +{ + public static final String GET_CUSTOM_REPORT = "getCustomReport"; + public ActionForward getCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + Timestamp fromDate = ReportDateManager.getFromDate(bean); + Timestamp toDate = ReportDateManager.getToDate(bean); + String timeperiod = bean.getTimePeriod(); + String chartType = bean.getChartType(); + String salesGroup = bean.getSalesGroup(); + + String reportDir = ReportManager.getReportDirectoryFromServletContext(this.servlet); + String filename = RandomStringGenerator.randomstring(); + + String subtitle = null; + String title = null; + + if(timeperiod!=null) + { + subtitle = "For " + timeperiod; + } + else + { + subtitle = "For period:"+fromDate+" to "+toDate; + } + + + if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)||salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET)) + { + title = "Sales By " + salesGroup; + } + else + { + String[] s = salesGroup.split("_"); + + if(s.length!=2) + { + throw new OperationException("Cannot generate sql. Unknown salesGroup parameter:"+salesGroup); + } + + int attributeSetId = Integer.parseInt(s[0]); + int attributeId = Integer.parseInt(s[1]); + + String attributeSetName = null; + String attributeName = null; + + attributeSetName = MAttributeSet.get(ctx,attributeSetId).getName(); + attributeName = new MAttribute(ctx,attributeId,null).getName(); + + title = "Sales By " + attributeName + " For " + attributeSetName; + } + + + if(chartType.equals(PieChart.CHART_TYPE)) + { + //draw pie chart + String pieChartSQL = SalesAnalysisReportManager.getPieChartDataSetSQL(ctx,Integer.valueOf(1),fromDate,toDate,salesGroup); + PieChart pieChart = new PieChart(); + + pieChart.setTitle(title); + pieChart.setSubtitle(subtitle); + pieChart.getDataSetFromSQL(pieChartSQL); + pieChart.getChart().setBackgroundPaint(Color.white); + pieChart.saveChartAsJPEG(reportDir+filename+".jpg",700,600); + } + else if(chartType.equals(TimeSeriesChart.CHART_TYPE)) + { + //draw timeseries + String timeSeriesChartSQL = SalesAnalysisReportManager.getTimeSeriesDataSetSQL(ctx,Integer.valueOf(1),fromDate,toDate,salesGroup); + TimeSeriesChart timeSeriesChart = new TimeSeriesChart(); + + timeSeriesChart.setTitle(title); + timeSeriesChart.setSubtitle(subtitle); + timeSeriesChart.setShowShapes(true); + timeSeriesChart.getDataSetFromSQL(timeSeriesChartSQL); + + + XYPlot plot = (XYPlot) timeSeriesChart.getChart().getPlot(); + DateAxis axis = (DateAxis) plot.getDomainAxis(); + + axis.setRange(fromDate, toDate); + //axis.setTickUnit(new DateTickUnit(DateTickUnit.MONTH,1,new SimpleDateFormat("MMM-yyyy"))); + + timeSeriesChart.getChart().setBackgroundPaint(Color.white); + timeSeriesChart.saveChartAsJPEG(reportDir+filename+".jpg",700,600); + } + else + { + throw new OperationException("Invalid Chart type:" + chartType); + } + + String imgURL = request.getContextPath() + "/config/reports/"+filename+".jpg"; + request.getSession().setAttribute(Constants.REPORT_URL,imgURL); + + return mapping.findForward(GET_CUSTOM_REPORT); + //return getGroupedSalesReport(mapping,form,request,response); + } + + public static final String INIT_CUSTOM_REPORT = "initCustomReport"; + public ActionForward initCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + SalesReportForm salesReportForm = (SalesReportForm) form; + ReportBean reportBean = (ReportBean) salesReportForm.getBean(); + + salesReportForm.setChartType(PieChart.CHART_TYPE); + reportBean.setChartType(PieChart.CHART_TYPE); + + boolean error = false; + + if((salesReportForm.getFromDate()==null)||(salesReportForm.getFromDate()=="")) + { + postGlobalError("error.required.startDate",request); + error = true; + } + + if((salesReportForm.getToDate()==null)||(salesReportForm.getToDate()=="")) + { + postGlobalError("error.required.endDate",request); + error = true; + } + + if(error) + { + return mapping.getInputForward(); + } + + SessionStorage.putSalesGroupFilter(ctx,request,reportBean); + + return mapping.findForward(INIT_CUSTOM_REPORT); + } + + public static final String INIT_CUSTOM_SALES_REPORT = "initCustomSalesReport"; + public ActionForward initCustomSalesReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + SalesReportForm reportForm = (SalesReportForm) form; + ReportBean reportBean = (ReportBean) reportForm.getBean(); + + if(reportBean.getFromDate()==null) + { + String timeperiod = reportBean.getTimePeriod(); + if(timeperiod==null) + { + throw new OperationException("No period parameter found!"); + } + + Date startDate = ReportDateManager.getStartDateForPeriod(timeperiod); + Date endDate = ReportDateManager.getEndDateForPeriod(timeperiod); + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + String fromDate = sdf.format(startDate); + String toDate = sdf.format(endDate); + + reportForm.setFromDate(fromDate); + reportForm.setToDate(toDate); + reportForm.setStartHour("0"); + reportForm.setStartMinute("0"); + reportForm.setChartType(PieChart.CHART_TYPE); + + reportBean.setFromDate(fromDate); + reportBean.setToDate(toDate); + reportBean.setStartHour("0"); + reportBean.setStartMinute("0"); + reportBean.setChartType(PieChart.CHART_TYPE); + + Calendar cal = Calendar.getInstance(); + + reportForm.setToDate(toDate); + reportForm.setEndHour(cal.get(Calendar.HOUR_OF_DAY)+""); + reportForm.setEndMinute(cal.get(Calendar.MINUTE)+""); + + reportBean.setToDate(toDate); + reportBean.setEndHour(cal.get(Calendar.HOUR_OF_DAY)+""); + reportBean.setEndMinute(cal.get(Calendar.MINUTE)+""); + + SessionStorage.putSalesGroupFilter(ctx,request,reportBean); + + } + + return mapping.findForward(INIT_CUSTOM_SALES_REPORT); + } + + public static final String SALES_BY_ATTRIBUTESET = "salesByAttributeSet"; + public static final String SALES_BY_REVENUE_RECOGNITION = "salesByRevenueRecognition"; + + public static final String GET_GROUPED_SALES_REPORT = "getGroupedSalesReport"; + public ActionForward getGroupedSalesReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + SalesReportForm reportForm = (SalesReportForm) form; + ReportBean reportBean = (ReportBean) reportForm.getBean(); + + String salesGroup = reportBean.getSalesGroup(); + + if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) + { + return mapping.findForward(SALES_BY_REVENUE_RECOGNITION); + } + else if(salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET)) + { + return mapping.findForward(SALES_BY_ATTRIBUTESET); + } + else + { + throw new OperationException("Invalid Sales Grouping: "+ salesGroup); + } + + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSStockAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSStockAction.java new file mode 100644 index 0000000000..dd609b9343 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSStockAction.java @@ -0,0 +1,155 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on May 8, 2006 + */ + + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.Constants; +import org.posterita.beans.AttributeBean; +import org.posterita.businesslogic.POSStockManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + +public class POSStockAction extends BaseDispatchAction +{ + public static final String initPOSStock="initPOSStock"; + public ActionForward initPOSStock(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + + request.getSession().removeAttribute(Constants.PRODUCTS); + ArrayList list=POSStockManager.getAllAttributeSet(ctx); + request.getSession().setAttribute(Constants.PRODUCT_ATTRIBUTE_SET,list); + + return mapping.findForward(GET_POS_STOCK); + + } + + public static final String GET_POS_STOCK="getPOSStock"; + public ActionForward getPOSStock(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + + request.removeAttribute(Constants.PRODUCTS); + ArrayList list=POSStockManager.getAllAttributeSet(ctx); + request.getSession().setAttribute(Constants.PRODUCT_ATTRIBUTE_SET,list); + + ArrayList list2=POSStockManager.getStockFromSearch(ctx, null, null, null); + request.getSession().setAttribute(Constants.PRODUCTS,list2); + + return mapping.findForward(GET_POS_STOCK); + + + } + + public static final String GET_STOCK="getStock"; + public ActionForward getStock(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + AttributeBean bean = (AttributeBean) df.getBean(); + ArrayList list=POSStockManager.getAllAttributeFromAttributeSet(ctx,bean); + request.getSession().setAttribute(Constants.ATTRIBUTE_SET_ID,bean.getAttributeSetId()); + request.getSession().setAttribute(Constants.PRODUCT_ATTRIBUTE_LIST,list); + request.removeAttribute(Constants.PRODUCTS); + ArrayList productList=POSStockManager.getAllProducts(ctx, bean.getAttributeSetId()); + request.getSession().setAttribute(Constants.PRODUCTS,productList); + + return mapping.findForward(GET_STOCK); + } + + + public static final String GET_PRODUCTS="getProducts"; + public ActionForward getProducts(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Integer attributeSetId=(Integer)request.getSession().getAttribute(Constants.ATTRIBUTE_SET_ID); + Properties ctx =TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + AttributeBean bean = (AttributeBean) df.getBean(); + ArrayList list=POSStockManager.getProducts(ctx,bean); + request.setAttribute(Constants.PRODUCTS,list); + + bean.setAttributeSetId(attributeSetId); + + ArrayList attriList=POSStockManager.getAllAttributeFromAttributeSet(ctx,bean); + request.getSession().setAttribute(Constants.PRODUCT_ATTRIBUTE_LIST,attriList); + + return mapping.findForward(GET_PRODUCTS); + } + + + public static final String GET_STOCK_FROM_SEARCH="getStockFromSearch"; + public ActionForward getStockFromSearch(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + if (isDisplayTagAction(request)) + { + return mapping.findForward(GET_STOCK_FROM_SEARCH); + } + + Properties ctx =TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + + String filter=null; + if(df.getQtyFilter()!=null && df.getQtyFilter().length()!=0) + filter=df.getQtyFilter(); + + ArrayList list = POSStockManager.getStockFromSearch(ctx,df.getProductName(),df.getBarCode(),filter); + request.getSession().setAttribute(Constants.PRODUCTS,list); + + return mapping.findForward(GET_STOCK_FROM_SEARCH); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/POSUserAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/POSUserAction.java new file mode 100644 index 0000000000..2e6441cf8b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/POSUserAction.java @@ -0,0 +1,293 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 29, 2005 by praveen + * + */ +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MCountry; +import org.compiere.util.Trx; + +import org.posterita.Constants; +import org.posterita.beans.UserBean; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.businesslogic.administration.UserManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.DuplicateUserPinException; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.UserAlreadyExistsException; +import org.posterita.form.UserForm; +import org.posterita.keyname.RegionKeyNamePair; +import org.posterita.struts.core.DefaultForm; + +public class POSUserAction extends POSDispatchAction +{ + + public static final String CREATE_USER = "createUser"; + public ActionForward createUser(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + + UserBean bean = (UserBean) df.getBean(); + + Properties ctx = TmkJSPEnv.getCtx(request); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + try + { + trx.start(); + MCountry country = MCountry.getDefault(ctx); + UserManager.createUser(ctx, bean.getOrgId(), bean.getUsername(),bean.getUsername(), bean.getIsSalesRep().booleanValue(),bean.getAddress1(),bean.getPostalAddress(),bean.getCity(),bean.getPassword(),bean.getEmail(),bean.getIsActive().booleanValue(),bean.getPhone(),0, bean.getRoleId().intValue(), country.get_ID(),bean.getUserPIN(),bean.getUserDiscount(),bean.getDocBasisType(),bean.getAmtMultiplier(),bean.getFrequencyType(),bean.getSubtractAmt(),bean.getIsFullAccess(),trx.getTrxName()); + trx.commit(); + } + catch(DuplicateUserPinException e) + { + trx.rollback(); + postGlobalError("error.duplicate.userpin", request); + return mapping.getInputForward(); + } + catch(UserAlreadyExistsException e) + { + trx.rollback(); + postGlobalError("error.usernameAlreadyUsed", request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(CREATE_USER); + } + + public static final String EDIT_USER = "editUser"; + public ActionForward editUser(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + + UserBean bean = (UserBean) df.getBean(); + + Properties ctx = TmkJSPEnv.getCtx(request); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + try + { + trx.start(); + UserManager.editUser(ctx, bean.getOrgId(), bean.getUserId().intValue(),bean.getRoleId().intValue(),bean.getPassword(),bean.getEmail(),bean.getPhone(),bean.getAddress1(),bean.getPostalAddress(),bean.getCity(),bean.getIsSalesRep().booleanValue(),bean.getIsActive().booleanValue(),bean.getUserPIN(),bean.getUserDiscount(),bean.getDocBasisType(),bean.getAmtMultiplier(),bean.getFrequencyType(),bean.getSubtractAmt(),bean.getIsFullAccess(),trx.getTrxName()); + trx.commit(); + } + catch(DuplicateUserPinException e) + { + trx.rollback(); + postGlobalError("error.duplicate.userpin", request); + return mapping.getInputForward(); + } + catch(NoAccessToEditObjectException e) + { + trx.rollback(); + postGlobalError("error.no.edit.access", request); + return mapping.getInputForward(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.editing.user", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return mapping.findForward(EDIT_USER); + } + + public static final String DELETE_USER = "deleteUser"; + @SuppressWarnings("unchecked") + public ActionForward deleteUser(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + UserForm uf = (UserForm) form; + + Properties ctx = TmkJSPEnv.getCtx(request); + + int userId = Integer.valueOf(uf.getUserId()).intValue(); + + UserManager.deleteUser(ctx,userId); + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.ALL_USERS); + + ArrayList newList = UserManager.updateUserListStatus(list, userId, false); + + request.getSession().setAttribute(Constants.ALL_USERS,newList); + + return mapping.findForward(DELETE_USER); + } + + public static final String ACTIVATE_USER = "activateUser"; + @SuppressWarnings("unchecked") + public ActionForward activateUser(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + UserForm uf = (UserForm) form; + + Properties ctx = TmkJSPEnv.getCtx(request); + + int userId = Integer.valueOf(uf.getUserId()).intValue(); + + UserManager.activateUser(ctx,userId); + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.ALL_USERS); + + ArrayList newList = UserManager.updateUserListStatus(list, userId, true); + + request.getSession().setAttribute(Constants.ALL_USERS,newList); + + return mapping.findForward(ACTIVATE_USER); + } + + public static final String INIT_CREATE_USER = "initCreateUser"; + public ActionForward initCreateUser(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList roles = RoleManager.getAllRoles(ctx); + + ArrayList regions = RegionKeyNamePair.getKeyNamePairs(ctx); + + request.getSession().setAttribute(Constants.ROLES,roles); + + request.getSession().setAttribute(Constants.REGIONS,regions); + + return mapping.findForward(INIT_CREATE_USER); + } + + public static final String INIT_EDIT_USER = "initEditUser"; + public ActionForward initEditUser(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + UserForm uf = (UserForm) form; + + int userId = Integer.valueOf(uf.getUserId()).intValue(); + + UserBean bean = UserManager.getUser(ctx,userId); + + uf.populate(bean); + + ArrayList roles = RoleManager.getAllRoles(ctx); + + request.getSession().setAttribute(Constants.ROLES,roles); + + request.getSession().setAttribute(Constants.USER_DETAILS,bean); + + return mapping.findForward(INIT_EDIT_USER); + } + + public static final String LIST_USERS = "listUsers"; + public ActionForward listUsers(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + ArrayList users = new ArrayList(); + + if (df.getFirst() != null && df.getFirst().equals("1")) + { + request.getSession().setAttribute(Constants.ALL_USERS,users); + return mapping.findForward(LIST_USERS); + } + else + users = UserManager.getUsers(ctx, df.getName()); + + request.getSession().setAttribute(Constants.ALL_USERS,users); + + return mapping.findForward(LIST_USERS); + } + + public static final String VIEW_USER = "viewUser"; + public ActionForward viewUser(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + UserForm uf = (UserForm) form; + + int userId = Integer.valueOf(uf.getUserId()).intValue(); + + UserBean userBean = UserManager.getUser(ctx,userId); + + request.getSession().setAttribute(Constants.USER_DETAILS,userBean); + + return mapping.findForward(VIEW_USER); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/PartialPOSOrderAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/PartialPOSOrderAction.java new file mode 100644 index 0000000000..57bf7e06ef --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/PartialPOSOrderAction.java @@ -0,0 +1,763 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * */ + + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; +import java.math.BigDecimal; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MOrder; +import org.compiere.util.Env; +import org.compiere.util.Trx; + +import org.posterita.Constants; +import org.posterita.beans.ItemBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.OrderReferenceManager; +import org.posterita.businesslogic.OrderManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.PartialPOSManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.RoleManager; +import org.posterita.businesslogic.administration.UserManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.SessionStorage; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BPartnerNoLocationException; +import org.posterita.exceptions.BPartnerOverCreditLimitException; +import org.posterita.exceptions.DiscountLimitException; +import org.posterita.exceptions.InputQuantityLessThanZeroException; +import org.posterita.exceptions.InsufficientQtyException; +import org.posterita.exceptions.InvalidInvokeOrderStatusException; +import org.posterita.exceptions.InvalidOrderIDException; +import org.posterita.exceptions.InvalidOrderTypeException; +import org.posterita.exceptions.InvalidTenderedAmountException; +import org.posterita.exceptions.NoOrderLineFoundException; +import org.posterita.exceptions.NoOrderLineSelectedException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.exceptions.QuantityNotAvailableException; +import org.posterita.exceptions.UOMValuePrecisionNotValidException; +import org.posterita.form.InvokeOrderForm; +import org.posterita.lib.UdiConstants; +import org.posterita.struts.core.DefaultForm; + + +public class PartialPOSOrderAction extends POSDispatchAction +{ + public static final String CREATE_POS_ORDER="createPOSOrder"; + public ActionForward createPOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, DiscountLimitException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + //validate payment type + + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + + if(cartBean==null ||cartBean.getItems() == null||cartBean.getItems().size()==0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + MOrder posOrder = null; + + Integer bPartnerId = bean.getBpartnerId(); + + if(bPartnerId==null) + bPartnerId = (Integer) request.getSession().getAttribute(Constants.BPARTNER); + + if(bPartnerId==null) + { + bPartnerId=Integer.valueOf(POSTerminalManager.getCashBPartner(ctx).get_ID()); + } + else + { + boolean isBPartnerPresent = BPartnerManager.isBPartnerPresent(ctx,bPartnerId.intValue(),null); + + if( !isBPartnerPresent ) + { + postGlobalError("error.pos.invalid.customerID",request); + return mapping.getInputForward(); + } + } + + request.getSession().setAttribute(Constants.BPARTNER, bPartnerId); + + bean.setBpartnerId(bPartnerId); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + posOrder= PartialPOSManager.createPOSOrder(ctx,bean,cartBean.getItems(),null/*trx.getTrxName()*/); + trx.commit(); + } + catch(BPartnerOverCreditLimitException e1) + { + trx.rollback(); + postGlobalError("error.bpartner.over.credit.limit",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(BPartnerNoLocationException ex) + { + trx.rollback(); + postGlobalError("error.bpartner.nolocation", request); + return mapping.getInputForward(); + } + catch(InvalidTenderedAmountException e) + { + trx.rollback(); + postGlobalError("error.pos.incorrect.tendered.amount",request); + return mapping.getInputForward(); + } + catch(InsufficientQtyException e3) + { + trx.rollback(); + postGlobalError("error.insufficient.qty",e3.getMessage(),request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + bean.setOrderId(Integer.valueOf(posOrder.get_ID())); + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx, posOrder); + if(posOrder.getPaymentRule().equals(UdiConstants.PAYMENTRULE_MIXED)) + { + if(bean.getPaymentByCash()!=null) + webBean.setPaymentByCash(bean.getPaymentByCash()); + if(bean.getPaymentByCard()!=null) + webBean.setPaymentByCard(bean.getPaymentByCard()); + if(bean.getPaymentByChq()!=null) + webBean.setPaymentbyCheque(bean.getPaymentByChq()); + } + + + ArrayList list = PartialPOSManager.populateOrderLines(ctx,posOrder); + WebDocumentBean documentBean=PartialPOSManager.calculateOrderTotals(list); + request.getSession().setAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID,posOrder.get_ID()); + request.getSession().setAttribute(Constants.ORDER_LINE_BEAN,bean); + request.setAttribute(Constants.PARTIAL_POS_ORDER_LINES,list); + /*request.removeAttribute(Constants.POS_ORDER_LINES);*/ + + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + return mapping.findForward(CREATE_POS_ORDER); + + + + } + + public static final String COMPLETE_POS_ORDER="completePOSOrder"; + public ActionForward completePOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + OrderLineBean bean=(OrderLineBean) request.getSession().getAttribute(Constants.ORDER_LINE_BEAN); + Integer orderId = (Integer)request.getSession().getAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + MOrder completedPOSOrder=null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + completedPOSOrder=PartialPOSManager.completePOSOrder(ctx,orderId.intValue(),bean,trx.getTrxName()); + trx.commit(); + } + catch(NoOrderLineFoundException e) + { + trx.rollback(); + postGlobalError("error.pos.no.orderline",request); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx, completedPOSOrder); + + if(completedPOSOrder.getPaymentRule().equals(UdiConstants.PAYMENTRULE_MIXED)) + { + PartialPOSManager.getAmountForMixedPayment(ctx,completedPOSOrder,webBean); + } + + ArrayList list = PartialPOSManager.populateOrderLines(ctx,completedPOSOrder); + WebDocumentBean documentBean=PartialPOSManager.calculateOrderTotals(list); + request.setAttribute(Constants.POS_ORDER_LINES,list); + + /*request.removeAttribute(Constants.POS_ORDER_LINES);*/ + request.getSession().removeAttribute(Constants.BPARTNER); + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + request.setAttribute(Constants.ORDER_NAME,"POS ORDER"); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + return mapping.findForward(COMPLETE_POS_ORDER); + } + + + public static final String GET_POS_PAYMENT_DETAILS="getPOSPaymentDetails"; + public ActionForward getPOSPaymentDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + // Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + df.populate(new OrderLineBean()); + request.getSession().setAttribute(Constants.BPARTNER, bean.getBpartnerId()); + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + + if(cartBean==null ||cartBean.getItems() == null||cartBean.getItems().size()==0) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART, cartBean); + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS, cartBean.getItems()); + return mapping.findForward(GET_POS_PAYMENT_DETAILS); + + + } + + public static final String DELETE_POS_ORDERLINE = "deletePOSOrderLine"; + public ActionForward deletePOSOrderLine(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + String forward = DELETE_POS_ORDERLINE; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + forward = PartialPOSManager.deleteOrderLines(ctx,bean.getPosOrderLineIds(),trx.getTrxName()); + trx.commit(); + } + catch (NoOrderLineSelectedException e) + { + trx.rollback(); + SessionStorage.putPOSOrderInfo(ctx,bean,request,forward); + + postGlobalError("error.order.noOrderline.selected",request); + return mapping.getInputForward(); + } + catch (OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + + Integer orderId = (Integer)request.getSession().getAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + //validating order + //if lines == 0 goto createpartialOrder + + if(OrderManager.isOrderEmpty(ctx,orderId.intValue(),null)) + { + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + return new ActionForward("/CreatePartialPOSOrder.do"); + } + + //reload shopping cart + ShoppingCartBean cart = PartialPOSManager.getShoppingCartForOrder(ctx,orderId.intValue(),null); + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART,cart); + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS,cart.getItems()); + + + + SessionStorage.putPOSOrderInfo(ctx,bean,request,forward); + df.populate(new OrderLineBean()); + + return mapping.findForward(DELETE_POS_ORDERLINE); + } + + + public static final String ADD_TO_SHOPPING_CART = "addToShoppingCart"; + public ActionForward addToShoppingCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + + + try + { + // PartialPOSManager.getQtyAndItem(bean); + if(bean.getProductId()==null && bean.getBarCode()==null) + { + postGlobalError("error.barcode.required", request); + return mapping.getInputForward(); + } + + cartBean = StockManager.addToPOSCart(ctx, bean, cartBean,true,Boolean.parseBoolean(bean.getIfAdd())); + } + catch (InputQuantityLessThanZeroException e1) + { + postGlobalError("error.invalid.inputQty", request); + return mapping.getInputForward(); + } + catch (ProductNotFoundException e2) + { + postGlobalError("error.product.not.found", e2.getMessage(), request); + return mapping.getInputForward(); + } + catch(QuantityNotAvailableException e3) + { + postGlobalError("error.quantity.notAvailable", e3.getMessage(), request); + return mapping.getInputForward(); + } + + catch(ProductNotOnPriceListException e4) + { + postGlobalError("error.product.price.not.found", e4.getMessage(), request); + return mapping.getInputForward(); + } + + catch (UOMValuePrecisionNotValidException e) + { + postGlobalError("error.precision", e.getMessage(), request); + return mapping.getInputForward(); + } + + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART, cartBean); + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS, cartBean.getItems()); + + df.setQtyAndItem(""); + + return mapping.findForward(ADD_TO_SHOPPING_CART); + } + + + + public static final String COMPLETE_PARTIAL_POS_ORDER="completePartialPOSOrder"; + public ActionForward completePartialPOSOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + Integer orderId = (Integer)request.getSession().getAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + + //MOrder posOrder=(MOrder) request.getSession().getAttribute(Constants.CURRENT_POS_ORDER); + //MOrder completedPOSOrder=null; + //boolean error = false; + + if (orderId == null) + { + return mapping.getInputForward(); + } + if(OrderManager.isOrderEmpty(ctx,orderId.intValue(),null)) + { + postGlobalError("error.pos.no.orderline",request); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + return mapping.getInputForward(); + } + + //completedPOSOrder=PartialPOSManager.completePOSOrder(ctx,posOrder,bean); + MOrder completedPOSOrder = OrderManager.prepareOrder(ctx,orderId.intValue(),null); + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx, completedPOSOrder); + + if(completedPOSOrder.getPaymentRule().equals(UdiConstants.PAYMENTRULE_MIXED)) + { + PartialPOSManager.getAmountForMixedPayment(ctx,completedPOSOrder,webBean); + } + + ArrayList list = PartialPOSManager.populateOrderLines(ctx,completedPOSOrder); + WebDocumentBean documentBean=PartialPOSManager.calculateOrderTotals(list); + request.getSession().setAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID,orderId); + request.setAttribute(Constants.POS_ORDER_LINES,list); + + /*request.removeAttribute(Constants.POS_ORDER_LINES);*/ + request.getSession().removeAttribute(Constants.BPARTNER); + request.getSession().removeAttribute(Constants.ALL_CUSTOMERS); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + request.getSession().removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + request.getSession().removeAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + request.setAttribute(Constants.ORDER_NAME,"POS ORDER"); + + return mapping.findForward(COMPLETE_PARTIAL_POS_ORDER); + } + + + public static final String INVOKE_PARTIAL_ORDER = "invokePartialOrder"; + public ActionForward invokePartialOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + InvokeOrderForm f = (InvokeOrderForm) form; + OrderLineBean bean = (OrderLineBean) f.getBean(); + + String documentNo = bean.getDocumentNo(); + + MOrder order = null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + order = PartialPOSManager.invokePartialOrder(ctx,documentNo,trx.getTrxName()); + trx.commit(); + } + catch (InvalidOrderIDException e) + { + trx.rollback(); + postGlobalError("error.invalid.orderId",request); + return mapping.getInputForward(); + } + catch (InvalidOrderTypeException e) + { + trx.rollback(); + postGlobalError("error.invalid.orderType",request); + return mapping.getInputForward(); + } + catch (NoOrderLineFoundException e) + { + trx.rollback(); + postGlobalError("error.pos.invoke.no.orderline",request); + return mapping.getInputForward(); + } + catch (InvalidInvokeOrderStatusException e) + { + trx.rollback(); + postGlobalError("error.invoke.status",e.getStatus(),request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + int bPartnerId = order.getC_BPartner_ID(); + ShoppingCartBean cart = PartialPOSManager.getShoppingCartForOrder(ctx,order.get_ID(),null); + ArrayList cartItems = cart.getItems(); + + BigDecimal discountAllowed = RoleManager.getDiscountAllowed(ctx, Env.getAD_Role_ID(ctx),null); + + //putting cart & other info in session + request.getSession().setAttribute(Constants.BPARTNER, Integer.valueOf(bPartnerId)); + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART, cart); + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS, cartItems); + request.getSession().setAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID,Integer.valueOf(order.get_ID())); + request.getSession().setAttribute(Constants.DISCOUNT_ALLOWED, discountAllowed); + + return mapping.findForward(INVOKE_PARTIAL_ORDER); + + } + + public static final String SET_POS_PAYMENT_DETAILS = "setPOSPaymentDetails"; + public ActionForward setPOSPaymentDetails(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + //mapping.setInput("/GetPartialPOSPaymentDetails.do"); + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + OrderLineBean bean=(OrderLineBean) df.getBean(); + + ShoppingCartBean cartBean = (ShoppingCartBean) request.getSession().getAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + + if(cartBean==null) + { + postGlobalError("error.pos.shoppingcart.empty",request); + return mapping.getInputForward(); + } + + //validate discount entered + String[] discountPercentage = df.getDiscountPercent(); + String[] actualPrice = df.getActualPrice(); + + for(String s : discountPercentage) + { + if(s == null || s == "") + { + continue; + } + + try + { + Double.parseDouble(s); + } + catch (NumberFormatException e) + { + postGlobalError("errors.double","Discount(s)",request); + return mapping.getInputForward(); + } + } + + for(String s : actualPrice) + { + if(s == null || s == "") + { + continue; + } + + try + { + Double.parseDouble(s); + } + catch (NumberFormatException e) + { + postGlobalError("errors.double","Price(s)",request); + return mapping.getInputForward(); + } + } + + Integer orderId = (Integer) request.getSession().getAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + Integer bPartnerId = bean.getBpartnerId(); + + if(bPartnerId==null) + bPartnerId = (Integer) request.getSession().getAttribute(Constants.BPARTNER); + if(bPartnerId==null) + bPartnerId=Integer.valueOf(POSTerminalManager.getCashBPartner(ctx).get_ID()); + + bean.setBpartnerId(bPartnerId); + MOrder posOrder = null; + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + try + { + trx.start(); + posOrder= PartialPOSManager.setOrderPaymentDetails(ctx,orderId,bean,cartBean.getItems(), trx.getTrxName()); + trx.commit(); + } + catch(InvalidTenderedAmountException e) + { + trx.rollback(); + postGlobalError("error.pos.incorrect.tendered.amount",request); + return mapping.getInputForward(); + } + catch (OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + + bean.setOrderId(Integer.valueOf(posOrder.get_ID())); + + df.populate(new OrderLineBean()); + WebDocumentBean webBean = OrderReferenceManager.getWebOrderBean(ctx, posOrder); + if(posOrder.getPaymentRule().equals(UdiConstants.PAYMENTRULE_MIXED)) + { + if(bean.getPaymentByCash()!=null) + webBean.setPaymentByCash(bean.getPaymentByCash()); + if(bean.getPaymentByCard()!=null) + webBean.setPaymentByCard(bean.getPaymentByCard()); + if(bean.getPaymentByChq()!=null) + webBean.setPaymentbyCheque(bean.getPaymentByChq()); + } + + + ArrayList list = PartialPOSManager.populateOrderLines(ctx,posOrder); + WebDocumentBean documentBean=PartialPOSManager.calculateOrderTotals(list); + //TODO put id only + request.getSession().setAttribute(Constants.CURRENT_POS_ORDER_ID,Integer.valueOf(orderId)); + request.getSession().setAttribute(Constants.ORDER_LINE_BEAN,bean); + request.setAttribute(Constants.POS_ORDER_LINES,list); + request.setAttribute(Constants.PARTIAL_POS_OREDR,"partialPOSOrder"); + + SessionStorage.putCompleteOrderInfo(ctx,request,webBean,documentBean); + + + return mapping.findForward(SET_POS_PAYMENT_DETAILS); + } + + public static final String DELETE_PARTIAL_ORDER = "deletePartialOrder"; + public ActionForward deletePartialOrder(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + InvokeOrderForm f = (InvokeOrderForm) form; + OrderLineBean bean = (OrderLineBean) f.getBean(); + + int orderId = bean.getOrderId().intValue(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + OrderManager.deleteDraftedOrder(ctx,orderId,trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + + return mapping.findForward(DELETE_PARTIAL_ORDER); + } + + //methods called using AJAX + public static final String INCREMENT_QTY = "incrementQty"; + public ActionForward incrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + addToShoppingCart(mapping,form,request,response); + return new ActionForward("/jsp/pos/partialPOSOrderShoppingCart.jsp"); + } + + public static final String DECREMENT_QTY = "decrementQty"; + public ActionForward decrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + addToShoppingCart(mapping,form,request,response); + return new ActionForward("/jsp/pos/partialPOSOrderShoppingCart.jsp"); + } + + public static final String DELETE_FROM_POS_CART = "deleteFromPOSCart"; + public ActionForward deleteFromPOSCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + ArrayList itemsInCart = StockManager.deleteItemFromPOSList(ctx,items, bean.getProductId(),true); + request.getSession().setAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS, itemsInCart); + + return new ActionForward("/jsp/pos/partialPOSOrderShoppingCart.jsp"); + } + + public static final String DELETE_ORDER = "deleteOrder"; + public ActionForward deleteOrder(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + OrderLineBean bean = (OrderLineBean) df.getBean(); + + int orderId = bean.getOrderId().intValue(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + OrderManager.deleteDraftedOrder(ctx,orderId,trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + + //removing cart & other info in session + HttpSession session = request.getSession(); + + session.removeAttribute(Constants.BPARTNER); + session.removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART); + session.removeAttribute(Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS); + session.removeAttribute(Constants.CURRENT_PARTIAL_POS_ORDER_ID); + + return mapping.getInputForward(); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/PaymentAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/PaymentAction.java new file mode 100644 index 0000000000..a5387dcc95 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/PaymentAction.java @@ -0,0 +1,132 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 08-Dec-2006 14:01:58 by praveen + * + */ + +package org.posterita.struts.pos; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MPayment; +import org.compiere.util.Trx; +import org.posterita.beans.PaymentBean; +import org.posterita.businesslogic.PaymentAllocationManager; +import org.posterita.businesslogic.PaymentManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.AllocatedAmtMoreThanOpenAmtException; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.BPartnerNotFoundException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.PayAmtNotEqualToAllocateAmtException; +import org.posterita.form.GeneralPaymentForm; +import org.posterita.form.PaymentForm; + +public class PaymentAction extends POSDispatchAction +{ + public static String CREATE_PAYMENT = "createPayment"; + public ActionForward createPayment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + GeneralPaymentForm pf = (GeneralPaymentForm) form; + PaymentBean bean = (PaymentBean) pf.getBean(); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + MPayment payment; + try + { + trx.start(); + payment= PaymentManager.createPayment(ctx,bean,trx.getTrxName()); + trx.commit(); + } + catch(BPartnerNotFoundException e) + { + trx.rollback(); + postGlobalError("error.required.bpartnerId",request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return new ActionForward("/ViewWebstorePaymentAction.do?action=viewOrder&documentId="+payment.get_ID()); + } + + + + public static String CREATE_PAYMENT_FOR_MULTIPLE_INVOICE = "createPaymentForMultipleInvoice"; + public ActionForward createPaymentForMultipleInvoice(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + PaymentForm pf = (PaymentForm) form; + PaymentBean bean = (PaymentBean) pf.getBean(); + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + MPayment payment=null; + try + { + trx.start(); + payment= PaymentManager.createPayment(ctx,bean,trx.getTrxName()); + PaymentAllocationManager.allocatepaymentWithInvoices(ctx,bean.getInvoiceIds(),bean.getAllocateAmount(),payment.get_ID(),trx.getTrxName()); + trx.commit(); + } + catch(AllocatedAmtMoreThanOpenAmtException e1) + { + trx.rollback(); + postGlobalError("error.allocate.amt.exceeds",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(PayAmtNotEqualToAllocateAmtException e2) + { + trx.rollback(); + postGlobalError("error.allocate.amt.payamt.notequal",e2.getMessage(),request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return new ActionForward("/ViewWebstorePaymentAction.do?action=viewOrder&documentId="+payment.get_ID()); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/PaymentTermAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/PaymentTermAction.java new file mode 100644 index 0000000000..aa75b82edc --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/PaymentTermAction.java @@ -0,0 +1,237 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 31, 2006 + */ + + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.PaymentTermBean; +import org.posterita.businesslogic.PaymentTermManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.CannotDeactivatePaymentTermException; +import org.posterita.exceptions.InvalidNetDaysException; +import org.posterita.exceptions.MandatoryNameException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.PaymentTermAlreadyExistsException; +import org.posterita.form.PaymentTermForm; +import org.posterita.form.PaymentTermForm2; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + +public class PaymentTermAction extends BaseDispatchAction +{ + public static final String VIEW_ALL_PAYMENT_TERMS = "viewAllPaymentTerms"; + public ActionForward viewAllPaymentTerms(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + ArrayList paymentTermList = PaymentTermManager.getAllPaymentTerm(ctx,false); + request.setAttribute(Constants.ALL_PAYMENT_TERMS,paymentTermList); + return mapping.findForward(VIEW_ALL_PAYMENT_TERMS); + } + + public static final String CREATE_PAYMENT_TERM = "createPaymentTerm"; + public ActionForward createPaymentTerm(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df= (DefaultForm) form; + PaymentTermBean bean=(PaymentTermBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + PaymentTermManager.createEditPaymentTerm(ctx,bean,trx.getTrxName()); + trx.commit(); + } + catch(MandatoryNameException e) + { + trx.rollback(); + postGlobalError("error.name.mandatory",request); + return mapping.getInputForward(); + } + catch(InvalidNetDaysException e1) + { + trx.rollback(); + postGlobalError("error.net.days.cannot.be.negative",request); + return mapping.getInputForward(); + } + catch(PaymentTermAlreadyExistsException e2) + { + trx.rollback(); + postGlobalError("error.paymentTermName.duplicate",request); + return mapping.getInputForward(); + } + catch(CannotDeactivatePaymentTermException e3) + { + trx.rollback(); + postGlobalError("error.cannot.deactivate.paymentTermName",request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + ArrayList paymentTermList = PaymentTermManager.getAllPaymentTerm(ctx,false); + request.setAttribute(Constants.ALL_PAYMENT_TERMS,paymentTermList); + return mapping.findForward(CREATE_PAYMENT_TERM); + } + + public static final String DEACTIVATE_PAYMENT_TERM = "deActivatePaymentTerm"; + public ActionForward deActivatePaymentTerm(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + PaymentTermForm2 df= (PaymentTermForm2) form; + PaymentTermBean bean=(PaymentTermBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + ArrayList paymentTermList = PaymentTermManager.getAllPaymentTerm(ctx,false); + request.setAttribute(Constants.ALL_PAYMENT_TERMS,paymentTermList); + try + { + PaymentTermManager.activatePaymentTerm(ctx,bean.getPaymentTermId(),false); + } + catch(CannotDeactivatePaymentTermException e3) + { + + postGlobalError("error.cannot.deactivate.paymentTermName",request); + return mapping.getInputForward(); + } + + + return mapping.findForward(DEACTIVATE_PAYMENT_TERM); + } + + + public static final String ACTIVATE_PAYMENT_TERM = "activatePaymentTerm"; + public ActionForward activatePaymentTerm(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + PaymentTermForm2 df= (PaymentTermForm2) form; + PaymentTermBean bean=(PaymentTermBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + + PaymentTermManager.activatePaymentTerm(ctx,bean.getPaymentTermId(),true); + ArrayList paymentTermList = PaymentTermManager.getAllPaymentTerm(ctx,false); + request.setAttribute(Constants.ALL_PAYMENT_TERMS,paymentTermList); + return mapping.findForward(ACTIVATE_PAYMENT_TERM); + } + + public static final String INIT_EDIT_PAYMENT_TERM = "initEditPaymentTerm"; + public ActionForward initEditPaymentTerm(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + PaymentTermForm ptf = (PaymentTermForm) form; + int paymentTermId = new Integer (ptf.getPaymentTermId()).intValue(); + Properties ctx=TmkJSPEnv.getCtx(request); + PaymentTermBean bean= PaymentTermManager.getPaymentTerm(ctx,paymentTermId); + ptf.populate(bean); + request.setAttribute(Constants.EDIT_PAYMENT_TERM,bean); + return mapping.findForward(INIT_EDIT_PAYMENT_TERM); + } + + public static final String EDIT_PAYMENT_TERM = "editPaymentTerm"; + public ActionForward editPaymentTerm(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df= (DefaultForm) form; + PaymentTermBean bean=(PaymentTermBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + PaymentTermManager.createEditPaymentTerm(ctx,bean,trx.getTrxName()); + trx.commit(); + } + catch(MandatoryNameException e) + { + trx.rollback(); + postGlobalError("error.name.mandatory",request); + return mapping.getInputForward(); + } + catch(InvalidNetDaysException e1) + { + trx.rollback(); + postGlobalError("error.net.days.cannot.be.negative",request); + return mapping.getInputForward(); + } + + catch(PaymentTermAlreadyExistsException e) + { + trx.rollback(); + postGlobalError("error.paymentTermName.duplicate",request); + return mapping.getInputForward(); + } + catch(CannotDeactivatePaymentTermException e3) + { + trx.rollback(); + postGlobalError("error.cannot.deactivate.paymentTermName",request); + return mapping.getInputForward(); + } + catch(OperationException e) + { + trx.rollback(); + throw e; + } + finally + { + trx.close(); + } + ArrayList paymentTermList = PaymentTermManager.getAllPaymentTerm(ctx,false); + request.setAttribute(Constants.ALL_PAYMENT_TERMS,paymentTermList); + return mapping.findForward(EDIT_PAYMENT_TERM); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/PostingAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/PostingAction.java new file mode 100644 index 0000000000..1148f59b3b --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/PostingAction.java @@ -0,0 +1,59 @@ +/** + * + * Copyright (c) 2007 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TAMAK ICT SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * 21 Dec 2007 17:36:26 by shameem + * + */ + +package org.posterita.struts.pos; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.businesslogic.PostingManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.BaseDispatchAction; + +public class PostingAction extends BaseDispatchAction +{ + + public static final String RESUBMIT_POSTING="resubmitPosting"; + + public ActionForward resubmitPosting(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx =TmkJSPEnv.getCtx(request); + + PostingManager.resubmitPostingForInvoice(ctx); + + return mapping.findForward(RESUBMIT_POSTING); + + + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/PriceListAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/PriceListAction.java new file mode 100644 index 0000000000..9755d38f25 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/PriceListAction.java @@ -0,0 +1,216 @@ +package org.posterita.struts.pos; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MPriceList; +import org.compiere.util.CLogger; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.PriceListBean; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.core.SessionStorage; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.PriceListForm; +import org.posterita.struts.core.BaseDispatchAction; + +public class PriceListAction extends BaseDispatchAction +{ + + private static CLogger logger = CLogger.getCLogger(PriceListAction.class); + + public static final String CREATE_OR_UPDATE_PRICE_LIST = "createOrUpdatePriceList"; + public ActionForward createOrUpdatePriceList(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException, InstantiationException, IllegalAccessException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + PriceListForm priceListForm = (PriceListForm)form; + PriceListBean priceListBean = (PriceListBean)priceListForm.getBean(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + try + { + trx.start(); + PriceListManager.createOrUpdatePriceList(ctx, priceListBean, trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + logger.log(Level.SEVERE, e.getMessage()); + postGlobalError("error.process", e.getMessage(), request); + } + finally + { + trx.close(); + } + + request.getSession().setAttribute(Constants.PRICE_LIST, priceListBean); + SessionStorage.putPriceLists(ctx, request); + priceListForm.populate(priceListBean); + return mapping.findForward(CREATE_OR_UPDATE_PRICE_LIST); + } + + + public static final String LIST_PRICE_LISTS = "listPriceLists"; + public ActionForward listPriceLists(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + PriceListForm priceListForm = (PriceListForm)form; + PriceListBean priceListBean = (PriceListBean)priceListForm.getBean(); + + String name = priceListBean.getName(); + ArrayList list = PriceListManager.getPriceLists(ctx, 0, name, null, null, null, null, null); + + request.getSession().setAttribute(Constants.LIST_PRICE_LISTS, list); + + String fromDeletePriceOnPriceList = request.getParameter("isFromDeletePriceOnPriceList"); + + if(fromDeletePriceOnPriceList != null && fromDeletePriceOnPriceList.equals("true")) + { + request.setAttribute(Constants.IS_FROM_DELETE_PRODUCT_PRICE, "true"); + } + + return mapping.findForward(LIST_PRICE_LISTS); + + } + + public static final String VIEW_PRICE_LIST = "viewPriceList"; + public ActionForward viewPriceList(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + Integer priceListId = Integer.valueOf(request.getParameter("priceListId")); + String next =request.getParameter("isNext"); + Boolean isNext= null; + if ("true".equals(next)) + { + isNext = true; + } + else if ("false".equals(next)) + { + isNext = false; + } + + PriceListForm priceListform = (PriceListForm)form; + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.LIST_PRICE_LISTS); + PriceListBean priceListBean = null; + + priceListBean = PriceListManager.getPriceListBean(ctx, list, priceListId, isNext); + priceListform.populate(priceListBean); + + request.getSession().setAttribute(Constants.PRICE_LIST, priceListBean); + + return mapping.findForward(VIEW_PRICE_LIST); + } + + + public static final String SET_DEFAULT_PRICE_LIST = "setDefaultPriceList"; + public ActionForward setDefaultPriceList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + int priceListId = 0; + try + { + priceListId = Integer.parseInt(String.valueOf(request.getParameter("priceListId"))); + MPriceList priceList = MPriceList.get(ctx, priceListId, null); + PriceListManager.setDefaultPriceList(ctx, priceList, true, null); + } + catch (NumberFormatException e) + { + return mapping.getInputForward(); + } + ArrayList list = (ArrayList)request.getSession().getAttribute(Constants.LIST_PRICE_LISTS); + ArrayList n_list = new ArrayList(); + for (PriceListBean pBean : list) + { + pBean = PriceListManager.getPriceList(ctx, pBean.getPriceListId(), null); + n_list.add(pBean); + } + request.getSession().setAttribute(Constants.LIST_PRICE_LISTS, n_list); + return mapping.findForward(LIST_PRICE_LISTS); + + } + + public static final String LOAD_PRICE_LISTS = "loadPriceLists"; + + public ActionForward loadPriceLists(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + PriceListForm priceListForm = (PriceListForm)form; + PriceListBean priceListBean = (PriceListBean)priceListForm.getBean(); + + int ad_org_id = Env.getAD_Org_ID(ctx); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + String name = priceListBean.getName(); + ArrayList list = PriceListManager.getPriceLists(ctx, ad_org_id , name, true, null, true, true, trx.getTrxName()); + String priceListHTML = PriceListManager.loadPriceListAsHTMLSelect(ctx, list); + + PrintWriter writer = response.getWriter(); + writer.print(priceListHTML); + writer.flush(); + writer.close(); + + return null; + + } + + public ActionForward fromDeletePriceOnPriceList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + request.setAttribute(Constants.IS_FROM_DELETE_PRODUCT_PRICE, "true"); + return mapping.findForward(LIST_PRICE_LISTS); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/SalesAnalysisReportAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/SalesAnalysisReportAction.java new file mode 100644 index 0000000000..6c36d000ab --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/SalesAnalysisReportAction.java @@ -0,0 +1,150 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + + +package org.posterita.struts.pos; + + +public class SalesAnalysisReportAction extends POSDispatchAction +{ + /*public static final String GET_CURRENT_DAY_REPORT = "getCurrentDayReport"; + public ActionForward getCurrentDayReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + + Timestamp toDate = new Timestamp(cal.getTimeInMillis()); + + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp fromDate = new Timestamp(cal.getTimeInMillis()); + + ArrayList list=POSReportManager.getSalesAnalysisReport(ctx,fromDate,toDate); + request.getSession().setAttribute(org.posterita.Constants.SALES_ANALYSIS,list); + + return mapping.findForward(GET_CURRENT_DAY_REPORT); + }*/ + + /*public static final String GET_CURRENT_MONTH_REPORT = "getCurrentMonthReport"; + public ActionForward getCurrentMonthReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1); + + String toDate = sdf.format(new Date(cal.getTimeInMillis())); + + cal.set(Calendar.DATE,1); + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + String fromDate = sdf.format(new Date(cal.getTimeInMillis())); + + //String report = SalesAnalysisReportManager.getPDFReport(ctx,fromDate,toDate); + + ArrayList list=POSReportManager.getSalesAnalysisReport(ctx,fromDate,toDate); + request.getSession().setAttribute(org.posterita.Constants.SALES_ANALYSIS,list); + + return mapping.findForward(GET_CURRENT_MONTH_REPORT); + } + */ + /*public static final String GET_CUSTOM_REPORT = "getCustomReport"; + public ActionForward getCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + Timestamp fromDate = ReportDateManager.getFromDate(bean); + Timestamp toDate = ReportDateManager.getToDate(bean); + + ArrayList list=POSReportManager.getSalesAnalysisReport(ctx,fromDate,toDate); + request.getSession().setAttribute(org.posterita.Constants.SALES_ANALYSIS,list); + + return mapping.findForward(GET_CUSTOM_REPORT); + }*/ + + /*public static final String GET_JPEG_REPORT = "getJpegReport"; + public ActionForward getJpegReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + try + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + + String reportDir = ReportManager.getReportDirectoryFromServletContext(this.servlet); + + String filename = RandomStringGenerator.randomstring(); + + PieChart pieChart = new PieChart(); + pieChart.getDataSetFromSQL("" + + " select t.ATTR_MODEL \"Model\"," + + " sum(AMTACCTCR) \"Sum\"" + + " from FACT_ACCT f,M_PRODUCT p,U_TSHIRT_V t" + + " where f.AD_CLIENT_ID = 1016840" + + " and f.M_PRODUCT_ID = p.M_PRODUCT_ID" + + " and f.AMTACCTCR > 0" + + " and t.M_PRODUCT_ID = p.M_PRODUCT_ID" + + " having sum(AMTACCTCR) < 1000" + + " group by t.ATTR_MODEL"); + + pieChart.saveChartAsJPEG(reportDir+filename+".jpg",700,600); + + String imgSrc = request.getContextPath() + "/config/reports/"+filename+".jpg"; + String imagemaptag = pieChart.getImageMap(filename); + String imagetag = ""; + + request.getSession().setAttribute("CHART",imagemaptag+imagetag); + + } + catch (Exception e) + { + e.printStackTrace(); + } + + return mapping.findForward(GET_JPEG_REPORT); + }*/ + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/SearchCustomerAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/SearchCustomerAction.java new file mode 100644 index 0000000000..7c6c14eaa4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/SearchCustomerAction.java @@ -0,0 +1,164 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 12-Dec-2006 10:00:02 by praveen + * + */ + +package org.posterita.struts.pos; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.Action; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MPriceList; +import org.posterita.beans.CustomerBean; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.CustomerManager; +import org.posterita.businesslogic.administration.VendorManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; +import org.posterita.order.UDIOrderTypes; + +/** + * This action is called using AJAX form the vendor panel + */ +public class SearchCustomerAction extends Action +{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx = TmkJSPEnv.getCtx(request); + String customerName = request.getParameter("customerQuery"); + String orderType = request.getParameter("orderType"); + int priceListId = -1; + + ArrayList customerList = null; + + if(UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType().equals(orderType) || + UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType().equals(orderType)) + { + customerList = VendorManager.searchVendors(ctx,customerName,true); + priceListId = POSTerminalManager.getPOPriceListId(ctx); + } + else + { + customerList = CustomerManager.searchCustomers(ctx,customerName,false); + priceListId = POSTerminalManager.getSOPriceListId(ctx); + } + + CustomerBean bean = null; + + ElementBean elementBean = null; + elementBean = ElementManager.getMsg(ctx, "not.found"); + + StringWriter sw = new StringWriter(); + PrintWriter out = new PrintWriter(sw); + + if (customerList == null || customerList.size() == 0) + { + out.print("
      "); + out.print("
    • "); + out.print("
    "); + out.print("
    "); + } + else + { + String priceListName = MPriceList.get(ctx, priceListId, null).getName(); + + + int size = customerList.size(); + size = (size > customerList.size())? customerList.size() : size; + + out.print("
      "); + + for(int i=0;i"); + out.print(vendorName); + out.print(""); + } + + out.print("
    "); + + elementBean = ElementManager.getMsg(ctx, "search.result.displaying"); + String msg = elementBean.getName(); + + out.print("
    "); + } + + response.getOutputStream().print(sw.toString()); + response.getOutputStream().flush(); + response.getOutputStream().close(); + + return null; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/SearchPOSProductAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/SearchPOSProductAction.java new file mode 100644 index 0000000000..6efae86cba --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/SearchPOSProductAction.java @@ -0,0 +1,57 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.Constants; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.core.TmkJSPEnv; + +public class SearchPOSProductAction extends POSDispatchAction +{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + String productName = request.getParameter("productName"); + + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList productList = ProductManager.getProductList(ctx,productName,true,true); + + request.getSession().setAttribute(Constants.PRODUCT_LIST,productList); + + return mapping.findForward("displayProducts"); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/SearchProductAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/SearchProductAction.java new file mode 100644 index 0000000000..e450481f65 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/SearchProductAction.java @@ -0,0 +1,152 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 12-Dec-2006 10:00:02 by praveen + * + */ + +package org.posterita.struts.pos; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.Action; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.CLogger; +import org.posterita.TangoColors; +import org.posterita.beans.ProductStatusBean; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.core.TmkJSPEnv; + +/** + * This action is called using AJAX form the product panel + */ +public class SearchProductAction extends Action +{ + private static final CLogger logger = CLogger.getCLogger(SearchProductAction.class); + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx = TmkJSPEnv.getCtx(request); + String description = request.getParameter("description"); + String productName = request.getParameter("productName"); + String strPriceListId = request.getParameter("priceListId"); + + int priceListId = 0; + if (strPriceListId != null && strPriceListId.trim().length() != 0) + { + try + { + priceListId = Integer.parseInt(strPriceListId); + } + catch (Exception ex) + { + logger.log(Level.SEVERE, "Could not parse Price List Id, priceListId: " + strPriceListId, ex); + } + } + else + { + priceListId = POSTerminalManager.getSOPriceListId(ctx); + } + + int adOrgId = POSTerminalManager.getOrgId(ctx); + int warehouseId = POSTerminalManager.getWarehouseId(ctx); + ArrayList productList = null; + + if(productName != null) + { + productName = productName.replaceAll("#", "&#"); + productList = ProductManager.searchProducts(ctx, adOrgId, productName, "", priceListId, warehouseId, null); + } + else if(description != null) + { + description = description.replaceAll("#", "&#"); + productList = ProductManager.searchProducts(ctx, adOrgId, "", description, priceListId, warehouseId, null); + } + else + { + productList = ProductManager.searchProducts(ctx, adOrgId, "", "", priceListId, warehouseId, null); + } + + ProductStatusBean bean = null; + StringWriter sw = new StringWriter(); + PrintWriter out = new PrintWriter(sw); + + if(productList == null || productList.size() == 0) + { + out.print("
    "); + } + else + { + int size = productList.size(); + + size = (size > productList.size())? productList.size() : size; + + int i = 0; + + if(size > 0) + { + out.print("
      "); + + for(i=0;i< size;i++) + { + bean = (ProductStatusBean)productList.get(i); + + if(i % 2 == 0) + { + out.print("
    • "); + + out.print(bean.getProductName() + "-" + bean.getDescription()+">qty:"+bean.getQtyOnHand()+ ">price:"+bean.getPriceStandard()); + + out.print("
    • "); + } + else + { + out.print("
    • "); + + out.print(bean.getProductName() + "-" + bean.getDescription()+">qty:"+bean.getQtyOnHand()+ ">price:"+bean.getPriceStandard()); + + out.print("
    • "); + + } + + + } + + out.print("
    "); + } + + out.print("
    "); + } + + response.getOutputStream().print(sw.toString()); + response.getOutputStream().flush(); + response.getOutputStream().close(); + + return null; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/SearchProductsInStockAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/SearchProductsInStockAction.java new file mode 100644 index 0000000000..662e341587 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/SearchProductsInStockAction.java @@ -0,0 +1,80 @@ +package org.posterita.struts.pos; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.Action; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.ProductStatusBean; +import org.posterita.businesslogic.administration.ProductManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.lib.UdiConstants; + +public class SearchProductsInStockAction extends Action +{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + String productName = request.getParameter("productName"); + Integer orgId = (Integer)request.getSession().getAttribute(Constants.ORG_FROM_ID); + Properties ctx = TmkJSPEnv.getCtx(request); + + if (orgId == null) + { + orgId = Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM); + } + + productName = productName.replaceAll("#", "&#"); + + ArrayList productList =ProductManager.searchProductsFromStock(ctx, orgId, productName, null); + + ProductStatusBean bean = null; + StringWriter sw = new StringWriter(); + PrintWriter out = new PrintWriter(sw); + + if(productList == null || productList.size() == 0) + { + out.print("
    "); + } + else + { + int size = productList.size(); + + size = (size > productList.size())? productList.size() : size; + + if(size > 0) + { + out.print("
      "); + + for(int i=0;i< size;i++) + { + bean = (ProductStatusBean)productList.get(i); + + out.print("
    • "); + out.print(bean.getProductName()); + out.print("
    • "); + } + + out.print("
    "); + } + + out.print("
    "); + + } + response.getOutputStream().print(sw.toString()); + response.getOutputStream().flush(); + response.getOutputStream().close(); + + return null; + + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/SearchVendorAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/SearchVendorAction.java new file mode 100644 index 0000000000..036b17c1c5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/SearchVendorAction.java @@ -0,0 +1,123 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 12-Dec-2006 10:00:02 by praveen + * + */ + +package org.posterita.struts.pos; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.Action; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + +import org.posterita.beans.CustomerBean; +import org.posterita.businesslogic.administration.VendorManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.bean.ElementBean; +import org.posterita.core.businesslogic.ElementManager; + +/** + * This action is called using AJAX form the vendor panel + */ +public class SearchVendorAction extends Action +{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx = TmkJSPEnv.getCtx(request); + String customerName = request.getParameter("customerQuery"); + + ArrayList customerList = VendorManager.searchVendors(TmkJSPEnv.getCtx(request),customerName,true); + CustomerBean bean = null; + + ElementBean elementBean = null; + elementBean = ElementManager.getMsg(ctx, "not.found"); + + StringWriter sw = new StringWriter(); + PrintWriter out = new PrintWriter(sw); + + if (customerList == null || customerList.size() == 0) + { + out.print("
      "); + out.print("
    • "); + out.print("
    "); + out.print("
    "); + } + else + { + int size = 15; + size = (size > customerList.size())? customerList.size() : size; + + out.print("
      "); + + for(int i=0;i"); + out.print(vendorName); + out.print(""); + } + + out.print("
    "); + + elementBean = ElementManager.getMsg(ctx, "search.result.displaying"); + String msg = elementBean.getName(); + + out.print("
    "); + } + + response.getOutputStream().print(sw.toString()); + response.getOutputStream().flush(); + response.getOutputStream().close(); + + return null; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/SlowMovingItemReportAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/SlowMovingItemReportAction.java new file mode 100644 index 0000000000..2f0d52bba0 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/SlowMovingItemReportAction.java @@ -0,0 +1,121 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.Constants; +import org.posterita.beans.ReportBean; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; + +public class SlowMovingItemReportAction extends POSDispatchAction +{ + public static final String GET_CURRENT_DAY_REPORT = "getCurrentDayReport"; + public ActionForward getCurrentDayReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + + Timestamp toDate = new Timestamp(cal.getTimeInMillis()); + + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp fromDate = new Timestamp(cal.getTimeInMillis()); + + ArrayList list=POSReportManager.getMaxMinSoldProducts(ctx,"asc",fromDate,toDate); + request.getSession().setAttribute(Constants.MIN_SOLD_ITEMS,list); + + return mapping.findForward(GET_CURRENT_DAY_REPORT); + } + + public static final String GET_CURRENT_MONTH_REPORT = "getCurrentMonthReport"; + public ActionForward getCurrentMonthReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + Timestamp toDate = new Timestamp(cal.getTimeInMillis()); + + cal.set(Calendar.DATE,1); + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp fromDate = new Timestamp(cal.getTimeInMillis()); + + ArrayList list=POSReportManager.getMaxMinSoldProducts(ctx,"asc",fromDate,toDate); + request.getSession().setAttribute(Constants.MIN_SOLD_ITEMS,list); + + return mapping.findForward(GET_CURRENT_MONTH_REPORT); + } + + public static final String GET_CUSTOM_REPORT = "getCustomReport"; + public ActionForward getCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + + ReportBean bean = (ReportBean) df.getBean(); + Timestamp fromDate = ReportDateManager.getFromDate(bean); + Timestamp toDate = ReportDateManager.getToDate(bean); + + ArrayList list=POSReportManager.getMaxMinSoldProducts(ctx,"asc",fromDate,toDate); + request.getSession().setAttribute(Constants.MIN_SOLD_ITEMS,list); + + return mapping.findForward(GET_CUSTOM_REPORT); + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/StockMovementReportAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/StockMovementReportAction.java new file mode 100644 index 0000000000..548344ddc7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/StockMovementReportAction.java @@ -0,0 +1,200 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; + +import org.posterita.Constants; +import org.posterita.beans.ReportBean; +import org.posterita.businesslogic.performanceanalysis.CSVReportManager; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.businesslogic.performanceanalysis.ReportDateManager; +import org.posterita.businesslogic.performanceanalysis.ReportManager; +import org.posterita.core.TabularReport; +import org.posterita.core.TimestampConvertor; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; + +public class StockMovementReportAction extends POSDispatchAction +{ + public static final String GET_CURRENT_DAY_REPORT = "getCurrentDayReport"; + public ActionForward getCurrentDayReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + + Timestamp toDate = new Timestamp(cal.getTimeInMillis()); + + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp fromDate = new Timestamp(cal.getTimeInMillis()); + + ArrayList list=POSReportManager.getStockMovementReport(ctx,fromDate,toDate); + request.getSession().setAttribute(Constants.STOCK_MOVEMENT,list); + + return mapping.findForward(GET_CURRENT_DAY_REPORT); + } + + public static final String GET_CURRENT_MONTH_REPORT = "getCurrentMonthReport"; + public ActionForward getCurrentMonthReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + Calendar cal = Calendar.getInstance(); + Timestamp toDate = new Timestamp(cal.getTimeInMillis()); + + cal.set(Calendar.DATE,1); + cal.set(Calendar.HOUR_OF_DAY,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.MILLISECOND,0); + + Timestamp fromDate = new Timestamp(cal.getTimeInMillis()); + + ArrayList list=POSReportManager.getStockMovementReport(ctx,fromDate,toDate); + request.getSession().setAttribute(Constants.STOCK_MOVEMENT,list); + + return mapping.findForward(GET_CURRENT_MONTH_REPORT); + } + + public static final String GET_CUSTOM_REPORT = "getCustomReport"; + public ActionForward getCustomReport(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df= (DefaultForm) form; + ReportBean bean = (ReportBean) df.getBean(); + + String title = "Stock Movement Report"; + String subtitle = ""; + + String dateRange = bean.getDateRange(); + String timePeriod = bean.getTimePeriod(); + + Timestamp fromDate = null; + Timestamp toDate = null; + + //setting from and to dates + if(dateRange.endsWith(Constants.FIXED_DATE_RANGE)) + { + if(timePeriod==null) + { + throw new OperationException("Invalid Parameter for timePeriod : Time period is null "); + } + + fromDate = ReportDateManager.getStartDateForPeriod(timePeriod); + toDate = ReportDateManager.getEndDateForPeriod(timePeriod); + + subtitle = "For " + timePeriod; + } + else if(dateRange.endsWith(Constants.CUSTOM_DATE_RANGE)) + { + boolean error = false; + ActionMessages messages = new ActionMessages(); + ActionMessage message = null; + + if((bean.getFromDate()==null)||(bean.getFromDate()=="")) + { + message = new ActionMessage("error.required.fromDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if((bean.getToDate()==null)||(bean.getToDate()=="")) + { + message = new ActionMessage("error.required.toDate"); + messages.add(ActionMessages.GLOBAL_MESSAGE, message); + error = true; + } + + if(error) + { + saveErrors(request, messages); + return mapping.getInputForward(); + } + else + { + fromDate = ReportDateManager.getFromDate(bean); + toDate = ReportDateManager.getToDate(bean); + + } + + + subtitle = "For period:"+fromDate+" to "+toDate; + } + else + { + throw new OperationException("Invalid Parameter for dateRange :" + dateRange); + } + + ArrayList reportData = POSReportManager.getStockMovementReportData(ctx,fromDate,toDate); + + //constructing the table + TabularReport tReport = new TabularReport(reportData); + tReport.setSortable(false); + tReport.setStyle("display"); + tReport.setTitle(title); + tReport.setSubtitle(subtitle); + tReport.createReport(); + + String csvReport = CSVReportManager.generateCSVReport(ctx,reportData); + String csvURI = ReportManager.getReportURI(csvReport,request); + + request.getSession().setAttribute(Constants.TABULAR_REPORT_DATA,tReport.toString()); + request.getSession().setAttribute(Constants.CSV_FILE,csvURI); + + return mapping.findForward(GET_CUSTOM_REPORT); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/TaxAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/TaxAction.java new file mode 100644 index 0000000000..5e4a7ca925 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/TaxAction.java @@ -0,0 +1,287 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Nov 28, 2006 + */ + + +package org.posterita.struts.pos; + +import java.io.IOException; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MTax; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.TaxBean; +import org.posterita.businesslogic.administration.TaxManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.CannotInactivateTaxException; +import org.posterita.exceptions.InvalidNetDaysException; +import org.posterita.exceptions.MandatoryException; +import org.posterita.exceptions.MandatoryNameException; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.TaxNameAlreadyExistsException; +import org.posterita.exceptions.TaxRateAlreadyExistsException; +import org.posterita.form.TaxForm; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + + +public class TaxAction extends BaseDispatchAction +{ + public static final String VIEW_ALL_TAX = "viewAllTax"; + + public ActionForward viewAllTax(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + + ArrayList taxList = TaxManager.getAllTaxRates(ctx,false); + request.setAttribute(Constants.ALL_TAX_RATE,taxList); + return mapping.findForward(VIEW_ALL_TAX); + } + + public static final String CREATE_TAX = "createTax"; + public ActionForward createTax(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df= (DefaultForm) form; + TaxBean bean=(TaxBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + TaxManager.createEditTaxCategoryAndTax(ctx,bean,trx.getTrxName()); + trx.commit(); + } + catch(MandatoryNameException e) + { + trx.rollback(); + postGlobalError("error.name.mandatory",request); + return mapping.getInputForward(); + } + catch(MandatoryException e1) + { + trx.rollback(); + postGlobalError("error.required.field",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch(TaxNameAlreadyExistsException e3) + { + trx.rollback(); + postGlobalError("error.taxname.duplicate",request); + return mapping.getInputForward(); + } + catch(TaxRateAlreadyExistsException e4) + { + trx.rollback(); + postGlobalError("error.taxrate.duplicate",request); + return mapping.getInputForward(); + } + catch(InvalidNetDaysException e5) + { + trx.rollback(); + postGlobalError("error.tax.rate.nagative",request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + ArrayList taxList = TaxManager.getAllTaxRates(ctx,false); + request.setAttribute(Constants.ALL_TAX_RATE,taxList); + return mapping.findForward(CREATE_TAX); + } + + public static final String DEACTIVATE_TAX = "deActivateTax"; + public ActionForward deActivateTax(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df= (DefaultForm) form; + TaxBean bean=(TaxBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + + try + { + TaxManager.activateTax(ctx,bean.getTaxId(),false); + } + + catch(CannotInactivateTaxException e) + { + ArrayList taxList = TaxManager.getAllTaxRates(ctx,false); + request.setAttribute(Constants.ALL_TAX_RATE,taxList); + postGlobalError("cannot.inactivate.tax",request); + return mapping.getInputForward(); + } + ArrayList taxList = TaxManager.getAllTaxRates(ctx,false); + request.setAttribute(Constants.ALL_TAX_RATE,taxList); + + return mapping.findForward(DEACTIVATE_TAX); + } + + + public static final String ACTIVATE_TAX = "activateTax"; + public ActionForward activateTax(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df= (DefaultForm) form; + TaxBean bean=(TaxBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + + TaxManager.activateTax(ctx,bean.getTaxId(),true); + ArrayList taxList = TaxManager.getAllTaxRates(ctx,false); + request.setAttribute(Constants.ALL_TAX_RATE,taxList); + return mapping.findForward(ACTIVATE_TAX); + } + + public static final String INIT_EDIT_TAX = "initEditTax"; + public ActionForward initEditTax(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + TaxForm tf = (TaxForm) form; + int taxId = new Integer (tf.getTaxId()).intValue(); + Properties ctx=TmkJSPEnv.getCtx(request); + TaxBean bean= TaxManager.getTaxRate(ctx,taxId); + tf.populate(bean); + request.setAttribute(Constants.EDIT_TAX,bean); + return mapping.findForward(INIT_EDIT_TAX); + } + + public static final String EDIT_TAX = "editTax"; + public ActionForward editTax(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df= (DefaultForm) form; + TaxBean bean=(TaxBean) df.getBean(); + Properties ctx=TmkJSPEnv.getCtx(request); + + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + try + { + trx.start(); + TaxManager.createEditTaxCategoryAndTax(ctx,bean,trx.getTrxName()); + trx.commit(); + } + catch(MandatoryException e1) + { + trx.rollback(); + postGlobalError("error.required.field",e1.getMessage(),request); + return mapping.getInputForward(); + } + catch (NoAccessToEditObjectException e) + { + trx.rollback(); + postGlobalError("error.no.edit.access", request); + return mapping.getInputForward(); + } + catch(MandatoryNameException e2) + { + trx.rollback(); + postGlobalError("error.name.required",request); + return mapping.getInputForward(); + } + catch(InvalidNetDaysException e3) + { + trx.rollback(); + postGlobalError("error.tax.rate.nagative",request); + return mapping.getInputForward(); + } + catch(TaxNameAlreadyExistsException e) + { + trx.rollback(); + postGlobalError("error.taxname.duplicate",request); + return mapping.getInputForward(); + } + catch(TaxRateAlreadyExistsException e) + { + trx.rollback(); + postGlobalError("error.taxrate.duplicate",request); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + ArrayList taxList = TaxManager.getAllTaxRates(ctx,false); + request.setAttribute(Constants.ALL_TAX_RATE,taxList); + return mapping.findForward(EDIT_TAX); + } + + public static final String GET_TAX_RATE = "getTaxRate"; + public ActionForward getTaxRate(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + Properties ctx=TmkJSPEnv.getCtx(request); + Object taxCatId = request.getParameter("taxCategoryId"); + Integer taxCategoryId = 0; + BigDecimal taxRate = Env.ZERO; + if (taxCatId != null) + { + taxCategoryId = Integer.parseInt(taxCatId.toString()); + + MTax tax = TaxManager.getTaxFromCategory(ctx, taxCategoryId, null); + + taxRate = tax.getRate(); + } + + String res = taxRate.toString(); + PrintWriter writer = response.getWriter(); + writer.print(res); + writer.flush(); + writer.close(); + + return null; + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/TerminalAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/TerminalAction.java new file mode 100644 index 0000000000..ddff7df5f4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/TerminalAction.java @@ -0,0 +1,477 @@ +/****************************************************************************** + * Product: Posterita Web-Based POS and Adempiere Plugin * + * Copyright (C) 2008 Posterita Ltd * + * This file is part of POSterita * + * * + * POSterita is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + *****************************************************************************/ +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MPOSTerminal; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.BankAccountBean; +import org.posterita.beans.CashBookBean; +import org.posterita.beans.PriceListBean; +import org.posterita.beans.TerminalBean; +import org.posterita.beans.UDIBean; +import org.posterita.beans.WarehouseBean; +import org.posterita.businesslogic.BankManager; +import org.posterita.businesslogic.CashManager; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.WarehouseManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.InvalidTerminalCashBookException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.TerminalInactivateException; +import org.posterita.form.TerminalForm; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +/** + * @author Ashley G Ramdass + * Apr 14, 2008 + */ +public class TerminalAction extends BaseDispatchAction +{ + private void populateData(HttpServletRequest request, TerminalBean terminalBean, int adOrgId, String trxName) + throws OperationException + { + Properties ctx = TmkJSPEnv.getCtx(request); + + ArrayList accessibleOrgs = OrganisationManager.getUserOrgPairs(ctx, false); + request.getSession().setAttribute(Constants.ACCESSIBLE_ORGS, accessibleOrgs); + + ArrayList purchasePriceLists = PriceListManager.getPriceLists(ctx, 0, false, trxName); + request.getSession().setAttribute(Constants.PURCHASE_PRICELISTS, purchasePriceLists); + + ArrayList salesPriceLists = PriceListManager.getPriceLists(ctx, 0, true, trxName); + request.getSession().setAttribute(Constants.SALES_PRICELISTS, salesPriceLists); + + ArrayList warehouseList = WarehouseManager.getAllWarehouses(ctx, adOrgId); + request.getSession().setAttribute(Constants.WAREHOUSES, warehouseList); + + ArrayList cashBookList = CashManager.getCashBooksForTerminal(ctx, adOrgId, terminalBean.getTerminalId(), trxName); + request.getSession().setAttribute(Constants.CASH_BOOK, cashBookList); + + ArrayList accessibleCashBookList = CashManager.getCashBooks(ctx, trxName); + request.getSession().setAttribute(Constants.ACCESSIBLE_CASHBOOKS, accessibleCashBookList); + + ArrayList bankAccountList = BankManager.getBankAccounts(ctx, adOrgId, trxName); + request.getSession().setAttribute(Constants.BANK_ACCOUNTS, bankAccountList); + + ArrayList accessibleBankAccountList = BankManager.getBankAccounts(ctx, trxName); + request.getSession().setAttribute(Constants.ACCESSIBLE_BANKACCOUNTS, accessibleBankAccountList); + } + + public static final String INIT_SEARCH_TERMINAL = "initSearchTerminal"; + public ActionForward initSearchTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + request.getSession().setAttribute(Constants.TERMINALS, null); + + return mapping.findForward(INIT_SEARCH_TERMINAL); + } + + public static final String SEARCH_TERMINAL = "searchTerminal"; + public ActionForward searchTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx=TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + UDIBean bean = (UDIBean)df.getBean(); + + String searchText = bean.getSearchText(); + + ArrayList terminalList = POSTerminalManager.getTerminals(ctx, searchText, null); + + request.setAttribute(Constants.TERMINALS, terminalList); + + return mapping.findForward(SEARCH_TERMINAL); + } + + public static final String INIT_CREATE_TERMINAL = "initCreateTerminal"; + public ActionForward initCreateTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm)form; + TerminalBean terminalBean = new TerminalBean(); + terminalBean.setIsActive(true); + + int orgId = Env.getAD_Org_ID(ctx); + + populateData(request, terminalBean, orgId, null); + int warehouseId = WarehouseManager.getOrganisationWarehouse(ctx, orgId, null); + terminalBean.setOrgId(orgId); + terminalBean.setWarehouseId(warehouseId); + df.populate(terminalBean); + df.setAction(CREATE_TERMINAL); + df.setReadOnly(false); + + return mapping.findForward(INIT_CREATE_TERMINAL); + } + + + public static final String CREATE_TERMINAL = "createTerminal"; + public ActionForward createTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + MPOSTerminal terminal = POSTerminalManager.createUpdatePOSTerminal(ctx, terminalBean, trx.getTrxName()); + terminalBean.setTerminalId(terminal.get_ID()); + trx.commit(); + } + catch (InvalidTerminalCashBookException invalidTerminalCashBookException) + { + postGlobalError("error.terminal.cashbook", request); + return mapping.getInputForward(); + } + catch (TerminalInactivateException terminalInactivateException) + { + postGlobalError("error.deactivate.terminal", request); + return mapping.getInputForward(); + } + catch (Exception ex) + { + postGlobalError("error.operation", request); + return mapping.getInputForward(); + } + finally + { + trx.rollback(); + trx.close(); + } + + terminalForm.populate(terminalBean); + viewTerminal(mapping, form, request, response); + + return mapping.findForward(CREATE_TERMINAL); + } + + public static final String EDIT_TERMINAL = "editTerminal"; + public ActionForward editTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + terminalBean = POSTerminalManager.getTerminalBean(ctx, terminalBean.getTerminalId(), null); + populateData(request, terminalBean, terminalBean.getOrgId(), null); + terminalForm.populate(terminalBean); + terminalForm.setAction(SAVE_TERMINAL); + terminalForm.setReadOnly(false); + return mapping.findForward(EDIT_TERMINAL); + } + + public static final String SAVE_TERMINAL = "saveTerminal"; + public ActionForward saveTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + return createTerminal(mapping, form, request, response); + } + + public static final String VIEW_TERMINAL = "viewTerminal"; + public ActionForward viewTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + terminalBean = POSTerminalManager.getTerminalBean(ctx, terminalBean.getTerminalId(), null); + + populateData(request, terminalBean, terminalBean.getOrgId(), null); + + terminalForm.populate(terminalBean); + terminalForm.setAction(VIEW_TERMINAL); + terminalForm.setReadOnly(true); + + return mapping.findForward(VIEW_TERMINAL); + } + + public static final String COPY_TERMINAL = "copyTerminal"; + public ActionForward copyTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + terminalBean = POSTerminalManager.getTerminalBean(ctx, terminalBean.getTerminalId(), null); + terminalBean.setTerminalId(0); + + populateData(request, terminalBean, Env.getAD_Org_ID(ctx), null); + + terminalForm.populate(terminalBean); + terminalForm.setAction(SAVE_TERMINAL); + terminalForm.setReadOnly(false); + + return mapping.findForward(COPY_TERMINAL); + } + + public static final String DEACTIVATE_TERMINAL = "deactivateTerminal"; + public ActionForward deactivateTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + terminalBean = POSTerminalManager.updateTerminalStatus(ctx, terminalBean.getTerminalId(), false, trx.getTrxName()); + trx.commit(); + } + catch (TerminalInactivateException terminalInactivateException) + { + postGlobalError("error.deactivate.terminal", request); + } + catch (Exception ex) + { + postGlobalError("error.operation", request); + } + finally + { + trx.rollback(); + trx.close(); + } + + searchTerminal(mapping, form, request, response); + + return mapping.findForward(SEARCH_TERMINAL); + } + + public static final String ACTIVATE_TERMINAL = "activateTerminal"; + public ActionForward activateTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + terminalBean = POSTerminalManager.updateTerminalStatus(ctx, terminalBean.getTerminalId(), true, trx.getTrxName()); + trx.commit(); + } + catch (InvalidTerminalCashBookException invalidTerminalCashBookException) + { + postGlobalError("error.terminal.cashbook", request); + } + catch (Exception ex) + { + postGlobalError("error.operation", request); + } + finally + { + trx.rollback(); + trx.close(); + } + + searchTerminal(mapping, form, request, response); + + return mapping.findForward(SEARCH_TERMINAL); + } + + public static final String RESET_CURRENT_TERMINAL = "resetCurrentTerminal"; + public ActionForward resetCurrentTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + POSTerminalManager.resetTerminalInCookie(response); + searchTerminal(mapping, form, request, response); + postGlobalMessage("current.terminal.reset", request); + return mapping.findForward(SEARCH_TERMINAL); + } + + public static final String UPDATE_CURRENT_TERMINAL = "updateCurrentTerminal"; + public ActionForward updateCurrentTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + POSTerminalManager.setTerminalInCookie(response, terminalBean.getTerminalId()); + + searchTerminal(mapping, form, request, response); + postGlobalMessage("current.terminal.updated", request); + return mapping.findForward(SEARCH_TERMINAL); + } + + public static final String CHANGE_ORGANISATION = "changeOrganisation"; + public ActionForward changeOrganisation(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + terminalBean.setBpartnerId(0); + terminalBean.setCashBookId(0); + terminalBean.setCashbookTransferBankAccountId(0); + terminalBean.setCashbookTransferCashbookId(0); + terminalBean.setCashbookTransferType(null); + terminalBean.setCheckBankAccountId(0); + terminalBean.setCheckTransferBankAccountId(0); + terminalBean.setCheckTransferCashbookId(0); + terminalBean.setCheckTransferType(null); + terminalBean.setCardBankAccountId(0); + terminalBean.setCardTransferBankAccountId(0); + terminalBean.setCardTransferCashbookId(0); + terminalBean.setCardTransferType(null); + terminalBean.setLastLockTime(null); + terminalBean.setPurchasePriceListId(0); + terminalBean.setSalesPriceListId(0); + terminalBean.setTemplateBPartnerId(0); + terminalBean.setWarehouseId(0); + + populateData(request, terminalBean, terminalBean.getOrgId(), null); + + terminalForm.populate(terminalBean); + terminalForm.setAction(CREATE_TERMINAL); + terminalForm.setReadOnly(false); + + return mapping.getInputForward(); + } + + public static final String LOCK_TERMINAL = "lockTerminal"; + public ActionForward lockTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + POSTerminalManager.setTerminalLockStatus(ctx, terminalBean.getTerminalId(), true, trx.getTrxName()); + trx.commit(); + } + catch (Exception ex) + { + postGlobalError("error.operation", request); + } + finally + { + trx.rollback(); + trx.close(); + } + + return viewTerminal(mapping, form, request, response); + } + + public static final String UNLOCK_TERMINAL = "unlockTerminal"; + public ActionForward unlockTerminal(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + TerminalForm terminalForm = (TerminalForm)form; + TerminalBean terminalBean = (TerminalBean)terminalForm.getBean(); + + Trx trx = Trx.get(Trx.createTrxName(), true); + trx.start(); + + try + { + POSTerminalManager.setTerminalLockStatus(ctx, terminalBean.getTerminalId(), false, trx.getTrxName()); + trx.commit(); + } + catch (Exception ex) + { + postGlobalError("error.operation", request); + } + finally + { + trx.rollback(); + trx.close(); + } + + return viewTerminal(mapping, form, request, response); + } +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/UOMAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/UOMAction.java new file mode 100644 index 0000000000..b1641a19a6 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/UOMAction.java @@ -0,0 +1,44 @@ +package org.posterita.struts.pos; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; + +public class UOMAction extends POSDispatchAction +{ + + public static final String CREATE_OR_UPDATE_UOM = "createOrUpdateUOM"; + public ActionForward createOrUpdateUOM(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + return null; + } + + public static final String VIEW_UOM = "viewUOM"; + public ActionForward viewUOM(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + return null; + } + + public static final String LIST_UOMS = "listUOMs"; + public ActionForward listUOMs(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + + if (fwd!=null) + { + return fwd; + } + Properties ctx=TmkJSPEnv.getCtx(request); + + return null; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/pos/VendorAction.java b/posterita/posterita/src/main/org/posterita/struts/pos/VendorAction.java new file mode 100644 index 0000000000..f3e7051acb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/pos/VendorAction.java @@ -0,0 +1,288 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on 25-Jul-2005 by alok + * + */ + +package org.posterita.struts.pos; + +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.PriceListBean; +import org.posterita.beans.VendorBean; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.administration.VendorManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.NoAccessToEditObjectException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.VendorForm; +import org.posterita.struts.core.DefaultForm; + +public class VendorAction extends POSDispatchAction +{ + public static final String SAVE_VENDOR = "saveVendor"; + public ActionForward saveVendor(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + VendorBean bean = (VendorBean) df.getBean(); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + Integer partnerId = 0; + + if (bean.getBpartnerId() != null) + partnerId = bean.getBpartnerId(); + + try + { + trx.start(); + VendorManager.saveVendor(ctx, partnerId, bean, trx.getTrxName()); + trx.commit(); + } + catch(NoAccessToEditObjectException e) + { + trx.rollback(); + postGlobalError("error.no.edit.access", request); + return mapping.getInputForward(); + } + catch(OperationException ex) + { + trx.rollback(); + throw ex; + } + finally + { + trx.close(); + } + request.setAttribute(Constants.VENDOR_DETAILS,bean); + + return mapping.findForward(SAVE_VENDOR); + } + + public static final String VIEW_VENDOR = "viewVendorDetails"; + public ActionForward viewVendorDetails1(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + VendorForm uf = (VendorForm) form; + + int vendorId = Integer.valueOf(uf.getBpartnerId()).intValue(); + + VendorBean vendorBean = VendorManager.getVendor(ctx,vendorId); + + request.getSession().setAttribute(Constants.VENDOR_DETAILS,vendorBean); + + return mapping.findForward(VIEW_VENDOR); + } + + + public static final String INIT_SEARCH_VENDOR = "initSearchVendors"; + public ActionForward initSearchVendors(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + request.getSession().removeAttribute(Constants.VENDOR_LIST); + + return mapping.findForward(INIT_SEARCH_VENDOR); + } + + + public static final String SEARCH_VENDOR = "searchVendors"; + public ActionForward searchVendors(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd=init(mapping,form,request,response); + + if (fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + ArrayList vendorList = VendorManager.searchVendors(ctx, df.getName()); + + request.getSession().setAttribute(Constants.VENDOR_LIST,vendorList); + + return mapping.findForward(SEARCH_VENDOR); + } + + + public static final String INIT_EDIT_VENDOR = "initEditVendor"; + public ActionForward initEditVendor(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + VendorForm f = (VendorForm) form; + f.validate(mapping,request); + + VendorBean bean = (VendorBean) f.getBean(); + + Integer bpartnerId = bean.getBpartnerId(); + if(bpartnerId==null) + { + throw new OperationException("Cannot edit vendor. Cause vendor id cannot be null!"); + } + + bean = VendorManager.getVendor(ctx,bpartnerId.intValue()); + f.populate(bean); + + ArrayList activePriceLists = PriceListManager.getPriceLists(ctx,0,"",true,null,null,false,null); + ArrayList priceListsKNP = PriceListManager.getKeyNamePair(ctx, activePriceLists); + request.getSession().setAttribute(Constants.USER_PRICE_LISTS, priceListsKNP); + + return mapping.findForward(INIT_EDIT_VENDOR); + } + + + public static final String ACTIVATE_VENDOR = "activateVendor"; + @SuppressWarnings("unchecked") + public ActionForward activateVendor(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + VendorForm f = (VendorForm) form; + f.validate(mapping,request); //copying the value from the form to the bean + + VendorBean bean = (VendorBean) f.getBean(); + + Integer bpartnerId = bean.getBpartnerId(); + + if(bpartnerId==null) + { + throw new OperationException("Cannot edit vendor. Cause: Vendor id cannot be null!"); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + + try + { + trx.start(); + VendorManager.activateVendor(ctx,bpartnerId.intValue(), trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.activate.vendor", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.VENDOR_LIST); + ArrayList vendorBeanList = list; + + ArrayList newList = VendorManager.updateVendorListStatus(vendorBeanList, bpartnerId, true); + + request.getSession().setAttribute(Constants.VENDOR_LIST, newList); + + + return mapping.findForward(SEARCH_VENDOR); + } + + public static final String DEACTIVATE_VENDOR = "deactivateVendor"; + @SuppressWarnings("unchecked") + public ActionForward deactivateVendor(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd=init(mapping,form,request,response); + if (fwd!=null) + return fwd; + Properties ctx = TmkJSPEnv.getCtx(request); + + VendorForm f = (VendorForm) form; + f.validate(mapping,request); //copying the value from the form to the bean + + VendorBean bean = (VendorBean) f.getBean(); + + Integer bpartnerId = bean.getBpartnerId(); + if(bpartnerId==null) + { + throw new OperationException("Cannot edit vendor. Cause vendor id cannot be null!"); + } + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + try + { + trx.start(); + VendorManager.deactivateVendor(ctx,bpartnerId.intValue(), trx.getTrxName()); + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.deactivate.vendor", request); + mapping.getInputForward(); + } + finally + { + trx.close(); + } + + ArrayList list = (ArrayList) request.getSession().getAttribute(Constants.VENDOR_LIST); + ArrayList vendorBeanList = list; + + ArrayList newList = VendorManager.updateVendorListStatus(vendorBeanList, bpartnerId, false); + + request.getSession().setAttribute(Constants.VENDOR_LIST, newList); + + return mapping.findForward(SEARCH_VENDOR); + } + + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/stock/StockAction.java b/posterita/posterita/src/main/org/posterita/struts/stock/StockAction.java new file mode 100644 index 0000000000..02903b9ad5 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/stock/StockAction.java @@ -0,0 +1,237 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.posterita.struts.stock; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.posterita.Constants; +import org.posterita.beans.ItemBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.POSGoodsAction; + + +public class StockAction extends BaseDispatchAction +{ + + + + public static final String DELETE_FROM_CART = "deleteFromCart"; + public ActionForward deleteFromCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm df = (DefaultForm) form; + + ItemBean bean = (ItemBean) df.getBean(); + + ArrayList cartItems = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_CART_ITEMS); + ShoppingCartBean cartBeans = (ShoppingCartBean) request.getSession().getAttribute(Constants.SHOPPING_CART); + + if (cartItems == null || cartItems.size() == 0) + return mapping.findForward(DELETE_FROM_CART); + + cartItems = StockManager.deleteItemFromList(cartItems, bean.getProductId()); + BigDecimal grandTotal = StockManager.setGrandTotal(cartItems); + cartBeans.setTotalPrice(grandTotal); + + request.getSession().setAttribute(Constants.SHOPPING_CART_ITEMS, cartItems); + request.getSession().setAttribute(Constants.SHOPPING_CART, cartBeans); + + return mapping.findForward(DELETE_FROM_CART); + } + + public static final String DELETE_FROM_POS_CART = "deleteFromPOSCart"; + public ActionForward deleteFromPOSCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + String orderType = df.getOrderType(); + ItemBean bean = (ItemBean) df.getBean(); + + if(orderType==null) + { + orderType=(String)request.getSession().getAttribute(Constants.ORDER_TYPE); + } + + String shoppingCartItem = null; + String path=null; + if(orderType.equalsIgnoreCase(Constants.CREDIT_ORDER)) + { + shoppingCartItem = Constants.CREDIT_ORDER_SHOPPING_CART_ITEMS; + path="/jsp/pos/creditOrderShoppingCart.jsp"; + } + else + { + shoppingCartItem = Constants.SHOPPING_ORDER_CART_ITEMS; + path="/jsp/pos/posShoppingCartFirstPage.jsp"; + + } + ArrayList items = (ArrayList) request.getSession().getAttribute(shoppingCartItem); + ArrayList itemsInCart = StockManager.deleteItemFromPOSList(ctx,items, bean.getProductId(),true); + request.getSession().setAttribute(shoppingCartItem, itemsInCart); + return new ActionForward(path); + } + + + + public static final String DELETE_FROM_CREDIT_ORDER_CART = "deleteFromCreditOrderCart"; + public ActionForward deleteFromCreditOrderCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + //String orderType = df.getOrderType(); + ItemBean bean = (ItemBean) df.getBean(); + + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.CREDIT_ORDER_SHOPPING_CART_ITEMS); + + ArrayList itemsInCart = StockManager.deleteItemFromPOSList(ctx,items, bean.getProductId(),true); + + + request.getSession().setAttribute(Constants.CREDIT_ORDER_SHOPPING_CART_ITEMS, itemsInCart); + + return new ActionForward("/jsp/pos/creditOrderShoppingCart.jsp"); + } + + public static final String DELETE_FROM_POS_GRN_CART = "deleteFromPOSGRNCart"; + public ActionForward deleteFromPOSGRNCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + DefaultForm df = (DefaultForm) form; + ItemBean bean = (ItemBean) df.getBean(); + + String orderType = df.getOrderType(); + //String shoppingCart = null; + String shoppingCartItem = null; + + if(orderType.equals(Constants.GOODS_RECEIVE_NOTE)) + { + //shoppingCart = Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART; + shoppingCartItem = Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS; + } + else if(orderType.equals(Constants.GOODS_RETURN_NOTE)) + { + //shoppingCart = Constants.GOODS_RETURN_NOTE_SHOPPING_CART; + shoppingCartItem = Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS; + } + else if(orderType.equals(Constants.CUSTOMER_RETURN_ORDER)) + { + //shoppingCart = Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART; + shoppingCartItem = Constants.CUSTOMER_RETURN_ORDER_SHOPPING_CART_ITEMS; + } + + + ArrayList items = (ArrayList) request.getSession().getAttribute(shoppingCartItem); + + ArrayList itemsInCart = StockManager.deleteItemFromPOSList(ctx,items, bean.getProductId(),false); + + request.getSession().setAttribute(shoppingCartItem, itemsInCart); + + POSGoodsAction action = new POSGoodsAction(); + ActionForward forward = action.getShoppingCart(mapping,form,request,response); + + return forward; + } + + public static final String DELETE_FROM_POS_RET_CART = "deleteFromPOSRetCart"; + public ActionForward deleteFromPOSRetCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, ProductNotOnPriceListException, OperationException + { + + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + ItemBean bean = (ItemBean) df.getBean(); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_GRN_CART_ITEMS); + + ArrayList itemsInCart = StockManager.deleteItemFromPOSList(ctx,items, bean.getProductId(),false); + + request.getSession().setAttribute(Constants.SHOPPING_GRN_CART_ITEMS, itemsInCart); + + return mapping.findForward(DELETE_FROM_POS_RET_CART); + } + + + public static final String DELETE_FROM_CUST_RET_CART = "deleteFromCustRetCart"; + public ActionForward deleteFromCustRetCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, ProductNotOnPriceListException, OperationException + { + ActionForward fwd = init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + + ItemBean bean = (ItemBean) df.getBean(); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.SHOPPING_GRN_CART_ITEMS); + + ArrayList itemsInCart = StockManager.deleteItemFromPOSList(ctx,items, bean.getProductId(),true); + + request.getSession().setAttribute(Constants.SHOPPING_GRN_CART_ITEMS, itemsInCart); + + return mapping.findForward(DELETE_FROM_CUST_RET_CART); + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/struts/stock/StockMovementAction.java b/posterita/posterita/src/main/org/posterita/struts/stock/StockMovementAction.java new file mode 100644 index 0000000000..d5a1f65822 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/struts/stock/StockMovementAction.java @@ -0,0 +1,912 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on May 22, 2006 by alok + */ +package org.posterita.struts.stock; + +import java.io.IOException; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MMovement; +import org.compiere.model.MProduct; +import org.compiere.util.Env; +import org.compiere.util.Trx; +import org.posterita.Constants; +import org.posterita.beans.ItemBean; +import org.posterita.beans.MMovementCartBean; +import org.posterita.beans.StockMovementBean; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.businesslogic.stock.MMovementManager; +import org.posterita.businesslogic.stock.StockManager; +import org.posterita.core.TimestampConvertor; +import org.posterita.core.TmkJSPEnv; +import org.posterita.core.TrxPrefix; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.InputQuantityLessThanZeroException; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.ProductNotFoundException; +import org.posterita.exceptions.ProductNotOnPriceListException; +import org.posterita.exceptions.QuantityNotAvailableException; +import org.posterita.form.StockMovementForm; +import org.posterita.lib.UdiConstants; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.struts.core.DefaultForm; + +public class StockMovementAction extends BaseDispatchAction +{ + public static final String VIEW_STOCK = "viewStock"; + public ActionForward viewStock(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean bean = (StockMovementBean)stockForm.getBean(); + + + Integer orgFromId = bean.getOrgFromId(); + int orgToId = bean.getOrgToId(); + String productName = bean.getProductName() == null? "" : bean.getProductName(); + String description = bean.getDescription() == null? "" : bean.getDescription(); + String barcode = bean.getBarCode() == null? "" : bean.getBarCode(); + + Integer preOrgFromId = (Integer)request.getSession().getAttribute(Constants.PRE_ORG_FROM_ID); + preOrgFromId = preOrgFromId == null?0:preOrgFromId; + HashMap stockProductList = (HashMap) request.getSession().getAttribute(Constants.STOCK_PRODUCT_LIST); + ArrayList stockList = (ArrayList) request.getSession().getAttribute(Constants.MATERIAL_MOVEMENT_ITEMS); + + stockProductList = stockProductList == null? new HashMap(): stockProductList; + stockList = stockList == null? new ArrayList():stockList; + + try + { + ArrayList productList = MMovementManager.getAvailableProducts(ctx, orgFromId, productName, + description, barcode, null); + + stockList = MMovementManager.convertToBeanList(ctx,stockList, stockProductList, productList, preOrgFromId, orgFromId, orgToId, null); + } + catch (ProductNotFoundException e) + { + postGlobalError("error.product.not.found", e.getMessage(),request); + } + + request.getSession().setAttribute(Constants.MATERIAL_MOVEMENT_ITEMS, stockList); + request.getSession().setAttribute(Constants.STOCK_PRODUCT_LIST, stockProductList); + request.getSession().setAttribute(Constants.PRE_ORG_FROM_ID, orgFromId); + return mapping.findForward(VIEW_STOCK); + + } + + public static final String VIEW_OR_EDIT_MMOVEMENT = "viewOrEditMMovement"; + public ActionForward viewOrEditMMovement (ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean bean = (StockMovementBean)stockForm.getBean(); + + return null; + } + + public static final String VIEW_MATERIAL_MOVEMENT_HISTORY="viewMMovementHistory"; + public ActionForward viewMMovementHistory(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd= init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + DefaultForm sf = (DefaultForm)form; + StockMovementBean bean = (StockMovementBean) sf.getBean(); + + Properties ctx =TmkJSPEnv.getCtx(request); + ArrayList list = MMovementManager.viewMMovementHistory(ctx, bean.getDocStatus(), bean.getMonth(), bean.getYear()); + request.setAttribute(Constants.MATERIAL_MOVEMENT_LIST, list); + return mapping.findForward(VIEW_MATERIAL_MOVEMENT_HISTORY); + } + + public static final String VIEW_MATERIAL_MOVEMENT = "viewMMovement"; + public ActionForward viewMMovement(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean bean = (StockMovementBean)stockForm.getBean(); + + int orgId = Env.getAD_Org_ID(ctx); + String docStatus = bean.getDocStatus(); + String f_Date = bean.getFromDate(); + String t_Date = bean.getToDate(); + String docNo = bean.getDocumentNo(); + Timestamp fromDate = TimestampConvertor.getCurrentDateTimeTimestamp(); + Timestamp toDate = TimestampConvertor.getCurrentDateTimestamp(); + + if (f_Date != null) + { + fromDate = TimestampConvertor.getTimestamp(f_Date, TimestampConvertor.BIRTH_DATE); + } + if (t_Date!=null) + { + toDate = TimestampConvertor.getTimestamp(t_Date, TimestampConvertor.BIRTH_DATE); + } + + ArrayList m_list = MMovementManager.getMovementByOrgFrom(ctx,orgId, docStatus, docNo, fromDate, toDate); + + request.getSession().setAttribute(Constants.MATERIAL_MOVEMENT, m_list); + return mapping.findForward(VIEW_MATERIAL_MOVEMENT); + + } + + public static final String VIEW_MOVE_CONFIRM = "viewMoveConfirm"; + public ActionForward viewMoveConfirm(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + + int orgToId = Env.getAD_Org_ID(ctx); + + ArrayList m_list = MMovementManager.getMoveConfirmByOrgTo(ctx, orgToId, null); + + request.getSession().setAttribute(Constants.MOVE_CONFIRM, m_list); + + return mapping.findForward(VIEW_MOVE_CONFIRM); + + } + + public static final String VIEW_MATERIAL_MOVEMENT_LINES = "viewMMovementLines"; + public ActionForward viewMMovementLines(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean bean = (StockMovementBean)stockForm.getBean(); + int movementId = bean.getMovementId(); + + StockMovementBean movementBean = MMovementManager.getBean(ctx, movementId); + ArrayList m_list = MMovementManager.getMovementLines(ctx,movementId); + + request.getSession().setAttribute(Constants.MMOVEMENT, movementBean); + request.getSession().setAttribute(Constants.MATERIAL_MOVEMENT_LINES, m_list); + return mapping.findForward(VIEW_MATERIAL_MOVEMENT_LINES); + } + + public static final String VIEW_MATERIAL_MOVEMENT_LINES_HISTORY = "viewMoveLinesHistory"; + public ActionForward viewMoveLinesHistory(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean bean = (StockMovementBean)stockForm.getBean(); + int movementId = bean.getMovementId(); + + StockMovementBean movementBean = MMovementManager.getBean(ctx, movementId); + ArrayList m_list = MMovementManager.getMovementLines(ctx,movementId); + + request.getSession().setAttribute(Constants.MMOVEMENT, movementBean); + request.getSession().setAttribute(Constants.MATERIAL_MOVEMENT_LINES, m_list); + return mapping.findForward(VIEW_MATERIAL_MOVEMENT_LINES_HISTORY); + } + + public static final String VIEW_MOVE_CONFIRM_LINES = "viewMoveConfirmLines"; + public ActionForward viewMoveConfirmLines(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + + Properties ctx = TmkJSPEnv.getCtx(request); + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean bean = (StockMovementBean)stockForm.getBean(); + int movementId = bean.getMovementId(); + int moveConfirmId = bean.getMoveConfirmId(); + StockMovementBean movementBean = MMovementManager.getBean(ctx, movementId); + movementBean.setMoveConfirmId(moveConfirmId); + ArrayList m_list = MMovementManager.getMovementLines(ctx,movementId); + request.getSession().setAttribute(Constants.MMOVEMENT, movementBean); + request.getSession().setAttribute(Constants.MOVE_CONFIRM_LINES, m_list); + return mapping.findForward(VIEW_MOVE_CONFIRM_LINES); + } + + public static final String CREATE_MATERIAL_MOVEMENT = "createMMovement"; + public ActionForward createMMovement(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + Properties ctx = TmkJSPEnv.getCtx(request); + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + + String movementCart = Constants.MMOVEMENT_CART; + String movementCartItems = Constants.MMOVEMENT_CART_ITEMS; + + String description = request.getParameter("description"); + String priceListIdAsStr = request.getParameter("priceListId"); + String movementIdAsStr = request.getParameter("movementId"); + String orgFromIdAsStr = request.getParameter("orgFromId"); + String orgToIdAsStr = request.getParameter("orgToId"); + int priceListId = Integer.parseInt(priceListIdAsStr); + int movementId = Integer.parseInt(movementIdAsStr); + Integer orgFromId = Integer.parseInt(orgFromIdAsStr); + Integer orgToId = Integer.parseInt(orgToIdAsStr); + + stockMovementBean.setMovementId(movementId); + stockMovementBean.setDescription(description); + stockMovementBean.setPriceListId(priceListId); + stockMovementBean.setOrgFromId(orgFromId); + stockMovementBean.setOrgToId(orgToId); + stockForm.populate(stockMovementBean); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + String docNo = null; + String docStatus = null; + String docInfo = null; + + ArrayList itemList = (ArrayList) request.getSession().getAttribute(Constants.MMOVEMENT_CART_ITEMS); + + if(stockMovementBean.getMovementId() == null || stockMovementBean.getMovementId() == 0) + { + MMovement mmovement = MMovementManager.createInventoryMove(ctx, stockMovementBean.getDescription(), null); + docNo = mmovement.getDocumentNo(); + docInfo = mmovement.getDocumentInfo(); + docStatus = mmovement.getDocStatus(); + stockMovementBean.setDocumentNo(docNo); + stockMovementBean.setMovementId(mmovement.getM_Movement_ID()); + + } + else + { + MMovement mmovement2 = new MMovement(ctx, stockMovementBean.getMovementId(), null); + mmovement2.setDescription(stockMovementBean.getDescription()); + docNo = mmovement2.getDocumentNo(); + docInfo = mmovement2.getDocumentInfo(); + docStatus = mmovement2.getDocStatus(); + stockMovementBean.setDocumentNo(docNo); + stockMovementBean.setMovementId(mmovement2.getM_Movement_ID()); + mmovement2.save(); + + MMovementManager.deleteMovementLines(ctx, mmovement2.getM_Movement_ID()); + + } + + try + { + trx.start(); + + for (ItemBean itemBean : itemList) + { + MMovementManager.createOrUpdateMaterialMovementLine(ctx, stockMovementBean.getMovementId(), itemBean.getProductId(), itemBean.getQtyToMove(), stockMovementBean.getOrgFromId(), stockMovementBean.getOrgToId(), trx.getTrxName()); + } + + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + postGlobalError("error.process", e.getMessage(), request); + } + finally + { + trx.close(); + } + + stockForm.populate(stockMovementBean); + + request.getSession().setAttribute(Constants.DOC_NO, docNo); + request.getSession().setAttribute(Constants.DOC_STATUS, docStatus); + request.getSession().setAttribute(Constants.MMOVEMENT_ID, stockMovementBean.getMovementId()); + request.getSession().setAttribute(Constants.DESCRIPTION, description); + + Env.setContext(ctx, Constants.MMOVEMENT_ID, stockMovementBean.getMovementId()); + + + if((MMovement.DOCSTATUS_Drafted).equals(docStatus)) + { + docStatus = "DRAFTED"; + } + + if((MMovement.DOCSTATUS_Completed).equals(docStatus)) + { + docStatus = "COMPLETED"; + } + + if((MMovement.DOCSTATUS_Closed).equals(docStatus)) + { + docStatus = "CLOSED"; + } + + if((MMovement.DOCSTATUS_InProgress).equals(docStatus)) + { + docStatus = "IN PROGRESS"; + } + + if((MMovement.DOCSTATUS_Approved).equals(docStatus)) + { + docStatus = "APPROVED"; + } + + + StringBuffer sb = new StringBuffer(); + sb.append("{"); + sb.append("movementId: \"" + stockMovementBean.getMovementId() + "\""); + sb.append(", docNo: \"" + docNo + "\""); + sb.append(", docStatus: \"" + docStatus + "\""); + sb.append(", docInfo: \"" + docInfo + "\""); + sb.append(", description: \"" + stockMovementBean.getDescription() + "\""); + sb.append("}"); + + PrintWriter writer = response.getWriter(); + writer.print( sb.toString() ); + writer.flush(); + writer.close(); + + return null; + } + + public static final String COMPLETE_MATERIAL_MOVEMENT = "completeMMovement"; + public ActionForward completeMMovement(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + Properties ctx = TmkJSPEnv.getCtx(request); + + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + + ArrayList itemList = (ArrayList) request.getSession().getAttribute(Constants.MMOVEMENT_CART_ITEMS); + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + + try + { + if(stockMovementBean.getMovementId() == null || stockMovementBean.getMovementId() == 0) + { + MMovement mmovement = MMovementManager.createInventoryMove(ctx, stockMovementBean.getReference(), null); + stockMovementBean.setMovementId(mmovement.get_ID()); + stockMovementBean.setDocumentNo(mmovement.getDocumentNo()); + stockMovementBean.setDocStatus(mmovement.getDocStatus()); + mmovement.save(); + + trx.start(); + + for (ItemBean itemBean : itemList) + { + MMovementManager.createOrUpdateMaterialMovementLine(ctx, stockMovementBean.getMovementId(), itemBean.getProductId(), itemBean.getQtyToMove(), stockMovementBean.getOrgFromId(), stockMovementBean.getOrgToId(), trx.getTrxName()); + } + + trx.commit(); + + MMovementManager.completeMaterialMovement(ctx, stockMovementBean.getMovementId(), trx.getTrxName()); + } + else + { + MMovementManager.deleteMovementLines(ctx, stockMovementBean.getMovementId()); + + trx.start(); + + for (ItemBean itemBean : itemList) + { + MMovementManager.createOrUpdateMaterialMovementLine(ctx, stockMovementBean.getMovementId(), itemBean.getProductId(), itemBean.getQtyToMove(), stockMovementBean.getOrgFromId(), stockMovementBean.getOrgToId(), trx.getTrxName()); + } + + trx.commit(); + + MMovementManager.completeMaterialMovement(ctx, stockMovementBean.getMovementId(), trx.getTrxName()); + + } + } + catch (OperationException e) + { + trx.rollback(); + trx.close(); + } + + ArrayList list = MMovementManager.getMovementLines(ctx, stockMovementBean.getMovementId()); + request.getSession().setAttribute(Constants.MATERIAL_MOVEMENT, list); + + MMovementManager.clearCart(ctx, request); + return mapping.findForward(VIEW_MATERIAL_MOVEMENT); + + } + + public static final String COMPLETE_MOVE_CONFIRM = "completeMoveConfirm"; + public ActionForward completeMoveConfirm(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + Properties ctx = TmkJSPEnv.getCtx(request); + + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + + int moveConfirmId = stockMovementBean.getMoveConfirmId(); + + + Trx trx = Trx.get(TrxPrefix.getPrefix(), true); + ArrayList bean = null; + try + { + trx.start(); + MMovementManager.completeMoveConfirm(ctx, moveConfirmId, trx.getTrxName()); + + trx.commit(); + } + catch (OperationException e) + { + trx.rollback(); + trx.close(); + } + ArrayList list = (ArrayList)request.getSession().getAttribute(Constants.MOVE_CONFIRM); + bean = MMovementManager.getConfirmList(ctx, list, moveConfirmId); + + request.getSession().setAttribute(Constants.MOVE_CONFIRM, bean); + return mapping.findForward(VIEW_MOVE_CONFIRM); + + } + + public ActionForward setOrgFrom(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + Properties ctx = TmkJSPEnv.getCtx(request); + + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + Integer orgFromId = stockMovementBean.getOrgFromId(); + + if (orgFromId != null) + { + request.getSession().setAttribute(Constants.ORG_FROM_ID, orgFromId); + } + + return null; + } + + + public ActionForward setQtyToMove(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + Properties ctx = TmkJSPEnv.getCtx(request); + String qtyToMove = request.getParameter("qtyToMove"); + String index = request.getParameter("index"); + String salesPriceListId = request.getParameter("salesPriceListId"); + + Double qty = Double.valueOf(qtyToMove); + BigDecimal qtyToMov = BigDecimal.valueOf(qty); + Integer ind = Integer.valueOf(index); + Integer salesPrId = 0; + if (salesPriceListId != null) + { + salesPrId = Integer.valueOf(salesPriceListId); + } + ArrayList stockList = (ArrayList)request.getSession().getAttribute(Constants.MATERIAL_MOVEMENT_ITEMS); + BigDecimal stockValue = MMovementManager.setQtyToMove(ctx, qtyToMov, ind, salesPrId, stockList); + + return null; + } + + + //--------------------------------------------------------------------------------------------------------------// + + public static final String ADD_TO_MMOVEMENT_CART = "addToMMovementCart"; + public ActionForward addToMMovementCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + { + return fwd; + } + Properties ctx = TmkJSPEnv.getCtx(request); + + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + + String movementCart = Constants.MMOVEMENT_CART; + String movementCartItems = Constants.MMOVEMENT_CART_ITEMS; + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + MMovementCartBean mmovementBean = (MMovementCartBean) request.getSession().getAttribute(movementCart); + + try + { + if(stockMovementBean.getProductId()==null && stockMovementBean.getBarCode()==null) + { + postGlobalError("error.barcode.required", request); + return mapping.getInputForward(); + } + + BigDecimal qty = stockMovementBean.getQtyToMove(); + if(qty != null && qty.doubleValue() < 0.0) + { + throw new InputQuantityLessThanZeroException(""); + } + + + trx.start(); + mmovementBean = StockManager.addToMovementCart(ctx, stockMovementBean, mmovementBean, false, Boolean.parseBoolean(stockMovementBean.getIfAdd())); + trx.commit(); + } + catch (InputQuantityLessThanZeroException e) + { + postGlobalError("error.invalid.inputQty", request); + trx.rollback(); + return mapping.getInputForward(); + } + catch (ProductNotFoundException e) + { + postGlobalError("error.product.not.found", e.getMessage(), request); + trx.rollback(); + return mapping.getInputForward(); + } + catch(QuantityNotAvailableException e) + { + postGlobalError("error.quantity.notAvailable", e.getMessage(), request); + trx.rollback(); + return mapping.getInputForward(); + } + + catch(ProductNotOnPriceListException e) + { + postGlobalError("error.product.price.not.found", e.getMessage(), request); + trx.rollback(); + return mapping.getInputForward(); + } + catch(OperationException e) + { + postGlobalError("error.inventory.not.available", e.getMessage(), request); + trx.rollback(); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + int priceListId = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + String currSymboleSales = PriceListManager.getCurrency(ctx, priceListId); + request.setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales); + + request.getSession().setAttribute(movementCart, mmovementBean); + request.getSession().setAttribute(movementCartItems, mmovementBean.getItems()); + + return mapping.findForward(ADD_TO_MMOVEMENT_CART); + } + + public ActionForward addProduct(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException, IOException, ParseException + { + // Bug fix for null pointer + StockMovementForm stockForm = (StockMovementForm)form; + if(stockForm.getQtyToMove() == null) + { + stockForm.setQtyToMove("1"); + } + + addToMMovementCart(mapping,form,request,response); + + return getMMovementCart(mapping,form,request,response); + } + + + public static final String INCREMENT_QTY = "incrementQty"; + public ActionForward incrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + stockMovementBean.setQtyToMove(new BigDecimal(1)); + + addToMMovementCart(mapping,form,request,response); + return getMMovementCart(mapping,form,request,response); + } + + public static final String DECREMENT_QTY = "decrementQty"; + public ActionForward decrementQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + stockMovementBean.setQtyToMove(new BigDecimal(1)); + + addToMMovementCart(mapping,form,request,response); + return getMMovementCart(mapping,form,request,response); + } + + public ActionForward getMMovementCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, IOException, ParseException + { + DefaultForm df = (DefaultForm) form; + String orderType = df.getOrderType(); + + String mmovementCart = MMovementManager.getMMovementCartAsHTML(request); + + PrintWriter writer = response.getWriter(); + writer.write(mmovementCart); + + + ActionMessages errors = (ActionMessages) request.getAttribute("org.apache.struts.action.ERROR"); + if(errors != null && !errors.isEmpty()) + { + MessageResources messageResources = getResources(request); + + Iterator iter = errors.get(); + while(iter.hasNext()) + { + ActionMessage message = iter.next(); + String key = message.getKey(); + Object[] values = message.getValues(); + + String errMsg = messageResources.getMessage(key, values); + writer.write(""); + } + + } + + writer.close(); + + return null; + } + + public static final String UPDATE_QTY = "updateQty"; + public ActionForward updateQty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx=TmkJSPEnv.getCtx(request); + + // Bug fix for null pointer + StockMovementForm stockForm = (StockMovementForm)form; + Trx trx = Trx.get(TrxPrefix.getPrefix(),true); + + if(stockForm.getQtyToMove() == null) + { + stockForm.setQtyToMove("1"); + } + + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + Integer product_id = stockMovementBean.getProductId(); + Integer quantity = stockMovementBean.getQtyToMove().intValue(); + Integer priceListId = stockMovementBean.getPriceListId(); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.MMOVEMENT_CART_ITEMS); + + try + { + trx.start(); + StockManager.updateItemFromMMovementList(ctx, priceListId, items, product_id, quantity); + trx.commit(); + } + catch(OperationException e) + { + postGlobalError("error.inventory.not.available", e.getMessage(), request); + trx.rollback(); + return mapping.getInputForward(); + } + finally + { + trx.close(); + } + + return getMMovementCart(mapping,form,request,response); + } + + public static final String UPDATE_NO_OF_PACK = "updateNoOfPack"; + public ActionForward updateNoOfPack(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception + { + Properties ctx=TmkJSPEnv.getCtx(request); + + // Bug fix for null pointer + StockMovementForm stockForm = (StockMovementForm)form; + + if(stockForm.getNoOfPack() == null) + { + stockForm.setNoOfPack("1"); + } + + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + Integer product_id = stockMovementBean.getProductId(); + Integer noOfPack = stockMovementBean.getNoOfPack(); + Integer priceListId = stockMovementBean.getPriceListId(); + + ArrayList items = (ArrayList) request.getSession().getAttribute(Constants.MMOVEMENT_CART_ITEMS); + StockManager.updateNoOfPack(ctx, priceListId, items, product_id, noOfPack); + + return getMMovementCart(mapping,form,request,response); + } + + public static final String RELOAD_BARCODE_CART = "reloadBarcodeCart"; + public ActionForward reloadBarcodeCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, IOException, ParseException, ApplicationException + { + ActionForward fwd=init(mapping,form,request,response); + if(fwd!=null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + StockMovementForm stockForm = (StockMovementForm)form; + StockMovementBean stockMovementBean = (StockMovementBean)stockForm.getBean(); + + String movementCart = Constants.MMOVEMENT_CART; + String movementCartItems = Constants.MMOVEMENT_CART_ITEMS; + + MMovementCartBean cartBean = (MMovementCartBean) request.getSession().getAttribute(movementCart); + ArrayList itemBeans= cartBean.getItems(); + + String priceListIdAsStr = request.getParameter("priceListId"); + String productIdAsStr = request.getParameter("productId"); + int productId = Integer.parseInt(productIdAsStr); + int priceListId = Integer.parseInt(priceListIdAsStr); + + BigDecimal qty = BigDecimal.ZERO; + + for(int i=0; i webDocStatusMap; + static LinkedHashMap docStatusMap; + + static + { + webDocStatusMap = new LinkedHashMap(); + webDocStatusMap.putAll(UDIMap.docStatusMap); + } + + static + { + docStatusMap = new LinkedHashMap(); + docStatusMap.putAll(webDocStatusMap); + docStatusMap.put(DocumentEngine.STATUS_Approved,"Approved"); + docStatusMap.put(DocumentEngine.STATUS_NotApproved,"Not Approved"); + docStatusMap.put(DocumentEngine.STATUS_Reversed,"Reversed"); + docStatusMap.put(DocumentEngine.STATUS_Unknown,"??"); + docStatusMap.put(DocumentEngine.STATUS_WaitingPayment,"Waiting Payment"); + docStatusMap.put(DocumentEngine.STATUS_WaitingConfirmation,"Waiting Confirmation"); + docStatusMap.put(DocumentEngine.STATUS_Invalid,"Invalid"); + } + + + + public static LinkedHashMap getWebDocStatusMap() + { + return webDocStatusMap; + } + + public static void setWebDocStatusMap(LinkedHashMap webDocStatusMap) + { + OrderStatus.webDocStatusMap = webDocStatusMap; + } + + public String formatValue(Object valueToFormat) throws JspException + { + if (valueToFormat instanceof String == false) + throw new JspException("Expected java.lang.String, obtained" + valueToFormat.getClass().getName()); + + String strValueToFormat = (String) valueToFormat; + + return format(strValueToFormat); + } + + + + + + private String format(String strValueToFormat) + { + if (docStatusMap.containsKey(strValueToFormat)) + return (String) docStatusMap.get(strValueToFormat); + + + return (String) docStatusMap.get(DocumentEngine.STATUS_Unknown); + } + + + @SuppressWarnings("deprecation") + public int doStartTag() throws JspException + { + + HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); + + request.getSession().getAttribute(WebUserInfo.NAME); + + if (ignore) + { + if (RequestUtils.lookup(pageContext, name, scope) == null) + return (SKIP_BODY); + } + + Object value = RequestUtils.lookup(pageContext, name, property, scope); + if (value == null) + return (SKIP_BODY); + + String output = formatValue(value); + + org.apache.struts.util.ResponseUtils.write(pageContext, output); + + return (SKIP_BODY); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/taglib/ProductName.java b/posterita/posterita/src/main/org/posterita/taglib/ProductName.java new file mode 100644 index 0000000000..7a7fc036bb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/taglib/ProductName.java @@ -0,0 +1,94 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 11, 2005 by Alok + */ + +package org.posterita.taglib; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.JspException; + +import org.apache.struts.taglib.bean.WriteTag; +import org.apache.struts.util.RequestUtils; +import org.compiere.model.MAttributeValue; + +import org.posterita.core.TmkJSPEnv; + +public class ProductName extends WriteTag +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + + + + public String formatValue(Object valueToFormat) throws JspException + { + if (valueToFormat instanceof Integer == false) + throw new JspException("Expected java.lang.Integer, obtained" + valueToFormat.getClass().getName()); + + Integer id = (Integer) valueToFormat; + + return format(id); + } + + private String format(Integer integerValueToFormat) + { + + if (integerValueToFormat == null) + return ""; + + HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); + + Properties ctx = TmkJSPEnv.getCtx(request); + + MAttributeValue attributeValue = new MAttributeValue(ctx, integerValueToFormat.intValue(),null); + + + return attributeValue.getName(); + } + + + + + @SuppressWarnings("deprecation") + public int doStartTag() throws JspException + { + + if (ignore) + { + if (RequestUtils.lookup(pageContext, name, scope) == null) + return (SKIP_BODY); + } + + Object value = RequestUtils.lookup(pageContext, name, property, scope); + if (value == null) + return (SKIP_BODY); + + String output = formatValue(value); + + org.apache.struts.util.ResponseUtils.write(pageContext, output); + + return (SKIP_BODY); + } +} diff --git a/posterita/posterita/src/main/org/posterita/user/WebUserInfo.java b/posterita/posterita/src/main/org/posterita/user/WebUserInfo.java new file mode 100644 index 0000000000..c354a15664 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/user/WebUserInfo.java @@ -0,0 +1,303 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 11, 2005 by Alok + */ + +package org.posterita.user; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MLocation; +import org.compiere.model.MOrg; +import org.compiere.model.MRole; +import org.compiere.model.MUser; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Secure; +import org.compiere.util.WebInfo; +import org.compiere.util.WebUser; + +import org.posterita.exceptions.DataException; +import org.posterita.exceptions.OperationException; + + +/** + * @author fred + * + *This Info is breaking convention because it is using Info that calls some business logic when + *invoking it in the jsp. But should be fine for now. + * + */ +public class WebUserInfo +{ + + public static final String NAME = "webUserInfo"; + protected WebUser user; + protected WebInfo info; + protected Properties ctx; + protected String orgName; + protected String roleName; + protected Integer roleId; + protected Integer orgId; + protected ArrayList menuItem; + protected Integer unreadMessageCount; + protected Boolean canAlterOrder; + protected Boolean canCreateOrder; + protected Boolean canViewOrder; + + + + public Boolean getCanAlterOrder() { + return canAlterOrder; + } + public void setCanAlterOrder(Boolean canAlterOrder) { + this.canAlterOrder = canAlterOrder; + } + public Boolean getCanCreateOrder() { + return canCreateOrder; + } + public void setCanCreateOrder(Boolean canCreateOrder) { + this.canCreateOrder = canCreateOrder; + } + public Boolean getCanViewOrder() { + return canViewOrder; + } + public void setCanViewOrder(Boolean canViewOrder) { + this.canViewOrder = canViewOrder; + } + + public Integer getUnreadMessageCount() + { + return unreadMessageCount; + } + + public void setUnreadMessageCount(Integer unreadMessageCount) + { + this.unreadMessageCount = unreadMessageCount; + } + + public ArrayList getMenuItem() + { + return menuItem; + } + + public void setMenuItem(ArrayList menuItem) + { + this.menuItem = menuItem; + } + + public Integer getOrgId() + { + return orgId; + } + + public void setOrgId(Integer orgId) + { + this.orgId = orgId; + } + + + public Integer getRoleId() + { + return roleId; + } + + public void setRoleId(Integer roleId) + { + this.roleId = roleId; + Env.setContext(ctx,"#AD_Role_ID",roleId.intValue()); + } + public WebUserInfo(Properties ctx, WebUser user, WebInfo info) throws DataException, OperationException + { + this.user = user; + this.ctx =ctx; + this.info = info; + + MUser muser = new MUser(ctx, user.getAD_User_ID(), null); + + // TODO think about this Little hack +// Env.setContext(ctx, "#AD_Org_ID", muser.getAD_Org_ID()); + +// setOriginalUserID(ctx, muser); + + orgId = Integer.valueOf(muser.getAD_Org_ID()); + + KeyNamePair[] roles = getRoles(muser.getName(),muser.getPassword()); + + + if (roles == null || roles.length == 0) + throw new DataException("No role has been set for your user, Please check with your administrator to assign one for you."); + + /* + if (roles.length > 1 ) + throw new DataException("You have been assigned many roles. You are permitted to have one role only. Please check with your administrator"); + */ + + setRoleId( Integer.valueOf(roles[0].getKey())); + setRoleName(); + + } + + /*public void setOriginalUserID(Properties ctx, MUser originalUser) + { + int originalUserID = Env.getContextAsInt(ctx, "#AD_OriginalUser_ID"); + + if (originalUserID == 0) + Env.setContext(ctx, "#AD_OriginalUser_ID", originalUser.getAD_User_ID()); + }*/ + + private KeyNamePair[] getRoles (String app_user, String app_pwd) throws OperationException + { + + if (app_user == null) + return null; + + KeyNamePair[] retValue = null; + ArrayList list = new ArrayList(); + // + String sql = "SELECT AD_User.AD_User_ID, AD_User.Description," + + " AD_Role.AD_Role_ID, AD_Role.Name " + + "FROM AD_User, AD_User_Roles, AD_Role " + + "WHERE AD_User.AD_User_ID=AD_User_Roles.AD_User_ID" + + " AND AD_User_Roles.AD_Role_ID=AD_Role.AD_Role_ID" + + " AND AD_User.Name=? AND AD_User.AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) // #1 + + " AND AD_User.IsActive='Y' AND AD_Role.IsActive='Y' AND AD_User_Roles.IsActive='Y'"; + if (app_pwd != null) + sql += " AND (AD_User.Password=? OR AD_User.Password=?)"; // #2/3 + sql += " ORDER BY AD_Role.Name"; + + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql, null); + pstmt.setString(1, app_user); + if (app_pwd != null) + { + pstmt.setString(2, app_pwd); + pstmt.setString(3, new Secure().getDigest(app_pwd)); + } + // execute a query + ResultSet rs = pstmt.executeQuery(); + + while (rs.next()) + { + + int AD_Role_ID = rs.getInt("AD_Role_ID"); + String Name = rs.getString("Name"); + KeyNamePair p = new KeyNamePair(AD_Role_ID, Name); + list.add(p); + } + + rs.close(); + pstmt.close(); + pstmt = null; + // + retValue = new KeyNamePair[list.size()]; + list.toArray(retValue); + } + catch (SQLException ex) + { + ex.printStackTrace(); + retValue = null; + } + // + try + { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + return retValue; + } // getRoles + + + /** + * @return Returns the info. + */ + public WebInfo getInfo() + { + return info; + } + /** + * @param info The info to set. + */ + public void setInfo(WebInfo info) + { + this.info = info; + } + /** + * @return Returns the user. + */ + public WebUser getUser() + { + return user; + } + /** + * @param user The user to set. + */ + public void setUser(WebUser user) + { + this.user = user; + } + + public String getOrgName() + { + if (orgName ==null) + { + MUser muser = new MUser(ctx,user.getAD_User_ID(),null); + MOrg org = new MOrg (ctx,muser.getAD_Org_ID(),null); + orgName = org.getName(); + } + + return orgName; + + } + + public String getRoleName() + { + MRole role = new MRole(ctx, getRoleId().intValue(),null); + return role.getName(); + } + + public MLocation getLocation() + { + + MUser muser = new MUser(ctx, user.getAD_User_ID(),null); + MOrg org = new MOrg(ctx,muser.getAD_Org_ID(),null); + + int locationId = org.getInfo().getC_Location_ID(); + MLocation mlocation = MLocation.get(ctx, locationId, null); + + return mlocation; + } + + public void setRoleName() + { + this.roleName = getRoleName(); + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/AbstractPrintFormatter.java b/posterita/posterita/src/main/org/posterita/util/AbstractPrintFormatter.java new file mode 100644 index 0000000000..39d06cb302 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/AbstractPrintFormatter.java @@ -0,0 +1,176 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.util; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; + +import org.posterita.exceptions.OperationException; + + +/** + * @author alok + */ + +public abstract class AbstractPrintFormatter implements IPrintFormatter +{ + private Map arguments; + + protected int _lineWidth = 40; + protected int _halfLineWidth = 20; + protected String _lineTop= ""; + protected String _lineBottom = ""; + protected boolean _showLogo = false; + protected boolean _showBarcode = false; + protected boolean _showDiscount = false; + protected boolean _showFooter = false; + protected boolean _priceWithVat = false; + protected String _footerMessage = ""; + + protected String trxName = null; + + public AbstractPrintFormatter(String args) + { + parseArguments(args); + initFormatter(); + } + + private void parseArguments(String args) + { + arguments = new HashMap(); + + if( args == null || args.length() == 0) + { + return; + } + + StringTokenizer params = new StringTokenizer(args,";"); + StringTokenizer s = null; + + while(params.hasMoreTokens()) + { + s = new StringTokenizer(params.nextToken(), "="); + + if(s.hasMoreTokens()) + { + String key = s.nextToken(); + + if(s.hasMoreTokens()) + { + String value = s.nextToken(); + + arguments.put(key, value); + } + } + }//while + + } + + public String getArgumentValue(String argumentName) + { + if(arguments != null) + { + return arguments.get(argumentName); + } + + return null; + } + + protected void setArgumentValue(String argumentName, String value) throws OperationException + { + try + { + Field field = getClass().getField(argumentName); + Class c = field.getType().getClass(); + + Constructor con = c.getConstructor(new Class[]{String.class}); + Object obj = con.newInstance(new Object[]{value}); + + field.set(this,obj); + } + catch (Exception e) + { + throw new OperationException(e); + } + } + + public void initFormatter() + { + String value; + + value = getArgumentValue("showBarcode"); + if(value != null) + { + _showBarcode = Boolean.parseBoolean(value); + } + + value = getArgumentValue("showLogo"); + if(value != null) + { + _showLogo = Boolean.parseBoolean(value); + } + + value = getArgumentValue("lineLength"); + if(value != null) + { + _lineWidth = Integer.parseInt(value); + } + + value = getArgumentValue("footer"); + if(value != null) + { + _footerMessage = value; + } + + value = getArgumentValue("showDiscount"); + if(value != null) + { + _showDiscount = Boolean.parseBoolean(value); + } + + value = getArgumentValue("showFooter"); + if(value != null) + { + _showFooter = Boolean.parseBoolean(value); + } + + value = getArgumentValue("priceWithVat"); + if(value != null) + { + _priceWithVat = Boolean.parseBoolean(value); + } + + String lineSeparator = ""; + + for(int i = 0; i < _lineWidth; i++) + { + lineSeparator = lineSeparator + "-"; + } + + _lineTop = lineSeparator; + _lineBottom = lineSeparator; + + _halfLineWidth = _lineWidth/2; + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/BarcodeFormatter.java b/posterita/posterita/src/main/org/posterita/util/BarcodeFormatter.java new file mode 100644 index 0000000000..d0ad551976 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/BarcodeFormatter.java @@ -0,0 +1,154 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * 04-Oct-2006 09:52:44 by praveen + * + */ + +package org.posterita.util; + +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.posterita.beans.PrintBarcodeBean; +import org.posterita.exceptions.FormattingException; +import org.posterita.formatter.Formatter; + +public class BarcodeFormatter extends Formatter +{ + boolean showPrice = true; + boolean showTitle = true; + boolean showSubtitle = true; + + public Object format(Object target) throws FormattingException + { + + PrintBarcodeBean bean = null; + bean = (PrintBarcodeBean) target; + + int qty = 0; + String title = null; + String barcode = null; + String price = null; + String subtitle = null; + + title = bean.getTitle(); + barcode = bean.getBarcode(); + price = bean.getPrice(); + subtitle = bean.getSubtitle(); + qty = bean.getQty(); + + //setting defaults if params are null + title = ( title == null ) ? "" : title; + barcode = ( barcode == null ) ? "" : barcode; + price = ( price == null ) ? "" : price; + subtitle = ( subtitle == null ) ? "" : subtitle; + qty = ( qty == 0 ) ? 1 : qty; + + StringWriter sw = new StringWriter(); + PrintWriter w = new PrintWriter(sw); + + w.println("^Q24,3"); + w.println("^W75"); + w.println("^H10"); + w.println("^P1"); + w.println("^S4"); + w.println("^AD"); + w.println("^C$qty"); //<-- qty + w.println("^R2"); + w.println("~Q+3"); + w.println("^O0"); + w.println("^D0"); + w.println("^E10"); + w.println("~R200"); + w.println("^L"); + w.println("Dy2-me-dd"); + w.println("Th:m:s"); + + if( showTitle ) + { + w.println("AA,22,12,1,1,0,0,$title"); //<--title1 + w.println("AA,22,12,1,1,0,0,$title"); //<--title1 + } + + w.println("BE,42,62,2,5,100,0,1,$barcode"); //<--barcode + w.println("BE,42,62,2,5,100,0,1,$barcode"); //<--barcode + + if( showPrice ) + { + w.println("AC,222,27,1,1,0,0,$price"); //<-- price + w.println("AC,222,27,1,1,0,0,$price"); //<-- price + } + + if( showSubtitle ) + { + w.println("AA,22,32,1,1,0,0,$subtitle"); //<-- title2 + w.println("AA,22,32,1,1,0,0,$subtitle"); //<-- title2 + } + + w.println("E"); + w.flush(); + + String printData = sw.getBuffer().toString(); + + printData = printData.replace("$qty", qty+""); + printData = printData.replace("$title", title); + printData = printData.replace("$subtitle", subtitle); + printData = printData.replace("$barcode", barcode); + printData = printData.replace("$price", price); + + return printData; + } + + + public Object unformat(Object target) throws FormattingException + { + throw new FormattingException("Operartion not supported"); + } + + + public boolean isShowPrice() { + return showPrice; + } + + + public void setShowPrice(boolean showPrice) { + this.showPrice = showPrice; + } + + + public boolean isShowSubtitle() { + return showSubtitle; + } + + + public void setShowSubtitle(boolean showSubtitle) { + this.showSubtitle = showSubtitle; + } + + + public boolean isShowTitle() { + return showTitle; + } + + + public void setShowTitle(boolean showTitle) { + this.showTitle = showTitle; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/util/EmailUtil.java b/posterita/posterita/src/main/org/posterita/util/EmailUtil.java new file mode 100644 index 0000000000..b8c545fec2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/EmailUtil.java @@ -0,0 +1,102 @@ +/* + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Servansingh + * */ + +package org.posterita.util; + +import java.util.Properties; + +import javax.mail.internet.InternetAddress; + +import org.compiere.model.MCountry; +import org.compiere.util.EMail; +import org.posterita.beans.UserBean; +import org.posterita.exceptions.InvalidEmailException; + +public class EmailUtil +{ + public static final String DEFAULT_SMTP_SERVER = "mail.tamakict.com"; + public static final String SUPPORT_EMAIL_ADDRESS = "support@posterita.org"; + public static final String DEFAULT_USER_AUTH_NAME = "admin@tamakict.com"; + public static final String DEFAULT_USER_AUTH_PWD = "kaizen"; + + public static boolean send(Properties ctx, String smtpHost, String from, String to, + String subject, String message, String username, String password) + { + EMail email = new EMail(ctx, smtpHost, from, to, subject, message); + + email.createAuthenticator(username, password); + String retMsg = email.send(); + + return EMail.SENT_OK.equals(retMsg); + } + + /** + * Validates an email address. Throws InvalidEmailException if mail address + * is not valid + * @param emailAddress + * @throws InvalidEmailException + */ + public static void checkEMail(String emailAddress) throws InvalidEmailException + { + if (emailAddress == null) + { + throw new InvalidEmailException("No email provided"); + } + + try + { + InternetAddress iNetAddress = new InternetAddress(emailAddress); + iNetAddress.validate(); + } + catch (Exception ex) + { + throw new InvalidEmailException(ex.getMessage(), ex); + } + } + + public static boolean sendRegistrationEmail(Properties ctx, UserBean userBean) + { + if (userBean == null) + { + throw new IllegalArgumentException("User cannot be null"); + } + + MCountry country = MCountry.get(ctx, userBean.getCountryId()); + StringBuffer msg = new StringBuffer(); + msg.append("Full Name: " + userBean.getName() + " " + userBean.getUserSurname()); + msg.append("\n\nAddress: " + userBean.getAddress1()); + msg.append("\n\nCity: " + userBean.getCity()); + msg.append("\n\nCountry: " + country.getName()); + msg.append("\n\nCompany: " + userBean.getCompany()); + msg.append("\n\nIndustry: " + userBean.getIndustry()); + msg.append("\n\nEmail: " + userBean.getEmail()); + msg.append("\n\nRemarks: " + userBean.getComments()); + + String subject = "Posterita POS User Registration"; + String from = userBean.getEmail(); + + return send(ctx, DEFAULT_SMTP_SERVER, from, + SUPPORT_EMAIL_ADDRESS, subject, msg.toString(), + DEFAULT_USER_AUTH_NAME, DEFAULT_USER_AUTH_PWD); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/util/HtmlOrderPrintFormatter.java b/posterita/posterita/src/main/org/posterita/util/HtmlOrderPrintFormatter.java new file mode 100644 index 0000000000..9e78ae4710 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/HtmlOrderPrintFormatter.java @@ -0,0 +1,735 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 23, 2006 + */ + + +package org.posterita.util; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MCashLine; +import org.compiere.model.MCurrency; +import org.compiere.model.MInvoice; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MPayment; +import org.compiere.model.MUser; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.ItemBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.ShoppingCartBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.exceptions.FormattingException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; + + + +public class HtmlOrderPrintFormatter extends AbstractPrintFormatter +{ + public HtmlOrderPrintFormatter(String args) + { + super(args); + } + + public HtmlOrderPrintFormatter(String args, String trxName) + { + super(args); + this.trxName = trxName; + } + + public String format(Properties ctx, int recordId, Object... args) throws Exception + { + //require UDIBean + OrderLineBean orderLineBean = null; + if( args != null && args.length > 0) + { + orderLineBean = (OrderLineBean) args[0]; + } + + //----------------------------------------------------------------------------------------------------------------------------- + + //set some default values + String vatRegNumber = ""; + String companyName1 = ""; + String companyName2 = ""; + String companyPhone = ""; + String companyAddress = ""; + String footerMsg = ""; + + //setting receipt header + try + { + MOrg myorg = OrganisationManager.getMyOrg(ctx); + int bpartnerId = myorg.getLinkedC_BPartner_ID(trxName); + + + MBPartner bpartner = BPartnerManager.loadBPartner(ctx,bpartnerId,trxName); + BPartnerBean bean = BPartnerManager.getBpartner(ctx, bpartnerId, trxName); + + vatRegNumber = bpartner.getTaxID(); + companyName1 = bean.getPartnerName(); + companyName2 = bean.getName2(); + companyPhone = bean.getPhone(); + + String add = bean.getAddress1(); + add = (add==null) ? "" : add; + + companyAddress = add; + + add = bean.getAddress2(); + + if(add!=null){ + companyAddress = companyAddress + " " + add; + } + + add = bean.getCity(); + add = (add==null) ? "" : add; + + companyAddress = companyAddress + ", " + add; + + + } catch (OperationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + String title = null; + String customerName = null; + String salesRep = null; + String docStatus = null; + String payment = null; + String customerAddress = null; + String refNo = null; + + //load the order + MOrder order = new MOrder(ctx, recordId, trxName); + + String paymentRule = null; + int priceListId = order.getM_PriceList_ID(); + String currency = PriceListManager.getCurrency(ctx, priceListId); + + //setting payment + paymentRule = order.getPaymentRule(); + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + payment = Constants.PAYMENT_RULE_CASH; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_CreditCard)) + { + payment = Constants.PAYMENT_RULE_CARD; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Check)) + { + payment = Constants.PAYMENT_RULE_CHEQUE; + } + + if(paymentRule.equalsIgnoreCase(UdiConstants.PAYMENTRULE_MIXED)) + { + payment = Constants.PAYMENT_RULE_MIXED; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_OnCredit)) + { + payment = "On Credit"; + } + + //setting ref no + refNo = order.getDocumentNo(); + + //getting orgInfo + MOrg org = new MOrg(ctx,order.getAD_Org_ID(),trxName); + footerMsg = org.getInfo().getReceiptFooterMsg(); + int location_id = org.getInfo().getC_Location_ID(); + MLocation location = new MLocation(ctx,location_id,trxName); + + // orgName = org.getName(); + + String address1 = (location.getAddress1() == null)? " " : location.getAddress1(); + String address2 = (location.getAddress2() == null)? " " : location.getAddress2(); + // orgAddress = (address1 + " " + address2).trim(); + + + //getting orderInfo + docStatus = order.getDocStatusName(); + + //getting salesrep + int saleRep_id = order.getSalesRep_ID(); + MUser user = new MUser(ctx,saleRep_id,null); + salesRep = user.getName(); + + //getting customer info + int bpartner_id = order.getBill_BPartner_ID(); + BPartnerBean bean; + try + { + bean = BPartnerManager.getBpartner(ctx,bpartner_id,trxName); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + + String name1 = (bean.getPartnerName() == null)? " " : bean.getPartnerName(); + String name2 = (bean.getName2() == null)? " " : bean.getName2(); + customerName = (name1 + " " + name2).trim(); + + address1 = (bean.getAddress1() == null)? " " : bean.getAddress1(); + address2 = (bean.getAddress2() == null)? " " : bean.getAddress2(); + customerAddress = (address1 + " " + address2).trim(); + + + ///////////////////////////////drawing the order//////////////////////////////// + StringBuffer reportData = new StringBuffer();//TmkPrinterConstants.LOGO1); + + if(_showLogo) + { + reportData.append(""); + } + + //adding header + reportData.append(_lineTop).append("
    "); + + if(companyName1!=null) + reportData.append("

    ").append(companyName1).append("

    "); + + + if(companyName2!=null) + if(companyName2.trim().length() > 0) + reportData.append("

    ").append("(" + companyName2 + ")").append("

    "); + + if(companyAddress!=null) + reportData.append(companyAddress).append("
    "); + + if(companyPhone!=null) + reportData.append("Tel:" + companyPhone).append("
    "); + + if(vatRegNumber!=null) + reportData.append("VAT Reg No:" + vatRegNumber).append("
    "); + + reportData.append(_lineTop).append("
    "); + + //adding title + + if ( UDIOrderTypes.POS_ORDER.getOrderType().equals(order.getOrderType())) + { + title = "Sales Receipt"; + } + else if ( UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType().equals(order.getOrderType())) + { + title = "Goods Received Note"; + } + else if ( UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType().equals(order.getOrderType())) + { + title = "Goods Returned Note"; + } + else if ( UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType().equals(order.getOrderType())) + { + title = "Customer Returned Order"; + } + else if ( UDIOrderTypes.CREDIT_ORDER.getOrderType().equals(order.getOrderType())) + { + title = "Credit Order"; + } + else + { + throw new OperationException("Unknown order type!"); + } + + reportData.append("

    ") + .append(title) + .append("

    "); + + //adding customer name + customerName = String.format("%1$-" + _halfLineWidth + "s", customerName); + reportData.append(customerName); + + //adding sales rep + salesRep = "Sales Rep:" + salesRep; + salesRep = String.format("%1$"+ _halfLineWidth + "s", salesRep); + reportData.append(salesRep) + .append("
    "); + + //adding customer address + customerAddress = String.format("%1$-" + _lineWidth + "s",customerAddress); + reportData.append(customerAddress) + .append("
    "); + + //adding status + docStatus = "Status:" + docStatus; + docStatus = String.format("%1$-" + _lineWidth + "s",docStatus); + reportData.append(docStatus) + .append("
    "); + + //adding payment + String paymentDetails = String.format("%1$-" + _lineWidth + "s","Payment:" + payment); + reportData.append(paymentDetails) + .append("
    "); + + //adding reference no + refNo = "Ref No:" + refNo; + refNo = String.format("%1$-" + _lineWidth + "s",refNo); + reportData.append(refNo) + .append("
    "); + + //adding date + Calendar c = Calendar.getInstance(); + c.setTime(new Date(order.getCreated().getTime())); + String date = String.format("%1$te %1$tb,%1$tY %1$tH:%1$tM:%1$tS",c); + date = String.format("%1$-" + _lineWidth + "s",date); + reportData.append(date) + .append("
    "); + + //adding orderlines + //1.header + reportData.append(_lineTop).append("
    ");; + + String headerFormat; + if(_showDiscount) + { + headerFormat = "%1$-" + (_lineWidth - ( 7 + 5 + 8 + 10 )) + "s" + + "%2$7s" + + "%3$5s" + + "%4$8s" + + "%5$10s"; + } + else + { + headerFormat = "%1$-" + (_lineWidth - ( 7 + 5 + 13 )) + "s" + + "%2$7s" + + "%3$5s" + + //"%4$8s" + + "%5$13s"; + } + + String header = String.format(headerFormat,"Name","Unit","Qty","Dis","Total"); + reportData.append(header).append("
    "); + + reportData.append(_lineBottom) + .append("
    "); + + //2.body + ShoppingCartBean cart = null; + + try + { + cart = POSManager.getShoppingCartForOrder(ctx, recordId, trxName); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + String name = null; + int qty; + BigDecimal discount = null; + BigDecimal taxAmt = null; + BigDecimal total; + BigDecimal unitPrice; + + int totalQty = 0; + double grandTotal = 0.0d; + double totalTax = 0.0d; + String orderline = ""; + String orderlineFormat = null; + + int nameWidth = 0; + + + if(_showDiscount) + { + orderlineFormat = "" + + "%1$-" + (_lineWidth - ( 7 + 5 + 8 + 10 )) + "s" + //1.product name OR description + "%2$7.2f" + //2.unit price + "%3$5d" + //3.quantity + "%4$8.2f" + //4.discount amount + "%5$10.2f"; //5.total price + + nameWidth = _lineWidth - ( 7 + 5 + 8 + 10 ); + } + else + { + orderlineFormat = "" + + "%1$-" + (_lineWidth - ( 7 + 5 + 13 )) + "s" + //1.product name OR description + "%2$7.2f" + //2.unit price + "%3$5d" + //3.quantity + //"%4$8.2f" + //4.discount amount + "%5$13.2f"; //5.total price + + nameWidth = _lineWidth - ( 7 + 5 + 13 ); + } + + + + for(ItemBean item : cart.getItems()) + { + taxAmt = item.getTaxAmt(); + name = item.getDescription(); + qty = item.getQty().intValue(); + discount = item.getDiscountPercent(); + total = item.getPrice(); + unitPrice = item.getUnitPrice(); + + if( _priceWithVat ) + { + unitPrice = total.divide(item.getQty(), 2, RoundingMode.HALF_EVEN); + } + + + if(name.length() > nameWidth) + { + // print on multiple lines + int beginIndex = 0; + int endIndex = 0; + endIndex = nameWidth; + + while(endIndex < name.length()) + { + String s = name.substring(beginIndex, endIndex); + beginIndex = endIndex; + endIndex = endIndex + nameWidth; + + orderline = String.format("%1$-" + _lineWidth + "s", s); + reportData.append(orderline) + .append("
    "); + } + + name = name.substring(beginIndex); + } + + discount = (discount==null)? new BigDecimal(0.0) : discount; + taxAmt = (taxAmt==null)? new BigDecimal(0.0) : taxAmt; + + double discountAmt = 0.0; + discountAmt = (total.doubleValue() * 100.0)/(100.0 - discount.doubleValue()) - total.doubleValue(); + + totalQty += qty; + grandTotal += total.doubleValue(); + totalTax += taxAmt.doubleValue(); + + if(taxAmt.intValue() == 0) + { + name = name + "*"; + } + + orderline = String.format(orderlineFormat,name,unitPrice,qty,discountAmt,total); + reportData.append(orderline) + .append("
    "); + } + + //3.footer + reportData.append(_lineBottom) + .append("
    "); + + String footerFormat = null; + if(_showDiscount) + { + footerFormat = "" + + "%1$-" + (_lineWidth - ( 5 + 8 + 10 )) + "s" + + "%2$5d" + + "%3$8.2s" + + "%4$10.2f"; + } + else + { + footerFormat = "" + + "%1$-" + (_lineWidth - ( 5 + 3 + 10 )) + "s" + + "%2$5d" + + "%3$3s" + + "%4$10.2f"; + } + + //4.amount tendered & refunded + BigDecimal cashAmountTendered = order.getAmountTendered(); + if(cashAmountTendered == null) + { + cashAmountTendered = new BigDecimal(0.0); + } + BigDecimal cashAmountRefunded = Env.ZERO; + if (MOrder.PAYMENTRULE_Cash.equals(order.getPaymentRule())) + { + cashAmountRefunded = order.getAmountRefunded(); + } + if(cashAmountRefunded == null) + { + cashAmountRefunded = new BigDecimal(0.0); + } + + BigDecimal cardAmountTendered = new BigDecimal(0.0d); + BigDecimal chequeAmountTendered = new BigDecimal(0.0d); + + + if(orderLineBean != null) + { + Double cardAmt = orderLineBean.getPaymentByCard(); + Double chequeAmt = orderLineBean.getPaymentByChq(); + + if(cardAmt == null) + { + cardAmountTendered = new BigDecimal(0.0d); + } + else + { + cardAmountTendered = new BigDecimal(cardAmt.doubleValue()); + } + + if(chequeAmt == null) + { + chequeAmountTendered = new BigDecimal(0.0d); + } + else + { + chequeAmountTendered = new BigDecimal(chequeAmt.doubleValue()); + } + } + else + { + + if(MOrder.STATUS_Completed.equalsIgnoreCase(order.getDocStatus())) + if(order.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType())) + { + try + { + cardAmountTendered = POSManager.getPayment(ctx, order.get_ID(), MPayment.TENDERTYPE_CreditCard, trxName); + chequeAmountTendered = POSManager.getPayment(ctx, order.get_ID(), MPayment.TENDERTYPE_Check, trxName); + } + catch (OperationException e) + { + throw new FormattingException("Cannot get payment",e); + } + } + else + { + cardAmountTendered = new BigDecimal(0.0d); + chequeAmountTendered = new BigDecimal(0.0d); + } + + } + + BigDecimal discountAmt = Env.ZERO; + BigDecimal writeOffAmt = Env.ZERO; + BigDecimal paymentAmt = Env.ZERO; + String writeOff = ""; + String actualPayment = ""; + String seperator = ""; + + MInvoice invoice = new MInvoice(ctx, order.getC_Invoice_ID(), trxName); + + if(invoice == null) + { + throw new OperationException("Could not load Invoice."); + } + + MCashLine cashLine = new MCashLine(ctx, invoice.getC_CashLine_ID(), trxName); + + if(cashLine == null) + { + throw new OperationException("Could not load CashLine"); + } + else + { + writeOffAmt = cashLine.getWriteOffAmt(); + paymentAmt = cashLine.getAmount(); + discountAmt = cashLine.getDiscountAmt(); + + if(writeOffAmt.doubleValue() == 0.0) + { + writeOffAmt = new BigDecimal(0.0d); + } + + if(discountAmt.doubleValue() == 0.0) + { + discountAmt = new BigDecimal(0.0d); + } + } + + String orderFooter = ""; + + if(discountAmt.doubleValue() > 0.0d) + { + orderFooter = String.format(footerFormat,"Sub Total",totalQty,currency,grandTotal); + } + else + { + orderFooter = String.format(footerFormat,"Grand Total",totalQty,currency,grandTotal); + } + reportData.append(orderFooter) + .append("
    "); + + reportData.append(_lineTop) + .append("
    "); + + if(!order.getOrderType().equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER.getOrderType())) + { + if(order.getOrderType().equalsIgnoreCase("POS Order")) + { + BigDecimal totalAfterDiscount = order.getGrandTotal().subtract(discountAmt); + + if(discountAmt.doubleValue() > 0.0d) + { + String str = String.format("%1$25s%2$4s:%3$10.2f","Less Discount", currency, discountAmt); + reportData.append(str).append("
    "); + + String totalAfterDiscountStr = String.format("%1$25s%2$4s:%3$10.2f","Grand Total", currency, totalAfterDiscount); + reportData.append(totalAfterDiscountStr).append("
    "); + + seperator = String.format("%1$25s%2$15s","","------------"); + reportData.append(seperator).append("
    "); + } + + if(payment.equalsIgnoreCase(Constants.PAYMENT_RULE_CASH)) + { + writeOff = String.format("%1$25s%2$4s:%3$10.2f","Write Off Amt", currency, writeOffAmt); + reportData.append(writeOff).append("
    "); + + actualPayment = String.format("%1$25s%2$4s:%3$10.2f","Payment Amt", currency, paymentAmt); + reportData.append(actualPayment).append("
    "); + } + + } + + String amountTendered = String.format("%1$25s%2$4s:%3$10.2f","Cash Tendered",currency,cashAmountTendered); + String amountRefunded = String.format("%1$25s%2$4s:%3$10.2f","Cash Refunded",currency,cashAmountRefunded); + + String cardTendered = String.format("%1$25s%2$4s:%3$10.2f","Card Tendered",currency,cardAmountTendered); + String chequeTendered = String.format("%1$25s%2$4s:%3$10.2f","Cheque Tendered",currency,chequeAmountTendered); + + if(cashAmountTendered.doubleValue() > 0.0d) + { + reportData.append(amountTendered).append("
    "); + } + + if(cardAmountTendered.doubleValue() > 0.0d) + { + reportData.append(cardTendered).append("
    "); + } + + if(chequeAmountTendered.doubleValue() > 0.0d) + { + reportData.append(chequeTendered).append("
    "); + } + + if(cashAmountTendered.doubleValue() > 0.0d && MOrder.PAYMENTRULE_Cash.equals(order.getPaymentRule())) + { + reportData.append(amountRefunded).append("
    "); + } + } + + + String totalVAT = String.format("%1$.2f",totalTax); + String vat = String.format("%1$-" + _lineWidth + "s","Total VAT:" + currency + totalVAT); + reportData.append("
    ") + .append(vat) + .append("
    "); + + String noVAT = String.format("%1$-" + _lineWidth + "s","* NO VAT"); + + + + reportData.append(noVAT) + .append("
    ") + .append("
    "); + + if(_showBarcode) + { + String barcode = order.getDocumentNo(); + reportData.append(barcode) + .append("
    "); + } + + + //reportData.append("*** Thank you ***") + reportData.append("
    "); + + + if(_showFooter) + if( _footerMessage.length() > 0 ) + { + reportData.append("
    ") + .append(_footerMessage) + .append("
    "); + } + + + if( order.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType()) ) + { + /* + reportData.append("
    ") + .append("*Goods once sold cannot be returned."); + */ + reportData.append("
    "); + reportData.append("
    "); + + if(footerMsg != null && footerMsg.length() != 0) + { + if(footerMsg.length() > 43) + { + String temp = ""; + String formattedFooterMsg = ""; + + while(footerMsg.length() > 43) + { + temp = footerMsg.substring(0, 42); + + if(!(temp.endsWith(" "))) + { + temp = temp.substring(0, temp.lastIndexOf(" ")); + formattedFooterMsg = formattedFooterMsg + temp.concat("
    "); + } + else + { + formattedFooterMsg = formattedFooterMsg + temp.concat("
    "); + } + + footerMsg = footerMsg.substring(temp.lastIndexOf(" ") +1); + } + + formattedFooterMsg = formattedFooterMsg.concat(footerMsg); + reportData.append(formattedFooterMsg); + } + else + { + reportData.append(footerMsg); + } + } + } + + return reportData.toString(); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/IPrintFormatter.java b/posterita/posterita/src/main/org/posterita/util/IPrintFormatter.java new file mode 100644 index 0000000000..cc328ab18c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/IPrintFormatter.java @@ -0,0 +1,33 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.util; + +import java.util.Properties; + +/** + * @author alok + */ + +public interface IPrintFormatter +{ + public String format(Properties ctx,int recordId, Object ...args) throws Exception; +} + diff --git a/posterita/posterita/src/main/org/posterita/util/InvoiceFormatter.java b/posterita/posterita/src/main/org/posterita/util/InvoiceFormatter.java new file mode 100644 index 0000000000..d3d869098e --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/InvoiceFormatter.java @@ -0,0 +1,308 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 26, 2006 + */ + + +package org.posterita.util; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import org.compiere.model.MDocType; +import org.compiere.model.MInvoice; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MUser; + +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.InvoiceManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.core.ContextId; +import org.posterita.exceptions.FormattingException; +import org.posterita.formatter.Formatter; +import org.posterita.lib.UdiConstants; + + +public class InvoiceFormatter extends Formatter +{ + + @Override + public Object format(Object target) throws FormattingException + { + + ContextId ctxId = (ContextId) target; + + Properties ctx = ctxId.getCtx(); + int recordId = ctxId.getId(); + + String title = null; + String customerName = null; + String salesRep = null; + String docStatus = null; + String payment = null; + String customerAddress = null; + String orderType=null; + //String dateOrdered = null; + String refNo = null; + + //load the order + MInvoice invoice = new MInvoice(ctx, recordId, null); + + String paymentRule = null; + + //setting payment + paymentRule = invoice.getPaymentRule(); + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + payment = Constants.PAYMENT_RULE_CASH; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_CreditCard)) + { + payment = Constants.PAYMENT_RULE_CARD; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Check)) + { + payment = Constants.PAYMENT_RULE_CHEQUE; + } + + if(paymentRule.equalsIgnoreCase(UdiConstants.PAYMENTRULE_MIXED)) + { + payment = Constants.PAYMENT_RULE_MIXED; + } + //setting ref no + refNo = invoice.getDocumentNo(); + + //getting orgInfo + MOrg org = new MOrg(ctx,invoice.getAD_Org_ID(),null); + int location_id = org.getInfo().getC_Location_ID(); + MLocation location = new MLocation(ctx,location_id,null); + + + String address1 = (location.getAddress1() == null)? " " : location.getAddress1(); + String address2 = (location.getAddress2() == null)? " " : location.getAddress2(); + + //getting order type + int docTypeId = invoice.getC_DocType_ID(); + MDocType docType = new MDocType(ctx, docTypeId, null); + + orderType = docType.getName(); + + //getting orderInfo + docStatus = invoice.getDocStatusName(); + + + //getting salesrep + int saleRep_id = invoice.getSalesRep_ID(); + MUser user = new MUser(ctx,saleRep_id,null); + salesRep = user.getName(); + + //getting customer info + int bpartner_id = invoice.getC_BPartner_ID(); + BPartnerBean bean; + try + { + bean = BPartnerManager.getBpartner(ctx,bpartner_id,null); + } + catch(Exception e) + { + throw new FormattingException("Formatting",e); + } + + + String name1 = (bean.getPartnerName() == null)? " " : bean.getPartnerName(); + String name2 = (bean.getName2() == null)? " " : bean.getName2(); + customerName = (name1 + " " + name2).trim(); + + address1 = (bean.getAddress1() == null)? " " : bean.getAddress1(); + address2 = (bean.getAddress2() == null)? " " : bean.getAddress2(); + customerAddress = (address1 + " " + address2).trim(); + + + ///////////////////////////////drawing the order//////////////////////////////// + StringBuffer reportData = new StringBuffer(TmkPrinterConstants.LOGO1); + //adding title + title = orderType; + reportData.append(TmkPrinterConstants.BIG_FONT) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(title) + .append(TmkPrinterConstants.LINE_FEED); + + //setting small font + reportData.append(TmkPrinterConstants.SMALL_FONT); + reportData.append(TmkPrinterConstants.LEFT_ALIGN); + + //adding customer name + customerName = String.format("%1$-30s",customerName); + reportData.append(customerName); + + //adding sales rep + salesRep = "Sales Rep:" + salesRep; + salesRep = String.format("%1$30s",salesRep); + reportData.append(salesRep) + .append(TmkPrinterConstants.LINE_FEED); + + //adding customer address + customerAddress = String.format("%1$-60s",customerAddress); + reportData.append(customerAddress) + .append(TmkPrinterConstants.LINE_FEED); + + //adding status + docStatus = "Status:" + docStatus; + docStatus = String.format("%1$-60s",docStatus); + reportData.append(docStatus) + .append(TmkPrinterConstants.LINE_FEED); + + //adding payment + payment = "Payment:" + payment; + payment = String.format("%1$-60s",payment); + reportData.append(payment) + .append(TmkPrinterConstants.LINE_FEED); + + //adding reference no + refNo = "Ref No:" + refNo; + refNo = String.format("%1$-60s",refNo); + reportData.append(refNo) + .append(TmkPrinterConstants.LINE_FEED); + + //adding date + Calendar c = Calendar.getInstance(); + c.setTime(new Date(invoice.getCreated().getTime())); + String date = String.format("%1$te %1$tb,%1$tY %1$tH:%1$tM:%1$tS",c); + date = String.format("%1$-60s",date); + reportData.append(date) + .append(TmkPrinterConstants.LINE_FEED); + + //adding orderlines + //1.header + reportData.append(TmkPrinterConstants.H_FULL_LINE_TOP).append("\n"); + + String headerFormat = "" + + "%1$-40s" + + "%2$5s" + + "%3$5s" + + "%4$10s"; + + String header = String.format(headerFormat,"Name","Qty","","Total"); + reportData.append(header).append("\n"); + + reportData.append(TmkPrinterConstants.H_FULL_LINE_BOTTOM) + .append(TmkPrinterConstants.LINE_FEED); + + ArrayList invoiceLineList; + + //2.body + try + { + invoiceLineList = InvoiceManager.populateInvoiceLines(ctx,invoice,false); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + + String name = null; + int qty; + + BigDecimal taxAmt = null; + BigDecimal total; + + int totalQty = 0; + double grandTotal = 0.0d; + double totalTax = 0.0d; + String orderline = ""; + + String orderlineFormat = "" + + "%1$-40s" + + "%2$5d" + + "%3$5s" + + "%4$10.2f"; + + for(WebOrderLineBean wbean : invoiceLineList) + { + taxAmt = wbean.getTaxAmt(); + name = wbean.getDescription(); + qty = wbean.getQtyOrdered().intValue(); + total = wbean.getLineTotalAmt(); + + taxAmt = (taxAmt==null)? new BigDecimal(0.0) : taxAmt; + + totalQty += qty; + grandTotal += total.doubleValue(); + totalTax += taxAmt.doubleValue(); + + if(taxAmt.intValue() == 0) + { + name = name + "*"; + } + + orderline = String.format(orderlineFormat,name,qty,"",total); + reportData.append(orderline) + .append(TmkPrinterConstants.LINE_FEED); + } + + //3.footer + reportData.append(TmkPrinterConstants.H_FULL_LINE_BOTTOM) + .append(TmkPrinterConstants.LINE_FEED); + + String footerFormat = "" + + "%1$-40s" + + "%2$5d" + + "%3$5s" + + "%4$10.2f"; + + String footer = String.format(footerFormat,"Grand Total",totalQty,"Rs",grandTotal); + reportData.append(footer) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(TmkPrinterConstants.H_FULL_LINE_TOP) + .append(TmkPrinterConstants.LINE_FEED); + + + String totalVAT = String.format("%1$.2f",totalTax); + String vat = String.format("%1$-60s","Total VAT:Rs"+totalVAT); + reportData.append(vat) + .append(TmkPrinterConstants.LINE_FEED); + + String noVAT = String.format("%1$-60s","* NO VAT"); + reportData.append(noVAT) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.PAPER_CUT); + + + return reportData.toString(); + } + + @Override + public Object unformat(Object target) + { + return null; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/util/ListUtil.java b/posterita/posterita/src/main/org/posterita/util/ListUtil.java new file mode 100644 index 0000000000..2f36dce1a1 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/ListUtil.java @@ -0,0 +1,44 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Created on Oct 3, 2006 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.util; + +import java.util.ArrayList; + +public class ListUtil +{ + public static ArrayList getListFromArray(T[] a) + { + ArrayList retList = new ArrayList(); + if(a != null) + { + for(T t : a) + retList.add(t); + } + return retList; + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/MinOutFormatter.java b/posterita/posterita/src/main/org/posterita/util/MinOutFormatter.java new file mode 100644 index 0000000000..cedd4e2b68 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/MinOutFormatter.java @@ -0,0 +1,44 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 26, 2006 + */ + + +package org.posterita.util; + +import org.posterita.formatter.Formatter; + + +public class MinOutFormatter extends Formatter +{ + + @Override + public Object format(Object target) + { + return null; + } + + @Override + public Object unformat(Object target) + { + return null; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/util/OSBroOrderPrintFormatter1.java b/posterita/posterita/src/main/org/posterita/util/OSBroOrderPrintFormatter1.java new file mode 100644 index 0000000000..fa1a3bdec7 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/OSBroOrderPrintFormatter1.java @@ -0,0 +1,655 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 23, 2006 + */ + + +package org.posterita.util; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.logging.Level; + +import org.compiere.model.MBPartner; +import org.compiere.model.MCashLine; +import org.compiere.model.MInvoice; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MPOS; +import org.compiere.model.MPayment; +import org.compiere.model.MUser; +import org.compiere.util.CLogger; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.exceptions.FormattingException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; + + + +public class OSBroOrderPrintFormatter1 extends AbstractPrintFormatter +{ + private static final CLogger log = CLogger.getCLogger(OSBroOrderPrintFormatter1.class); + + public OSBroOrderPrintFormatter1(String args) + { + super(args); + } + + public OSBroOrderPrintFormatter1(String args, String trxName) + { + super(args); + this.trxName = trxName; + } + + public String format(Properties ctx, int recordId, Object... args) throws Exception + { + + //require UDIBean + OrderLineBean orderLineBean = null; + if( args != null && args.length > 0) + { + orderLineBean = (OrderLineBean) args[0]; + } + + //----------------------------------------------------------------------------------------------------------------------------- + + //set some default values + String vatRegNumber = ""; + String companyName1 = ""; + String companyName2 = ""; + String companyPhone = ""; + String companyFax = ""; + String companyAddress = ""; + String footerMsg = ""; + String terminal = ""; + + //setting receipt header + try + { + MOrg myorg = OrganisationManager.getMyOrg(ctx); + int bpartnerId = myorg.getLinkedC_BPartner_ID(trxName); + + //get footer message + footerMsg = myorg.getInfo().getReceiptFooterMsg(); + + + MBPartner linkedBPartner = BPartnerManager.loadBPartner(ctx,bpartnerId,trxName); + BPartnerBean linkedBPartnerBean = BPartnerManager.getBpartner(ctx, bpartnerId, trxName); + + vatRegNumber = linkedBPartner.getTaxID(); + companyName1 = linkedBPartnerBean.getPartnerName(); + companyName2 = linkedBPartnerBean.getName2(); + companyPhone = linkedBPartnerBean.getPhone(); + companyFax = linkedBPartnerBean.getFax(); + + String address1 = linkedBPartnerBean.getAddress1(); + String address2 = linkedBPartnerBean.getAddress2(); + String city = linkedBPartnerBean.getCity(); + String postalAddress = linkedBPartnerBean.getPostalAddress(); + String postalCode = linkedBPartnerBean.getPostalCode(); + + String newLine = System.getProperty("line.separator"); + companyAddress = (address1==null) ? companyAddress : getFormattedText(address1, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN); + companyAddress = (address2==null) ? companyAddress : companyAddress + getFormattedText(address2, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN); + companyAddress = (postalAddress==null) ? companyAddress : companyAddress + getFormattedText(postalAddress, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN); + companyAddress = (city==null) ? companyAddress : companyAddress + getFormattedText(city, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN); + companyAddress = (postalCode==null) ? companyAddress : companyAddress + getFormattedText(postalCode, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN); + } + catch (OperationException e1) + { + log.log(Level.SEVERE, "Could not get details for linked business partner", e1); + } + + String title = null; + String customerName = null; + String salesRep = null; + String docStatus = null; + String payment = null; + String customerAddress = null; + String refNo = null; + + //load the order + MOrder order = new MOrder(ctx, recordId, trxName); + + // Load terminal info + MPOS posTerminal = new MPOS(ctx, order.getC_POS_ID(), trxName); + terminal = posTerminal.getName(); + + //getting customer info + int bpartner_id = order.getBill_BPartner_ID(); + BPartnerBean bean; + try + { + bean = BPartnerManager.getBpartner(ctx,bpartner_id,trxName); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + String name1 = (bean.getPartnerName() == null)? " " : bean.getPartnerName(); + String name2 = (bean.getName2() == null)? " " : bean.getName2(); + customerName = (name1 + " " + name2).trim(); + + String address1 = (bean.getAddress1() == null)? " " : bean.getAddress1(); + String address2 = (bean.getAddress2() == null)? " " : bean.getAddress2(); + customerAddress = (address1 + " " + address2).trim(); + + MBPartner customer = BPartnerManager.loadBPartner(ctx,bean.getBpartnerId(),trxName); + String customerVAT = customer.getTaxID()==null?"":customer.getTaxID(); + + if ( UDIOrderTypes.POS_ORDER.getOrderType().equals(order.getOrderType()) + || order.getOrderType().equals(null) + || UDIOrderTypes.CREDIT_ORDER.getOrderType().equals(order.getOrderType())) + { + title = "Tax Invoice"; + } + if ( UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType().equals(order.getOrderType())) + { + title = "Goods Receive Note"; + } + if ( UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType().equals(order.getOrderType())) + { + title = "Goods Return Note"; + } + if ( UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType().equals(order.getOrderType())) + { + title = "Customer Return Order"; + } + + + ///////////////////////////////drawing the order//////////////////////////////// + StringBuffer reportData = new StringBuffer(); + + // add title + reportData.append(getFormattedText("***" + title + "***", TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + + // add company name + if(companyName1 != null) + { + // TODO Refactor code push code in getFormattedText(String text, String font, String alignment, boolean addLineFeed) method + int lineWidth = getLineWidth(TmkPrinterConstants.FONT_DOUBLE); + //split name1 + StringTokenizer st = new StringTokenizer(companyName1); + String line = ""; + + while(st.hasMoreTokens()) + { + String s = st.nextToken(); + + if((line + " " + s).length() > lineWidth) + { + reportData.append(getFormattedText(line, TmkPrinterConstants.FONT_DOUBLE, TmkPrinterConstants.LEFT_ALIGN)); + line = ""; + } + + line += s + " "; + + } + + reportData.append(getFormattedText(line, TmkPrinterConstants.FONT_DOUBLE, TmkPrinterConstants.LEFT_ALIGN)); + + } + + // add company branch + if(companyName2 != null) + { + if(companyName2.trim().length() > 0) + { + reportData.append(getFormattedText(companyName2, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + } + + reportData.append(TmkPrinterConstants.LINE_FEED); + + // add vat# + if(vatRegNumber != null) + { + reportData.append(getFormattedText("VAT NO: " + vatRegNumber, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + + // add phone# + if(companyPhone != null) + { + reportData.append(getFormattedText("TEL: " + companyPhone, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + + // add fax# + if(companyFax != null) + { + reportData.append(getFormattedText("FAX: " + companyFax, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + + reportData.append(TmkPrinterConstants.LINE_FEED); + + // add date & time + Calendar c = Calendar.getInstance(); + c.setTime(new Date(order.getCreated().getTime())); + String date = String.format("%1$te/%1$tm/%1$tY",c); + String time = String.format("%1$tH:%1$tM",c); + String dateTime = "DATE: " + date + " TIME: " + time; + + reportData.append(getFormattedText(dateTime, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + + // add till# + if(terminal != null) + { + reportData.append(getFormattedText("TILL : " + terminal, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + + if (companyAddress != null) + { + reportData.append(companyAddress); + } + + // add Invoice # + MInvoice[] invoices = order.getInvoices(); + if(invoices.length > 0) + { + MInvoice invoice = invoices[0]; + reportData.append(getFormattedText("INVOICE NO : " + invoice.getDocumentNo(), TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + + + // add BP account# followed by address and VAT# + // reportData.append(getFormattedText(customerActNumber, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + reportData.append(getFormattedText(customerName, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + reportData.append(getFormattedText(address1, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + reportData.append(getFormattedText(address2, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + reportData.append(getFormattedText("Client VAT No: " + customerVAT, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + + reportData.append(getFormattedText(_lineTop, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.CENTER_ALIGN)); + + // 1.body + ArrayList orderLineList; + + try + { + orderLineList = POSManager.populateOrderLines(ctx,order); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + BigDecimal lineQty = Env.ZERO; + BigDecimal lineDiscount = Env.ZERO; + BigDecimal lineTaxAmt = Env.ZERO; + BigDecimal lineTotal = Env.ZERO; + BigDecimal lineListPrice = Env.ZERO; + BigDecimal lineInclUnitPrice = Env.ZERO; + BigDecimal linePriceActual = Env.ZERO; + BigDecimal lineTaxRate = Env.ZERO; + BigDecimal orderTotalQty = Env.ZERO; + BigDecimal orderGrandTotal = Env.ZERO; + BigDecimal orderTotalTax = Env.ZERO; + Boolean isTaxIncluded = order.isTaxIncluded(); + + String orderline = ""; + String orderlineFormat = ""; + + orderlineFormat = "%1$-9.2f X %2$-10.2f %3$" + (_lineWidth - (9 + 10 + 4) + ".2f"); + + BigDecimal orderTotalDiscount = Env.ZERO; + for(WebOrderLineBean wbean : orderLineList) + { + String productName = wbean.getProductName(); + String productDesc = wbean.getDescription(); + int nameLength = productName.length(); + int space = 2; + int descLength = productDesc.length(); + + if ((nameLength + descLength + space) > _lineWidth) + { + int trunc = nameLength + descLength + space - _lineWidth; + productDesc = productDesc.substring(0, descLength-trunc-1); + } + + orderline = String.format("%1$-"+ (nameLength + space) +"s %2$-" + (_lineWidth - (nameLength + space + 1))+ "s", productName, productDesc); + reportData.append(TmkPrinterConstants.FONT_SMALL) + .append(orderline); + + lineTaxAmt = wbean.getTaxAmt()==null?Env.ZERO :wbean.getTaxAmt(); + lineTaxRate = wbean.getTaxRate() == null? Env.ZERO : wbean.getTaxRate(); + lineQty = wbean.getQtyOrdered(); + lineDiscount = wbean.getDiscountPercentage()==null?Env.ZERO :wbean.getDiscountPercentage(); + lineListPrice = wbean.getUnitPrice(); + linePriceActual = wbean.getPriceActual(); + + lineTotal = linePriceActual.multiply(lineQty); + + BigDecimal taxRateMulFactor = (lineTaxRate.divide(Env.ONEHUNDRED)).add(Env.ONE).setScale(2, RoundingMode.HALF_DOWN); + BigDecimal discountMulFactor = (lineDiscount.divide(Env.ONEHUNDRED)).add(Env.ONE).setScale(2, RoundingMode.HALF_DOWN); + BigDecimal discountAmt = lineListPrice.multiply(lineDiscount).multiply(taxRateMulFactor).setScale(2, RoundingMode.HALF_DOWN); + + if (isTaxIncluded) + { + lineInclUnitPrice = linePriceActual; + orderGrandTotal = orderGrandTotal.add(lineTotal); + } + else + { + lineInclUnitPrice = linePriceActual.multiply(taxRateMulFactor).setScale(2, RoundingMode.HALF_DOWN); + orderGrandTotal = orderGrandTotal.add(lineTotal).add(lineTaxAmt); + } + + orderTotalDiscount = orderTotalDiscount.add(discountAmt); + orderTotalQty = orderTotalQty.add(lineQty); + orderTotalTax = orderTotalTax.add(lineTaxAmt); + + orderline = String.format(orderlineFormat, lineQty, lineInclUnitPrice, lineInclUnitPrice.multiply(lineQty)); + reportData.append(TmkPrinterConstants.FONT_SMALL) + .append(orderline) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(getFormattedText(_lineBottom, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.CENTER_ALIGN)); + } + + // 2.footer + String footerFormat = "%1$6s %2$" + (_lineWidth - (6 + 1)) + ".2f"; + String orderFooter = String.format(footerFormat,"TOTAL",orderGrandTotal); + reportData.append(TmkPrinterConstants.FONT_SMALL) + .append(orderFooter) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.LINE_FEED); + + footerFormat = "%1$6s %2$-" + (_lineWidth - (10)) + ".2f"; + orderFooter = String.format(footerFormat,"Total VAT",orderTotalTax); + reportData.append(TmkPrinterConstants.FONT_SMALL) + .append(orderFooter) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.LINE_FEED); + + // add messages + // align contents to left + reportData.append(TmkPrinterConstants.LEFT_ALIGN); + + reportData.append(TmkPrinterConstants.LINE_FEED).append(TmkPrinterConstants.LINE_FEED); + + reportData.append(getFormattedText("Total Items..... "+ String.format("%1$-9.2f",orderTotalQty), TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + + reportData.append(TmkPrinterConstants.LINE_FEED).append(TmkPrinterConstants.LINE_FEED); + + /*-----------------------------------------------------------------------------------*/ + + // 4.amount tendered & refunded + + if (UDIOrderTypes.CREDIT_ORDER.getOrderType().equals(order.getOrderType())) + { + MInvoice invoice = order.getInvoices()[0]; + reportData.append(getFormattedText("DEBTORS ACCOUNT SALES " + invoice.getDocumentNo() , TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + + BigDecimal openBalance = customer.getTotalOpenBalance(); + reportData.append(getFormattedText("Balance: " + String.format("%1$10.2f", openBalance) , TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + else + { + BigDecimal cashAmountTendered = order.getAmountTendered()==null? Env.ZERO : order.getAmountTendered(); + + BigDecimal cashAmountRefunded = Env.ZERO; + if (MOrder.PAYMENTRULE_Cash.equals(order.getPaymentRule())) + { + cashAmountRefunded = order.getAmountRefunded() == null? cashAmountRefunded : order.getAmountRefunded(); + } + + BigDecimal cardAmountTendered = Env.ZERO; + BigDecimal chequeAmountTendered = Env.ZERO; + BigDecimal writeOffAmt = Env.ZERO; + BigDecimal orderDiscount = Env.ZERO; + BigDecimal paymentAmt = Env.ZERO; + + if (MOrder.STATUS_Completed.equalsIgnoreCase(order.getDocStatus())) + { + if(order.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType())) + { + try + { + orderDiscount = POSManager.getFromInvoice(ctx, order.getC_Invoice_ID(), Constants.ORDER_DICOUNT, trxName); + writeOffAmt = POSManager.getFromInvoice(ctx, order.getC_Invoice_ID(), Constants.ORDER_WRITE_OFF, trxName); + cardAmountTendered = POSManager.getFromInvoice(ctx, order.getC_Invoice_ID(), Constants.ORDER_CARD_AMOUNT, trxName); + chequeAmountTendered = POSManager.getFromInvoice(ctx, order.getC_Invoice_ID(), Constants.ORDER_CHECK_AMOUNT, trxName); + paymentAmt = POSManager.getFromInvoice(ctx, order.getC_Invoice_ID(), Constants.ORDER_PAYMENT, trxName); + + } + catch (OperationException e) + { + throw new FormattingException("Cannot get payment",e); + } + } + } + + boolean discountOnOrderLine = false; + + if (orderTotalDiscount.compareTo(Env.ZERO) == 1) + { + discountOnOrderLine = true; + } + orderTotalDiscount = orderTotalDiscount.add(orderDiscount); + + if (orderTotalDiscount.compareTo(Env.ZERO)==1 && !discountOnOrderLine) + { + String discountAmtStr = String.format("Discount Amt :%1$10.2f", orderTotalDiscount); + reportData.append(getFormattedText(discountAmtStr, TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.LEFT_ALIGN)).append(TmkPrinterConstants.LINE_FEED); + } + if (writeOffAmt.compareTo(Env.ZERO)==1 && MOrder.PAYMENTRULE_Cash.equals(order.getPaymentRule())) + { + String writeOff = String.format("Write Off Amt :%1$10.2f", writeOffAmt); + reportData.append(getFormattedText(writeOff, TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.LEFT_ALIGN)); + } + if (paymentAmt.compareTo(Env.ZERO)==1) + { + String actualPayment = String.format("Payment Amt :%1$10.2f", paymentAmt); + reportData.append(getFormattedText(actualPayment, TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.LEFT_ALIGN)); + } + + String amountTendered = String.format("Cash Tendered :%1$10.2f", cashAmountTendered); + String amountRefunded = String.format("Cash refunded :%1$10.2f", cashAmountRefunded); + String cardTendered = String.format("Card Tendered :%1$10.2f", cardAmountTendered); + String chequeTendered = String.format("Cheque Tendered:%1$10.2f", chequeAmountTendered); + + if (MOrder.PAYMENTRULE_Cash.equals(order.getPaymentRule()) || MOrder.PAYMENTRULE_Mixed.equals(order.getPaymentRule())) + { + if(cashAmountTendered.doubleValue() > 0.0d) + { + reportData.append(getFormattedText(amountTendered, TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.LEFT_ALIGN)); + } + if (cashAmountRefunded.compareTo(Env.ZERO) == 1) + { + reportData.append(getFormattedText(amountRefunded, TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.LEFT_ALIGN)); + } + } + if (MOrder.PAYMENTRULE_CreditCard.equals(order.getPaymentRule()) || MOrder.PAYMENTRULE_Mixed.equals(order.getPaymentRule())) + { + if(cardAmountTendered.doubleValue() > 0.0d) + { + reportData.append(getFormattedText(cardTendered, TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.LEFT_ALIGN)); + } + } + if (MOrder.PAYMENTRULE_Check.equals(order.getPaymentRule()) || MOrder.PAYMENTRULE_Mixed.equals(order.getPaymentRule())) + { + if(chequeAmountTendered.doubleValue() > 0.0d) + { + reportData.append(getFormattedText(chequeTendered, TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.LEFT_ALIGN)); + } + } + } + + // show if credit sales + + if ( UDIOrderTypes.CREDIT_ORDER.getOrderType().equals(order.getOrderType())) + { + reportData.append(TmkPrinterConstants.LINE_FEED).append(TmkPrinterConstants.LINE_FEED) + .append(getFormattedText("------------------------------" , TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.CENTER_ALIGN)); + + reportData.append(getFormattedText("SIGNATURE OF BUYER" , TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.CENTER_ALIGN)); + + } + + reportData.append(TmkPrinterConstants.LINE_FEED); + + if( order.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType()) ) + { + /*reportData.append(getFormattedText("*** Thank you ***", TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + reportData.append(TmkPrinterConstants.LINE_FEED) + .append(getFormattedText("*Goods once sold cannot be returned.", TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + reportData.append(TmkPrinterConstants.LINE_FEED);*/ + reportData.append(TmkPrinterConstants.LINE_FEED); + + if(footerMsg != null && footerMsg.length() != 0) + { + if(footerMsg.length() > 40) // 40 is the max no of chars that can fit in a single line + { + String temp = ""; + String splittedFooterMsg = ""; + + while(footerMsg.length() > 40) + { + temp = footerMsg.substring(0, 39); + + if(!(temp.endsWith(" "))) + { + splittedFooterMsg = temp.substring(0, temp.lastIndexOf(" ")); + + } + else + { + splittedFooterMsg = temp; + } + + footerMsg = footerMsg.substring(temp.lastIndexOf(" ") +1); + reportData.append(getFormattedText(splittedFooterMsg, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + + reportData.append(getFormattedText(footerMsg, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + else //footerMsg length < 40 + { + reportData.append(getFormattedText(footerMsg, TmkPrinterConstants.FONT_SMALL, TmkPrinterConstants.LEFT_ALIGN)); + } + } + } + + reportData.append(TmkPrinterConstants.PAPER_CUT).append(TmkPrinterConstants.LINE_FEED); + + return reportData.toString(); + + } + + public String format1(Properties ctx, int recordId, Object... args) throws Exception + { + StringBuffer reportData = new StringBuffer(); + + String text1 = getFormattedText("L", TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.LEFT_ALIGN); + String text2 = getFormattedText("R", TmkPrinterConstants.FONT_NORMAL, TmkPrinterConstants.RIGHT_ALIGN); + + reportData.append(text1); + reportData.append(text2); + + reportData.append(text1); + reportData.append("\r"); + reportData.append(text2); + reportData.append("\n"); + + return reportData.toString(); + } + + private int getLineWidth(String font) + { + if(TmkPrinterConstants.FONT_DOUBLE.equals(font)) + { + return 16; + } + + if(TmkPrinterConstants.FONT_NORMAL.equals(font)) + { + return 33; + } + + if(TmkPrinterConstants.FONT_SMALL.equals(font)) + { + return 40; + } + + return _lineWidth; + } + + public String getFormattedText(String text, String font, String alignment) + { + return getFormattedText(text, font, alignment, true); + } + + public String getFormattedText(String text, String font, String alignment, boolean addLineFeed) + { + int charPerLine = getLineWidth(font); + String formattedText = ""; + + if (TmkPrinterConstants.CENTER_ALIGN.equals(alignment)) + { + formattedText = font + TmkPrinterConstants.CENTER_ALIGN + text; + + if(addLineFeed) + { + formattedText = formattedText + TmkPrinterConstants.LINE_FEED; + } + return formattedText; + } + + if (TmkPrinterConstants.LEFT_ALIGN.equals(alignment)) + { + formattedText = font + String.format("%1$-" + charPerLine + "s", text); + + if(addLineFeed) + { + formattedText = formattedText + TmkPrinterConstants.LINE_FEED; + } + return formattedText; + } + + if (TmkPrinterConstants.RIGHT_ALIGN.equals(alignment)) + { + formattedText = font + String.format("%1$" + charPerLine + "s", text); + + if(addLineFeed) + { + formattedText = formattedText + TmkPrinterConstants.LINE_FEED; + } + return formattedText; + } + + return text; + } + + + + +} diff --git a/posterita/posterita/src/main/org/posterita/util/OrderFormatter.java b/posterita/posterita/src/main/org/posterita/util/OrderFormatter.java new file mode 100644 index 0000000000..81d0f90e5a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/OrderFormatter.java @@ -0,0 +1,524 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 26, 2006 + */ + + +package org.posterita.util; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; +import java.util.ResourceBundle; + +import org.compiere.model.MBPartner; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MPayment; +import org.compiere.model.MUser; + +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.core.ContextId; +import org.posterita.exceptions.FormattingException; +import org.posterita.exceptions.OperationException; +import org.posterita.formatter.Formatter; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; + +import org.posterita.util.TmkPrinterConstants; + + +public class OrderFormatter extends Formatter +{ + private boolean isVatIncluded = true; + + @Override + public Object format(Object target) throws FormattingException + { + ResourceBundle messageResource = ResourceBundle.getBundle("MessageResources"); + + String vatRegNumber = "VAT Reg No:" + messageResource.getString("receipt.VATRegNo"); + String companyName1 = messageResource.getString("receipt.company.name1"); + String companyName2 = messageResource.getString("receipt.company.name2"); + String companyPhone = messageResource.getString("receipt.company.phone"); + String companyAddress = messageResource.getString("receipt.company.address"); + + ContextId ctxId = (ContextId) target; + + Properties ctx = ctxId.getCtx(); + int id = ctxId.getId(); + + //setting receipt header + try + { + MOrg myorg = OrganisationManager.getMyOrg(ctx); + int bpartnerId = myorg.getLinkedC_BPartner_ID(null); + + + MBPartner bpartner = BPartnerManager.loadBPartner(ctx,bpartnerId,null); + BPartnerBean bean = BPartnerManager.getBpartner(ctx, bpartnerId, null); + + vatRegNumber = bpartner.getTaxID(); + companyName1 = bean.getPartnerName(); + companyName2 = bean.getName2(); + companyPhone = bean.getPhone(); + + String add = bean.getAddress1(); + add = (add==null) ? "" : add; + + companyAddress = add; + + add = bean.getAddress2(); + + if(add!=null){ + companyAddress = companyAddress + " " + add; + } + + add = bean.getCity(); + add = (add==null) ? "" : add; + + companyAddress = companyAddress + ", " + add; + + + } catch (OperationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + String title = null; + String customerName = null; + String salesRep = null; + String docStatus = null; + String payment = null; + String customerAddress = null; + String orderType=null; + //String dateOrdered = null; + String refNo = null; + + //load the order + MOrder order = new MOrder(ctx, id, null); + + String paymentRule = null; + + //setting payment + paymentRule = order.getPaymentRule(); + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + payment = Constants.PAYMENT_RULE_CASH; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_CreditCard)) + { + payment = Constants.PAYMENT_RULE_CARD; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Check)) + { + payment = Constants.PAYMENT_RULE_CHEQUE; + } + + if(paymentRule.equalsIgnoreCase(UdiConstants.PAYMENTRULE_MIXED)) + { + payment = Constants.PAYMENT_RULE_MIXED; + } + //setting ref no + refNo = order.getDocumentNo(); + + //getting orgInfo + MOrg org = new MOrg(ctx,order.getAD_Org_ID(),null); + int location_id = org.getInfo().getC_Location_ID(); + MLocation location = new MLocation(ctx,location_id,null); + + // orgName = org.getName(); + + String address1 = (location.getAddress1() == null)? " " : location.getAddress1(); + String address2 = (location.getAddress2() == null)? " " : location.getAddress2(); + // orgAddress = (address1 + " " + address2).trim(); + + //getting order type + orderType = order.getOrderType(); + + //getting orderInfo + docStatus = order.getDocStatusName(); + + + //getting salesrep + int saleRep_id = order.getSalesRep_ID(); + MUser user = new MUser(ctx,saleRep_id,null); + salesRep = user.getName(); + + //getting customer info + int bpartner_id = order.getBill_BPartner_ID(); + BPartnerBean bean; + try + { + bean = BPartnerManager.getBpartner(ctx,bpartner_id,null); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + + String name1 = (bean.getPartnerName() == null)? " " : bean.getPartnerName(); + String name2 = (bean.getName2() == null)? " " : bean.getName2(); + customerName = (name1 + " " + name2).trim(); + + address1 = (bean.getAddress1() == null)? " " : bean.getAddress1(); + address2 = (bean.getAddress2() == null)? " " : bean.getAddress2(); + customerAddress = (address1 + " " + address2).trim(); + + + ///////////////////////////////drawing the order//////////////////////////////// + StringBuffer reportData = new StringBuffer(TmkPrinterConstants.LOGO1); + //adding header + reportData.append(TmkPrinterConstants.SMALL_FONT) + .append(TmkPrinterConstants.H_FULL_LINE_TOP) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(TmkPrinterConstants.LINE_FEED); + + if(companyName1!=null) + reportData.append(TmkPrinterConstants.FONT_DOUBLE) + .append(companyName1) + .append(TmkPrinterConstants.LINE_FEED); + + if(companyName2!=null) + reportData.append(TmkPrinterConstants.CENTER_ALIGN) + .append(TmkPrinterConstants.BIG_FONT) + .append("(" + companyName2 + ")") + .append(TmkPrinterConstants.LINE_FEED); + + if(companyAddress!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append(companyAddress) + .append(TmkPrinterConstants.LINE_FEED); + + if(companyPhone!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append("Tel:" + companyPhone) + .append(TmkPrinterConstants.LINE_FEED); + + if(vatRegNumber!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append("VAT Reg No:" + vatRegNumber) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(TmkPrinterConstants.SMALL_FONT) + .append(TmkPrinterConstants.H_FULL_LINE_TOP) + .append(TmkPrinterConstants.LINE_FEED); + + //adding title + title = orderType; + reportData.append(TmkPrinterConstants.BIG_FONT) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(title) + .append(TmkPrinterConstants.LINE_FEED); + + //setting small font + reportData.append(TmkPrinterConstants.SMALL_FONT); + reportData.append(TmkPrinterConstants.LEFT_ALIGN); + + //adding customer name + customerName = String.format("%1$-30s",customerName); + reportData.append(customerName); + + //adding sales rep + salesRep = "Sales Rep:" + salesRep; + salesRep = String.format("%1$30s",salesRep); + reportData.append(salesRep) + .append(TmkPrinterConstants.LINE_FEED); + + //adding customer address + customerAddress = String.format("%1$-60s",customerAddress); + reportData.append(customerAddress) + .append(TmkPrinterConstants.LINE_FEED); + + //adding status + docStatus = "Status:" + docStatus; + docStatus = String.format("%1$-60s",docStatus); + reportData.append(docStatus) + .append(TmkPrinterConstants.LINE_FEED); + + //adding payment + payment = "Payment:" + payment; + payment = String.format("%1$-60s",payment); + reportData.append(payment) + .append(TmkPrinterConstants.LINE_FEED); + + //adding reference no + refNo = "Ref No:" + refNo; + refNo = String.format("%1$-60s",refNo); + reportData.append(refNo) + .append(TmkPrinterConstants.LINE_FEED); + + //adding date + Calendar c = Calendar.getInstance(); + c.setTime(new Date(order.getCreated().getTime())); + String date = String.format("%1$te %1$tb,%1$tY %1$tH:%1$tM:%1$tS",c); + date = String.format("%1$-60s",date); + reportData.append(date) + .append(TmkPrinterConstants.LINE_FEED); + + //adding orderlines + //1.header + reportData.append(TmkPrinterConstants.H_FULL_LINE_TOP).append("\n"); + + String headerFormat = "" + + "%1$-30s" + + "%2$7s" + + "%3$5s" + + "%4$8s" + + "%5$10s"; + + String header = String.format(headerFormat,"Name","Unit","Qty","Dis","Total"); + reportData.append(header).append("\n"); + + reportData.append(TmkPrinterConstants.H_FULL_LINE_BOTTOM) + .append(TmkPrinterConstants.LINE_FEED); + + //2.body + ArrayList orderLineList; + try + { + orderLineList = POSManager.populateOrderLines(ctx,order); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + String name = null; + int qty; + BigDecimal discount = null; + BigDecimal taxAmt = null; + BigDecimal total; + BigDecimal unitPrice; + + int totalQty = 0; + double grandTotal = 0.0d; + double totalTax = 0.0d; + String orderline = ""; + + String orderlineFormat = "" + + "%1$-30s" + //1.product name OR description + "%2$7.2f" + //2.unit price + "%3$5d" + //3.quantity + "%4$8.2f" + //4.discount amount + "%5$10.2f"; //5.total price + + for(WebOrderLineBean wbean : orderLineList) + { + taxAmt = wbean.getTaxAmt(); + name = wbean.getDescription(); + qty = wbean.getQtyOrdered().intValue(); + discount = wbean.getDiscountPercentage(); + total = wbean.getLineTotalAmt(); + unitPrice = wbean.getUnitPrice(); + + if(isVatIncluded) + { + unitPrice = total.divide(new BigDecimal(qty)); + } + + + discount = (discount==null)? new BigDecimal(0.0) : discount; + taxAmt = (taxAmt==null)? new BigDecimal(0.0) : taxAmt; + + double discountAmt = 0.0; + discountAmt = (total.doubleValue() * 100.0)/(100.0 - discount.doubleValue()) - total.doubleValue(); + + totalQty += qty; + grandTotal += total.doubleValue(); + totalTax += taxAmt.doubleValue(); + + if(taxAmt.intValue() == 0) + { + name = name + "*"; + } + + orderline = String.format(orderlineFormat,name,unitPrice,qty,discountAmt,total); + reportData.append(orderline) + .append(TmkPrinterConstants.LINE_FEED); + } + + //3.footer + reportData.append(TmkPrinterConstants.H_FULL_LINE_BOTTOM) + .append(TmkPrinterConstants.LINE_FEED); + + String footerFormat = "" + + "%1$-37s" + + "%2$5d" + + "%3$8s" + + "%4$10.2f"; + + String footer = String.format(footerFormat,"Grand Total",totalQty,"Rs",grandTotal); + reportData.append(footer) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(TmkPrinterConstants.H_FULL_LINE_TOP) + .append(TmkPrinterConstants.LINE_FEED); + + + //4.amount tendered & refunded + BigDecimal cashAmountTendered = order.getAmountTendered(); + if(cashAmountTendered == null) + { + cashAmountTendered = new BigDecimal(0.0); + } + + BigDecimal cashAmountRefunded = order.getAmountRefunded(); + if(cashAmountRefunded == null) + { + cashAmountRefunded = new BigDecimal(0.0); + } + + BigDecimal cardAmountTendered = null; + BigDecimal chequeAmountTendered = null; + + OrderLineBean orderLineBean = null; + if(ctxId.getBean() != null) + { + orderLineBean = (OrderLineBean) ctxId.getBean(); + Double cardAmt = orderLineBean.getPaymentByCard(); + Double chequeAmt = orderLineBean.getPaymentByChq(); + + if(cardAmt == null) + { + cardAmountTendered = new BigDecimal(0.0d); + } + else + { + cardAmountTendered = new BigDecimal(cardAmt.doubleValue()); + } + + if(chequeAmt == null) + { + chequeAmountTendered = new BigDecimal(0.0d); + } + else + { + chequeAmountTendered = new BigDecimal(chequeAmt.doubleValue()); + } + } + else + { + + if(order.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType())) + { + try + { + cardAmountTendered = POSManager.getPayment(ctx, order.get_ID(),MPayment.TENDERTYPE_CreditCard,null); + chequeAmountTendered = POSManager.getPayment(ctx, order.get_ID(),MPayment.TENDERTYPE_Check,null); + } + catch (OperationException e) + { + throw new FormattingException("Cannot get payment",e); + } + } + else + { + cardAmountTendered = new BigDecimal(0.0d); + chequeAmountTendered = new BigDecimal(0.0d); + } + + } + + String amountTendered = String.format("%1$45s%2$4s:%3$10.2f","Cash Tendered","Rs",cashAmountTendered); + String amountRefunded = String.format("%1$45s%2$4s:%3$10.2f","Cash Refunded","Rs",cashAmountRefunded); + + String seperator = String.format("%1$45s%2$15s","","------------"); + + String cardTendered = String.format("%1$45s%2$4s:%3$10.2f","Card Tendered","Rs",cardAmountTendered); + String chequeTendered = String.format("%1$45s%2$4s:%3$10.2f","Cheque Tendered","Rs",chequeAmountTendered); + + if(cashAmountTendered.doubleValue() > 0.0d) + { + reportData.append(amountTendered).append(TmkPrinterConstants.LINE_FEED); + } + + if(cardAmountTendered.doubleValue() > 0.0d) + { + reportData.append(cardTendered).append(TmkPrinterConstants.LINE_FEED); + } + + if(chequeAmountTendered.doubleValue() > 0.0d) + { + reportData.append(chequeTendered).append(TmkPrinterConstants.LINE_FEED); + } + + if(cashAmountTendered.doubleValue() > 0.0d) + { + reportData.append(seperator).append(TmkPrinterConstants.LINE_FEED); + reportData.append(amountRefunded).append(TmkPrinterConstants.LINE_FEED); + } + + + String totalVAT = String.format("%1$.2f",totalTax); + String vat = String.format("%1$-60s","Total VAT:Rs"+totalVAT); + reportData.append(vat) + .append(TmkPrinterConstants.LINE_FEED); + + String noVAT = String.format("%1$-60s","* NO VAT"); + + //barcode + String barcode = ((char)0x1d ) + "H" + (char)2 + ((char)0x1d ) + "k" + (char)4 + order.getDocumentNo() + (char)0; + String barcodeDim = ((char)0x1d) + "h" + (char)50 + ((char)0x1d) + "w" + (char)3; + + reportData.append(noVAT) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(barcodeDim) + .append(barcode) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.FONT_NORMAL) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append("*** Thank you ***") + .append(TmkPrinterConstants.LINE_FEED); + + if( order.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType()) ) + { + reportData.append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(TmkPrinterConstants.FONT_SMALL) + .append("*Goods once sold cannot be returned."); + } + + reportData.append(TmkPrinterConstants.PAPER_CUT) + .append(TmkPrinterConstants.LINE_FEED); + + + return reportData.toString(); + } + + @Override + public Object unformat(Object target) { + throw new RuntimeException("Method not implemented"); + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/PathInfo.java b/posterita/posterita/src/main/org/posterita/util/PathInfo.java new file mode 100644 index 0000000000..8905bd31a4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/PathInfo.java @@ -0,0 +1,50 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* Created on Mar 15, 2006 by ashley +* +*/ + +package org.posterita.util; + +import javax.servlet.Servlet; +import javax.servlet.ServletContext; + +public class PathInfo +{ + + public static String PROJECT_HOME = ""; + public static final String FILE_SEPARATOR = System.getProperty("file.separator"); + static + { + PROJECT_HOME = System.getProperty("user.dir"); + } + + public static void setPathInfo(Servlet servlet) + { + ServletContext serCtx = servlet.getServletConfig().getServletContext(); + + try + { + PROJECT_HOME = serCtx.getRealPath("") + FILE_SEPARATOR; + } + catch(Exception ex) + {} + + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/PaymentFormatter.java b/posterita/posterita/src/main/org/posterita/util/PaymentFormatter.java new file mode 100644 index 0000000000..ab3cebf0bb --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/PaymentFormatter.java @@ -0,0 +1,43 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Sep 26, 2006 + */ + + +package org.posterita.util; + +import org.posterita.formatter.Formatter; + + +public class PaymentFormatter extends Formatter +{ + + @Override + public Object format(Object target) + { + return null; + } + + @Override + public Object unformat(Object target) + { + return null; + } + +} diff --git a/posterita/posterita/src/main/org/posterita/util/PoManager.java b/posterita/posterita/src/main/org/posterita/util/PoManager.java new file mode 100644 index 0000000000..fba4c3ab1a --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/PoManager.java @@ -0,0 +1,118 @@ +/** + * + * Copyright (c) 2007 Posterita. All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Posterita. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Posterita. + * + * POSTERITA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR + * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Posterita SHALL NOT + * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * + * May 22, 2007 11:46:27 AM by praveen + * + */ + +package org.posterita.util; + +import org.compiere.model.PO; +import org.compiere.model.X_C_Order; +import org.compiere.process.DocAction; +import org.compiere.util.CLogger; +import org.compiere.util.ValueNamePair; +import org.posterita.businesslogic.POSTerminalManager; +import org.posterita.exceptions.OperationException; +import org.posterita.exceptions.TerminalLockedException; + +public class PoManager +{ + public static void save(PO po) throws OperationException + { + boolean saved = po.save(); + if(! saved ) + { + handleError(po); + } + } + + private static void validatePO(PO po) throws OperationException + { + if (po instanceof X_C_Order) + { + X_C_Order order = (X_C_Order)po; + int terminalId = order.getC_POS_ID(); + if (terminalId > 0 && POSTerminalManager.isTerminalLocked(po.getCtx(), terminalId)) + { + throw new TerminalLockedException("Terminal is locked"); + } + } + } + + public static void save(PO po, String trxName) throws OperationException + { + validatePO(po); + boolean saved = po.save(trxName); + if(!saved) + { + handleError(po); + } + } + + private static void handleError(PO po) throws OperationException + { + Exception ex = CLogger.retrieveException(); + ValueNamePair error = CLogger.retrieveError(); + String msg = null; + if(error != null) + { + msg = error.getName(); + } + + if(ex != null) + { + throw new OperationException("Cannot save PO object. " + po.getClass().getName() + " Cause: " + ex.getMessage()); + } + + if(msg != null) + { + throw new OperationException("Cannot save PO object. " + po.getClass().getName() + " Cause: " + msg); + } + + throw new OperationException("Cannot save PO object. " + po.getClass().getName()); + } + + public static void processIt(PO po, String processAction) throws OperationException + { + validatePO(po); + boolean processed = false; + try + { + if(po instanceof DocAction) + { + DocAction docPo = (DocAction)po; + processed = docPo.processIt(processAction); + save(po); + + if (!processed) + { + throw new OperationException("Cannot process " + po.getClass().getName() + " to: " + processAction + " "+ docPo.getProcessMsg()); + } + } + } + catch (OperationException ex) // Should not wrap Operation exception instance + { + throw ex; + } + catch (Exception ex) + { + throw new OperationException(ex.getMessage(), ex); + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/util/RegenerateModels.java b/posterita/posterita/src/main/org/posterita/util/RegenerateModels.java new file mode 100644 index 0000000000..b0e4413797 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/RegenerateModels.java @@ -0,0 +1,119 @@ +/* +* +* Copyright (c) 2007 Posterita Ltd. All Rights Reserved. +* +* This software is the confidential and proprietary information of +* Tamak ICT Ltd. ("Confidential Information"). You shall not +* disclose such Confidential Information and shall use it only in +* accordance with the terms of the license agreement you entered into +* with Tamak ICT. +* +* Tamak ICT MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE +* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT +* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR +* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Tamak ICT SHALL NOT +* BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* +* Created on Feb 6, 2007 by ashley +* +*/ + +/** + @author ashley + */ + +package org.posterita.util; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.logging.Level; + +import org.adempiere.util.ModelClassGenerator; +import org.adempiere.util.ModelInterfaceGenerator; +import org.compiere.Adempiere; +import org.compiere.util.CLogMgt; +import org.compiere.util.DB; + +public class RegenerateModels +{ + + private static final ArrayList tables = new ArrayList(); + private static final String PACKAGE_NAME = "org.compiere.model"; + private static final String DIRECTORY = PathInfo.PROJECT_HOME + "/posterita/src/main/org/compiere/model/"; + + static + { + tables.add("M_PriceList"); + /*tables.add("U_RoleMenu"); + tables.add("U_WEB_PROPERTIES"); + tables.add("U_BlackListCheque"); + tables.add("C_ORDER"); + tables.add("AD_USER"); + tables.add("AD_ROLE"); + tables.add("M_PRODUCT"); + tables.add("AD_PRINTFORMAT");*/ + } + + public static void main(String args[]) throws Exception + { + Adempiere.startupEnvironment(true); + CLogMgt.setLevel(Level.FINE); + + StringBuffer sqlStmt = new StringBuffer(); + + StringBuffer tableNames = new StringBuffer(); + + for (String tblName : tables) + { + tableNames.append(", '").append(tblName).append("'"); + } + + if (tableNames.length() > 0 && tables.size() > 0) + { + String tableInStmt = tableNames.substring(1); + tableInStmt = tableInStmt.toUpperCase(); + + String entityType = "'U','A','D','EXT'"; + sqlStmt.append("SELECT AD_Table_ID from AD_Table where "); + sqlStmt.append(" (TableName IN ('RV_WarehousePrice','RV_BPartner')"); + sqlStmt.append(" OR IsView='N')"); + sqlStmt.append(" AND Upper(TableName) in (").append(tableInStmt).append(") and"); + sqlStmt.append(" EntityType in (").append(entityType).append(")"); + sqlStmt.append(" ORDER BY TableName"); + + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sqlStmt.toString(), null); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + { + int tableId = rs.getInt(1); + new ModelInterfaceGenerator(tableId, DIRECTORY, PACKAGE_NAME); + new ModelClassGenerator(tableId, DIRECTORY, PACKAGE_NAME); + } + rs.close(); + } + catch (SQLException ex) + { + throw ex; + } + finally + { + if (pstmt != null) + { + try + { + pstmt.close(); + } + catch (Exception ex){} + } + } + + } + + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/TMKInvoicePrintFormatter.java b/posterita/posterita/src/main/org/posterita/util/TMKInvoicePrintFormatter.java new file mode 100644 index 0000000000..a86c667010 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/TMKInvoicePrintFormatter.java @@ -0,0 +1,439 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 23, 2006 + */ + + +package org.posterita.util; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MDocType; +import org.compiere.model.MInvoice; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MUser; + +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.InvoiceManager; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.exceptions.FormattingException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; + + + +public class TMKInvoicePrintFormatter extends AbstractPrintFormatter +{ + public TMKInvoicePrintFormatter(String args) + { + super(args); + } + + public String format(Properties ctx, int recordId, Object... args) throws Exception + { + //----------------------------------------------------------------------------------------------------------------------------- + + //set some default values + String vatRegNumber = ""; + String companyName1 = ""; + String companyName2 = ""; + String companyPhone = ""; + String companyAddress = ""; + + //setting receipt header + try + { + MOrg myorg = OrganisationManager.getMyOrg(ctx); + int bpartnerId = myorg.getLinkedC_BPartner_ID(null); + + + MBPartner bpartner = BPartnerManager.loadBPartner(ctx,bpartnerId,null); + BPartnerBean bean = BPartnerManager.getBpartner(ctx, bpartnerId, null); + + vatRegNumber = bpartner.getTaxID(); + companyName1 = bean.getPartnerName(); + companyName2 = bean.getName2(); + companyPhone = bean.getPhone(); + + String add = bean.getAddress1(); + add = (add==null) ? "" : add; + + companyAddress = add; + + add = bean.getAddress2(); + + if(add!=null){ + companyAddress = companyAddress + " " + add; + } + + add = bean.getCity(); + add = (add==null) ? "" : add; + + companyAddress = companyAddress + ", " + add; + + + } catch (OperationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + String title = null; + String customerName = null; + String salesRep = null; + String docStatus = null; + String payment = null; + String customerAddress = null; + String orderType=null; + //String dateOrdered = null; + String refNo = null; + + //load the order + MInvoice invoice = new MInvoice(ctx, recordId, null); + + String paymentRule = null; + + //setting payment + paymentRule = invoice.getPaymentRule(); + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + payment = Constants.PAYMENT_RULE_CASH; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_CreditCard)) + { + payment = Constants.PAYMENT_RULE_CARD; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Check)) + { + payment = Constants.PAYMENT_RULE_CHEQUE; + } + + if(paymentRule.equalsIgnoreCase(UdiConstants.PAYMENTRULE_MIXED)) + { + payment = Constants.PAYMENT_RULE_MIXED; + } + //setting ref no + refNo = invoice.getDocumentNo(); + + //getting orgInfo + MOrg org = new MOrg(ctx,invoice.getAD_Org_ID(),null); + int location_id = org.getInfo().getC_Location_ID(); + MLocation location = new MLocation(ctx,location_id,null); + + + String address1 = (location.getAddress1() == null)? " " : location.getAddress1(); + String address2 = (location.getAddress2() == null)? " " : location.getAddress2(); + + //getting order type + int docTypeId = invoice.getC_DocType_ID(); + MDocType docType = new MDocType(ctx, docTypeId, null); + + orderType = docType.getName(); + + //getting orderInfo + docStatus = invoice.getDocStatusName(); + + + //getting salesrep + int saleRep_id = invoice.getSalesRep_ID(); + MUser user = new MUser(ctx,saleRep_id,null); + salesRep = user.getName(); + + //getting customer info + int bpartner_id = invoice.getC_BPartner_ID(); + BPartnerBean bean; + try + { + bean = BPartnerManager.getBpartner(ctx,bpartner_id,null); + } + catch(Exception e) + { + throw new FormattingException("Formatting",e); + } + + + String name1 = (bean.getPartnerName() == null)? " " : bean.getPartnerName(); + String name2 = (bean.getName2() == null)? " " : bean.getName2(); + customerName = (name1 + " " + name2).trim(); + + address1 = (bean.getAddress1() == null)? " " : bean.getAddress1(); + address2 = (bean.getAddress2() == null)? " " : bean.getAddress2(); + customerAddress = (address1 + " " + address2).trim(); + + + ///////////////////////////////drawing the order//////////////////////////////// + StringBuffer reportData = new StringBuffer();//TmkPrinterConstants.LOGO1); + + if(_showLogo) + { + reportData.append(TmkPrinterConstants.LOGO1); + } + + //adding header + reportData.append(TmkPrinterConstants.FONT_SMALL) + .append(_lineTop) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(TmkPrinterConstants.LINE_FEED); + + if(companyName1!=null) + reportData.append(TmkPrinterConstants.FONT_DOUBLE) + .append(companyName1) + .append(TmkPrinterConstants.LINE_FEED); + + if(companyName2.trim().length() > 0) + if(companyName2!=null) + reportData.append(TmkPrinterConstants.CENTER_ALIGN) + .append(TmkPrinterConstants.BIG_FONT) + .append("(" + companyName2 + ")") + .append(TmkPrinterConstants.LINE_FEED); + + if(companyAddress!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append(companyAddress) + .append(TmkPrinterConstants.LINE_FEED); + + if(companyPhone!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append("Tel:" + companyPhone) + .append(TmkPrinterConstants.LINE_FEED); + + if(vatRegNumber!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append("VAT Reg No:" + vatRegNumber) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(TmkPrinterConstants.FONT_SMALL) + .append(_lineTop) + .append(TmkPrinterConstants.LINE_FEED); + + //adding title + title = "Invoice"; + reportData.append(TmkPrinterConstants.BIG_FONT) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(title) + .append(TmkPrinterConstants.LINE_FEED); + + //setting small font + reportData.append(TmkPrinterConstants.FONT_SMALL); + reportData.append(TmkPrinterConstants.LEFT_ALIGN); + + //adding customer name + customerName = String.format("%1$-" + _halfLineWidth + "s", customerName); + reportData.append(customerName); + + //adding sales rep + salesRep = "Sales Rep:" + salesRep; + salesRep = String.format("%1$"+ _halfLineWidth + "s", salesRep); + reportData.append(salesRep) + .append(TmkPrinterConstants.LINE_FEED); + + //adding customer address + customerAddress = String.format("%1$-" + _lineWidth + "s",customerAddress); + reportData.append(customerAddress) + .append(TmkPrinterConstants.LINE_FEED); + + //adding status + docStatus = "Status:" + docStatus; + docStatus = String.format("%1$-" + _lineWidth + "s",docStatus); + reportData.append(docStatus) + .append(TmkPrinterConstants.LINE_FEED); + + //adding payment + payment = "Payment:" + payment; + payment = String.format("%1$-" + _lineWidth + "s",payment); + reportData.append(payment) + .append(TmkPrinterConstants.LINE_FEED); + + //adding reference no + refNo = "Ref No:" + refNo; + refNo = String.format("%1$-" + _lineWidth + "s",refNo); + reportData.append(refNo) + .append(TmkPrinterConstants.LINE_FEED); + + //adding date + Calendar c = Calendar.getInstance(); + c.setTime(new Date(invoice.getCreated().getTime())); + String date = String.format("%1$te %1$tb,%1$tY %1$tH:%1$tM:%1$tS",c); + date = String.format("%1$-" + _lineWidth + "s",date); + reportData.append(date) + .append(TmkPrinterConstants.LINE_FEED); + + //adding orderlines + //1.header + reportData.append(_lineTop).append("\n"); + + String headerFormat = "%1$-" + (_lineWidth - ( 7 + 5 + 13 )) + "s" + + "%2$7s" + + "%3$5s" + + "%4$13s"; + + String header = String.format(headerFormat,"Name","Unit","Qty","Total"); + reportData.append(header).append("\n"); + + reportData.append(_lineBottom) + .append(TmkPrinterConstants.LINE_FEED); + + //2.body + ArrayList invoiceLineList; + try + { + invoiceLineList = InvoiceManager.populateInvoiceLines(ctx,invoice,false); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + String name = null; + int qty; + + BigDecimal taxAmt = null; + BigDecimal total; + BigDecimal unitPrice; + + int totalQty = 0; + double grandTotal = 0.0d; + double totalTax = 0.0d; + String orderline = ""; + + String orderlineFormat = "" + + "%1$-" + (_lineWidth - ( 7 + 5 + 13 )) + "s" + //1.product name OR description + "%2$7.2f" + //2.unit price + "%3$5d" + //3.quantity + "%4$13.2f"; //5.total price + + for(WebOrderLineBean wbean : invoiceLineList) + { + taxAmt = wbean.getTaxAmt(); + name = wbean.getDescription(); + qty = wbean.getQtyOrdered().intValue(); + total = wbean.getLineTotalAmt(); + unitPrice = wbean.getUnitPrice(); + + if( _priceWithVat ) + { + unitPrice = total.divide(wbean.getQtyOrdered()); + } + + if(name.length() > 10) + { + if(name.length() > 40) + name = name.substring(0,39); + + orderline = String.format("%1$-" + _lineWidth + "s", name); + reportData.append(orderline) + .append(TmkPrinterConstants.LINE_FEED); + + name = ""; + + } + + taxAmt = (taxAmt==null)? new BigDecimal(0.0) : taxAmt; + + totalQty += qty; + grandTotal += total.doubleValue(); + totalTax += taxAmt.doubleValue(); + + if(taxAmt.intValue() == 0) + { + name = name + "*"; + } + + orderline = String.format(orderlineFormat,name,unitPrice,qty,total); + reportData.append(orderline) + .append(TmkPrinterConstants.LINE_FEED); + } + + //3.footer + reportData.append(_lineBottom) + .append(TmkPrinterConstants.LINE_FEED); + + String footerFormat = "" + + "%1$-" + (_lineWidth - ( 5 + 3 + 10 )) + "s" + + "%2$5d" + + "%3$3s" + + "%4$10.2f"; + + String footer = String.format(footerFormat,"Grand Total",totalQty,"Rs",grandTotal); + reportData.append(footer) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(_lineTop) + .append(TmkPrinterConstants.LINE_FEED); + + + String totalVAT = String.format("%1$.2f",totalTax); + String vat = String.format("%1$-" + _lineWidth + "s","Total VAT:Rs"+totalVAT); + reportData.append(vat) + .append(TmkPrinterConstants.LINE_FEED); + + String noVAT = String.format("%1$-" + _lineWidth + "s","* NO VAT"); + reportData.append(noVAT) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.LINE_FEED); + + if(_showBarcode) + { + String barcode = ((char)0x1d ) + "H" + (char)2 + ((char)0x1d ) + "k" + (char)4 + invoice.getDocumentNo() + (char)0; + String barcodeDim = ((char)0x1d) + "h" + (char)50 + ((char)0x1d) + "w" + (char)3; + reportData.append(TmkPrinterConstants.CENTER_ALIGN) + .append(barcodeDim) + .append(barcode) + .append(TmkPrinterConstants.LINE_FEED); + } + + + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append("*** Thank you ***") + .append(TmkPrinterConstants.LINE_FEED); + + + if(_showFooter) + if( _footerMessage.length() > 0 ) + { + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(_footerMessage) + .append(TmkPrinterConstants.LINE_FEED); + } + + reportData.append(TmkPrinterConstants.PAPER_CUT) + .append(TmkPrinterConstants.LINE_FEED); + + + return reportData.toString(); + + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/util/TMKOrderPrintFormatter.java b/posterita/posterita/src/main/org/posterita/util/TMKOrderPrintFormatter.java new file mode 100644 index 0000000000..1f45043f43 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/TMKOrderPrintFormatter.java @@ -0,0 +1,637 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 23, 2006 + */ + + +package org.posterita.util; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MLocation; +import org.compiere.model.MOrder; +import org.compiere.model.MOrg; +import org.compiere.model.MPayment; +import org.compiere.model.MUser; +import org.posterita.Constants; +import org.posterita.beans.BPartnerBean; +import org.posterita.beans.OrderLineBean; +import org.posterita.beans.WebOrderLineBean; +import org.posterita.businesslogic.OrganisationManager; +import org.posterita.businesslogic.POSManager; +import org.posterita.businesslogic.administration.BPartnerManager; +import org.posterita.businesslogic.administration.PriceListManager; +import org.posterita.exceptions.FormattingException; +import org.posterita.exceptions.OperationException; +import org.posterita.lib.UdiConstants; +import org.posterita.order.UDIOrderTypes; + + + +public class TMKOrderPrintFormatter extends AbstractPrintFormatter +{ + public TMKOrderPrintFormatter(String args) + { + super(args); + } + + public TMKOrderPrintFormatter(String args, String trxName) + { + super(args); + this.trxName = trxName; + } + + public String format(Properties ctx, int recordId, Object... args) throws Exception + { + //require UDIBean + OrderLineBean orderLineBean = null; + if( args != null && args.length > 0) + { + orderLineBean = (OrderLineBean) args[0]; + } + + //----------------------------------------------------------------------------------------------------------------------------- + + //set some default values + String vatRegNumber = ""; + String companyName1 = ""; + String companyName2 = ""; + String companyPhone = ""; + String companyAddress = ""; + + //setting receipt header + try + { + MOrg myorg = OrganisationManager.getMyOrg(ctx); + int bpartnerId = myorg.getLinkedC_BPartner_ID(trxName); + + + MBPartner bpartner = BPartnerManager.loadBPartner(ctx,bpartnerId,trxName); + BPartnerBean bean = BPartnerManager.getBpartner(ctx, bpartnerId, trxName); + + vatRegNumber = bpartner.getTaxID(); + companyName1 = bean.getPartnerName(); + companyName2 = bean.getName2(); + companyPhone = bean.getPhone(); + + String add = bean.getAddress1(); + add = (add==null) ? "" : add; + + companyAddress = add; + + add = bean.getAddress2(); + + if(add!=null){ + companyAddress = companyAddress + " " + add; + } + + add = bean.getCity(); + add = (add==null) ? "" : add; + + companyAddress = companyAddress + ", " + add; + + + } catch (OperationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + String title = null; + String customerName = null; + String salesRep = null; + String docStatus = null; + String payment = null; + String customerAddress = null; + String refNo = null; + + //load the order + MOrder order = new MOrder(ctx, recordId, trxName); + + String paymentRule = null; + int priceListId = order.getM_PriceList_ID(); + String currency = PriceListManager.getCurrency(ctx, priceListId); + + //setting payment + paymentRule = order.getPaymentRule(); + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + payment = Constants.PAYMENT_RULE_CASH; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_CreditCard)) + { + payment = Constants.PAYMENT_RULE_CARD; + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Check)) + { + payment = Constants.PAYMENT_RULE_CHEQUE; + } + + if(paymentRule.equalsIgnoreCase(UdiConstants.PAYMENTRULE_MIXED)) + { + payment = Constants.PAYMENT_RULE_MIXED; + } + //setting ref no + refNo = order.getDocumentNo(); + + //getting orgInfo + MOrg org = new MOrg(ctx,order.getAD_Org_ID(),trxName); + int location_id = org.getInfo().getC_Location_ID(); + MLocation location = new MLocation(ctx,location_id,trxName); + + // orgName = org.getName(); + + String address1 = (location.getAddress1() == null)? " " : location.getAddress1(); + String address2 = (location.getAddress2() == null)? " " : location.getAddress2(); + // orgAddress = (address1 + " " + address2).trim(); + + + //getting orderInfo + docStatus = order.getDocStatusName(); + + //getting salesrep + int saleRep_id = order.getSalesRep_ID(); + MUser user = new MUser(ctx,saleRep_id,null); + salesRep = user.getName(); + + //getting customer info + int bpartner_id = order.getBill_BPartner_ID(); + BPartnerBean bean; + try + { + bean = BPartnerManager.getBpartner(ctx,bpartner_id,trxName); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + + String name1 = (bean.getPartnerName() == null)? " " : bean.getPartnerName(); + String name2 = (bean.getName2() == null)? " " : bean.getName2(); + customerName = (name1 + " " + name2).trim(); + + address1 = (bean.getAddress1() == null)? " " : bean.getAddress1(); + address2 = (bean.getAddress2() == null)? " " : bean.getAddress2(); + customerAddress = (address1 + " " + address2).trim(); + + + ///////////////////////////////drawing the order//////////////////////////////// + StringBuffer reportData = new StringBuffer();//TmkPrinterConstants.LOGO1); + + if(_showLogo) + { + reportData.append(TmkPrinterConstants.LOGO1); + } + + //adding header + reportData.append(TmkPrinterConstants.FONT_SMALL) + .append(_lineTop) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(TmkPrinterConstants.LINE_FEED); + + if(companyName1!=null) + reportData.append(TmkPrinterConstants.FONT_DOUBLE) + .append(companyName1) + .append(TmkPrinterConstants.LINE_FEED); + + + if(companyName2!=null) + if(companyName2.trim().length() > 0) + reportData.append(TmkPrinterConstants.CENTER_ALIGN) + .append(TmkPrinterConstants.BIG_FONT) + .append("(" + companyName2 + ")") + .append(TmkPrinterConstants.LINE_FEED); + + if(companyAddress!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append(companyAddress) + .append(TmkPrinterConstants.LINE_FEED); + + if(companyPhone!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append("Tel:" + companyPhone) + .append(TmkPrinterConstants.LINE_FEED); + + if(vatRegNumber!=null) + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append("VAT Reg No:" + vatRegNumber) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(TmkPrinterConstants.FONT_SMALL) + .append(_lineTop) + .append(TmkPrinterConstants.LINE_FEED); + + //adding title + + if ( UDIOrderTypes.POS_ORDER.getOrderType().equals(order.getOrderType()) || order.getOrderType().equals(null)) + { + title = "Sales Receipt"; + } + if ( UDIOrderTypes.POS_GOODS_RECEIVE_NOTE.getOrderType().equals(order.getOrderType())) + { + title = "Goods Received Note"; + } + if ( UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType().equals(order.getOrderType())) + { + title = "Goods Returned Note"; + } + if ( UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType().equals(order.getOrderType())) + { + title = "Customer Returned Order"; + } + if ( UDIOrderTypes.CREDIT_ORDER.getOrderType().equals(order.getOrderType())) + { + title = "Credit Order"; + } + + reportData.append(TmkPrinterConstants.BIG_FONT) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(title) + .append(TmkPrinterConstants.LINE_FEED); + + //setting small font + reportData.append(TmkPrinterConstants.FONT_SMALL); + reportData.append(TmkPrinterConstants.LEFT_ALIGN); + + //adding customer name + customerName = String.format("%1$-" + _halfLineWidth + "s", customerName); + reportData.append(customerName); + + //adding sales rep + salesRep = "Sales Rep:" + salesRep; + salesRep = String.format("%1$"+ _halfLineWidth + "s", salesRep); + reportData.append(salesRep) + .append(TmkPrinterConstants.LINE_FEED); + + //adding customer address + customerAddress = String.format("%1$-" + _lineWidth + "s",customerAddress); + reportData.append(customerAddress) + .append(TmkPrinterConstants.LINE_FEED); + + //adding status + docStatus = "Status:" + docStatus; + docStatus = String.format("%1$-" + _lineWidth + "s",docStatus); + reportData.append(docStatus) + .append(TmkPrinterConstants.LINE_FEED); + + //adding payment + payment = "Payment:" + payment; + payment = String.format("%1$-" + _lineWidth + "s",payment); + reportData.append(payment) + .append(TmkPrinterConstants.LINE_FEED); + + //adding reference no + refNo = "Ref No:" + refNo; + refNo = String.format("%1$-" + _lineWidth + "s",refNo); + reportData.append(refNo) + .append(TmkPrinterConstants.LINE_FEED); + + //adding date + Calendar c = Calendar.getInstance(); + c.setTime(new Date(order.getCreated().getTime())); + String date = String.format("%1$te %1$tb,%1$tY %1$tH:%1$tM:%1$tS",c); + date = String.format("%1$-" + _lineWidth + "s",date); + reportData.append(date) + .append(TmkPrinterConstants.LINE_FEED); + + //adding orderlines + //1.header + reportData.append(_lineTop).append("\n"); + + String headerFormat; + if(_showDiscount) + { + headerFormat = "%1$-" + (_lineWidth - ( 7 + 5 + 8 + 10 )) + "s" + + "%2$7s" + + "%3$5s" + + "%4$8s" + + "%5$10s"; + } + else + { + headerFormat = "%1$-" + (_lineWidth - ( 7 + 5 + 13 )) + "s" + + "%2$7s" + + "%3$5s" + + //"%4$8s" + + "%5$13s"; + } + + String header = String.format(headerFormat,"Name","Unit","Qty","Dis","Total"); + reportData.append(header).append("\n"); + + reportData.append(_lineBottom) + .append(TmkPrinterConstants.LINE_FEED); + + //2.body + ArrayList orderLineList; + try + { + orderLineList = POSManager.populateOrderLines(ctx,order); + } + catch(Exception e) + { + throw new FormattingException("Formatting Error", e); + } + + String name = null; + int qty; + BigDecimal discount = null; + BigDecimal taxAmt = null; + BigDecimal total; + BigDecimal unitPrice; + + int totalQty = 0; + double grandTotal = 0.0d; + double totalTax = 0.0d; + String orderline = ""; + String orderlineFormat = null; + + int nameWidth = 0; + + + if(_showDiscount) + { + orderlineFormat = "" + + "%1$-" + (_lineWidth - ( 7 + 5 + 8 + 10 )) + "s" + //1.product name OR description + "%2$7.2f" + //2.unit price + "%3$5d" + //3.quantity + "%4$8.2f" + //4.discount amount + "%5$10.2f"; //5.total price + + nameWidth = _lineWidth - ( 7 + 5 + 8 + 10 ); + } + else + { + orderlineFormat = "" + + "%1$-" + (_lineWidth - ( 7 + 5 + 13 )) + "s" + //1.product name OR description + "%2$7.2f" + //2.unit price + "%3$5d" + //3.quantity + //"%4$8.2f" + //4.discount amount + "%5$13.2f"; //5.total price + + nameWidth = _lineWidth - ( 7 + 5 + 13 ); + } + + + + for(WebOrderLineBean wbean : orderLineList) + { + taxAmt = wbean.getTaxAmt(); + name = wbean.getDescription(); + qty = wbean.getQtyOrdered().intValue(); + discount = wbean.getDiscountPercentage(); + total = wbean.getLineTotalAmt(); + unitPrice = wbean.getUnitPrice(); + + if( _priceWithVat ) + { + unitPrice = total.divide(wbean.getQtyOrdered(),BigDecimal.ROUND_UP); + } + + + if(name.length() > nameWidth) + { + // print on multiple lines + int beginIndex = 0; + int endIndex = 0; + endIndex = nameWidth; + + while(endIndex < name.length()) + { + String s = name.substring(beginIndex, endIndex); + beginIndex = endIndex; + endIndex = endIndex + nameWidth; + + orderline = String.format("%1$-" + _lineWidth + "s", s); + reportData.append(orderline) + .append(TmkPrinterConstants.LINE_FEED); + } + + name = name.substring(beginIndex); + } + + discount = (discount==null)? new BigDecimal(0.0) : discount; + taxAmt = (taxAmt==null)? new BigDecimal(0.0) : taxAmt; + + double discountAmt = 0.0; + discountAmt = (total.doubleValue() * 100.0)/(100.0 - discount.doubleValue()) - total.doubleValue(); + + totalQty += qty; + grandTotal += total.doubleValue(); + totalTax += taxAmt.doubleValue(); + + if(taxAmt.intValue() == 0) + { + name = name + "*"; + } + + unitPrice = unitPrice.add(BigDecimal.valueOf(discountAmt)); + + orderline = String.format(orderlineFormat,name,unitPrice,qty,discountAmt,total); + reportData.append(orderline) + .append(TmkPrinterConstants.LINE_FEED); + } + + //3.footer + reportData.append(_lineBottom) + .append(TmkPrinterConstants.LINE_FEED); + + String footerFormat = null; + if(_showDiscount) + { + footerFormat = "" + + "%1$-" + (_lineWidth - ( 5 + 8 + 10 )) + "s" + + "%2$5d" + + "%3$8.2s" + + "%4$10.2f"; + } + else + { + footerFormat = "" + + "%1$-" + (_lineWidth - ( 5 + 3 + 10 )) + "s" + + "%2$5d" + + "%3$3s" + + "%4$10.2f"; + } + + String orderFooter = String.format(footerFormat,"Grand Total",totalQty,currency,grandTotal); + reportData.append(orderFooter) + .append(TmkPrinterConstants.LINE_FEED); + + reportData.append(_lineTop) + .append(TmkPrinterConstants.LINE_FEED); + + + //4.amount tendered & refunded + BigDecimal cashAmountTendered = order.getAmountTendered(); + if(cashAmountTendered == null) + { + cashAmountTendered = new BigDecimal(0.0); + } + + BigDecimal cashAmountRefunded = order.getAmountRefunded(); + if(cashAmountRefunded == null) + { + cashAmountRefunded = new BigDecimal(0.0); + } + + BigDecimal cardAmountTendered = null; + BigDecimal chequeAmountTendered = null; + + + if(orderLineBean != null) + { + Double cardAmt = orderLineBean.getPaymentByCard(); + Double chequeAmt = orderLineBean.getPaymentByChq(); + + if(cardAmt == null) + { + cardAmountTendered = new BigDecimal(0.0d); + } + else + { + cardAmountTendered = new BigDecimal(cardAmt.doubleValue()); + } + + if(chequeAmt == null) + { + chequeAmountTendered = new BigDecimal(0.0d); + } + else + { + chequeAmountTendered = new BigDecimal(chequeAmt.doubleValue()); + } + } + else + { + + if(MOrder.STATUS_Completed.equalsIgnoreCase(order.getDocStatus())) + if(order.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType())) + { + try + { + cardAmountTendered = POSManager.getPayment(ctx, order.get_ID(), MPayment.TENDERTYPE_CreditCard, trxName); + chequeAmountTendered = POSManager.getPayment(ctx, order.get_ID(), MPayment.TENDERTYPE_Check, trxName); + } + catch (OperationException e) + { + throw new FormattingException("Cannot get payment",e); + } + } + else + { + cardAmountTendered = new BigDecimal(0.0d); + chequeAmountTendered = new BigDecimal(0.0d); + } + + } + + String amountTendered = String.format("%1$25s%2$4s:%3$10.2f","Cash Tendered",currency ,cashAmountTendered); + String amountRefunded = String.format("%1$25s%2$4s:%3$10.2f","Cash Refunded",currency ,cashAmountRefunded); + + String seperator = String.format("%1$25s%2$15s","","------------"); + + String cardTendered = String.format("%1$25s%2$4s:%3$10.2f","Card Tendered",currency ,cardAmountTendered); + String chequeTendered = String.format("%1$25s%2$4s:%3$10.2f","Cheque Tendered",currency ,chequeAmountTendered); + + if(cashAmountTendered.doubleValue() > 0.0d) + { + reportData.append(amountTendered).append(TmkPrinterConstants.LINE_FEED); + } + + if(cardAmountTendered.doubleValue() > 0.0d) + { + reportData.append(cardTendered).append(TmkPrinterConstants.LINE_FEED); + } + + if(chequeAmountTendered.doubleValue() > 0.0d) + { + reportData.append(chequeTendered).append(TmkPrinterConstants.LINE_FEED); + } + + if(cashAmountTendered.doubleValue() > 0.0d) + { + reportData.append(seperator).append(TmkPrinterConstants.LINE_FEED); + reportData.append(amountRefunded).append(TmkPrinterConstants.LINE_FEED); + } + + + String totalVAT = String.format("%1$.2f",totalTax); + String vat = String.format("%1$-" + _lineWidth + "s","Total VAT:" + currency + totalVAT); + reportData.append(vat) + .append(TmkPrinterConstants.LINE_FEED); + + String noVAT = String.format("%1$-" + _lineWidth + "s","* NO VAT"); + + + + reportData.append(noVAT) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.LINE_FEED); + + if(_showBarcode) + { + String barcode = ((char)0x1d ) + "H" + (char)2 + ((char)0x1d ) + "k" + (char)4 + order.getDocumentNo() + (char)0; + String barcodeDim = ((char)0x1d) + "h" + (char)50 + ((char)0x1d) + "w" + (char)3; + reportData.append(TmkPrinterConstants.CENTER_ALIGN) + .append(barcodeDim) + .append(barcode) + .append(TmkPrinterConstants.LINE_FEED); + } + + + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append("*** Thank you ***") + .append(TmkPrinterConstants.LINE_FEED); + + + if(_showFooter) + if( _footerMessage.length() > 0 ) + { + reportData.append(TmkPrinterConstants.FONT_NORMAL) + .append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(_footerMessage) + .append(TmkPrinterConstants.LINE_FEED); + } + + if( order.getOrderType().equalsIgnoreCase(UDIOrderTypes.POS_ORDER.getOrderType()) ) + { + reportData.append(TmkPrinterConstants.LINE_FEED) + .append(TmkPrinterConstants.CENTER_ALIGN) + .append(TmkPrinterConstants.FONT_SMALL) + .append("*Goods once sold cannot be returned."); + } + + reportData.append(TmkPrinterConstants.PAPER_CUT) + .append(TmkPrinterConstants.LINE_FEED); + + return reportData.toString(); + + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/TmkPrintUtil.java b/posterita/posterita/src/main/org/posterita/util/TmkPrintUtil.java new file mode 100644 index 0000000000..90cb9a64ca --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/TmkPrintUtil.java @@ -0,0 +1,71 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 23, 2006 + */ + + +package org.posterita.util; + + +public class TmkPrintUtil +{ + + private static final int TOTAL_PAGE_LENGTH=40; + private static final int MAX_ALLOWED_FOR_FIELD=15; + public static String alignRight(String data) + { + int dataLength=data.length(); + String padding=" "; + for( int i=0;i14) + { + finaldata=finaldata+"\n"+initData.substring(0,MAX_ALLOWED_FOR_FIELD); + initData=initData.substring(MAX_ALLOWED_FOR_FIELD,initData.length()-1); + } + + } + + finaldata=finaldata+"\n"+initData; + + return finaldata.trim(); + + + } + + + public static String alignInCorners(String data1,String data2) + { + + + return null; + } +} diff --git a/posterita/posterita/src/main/org/posterita/util/TmkPrinterConstants.java b/posterita/posterita/src/main/org/posterita/util/TmkPrinterConstants.java new file mode 100644 index 0000000000..fad7179d72 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/util/TmkPrinterConstants.java @@ -0,0 +1,87 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Aug 24, 2006 + */ + + +package org.posterita.util; + + +public class TmkPrinterConstants +{ + public static final String SLIP_PRINTER_THERMAL = "Slip - Thermal"; + public static final String SLIP_PRINTER_9PIN = "Slip - 9 Pin"; + public static final String NORMAL_PRINTER = "Normal"; + + public static final int PRINTER_9PIN_WIDTH = 40; + public static final int PRINTER_SLIP_WIDTH = 64; + public static final int PRINTER_DEFAULT_WIDTH = PRINTER_9PIN_WIDTH; + + public static final String PAPER_CUT = new String(new byte[]{10,29,86,66}); + // public static final String PAPER_CUT= new String (new byte[]{10,29,56,66}); + public static final String PAGE_MODE = new String (new byte[]{27,76}); + public static final String LOGO1= new String(new byte[]{28,112,1,48}); + public static final String STANDARD_MODE = new String (new byte[]{27,83}); + public static final String LINE_FEED= new String (new byte []{10}); + public static final String H_TAB = new String (new byte[]{9}); + public static final String SOUND_BUZZER=new String (new byte[]{27,30}); + public static final String ABS_POSITION=new String (new byte[]{}); + public static final String LEFT_ALIGN=new String (new byte[]{27,97,2}); + public static final String CENTER_ALIGN=new String (new byte[]{27,97,1}); + public static final String RIGHT_ALIGN=new String (new byte[]{27,97,2,80}); + public static final String MULTIPLE_LINE_FEED= new String (new byte []{27,100,2});//5 lines + public static final String SETTING_LEFT_MARGIN=new String (new byte[]{29,76,5,0}); + public static final String BIG_FONT=new String (new byte[]{27,33,8}); + public static final String SMALL_FONT=new String (new byte[]{27,33,1}); + public static final String ABS_POS_LOC1=new String (new byte[]{27,36,0,0}); + public static final String ABS_POS_LOC2=new String (new byte[]{27,36,100,1}); + public static final String ABS_POS_LOC3=new String (new byte[]{27,36,(byte)145,1}); + public static final String ABS_POS_LOC4=new String (new byte[]{27,36,(byte)200,1}); + public static final String ABS_POS_LOC5=new String (new byte[]{27,36,1,1}); + public static final String CHARACTER_SPACING=new String (new byte[]{27,32,0}); + public static final String H_FULL_LINE_TOP; + + public static final String FONT_NORMAL = ((char)0x1b) + "!" + ((char)0x00); + public static final String FONT_SMALL = ((char)0x1b) + "!" + ((char)0x01); + public static final String FONT_NORMAL_BOLD = ((char)0x1b) + "!" + ((char)0x08); + public static final String FONT_DOUBLE_HEIGHT = ((char)0x1b) + "!" + ((char)0x10); + public static final String FONT_DOUBLE_WIDTH = ((char)0x1b) + "!" + ((char)0x20); + public static final String FONT_DOUBLE = ((char)0x1b) + "!" + ((char)0x30); + + public static final String H_FULL_LINE_BOTTOM; + + static + { + int length = 60; + byte hFullLineTop[] = new byte[length]; + + for(int i = 0; i < length; i++) + hFullLineTop[i] = (byte)223; + + H_FULL_LINE_TOP = new String(hFullLineTop); + + byte hFullLineBottom[] = new byte[length]; + + for(int i = 0; i < length; i++) + hFullLineBottom[i] = (byte)220; + + H_FULL_LINE_BOTTOM = new String(hFullLineBottom); + } + +} diff --git a/posterita/posterita/src/main/org/posterita/webstore/action/DocumentHistoryAction.java b/posterita/posterita/src/main/org/posterita/webstore/action/DocumentHistoryAction.java new file mode 100644 index 0000000000..5fee77ae01 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/webstore/action/DocumentHistoryAction.java @@ -0,0 +1,136 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.webstore.action; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Properties; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.compiere.model.MBPartner; +import org.compiere.process.DocAction; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.DocumentHistortFilterBean; +import org.posterita.beans.DocumentHistoryBean; +import org.posterita.beans.FilterBean; +import org.posterita.businesslogic.performanceanalysis.POSReportManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.form.DocumentHistoryForm; +import org.posterita.order.UDIOrderTypes; +import org.posterita.struts.core.BaseDispatchAction; +import org.posterita.user.WebUserInfo; +import org.posterita.webstore.businesslogic.DocumentHistoryManager; + +public class DocumentHistoryAction extends BaseDispatchAction +{ + + public static final String INIT_HISTORY = "initHistory"; + public ActionForward initHistory(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DocumentHistoryForm dhf = (DocumentHistoryForm) form; + DocumentHistoryBean bean = (DocumentHistoryBean) dhf.getBean(); + + Calendar calendar = Calendar.getInstance(); + int month = calendar.get(Calendar.MONTH) + 1 ; + int year = calendar.get(Calendar.YEAR); + + bean.setMonth( Integer.valueOf(month) ); + bean.setYear( Integer.valueOf(year) ); + bean.setOrderType( UDIOrderTypes.POS_ORDER .getOrderType()); + bean.setDocStatus( DocAction.STATUS_Completed ); + + dhf.populate( bean ); + + //TODO OrderType should be taken from the bean + ArrayList list = DocumentHistoryManager.getHistory(ctx, bean.getBpartnerId(), bean.getDocStatus(), bean.getMonth(), bean.getYear(), bean.getOrderType()); + + getWebstoreFilterBean(ctx, request, list); + + request.getSession().setAttribute(Constants.DOCUMENT_HISTORY, list); + + return mapping.findForward(GET_HISTORY); + } + + public static final String GET_HISTORY = "getHistory"; + public ActionForward getHistory(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + Properties ctx = TmkJSPEnv.getCtx(request); + + DocumentHistoryForm dhf = (DocumentHistoryForm) form; + DocumentHistoryBean bean = (DocumentHistoryBean) dhf.getBean(); + + //TODO OrderType should be taken from the bean + ArrayList list = DocumentHistoryManager.getHistory(ctx, bean.getBpartnerId(), bean.getDocStatus(), bean.getMonth(), bean.getYear(), bean.getOrderType()); + + getWebstoreFilterBean(ctx, request, list); + + request.getSession().setAttribute(Constants.DOCUMENT_HISTORY, list); + + return mapping.findForward(GET_HISTORY); + + } + + public static void getWebstoreFilterBean(Properties ctx, HttpServletRequest request, ArrayList orderHistory) throws OperationException + { + + DocumentHistortFilterBean filterBean = new DocumentHistortFilterBean(orderHistory); + + TreeSet docStatus = filterBean.getDocStatusList(); + request.getSession().setAttribute(Constants.DOC_STATUS, docStatus); + ArrayList orderTypeList=POSReportManager.getAllOrderTypes(ctx); + + request.getSession().setAttribute(Constants.ORDER_TYPES,orderTypeList); + + WebUserInfo wuInfo = (WebUserInfo) request.getSession().getAttribute(WebUserInfo.NAME); + int partnerId = wuInfo.getInfo().getC_BPartner_ID(); + MBPartner partner = new MBPartner(ctx, partnerId, null); + + + if (partner.getAD_Org_ID() != Env.getAD_Org_ID(ctx)) + { + TreeSet bPartners = (TreeSet)filterBean.getBPartnerList(); + request.getSession().setAttribute(Constants.BPARTNERS, bPartners); + + } + } + +} diff --git a/posterita/posterita/src/main/org/posterita/webstore/action/ViewCashPaymentAction.java b/posterita/posterita/src/main/org/posterita/webstore/action/ViewCashPaymentAction.java new file mode 100644 index 0000000000..cde8b771c3 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/webstore/action/ViewCashPaymentAction.java @@ -0,0 +1,101 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Created on Oct 25, 2006 + */ + + +package org.posterita.webstore.action; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.config.ActionConfig; +import org.apache.struts.config.ForwardConfig; +import org.apache.struts.util.MessageResources; + +import org.posterita.Constants; +import org.posterita.beans.DocumentBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.CashManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.POSDispatchAction; + + +public class ViewCashPaymentAction extends POSDispatchAction +{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + MessageResources resources = (MessageResources) request.getAttribute(Globals.MESSAGES_KEY); + + String operationException = resources.getMessage("error.operationException"); + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + DocumentBean bean = (DocumentBean) df.getBean(); + Integer paymentId = bean.getDocumentId(); + + // retrieve from cache + WebDocumentBean webBean = null; + webBean = CashManager.getWebCashPaymentBean(ctx, paymentId); + + request.getSession().setAttribute(Constants.WEB_PAYMENT_BEAN, webBean); + if (webBean == null) + webBean = (WebDocumentBean) request.getSession().getAttribute(Constants.WEB_PAYMENT_BEAN); + + if (webBean == null) + throw new OperationException(operationException); + + request.getSession().setAttribute(Constants.ME_LOCATION, webBean.getMeLocation()); + request.getSession().setAttribute(Constants.YOU_LOCATION, webBean.getYouLocation()); + request.getSession().setAttribute(Constants.YOU_BP_LOCATION, webBean.getYoubpLocation()); + request.getSession().setAttribute(Constants.ME, webBean.getMe()); + request.getSession().setAttribute(Constants.YOU,webBean.getYou()); + request.getSession().setAttribute(Constants.MCASHLINE, webBean.getCashLine()); + request.getSession().setAttribute(Constants.WEB_DOCUMENT_HEADER_BEAN, webBean.getHeaderBean()); + request.setAttribute(Constants.CURRENCY_SYMBOLE,webBean.getCurrencySymbole()); + request.getSession().setAttribute(Constants.CASH_PAYMENT_MADE,bean); + ForwardConfig forwardConfig = getForward(ctx,webBean,mapping,form); + + ActionForward forward = new ActionForward(forwardConfig.getPath()); + + return forward; + } + + private ForwardConfig getForward(Properties ctx, WebDocumentBean webBean, ActionMapping mapping, ActionForm form) throws OperationException + { + ActionConfig config = mapping.getModuleConfig().findActionConfig("/ViewWebstoreCashPaymentAction"); + + return config.findForwardConfig(Constants.VIEW_PAYMENT); + } +} \ No newline at end of file diff --git a/posterita/posterita/src/main/org/posterita/webstore/action/ViewPaymentAction.java b/posterita/posterita/src/main/org/posterita/webstore/action/ViewPaymentAction.java new file mode 100644 index 0000000000..f03ec967a4 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/webstore/action/ViewPaymentAction.java @@ -0,0 +1,109 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +package org.posterita.webstore.action; + +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.config.ActionConfig; +import org.apache.struts.config.ForwardConfig; +import org.apache.struts.util.MessageResources; +import org.compiere.model.MPayment; + +import org.posterita.Constants; +import org.posterita.beans.DocumentBean; +import org.posterita.beans.WebDocumentBean; +import org.posterita.businesslogic.PaymentManager; +import org.posterita.core.TmkJSPEnv; +import org.posterita.exceptions.ApplicationException; +import org.posterita.exceptions.OperationException; +import org.posterita.struts.core.DefaultForm; +import org.posterita.struts.pos.POSDispatchAction; + + +public class ViewPaymentAction extends POSDispatchAction +{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException + { + ActionForward fwd = init(mapping, form, request, response); + + if (fwd != null) + return fwd; + + MessageResources resources = (MessageResources) request.getAttribute(Globals.MESSAGES_KEY); + + String operationException = resources.getMessage("error.operationException"); + + Properties ctx = TmkJSPEnv.getCtx(request); + + DefaultForm df = (DefaultForm) form; + DocumentBean bean = (DocumentBean) df.getBean(); + Integer paymentId = bean.getDocumentId(); + + // retrieve from cache + WebDocumentBean webBean = null; + + MPayment payment = null; + if (paymentId!= null) + { + payment = new MPayment(ctx, paymentId.intValue(), null); + webBean = PaymentManager.getWebPaymentBean(ctx, payment); + request.getSession().setAttribute(Constants.WEB_PAYMENT_BEAN, webBean); + } + + if (webBean == null) + webBean = (WebDocumentBean) request.getSession().getAttribute(Constants.WEB_PAYMENT_BEAN); + + if (webBean == null) + throw new OperationException(operationException); + + request.getSession().setAttribute(Constants.ME_LOCATION, webBean.getMeLocation()); + request.getSession().setAttribute(Constants.YOU_LOCATION, webBean.getYouLocation()); + request.getSession().setAttribute(Constants.YOU_BP_LOCATION, webBean.getYoubpLocation()); + request.getSession().setAttribute(Constants.ME, webBean.getMe()); + request.getSession().setAttribute(Constants.MORDER, webBean.getOrder()); + request.getSession().setAttribute(Constants.YOU,webBean.getYou()); + request.getSession().setAttribute(Constants.MPAYMENT, webBean.getPayment()); + request.getSession().setAttribute(Constants.PAYMENT_TYPE, webBean.getTenderType()); + request.getSession().setAttribute(Constants.MINVOICE, webBean.getInvoice()); + request.getSession().setAttribute(Constants.SIMPLE_COMMAND,webBean.getSimpleCommand()); + request.getSession().setAttribute(Constants.COMPLEX_COMMAND,webBean.getComplexCommand()); + request.getSession().setAttribute(Constants.WEB_DOCUMENT_HEADER_BEAN, webBean.getHeaderBean()); + request.setAttribute(Constants.CURRENCY_SYMBOLE,webBean.getCurrencySymbole()); + ForwardConfig forwardConfig = getForward(ctx,webBean,mapping,form); + + ActionForward forward = new ActionForward(forwardConfig.getPath()); + + return forward; + } + + private ForwardConfig getForward(Properties ctx, WebDocumentBean webBean, ActionMapping mapping, ActionForm form) throws OperationException + { + ActionConfig config = mapping.getModuleConfig().findActionConfig("/ViewWebstorePaymentAction"); + + return config.findForwardConfig(Constants.VIEW_PAYMENT); + } +} diff --git a/posterita/posterita/src/main/org/posterita/webstore/businesslogic/DocumentHistoryManager.java b/posterita/posterita/src/main/org/posterita/webstore/businesslogic/DocumentHistoryManager.java new file mode 100644 index 0000000000..b4c33429e2 --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/webstore/businesslogic/DocumentHistoryManager.java @@ -0,0 +1,186 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.webstore.businesslogic; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.posterita.beans.DocumentHistoryBean; +import org.posterita.core.UDIMap; +import org.posterita.exceptions.OperationException; + +public class DocumentHistoryManager +{ + + private static Integer getIntegerValue(int value) + { + if (value == 0) + return null; + else + return Integer.valueOf(value); + } + + + public static ArrayList getHistory(Properties ctx, Integer bpartnerId, String docStatus, Integer month, Integer year, String orderType) throws OperationException + { + StringBuffer sql = new StringBuffer(); + sql.append(" select"); + sql.append(" ord.c_order_id, "); //1.orderID + sql.append(" pay.c_payment_id, "); //2.paymentID + sql.append(" inv.c_invoice_id, "); //3.invoiceID + sql.append(" ship.m_inout_id, "); //4.shipmentID + sql.append(" partner.c_bpartner_id, "); //5.partnerID + sql.append(" partner.name, "); //6.partnerName + sql.append(" partner.name2, "); //7.partnerName2 + sql.append(" ord.created, "); //8.dateCreated + sql.append(" ship.docstatus,"); //9/docStatus + //sql.append(" DECODE(pay.docstatus, 'CO', 'Paid', 'Awaiting Payment') paymentStatus,"); + sql.append(" CASE WHEN pay.docstatus = 'CO' THEN 'Paid' ELSE 'Awaiting Payment' END AS paymentStatus,"); + //sql.append(" DECODE (ship.docstatus, 'CO', 'Shipped', 'Not Shipped') shipmentStatus,"); + sql.append(" CASE WHEN ship.docstatus= 'CO' THEN 'Shipped' ELSE 'Not Shipped' END AS shipmentStatus,"); + sql.append(" ord.documentNo,"); + sql.append(" inv.documentNo,"); + sql.append(" pay.documentNo,"); + sql.append(" ship.documentNo,"); + sql.append(" partner.isCustomer,"); + sql.append(" partner.isVendor from "); + sql.append("(((c_order ord left outer join c_invoice inv on ord.C_Order_ID=inv.C_Order_ID) left outer join M_InOut ship on ord.C_Order_ID=ship.C_Order_ID) left outer join c_payment pay on inv.c_invoice_id = pay.c_invoice_id)"); + sql.append(", c_bpartner partner"); + sql.append(" where ord.ad_client_id=" + Env.getAD_Client_ID(ctx)); + sql.append(" and ord.ad_org_id=" + Env.getAD_Org_ID(ctx)); + sql.append(" and partner.c_bpartner_id=ord.c_bpartner_id"); + sql.append(" and ord.isactive='Y'"); + + + if(orderType!=null) + { + sql.append(" and ord.ordertype='" + orderType + "'"); + } + + if (month != null) + { + String mm = String.valueOf(month); + if (mm.length() == 1) + { + mm = "0" + mm; + } + sql.append(" and to_char(ord.dateOrdered, 'mm') ='" + mm + "'"); + } + + if (year != null) + { + sql.append(" and to_char(ord.dateOrdered, 'yyyy') ='" + year+"'"); + } + + if (bpartnerId != null) + { + sql.append(" and ord.c_bpartner_id=" + bpartnerId); + } + + sql.append(" order by ord.c_order_id desc"); + + + + PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null); + + ResultSet rs = null; + DocumentHistoryBean bean; + ArrayList list = new ArrayList(); + + try + { + rs = pstmt.executeQuery(); + + while(rs.next()) + { + bean = new DocumentHistoryBean(); + bean.setOrderId(getIntegerValue(rs.getInt(1))); + bean.setPaymentId(getIntegerValue(rs.getInt(2))); + bean.setInvoiceId(getIntegerValue(rs.getInt(3))); + bean.setMinOutId(getIntegerValue(rs.getInt(4))); + bean.setBpartnerId(getIntegerValue(rs.getInt(5))); + bean.setPartnerName(rs.getString(6) + " " + rs.getString(7)); + bean.setDateOrdered(rs.getTimestamp(8)); + + if (rs.getString(9) != null) + { + bean.setDocStatus(UDIMap.docStatusMap.get(rs.getString(9))); + bean.setDocStatusCode(rs.getString(9)); + } + + bean.setPaymentStatus(rs.getString(10)); + bean.setShipmentStatus(rs.getString(11)); + bean.setDocumentNo(rs.getString(12)); + bean.setInvoiceNo(rs.getString(13)); + bean.setPaymentNo(rs.getString(14)); + bean.setShipmentNo(rs.getString(15)); + + if(rs.getString(16).equals("Y")) + { + bean.setIsCustomer(Boolean.valueOf(true)); + } + else + { + bean.setIsCustomer(Boolean.valueOf(false)); + } + + if(rs.getString(17).equals("Y")) + { + bean.setIsVendor(Boolean.valueOf(true)); + } + else + { + bean.setIsVendor(Boolean.valueOf(false)); + } + + + list.add(bean); + } + + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + finally + { + try + { + rs.close(); + pstmt.close(); + } + catch (Exception ex) + { + } + rs = null; + pstmt = null; + } + + return list; + } + + +} diff --git a/posterita/posterita/src/main/org/posterita/webstore/businesslogic/PaymentManager.java b/posterita/posterita/src/main/org/posterita/webstore/businesslogic/PaymentManager.java new file mode 100644 index 0000000000..45abaae90c --- /dev/null +++ b/posterita/posterita/src/main/org/posterita/webstore/businesslogic/PaymentManager.java @@ -0,0 +1,256 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + **/ +package org.posterita.webstore.businesslogic; + +import java.util.Properties; + +import org.compiere.model.MBankAccount; +import org.compiere.model.MDocType; +import org.compiere.model.MInOut; +import org.compiere.model.MOrder; +import org.compiere.model.MPayment; +import org.compiere.model.MPaymentValidate; +import org.compiere.process.DocumentEngine; +import org.compiere.util.Env; +import org.posterita.Constants; +import org.posterita.beans.CreditCardBean; +import org.posterita.exceptions.CreditCardExpiryInvalidException; +import org.posterita.exceptions.CreditCardNumberException; +import org.posterita.exceptions.CreditCardTypeNotSupportedException; +import org.posterita.exceptions.CreditCardVVInvalidException; +import org.posterita.exceptions.OperationException; +import org.posterita.order.UDIOrderTypes; +import org.posterita.util.PoManager; + +public class PaymentManager +{ + + public static MPayment createARReceipt(Properties ctx, int salesOrderId, String deliveryViaRule, String trxName) throws OperationException + { + return createPayment(ctx, salesOrderId, deliveryViaRule, MDocType.DOCBASETYPE_ARReceipt, null, null, null, null, null, trxName); + } + + + public static MPayment createARReceipt(Properties ctx, int salesOrderId, String deliveryViaRule, String creditCardType, String creditCardNumber, String cvv2, Integer expMonth, Integer expYear, String trxName) throws OperationException + { + return createPayment(ctx, salesOrderId, deliveryViaRule, MDocType.DOCBASETYPE_ARReceipt, creditCardType, creditCardNumber, cvv2, expMonth, expYear, trxName); + } + + + public static MPayment createPayment(Properties ctx, int orderId, String deliveryViaRule, String docBaseType, String creditCardType, String creditCardNumber, String cvv2, Integer expMonth, Integer expYear, String trxName) throws OperationException + { + MPayment payment; + MOrder order = new MOrder(ctx, orderId, trxName); + + try + { + int orgID = Env.getAD_Org_ID(ctx); + //get org's default bank Account + int bankAccIds[] = MBankAccount.getAllIDs(MBankAccount.Table_Name, " ad_org_id=" + orgID + " and ad_client_id=" + Env.getAD_Client_ID(ctx) + " and isDefault='Y'", trxName); + + if (bankAccIds.length == 0) + throw new OperationException("No default bank account found for org"); + + MBankAccount orgBankAc = new MBankAccount(ctx, bankAccIds[0], trxName); + + payment = new MPayment(ctx,0, trxName); + payment.setC_BankAccount_ID(bankAccIds[0]); + payment.setC_BPartner_ID(order.getC_BPartner_ID()); + payment.setC_Currency_ID(order.getC_Currency_ID()); + payment.setC_Order_ID(orderId); + + if (deliveryViaRule != null && deliveryViaRule.equals(MInOut.DELIVERYVIARULE_Shipper)) + { + payment.setTenderType(MPayment.TENDERTYPE_CreditCard); + + boolean creditcardDetailsValid = payment.setCreditCard(MPayment.TRXTYPE_Sales, creditCardType, creditCardNumber, cvv2,expMonth.intValue(), expYear.intValue()); + + if (!creditcardDetailsValid) + throw new OperationException("Credit Card Details Missing!!!"); + } + else + payment.setTenderType(MPayment.TENDERTYPE_Check); + + MDocType[] docTypes = MDocType.getOfDocBaseType(ctx, docBaseType); + + if (docTypes.length == 0) + throw new OperationException("not document type found for payment"); + + payment.setC_DocType_ID(docTypes[0].get_ID()); + + payment.setAccountNo(orgBankAc.getAccountNo()); + + payment.setPayAmt(order.getGrandTotal()); + + + if (docBaseType.equals(MDocType.DOCBASETYPE_APPayment)) + { + payment.setIsReceipt(false); + payment.setDescription("(AP Payment) Payment Made"); + } + + else + { + payment.setIsReceipt(true); + payment.setDescription("(AR Receipt) Payment Received"); + } + + PoManager.save(payment); + + } + catch(OperationException e) + { + throw e; + } + + return payment; + } + + + public static MPayment completePayment(Properties ctx, int paymentId, String trxName) throws OperationException + { + MPayment payment; + + try + { + payment = new MPayment(ctx, paymentId, trxName); + + + if (payment.getDocStatus().equals(DocumentEngine.STATUS_Completed)) + throw new OperationException("Cannot complete a payment which is already completed"); + + if (payment.getDocStatus().equals(DocumentEngine.STATUS_Voided)) + throw new OperationException("Cannot complete a payment which has been voided"); + + PoManager.processIt(payment, DocumentEngine.ACTION_Complete); + } + catch(OperationException e) + { + throw e; + } + + return payment; + } + + public static MPayment loadPayment(Properties ctx, MOrder order, String trxName) throws OperationException + { + if (!order.getOrderType().equals(UDIOrderTypes.WEBSTORE_ORDER.getOrderType())) + throw new OperationException("This method only loads payment for a webstore order!!"); + + int[] paymentIds = MPayment.getAllIDs(MPayment.Table_Name, "c_order_id=" + order.get_ID(), null); + + if (paymentIds.length > 1) + throw new OperationException("Error loading payment. Webstore does not support multiple payment for one order.Order Id is " + order.get_ID()); + + if (paymentIds.length < 0) + throw new OperationException("Error loading payment. No payment found for this order: " + order.get_ID()); + + //Assuming that there will be only one payment for this order + MPayment payment = new MPayment(ctx, paymentIds[0], trxName); + + return payment; + } + + + public static String isPaid(Properties ctx, int orderId, String trxName) + { + int[] paymentIds = MPayment.getAllIDs(MPayment.Table_Name, "c_order_id=" + orderId, trxName); + + if (paymentIds.length == 0) + return Constants.NO_CHAR; + + MPayment payment = new MPayment(ctx, paymentIds[0], trxName); + + if (payment.getDocStatus().equals(MPayment.DOCSTATUS_Completed)) + return Constants.YES_CHAR; + else + return Constants.NO_CHAR; + } + + + public static void validateCreditCardDetails(CreditCardBean cardBean) throws CreditCardTypeNotSupportedException, CreditCardNumberException, CreditCardExpiryInvalidException, CreditCardVVInvalidException + { + if(cardBean == null) + throw new IllegalArgumentException("CardBean cannot be null"); + + String creditCardNum = cardBean.getCreditCardNumber(); + String creditCardType = cardBean.getCreditCardType(); + + if(!(creditCardType != null + && (creditCardType.equals(MPayment.CREDITCARDTYPE_Amex) + || creditCardType.equals(MPayment.CREDITCARDTYPE_Discover) + || creditCardType.equals(MPayment.CREDITCARDTYPE_MasterCard) + || creditCardType.equals(MPayment.CREDITCARDTYPE_Visa)))) + { + throw new CreditCardTypeNotSupportedException("Credit Card type: " + creditCardType + " is not supported"); + } + + String numValResult = MPaymentValidate.validateCreditCardNumber(creditCardNum, creditCardType); + if(numValResult != "") + throw new CreditCardNumberException("Credit Card number is not valid, Reason: " + numValResult); + + Integer expMonth = cardBean.getCreditCardExpMonth(); + Integer expYear = cardBean.getCreditCardExpYear(); + + if(expMonth == null) + throw new CreditCardExpiryInvalidException("Expiry month cannot be null"); + if(expYear == null) + throw new CreditCardExpiryInvalidException("Expiry year cannot be null"); + + String expiryValResult = MPaymentValidate.validateCreditCardExp(expMonth.intValue(), expYear.intValue()); + + if(expiryValResult != "") + throw new CreditCardExpiryInvalidException("Credit Card Expiry date invalid"); + + String cvv = cardBean.getCvv(); + if(cvv == null) + throw new CreditCardVVInvalidException("Credit Card VV cannot be null"); + + String cvvValResult = MPaymentValidate.validateCreditCardVV(cvv, creditCardType); + if(cvvValResult != "") + throw new CreditCardVVInvalidException("Credit Card VV is not valid"); + } + + + public static String loadCreditCardTypeName(String creditCardType) throws OperationException + { + if(creditCardType == null) + throw new OperationException("Credit Card Type not present!!"); + + String creditCardTypeName = ""; + + if (creditCardType.equals(MPayment.CREDITCARDTYPE_Amex)) + creditCardTypeName = Constants.CREDITCARDTYPE_AMEX; + else + if (creditCardType.equals(MPayment.CREDITCARDTYPE_Discover)) + creditCardTypeName = Constants.CREDITCARDTYPE_DISCOVER; + else + if (creditCardType.equals(MPayment.CREDITCARDTYPE_MasterCard)) + creditCardTypeName = Constants.CREDITCARDTYPE_MASTERCARD; + else + if (creditCardType.equals(MPayment.CREDITCARDTYPE_Visa)) + creditCardTypeName = Constants.CREDITCARDTYPE_VISA; + + return creditCardTypeName; + + } + +} diff --git a/posterita/posterita/src/main/posterita.properties b/posterita/posterita/src/main/posterita.properties new file mode 100644 index 0000000000..7ca992f448 --- /dev/null +++ b/posterita/posterita/src/main/posterita.properties @@ -0,0 +1,13 @@ +## webstore Image Folder +webstore.automated.import=OFF +webstore.automated.time=1800000 +webstore.collection.folder=/home/posterita/images/Collections +webstore.inactive.folder=/home/posterita/images/Inactive +webstore.folder.errors=/home/posterita/images/Errors + + +webstore.shipping.promotion.status=ON +webstore.shipping.promotion.price=50 + +webstore.url=http://www.posterita.com +webstore.price.default=120 diff --git a/posterita/posterita/src/utils/ImportMessages.sh b/posterita/posterita/src/utils/ImportMessages.sh new file mode 100644 index 0000000000..c5fbac3538 --- /dev/null +++ b/posterita/posterita/src/utils/ImportMessages.sh @@ -0,0 +1 @@ +java -DPropertyFile=../Adempiere.properties -cp ./trlImporter.jar:../lib/Adempiere.jar:../lib/CSTools.jar:../lib/CCTools.jar:../lib/oracle.jar:../lib/postgresql.jar:../lib/j2ee.jar:../lib/sqlj.jar com.tamak.core.utils.MsgImporter messages.csv diff --git a/posterita/posterita/src/utils/messages.csv b/posterita/posterita/src/utils/messages.csv new file mode 100644 index 0000000000..2ec869dc47 --- /dev/null +++ b/posterita/posterita/src/utils/messages.csv @@ -0,0 +1,444 @@ +"SEARCHKEY";"ENGTEXT";"ENGTIP";"FRENCHTXT";"FRENCHTIP" +"1000_rupees";"1000 Rupees";" ";"1000 Rupees";" " +"100_dollars";"100 dollars";" ";"100 dollars";" " +"100_rupees";"100 Rupees";" ";"100 Rupees";" " +"10_dollars";"10 dollars";" ";"10 dollars";" " +"10_rupees";"10 Rupees";" ";"10 Rupees";" " +"1_cent";"1 cent";"1 cent";"1 sous/centime";" " +"1_dollar";"1 dollar";" ";"1 dollar";" " +"1_rupee";"1 Rupee";" ";"1 Rupee";" " +"2000_rupees";"2000 Rupees";" ";"2000 Rupees";" " +"200_rupees";"200 Rupees";" ";"200 Rupees";" " +"20_cents";"20 cents";"20 cents";"20 sous/centimes";" " +"20_dollars";"20 dollars";" ";"20 dollars";" " +"25_rupees";"25 Rupees";" ";"25 Rupees";" " +"500_rupees";"500 Rupees";" ";"500 Rupees";" " +"50_cents";"50 cents";"50 cents";"50 sous/centimes";" " +"50_dollars";"50 dollars";" ";"50 dollars";" " +"50_rupees";"50 Rupees";" ";"50 Rupees";" " +"5_cents";"5 cents";"5 cents";"5 sous/centimes";" " +"5_dollars";"5 dollars";" ";"5 dollars";" " +"5_rupees";"5 Rupees";" ";"5 Rupees";" " +"Due0";"Due 0";" ";"D 0";" " +"Due0_30";"Due 0-30";" ";"D 0-30";" " +"account.type";"Account Type";" ";"Type de compte";" " +"accounts.receivable";"Accounts Receivable-Trade";" ";"Comptes clients";" " +"activate";"Activate";" ";"Activer";" " +"activate.vendor";"Activate Vendor";" ";"Activer fournisseur";" " +"actual.price";"Actual Price";" ";"Prix actuel";" " +"add";"Add";" ";"Ajouter";" " +"add.black.listed.cheque";"Add Black Listed Cheque";" ";"Ajouter aux ch�ues non valable";" " +"add.customer.fidelity.card";"Add Customer for fidelity card";" ";"Ajouter client �la liste des cartes de fid�it�;" " +"add.customer.for.fidelity.card";"Add Customer for fidelity card";" ";"Ajouter client �la liste des cartes de fid�it�;" " +"add.record";"Add Record";" ";"Ajouter";" " +"add.to.cart";"Add To Cart";" ";"Ajouter au Caddie";" " +"address";"Address";" ";"Adresse";" " +"adjust.cash.book";"Adjust Cash Book";" ";"Ajuster le livre de caisse";" " +"advanced";"Advanced";" ";"Avanc�";" " +"aging";"Aging";" ";"Balance �� du d�iteur";" " +"ajax.error";"Some error occured while communicating with the server. Please try again.";" ";"Une erreur s'est produite lors de la communication avec le serveur. Pri�e de r�ssayer";" " +"all";"All";" ";"Tout";" " +"all.products";"All products";" ";"Tous les produits";" " +"amount.difference";"Difference";" ";"Diff�ence";" " +"amount.expense";"Expense";" ";"D�enses";" " +"amount.receipt";"Receipt";" ";"Montant re�";" " +"amount.refunded";"Amount refunded";" ";"Montant rendu";" " +"amount.tendered";"Amount Tendered";" ";"Montant re�";" " +"amount.transfer";"Transfer";" ";"Montant transf��;" " +"application.name";"Application Name";" ";"Nom de l`application";" " +"application.version";"Application Version";" ";"Version de l`application";" " +"asset";"Assets";" ";"Actif";" " +"at.least.one";"At least one";" ";"Au moins un";" " +"attach.image";"Attach Image";" ";"Attacher une image";" " +"attribute";"Attribute";"Attribute";"Attribue";" " +"attribute.set";"Attribute Set";"Attribute Set";"Groupe de l`attribue";" " +"available.menu";"Available Menus";" ";"Menus disponibles";" " +"back";"Back";" ";"Retour";" " +"barcode";"Barcode";"Barcode";"Code barre";" " +"barcode.already.exists";"Barcode already exists!";" ";"Code barre d��existant";" " +"black.listed.cheques";"Black Listed Cheques";" ";"Ch�ue sur liste noire";" " +"bpartner.info";"Business Partner Info";" ";"Info sur tiers";" " +"bpartner.trx.details";"Business Partner Trx Details";" ";"D�ails des transactions des tiers";" " +"brand";"Brand";" ";"Marque";" " +"cal.period.curr";"Calculation Period And Curr.";" ";"P�iode de calcul et devise";" " +"card";"Card";" ";"Carte bleue";" " +"card.amount";"Card Amount";" ";"Montant carte bleue";" " +"card.amt.entered";"Card Amount Entered";" ";"Montant carte bleue �d�iter";" " +"card.amt.tendered";"Card amount tendered";" ";"Montant re� par carte bleue";" " +"card.amt.total";"Card Amount Total";" ";"Montant total sur carte bleue";" " +"card.is.empty";"The Cart is Empty !";" ";"Le caddie est vide!";" " +"card.no";"Card No";" ";"Num�o de carte bleue";" " +"card.total";"Card Total";" ";"Montant total sur carte bleue";" " +"cart.addmore";"Add More";" ";"Rajouter";" " +"cart.empty";"Cart is empty!";" ";"Le caddie est vide!";" " +"cart.has";"Cart has";" ";"Le caddie contient:";" " +"cart.items";" items";" ";"items";" " +"cart.remove";"Remove";" ";"Retirer";" " +"cash";"Cash";" ";"Esp�e";" " +"cash.amount";"Cash Amount";" ";"Montant en esp�e";" " +"cash.book";"Cash Book";" ";"Livre de caisse";" " +"cash.book.adjust";"The Cash Book has been adjusted.";" ";"Le livre de caisse a ��ajust�;" " +"cash.book.adjusted";"The Cash Book has been adjusted";" ";"Le livre de caisse a ��ajust�;" " +"cash.book.history";"Cash Book History";" ";"Historique du livre de caisse";" " +"cash.line.detail";"Cash Line Details";" ";"D�ail des lignes d'esp�e";" " +"cash.payment";"Cash Payment";" ";"Paiement en esp�e";" " +"cash.receipt";"Cash Receipt";" ";"Montant re� en esp�e";" " +"cash.refunded";"Cash refunded";" ";"Montant rembours�en esp�e";" " +"cash.tendered";"Cash tendered";" ";"Argent donn�;" " +"cash.to.transfer";"Cash to transfer";" ";"Argent �transf�er";" " +"cash.total";"Cash Total";" ";"Total Esp�e";" " +"cellphone";"Cellphone";" ";"T��hone portable/GSM";" " +"checkout";"Checkout";" ";"Sortir";" " +"cheque";"Cheque";" ";"Ch�ue";" " +"cheque.amount";"Cheque Amount";" ";"Montant ch�ue";" " +"cheque.amt.entered";"Cheque Amount Entered";" ";"Montant donn�en ch�ue";" " +"cheque.amt.tendered";"Cheque amount tendered";" ";"Montant re� par ch�ue";" " +"cheque.amt.total";"Cheque Amount Total";" ";"Montant total en ch�ue";" " +"cheque.no";"Cheque No";" ";"No de ch�ue";" " +"cheque.total";"Cheque Total";" ";"Montant total ch�ue";" " +"choose.attribute";"Choose Attribute";" ";"Choisir les attributs";" " +"choose.your.till";"Please choose your till number";" ";"Choisir le num�o de poste";" " +"clear";"Clear";" ";"Supprimer";" " +"close";"Close";" ";"Fermer";" " +"close.till";"Close Till";" ";"Fermer la caisse";" " +"closed";"Closed";" ";"Ferm�;" " +"closing.balance";"Closing Balance";" ";"Balance de cl�ure";" " +"cogs";"CoGS";" ";"Cots des marchandises vendues";" " +"colour";"Colour";" ";"Couleur";" " +"commission.details";"Commission Details";" ";"D�ails des commissions";" " +"completed";"Completed";" ";"Compl��;" " +"continue";"Continue";" ";"Continuer a v�ifier";" " +"create.bpartner";"Create Business Partner";" ";"Cr�r tiers";" " +"create.garment";"Create Garment";" ";"Cr�r";" " +"create.payment";"Create Payment";" ";"Cr�r un paiement";" " +"credit.check";"Credit Check";" ";"V�ification cr�it";" " +"credit.details";"Credit Details";" ";"D�ails cr�nces";" " +"credit.hold";"Credit Hold";" ";"Cr�it �v�ifier";" " +"credit.memo";"Credit Memo";" ";"Cr�it M�o";" " +"credit.ok";"Credit OK";" ";"Cr�it OK";" " +"credit.order";"Credit Order";" ";"Vente �cr�it";" " +"credit.order.discount";"Credit Order Discount";" ";"Remise sur vente �cr�it";" " +"credit.stop";"Credit Stop";" ";"Cr�it suspendu";" " +"credit.watch";"Credit Watch";" ";"Cr�it sous surveillance";" " +"current.month";"Current Month";" ";"Mois actuel";" " +"current.till.amount";"Current Till Amount";" ";"Montant en caisse";" " +"current.week";"Current Week";" ";"Semaine actuelle";" " +"current.year";"Current Year";" ";"Ann� actuelle";" " +"custom";"Custom";" ";"Personnalis�;" " +"custom.sales.reports";"Custom Sales Report";" ";"Tableaux de bords personnalis�";" " +"customer";"Customer";" ";"Client";" " +"customer.id";"Customer ID";" ";"Identification client";" " +"customer.info";"Customer Info";" ";"Information client";" " +"customer.returned.order";"Customer Returned Order";" ";"Retour client";" " +"customervendor";"Customer/Vendor";" ";"Client/Fournisseur";" " +"date.created";"Date Created";" ";"Date de cr�tion";" " +"date.from";"From";" ";"De";" " +"date.ordered";"Date Ordered";"Date Ordered";"Date de commande";" " +"date.range";"Date Range";" ";"P�iode";" " +"date.to";"to";" ";"�;" " +"deactivate";"De-activate";" ";"D�activer";" " +"deactivate.vendor";"Deactivate Vendor";" ";"D�activer fournisseur";" " +"dealer.name";"Dealer Name";" ";"Nom client";" " +"default";"Default";" ";"Par d�aut";" " +"delete";"Delete";" ";"Supprimer";" " +"delete.selected";"Delete Selected";" ";"Supprimer la s�ection";" " +"design";"Design";" ";"Dessin";" " +"discount.amt";"Discount";" ";"Escompte";" " +"discounted.price";"Discounted Price";" ";"Prix sold�;" " +"display";"Display";" ";"Display";" " +"display.all.records";"Do you want to display all records?";" ";"Voulez vous voir toute les entr�s?";" " +"doc.basis.type";"Doc Basis Type";" ";"Type de document";" " +"download.csv";"Download CSV";" ";"T��harger en CSV";" " +"drafted";"Drafted";" ";"Brouillon";" " +"dunning.letters.printed.successfully";"Dunning letters have been printed successfully";" ";"Les lettres ont ��imprim�s";" " +"edit";"Edit";" ";"Modifier";" " +"edit.attribute";"Edit Attribute";" ";"Modifier les attributs";" " +"edit.black.listed.cheque";"Edit Black Listed Cheque";" ";"Modifier la liste des ch�ues non recevables";" " +"edit.customer";"Edit Customer";" ";"Modifier client";" " +"edit.price";"Edit Price";" ";"Modifier prix";" " +"edit.price.list";"Edit Price List";" ";"Modifier la liste de prix";" " +"edit.product";"Edit Product";" ";"�iter le produit";" " +"edit.related.products";"Edit related products details";" ";"Modifier les d�ails des produits";" " +"edit.role";"Edit Role";" ";"Modifier le r�e";" " +"edit.user";"Edit User";" ";"Modifier utilisateur";" " +"edit.vendor";"Edit Vendor";" ";"�iter le fournisseur";" " +"enable.printing";"Enable printing";" ";"Permettre l`impression";" " +"enter";"ENTER";" ";"Entrer";" " +"excl.vat";"(excl. VAT)";" ";"TVA exclu";" " +"fast.moving.item";"Fast Moving Items Report";" ";"Tableau des produits les PLUS vendus";" " +"fast.moving.item.current.month";"Fast Moving Items Report (Current Month)";" ";"Tableau des produits les PLUS vendus (MOIS courant)";" " +"fast.moving.item.today";"Fast Moving Items Report (Today)";" ";"Tableau des produits les PLUS vendus (aujourd'hui)";" " +"filter.by";"Filter By";" ";"Filtrer par";" " +"filter.type";"Choose the type of filter";" ";"Choisir le type de filtre";" " +"first";"First";" ";"Premier";" " +"fixed";"Fixed";" ";"Fixe";" " +"float.amt.change";"This is the float amount for today. Please Enter float amount for the next day if needs to be changed.";" ";"Ceci est le fond de caisse pour aujourd'hui. Pri�e d'entrer le fond de caisse pour le jour suivant si besoin est.";" " +"footer.copyright";"All Contents ©2006 Tamak ICT";" ";" ";"Tout contenues et copies r�erv�" +"found.none";"Found None";" ";"Aucune information correspond �la recherche";" " +"from";"From";" ";"De";" " +"garment.template";"Garment Template";" ";"Mod�e pour v�ement";" " +"generate.commission";"Generate Commission";" ";"G��er les commissions";" " +"goods.received.note";"Goods Received Note";" ";"Achat produit";" " +"goods.returned.note";"Goods Returned Note";" ";"Retour produit";" " +"hide.details";"Hide Details";" ";"Cacher d�ails";" " +"import.black.listed";"Import Black Listed Cheques";" ";"Importer la liste de ch�ues non recevables";" " +"import.blacklisted.message1";"This utility is to import the a list of Black Listed Cheques from a csv file into the system,
    The csv file should look like the one shown below including the header:";" ";"Cet outil aide �importer une liste de ch�ue non recevables dans l'application a partir d'un fichier CSV.
    le ficher CSV doit �re importe sous le m�e format que celui de l'exemple ci-dessous en incluant l'en-t�e";" " +"import.list";"Import List";" ";"Importer la liste";" " +"import.product.message";"This utility is to import the products & Stock in Hand from a csv file into the system,
    For importing the garment products, the CSV file name should containg the word 'Garment'
    The csv file should look like the one shown below including the header";" ";"Cet outil aide �importer une liste de produit accompagner du stock dans l'application a partir d'un fichier CSV.
    le ficher CSV doit �re importe sous le m�e format que celui de l'exemple ci-dessous en incluant l'en-t�e";" " +"incl.vat";"(incl. VAT)";" ";"( TVA inclue)";" " +"inprogress";"InProgress";" ";"En cours";" " +"invalid";"Invalid";" ";"Non valable";" " +"invoice.no";"Invoice No";" ";"No de facture";" " +"invoke";"Invoke";" ";"Chercher";" " +"invoke.customer.returned.order";"Invoke";" ";"Chercher r��ence pour retour client";" " +"invoke.partial";"Invoke Partial POS Order";" ";"Chercher Ordre de vente partiel";" " +"items";"Items";" ";"Items";" " +"last";"Last";" ";"Suivant";" " +"last.2.months";"Last 2 Months";" ";"Deux derniers mois";" " +"last.2.weeks";"Last 2 Weeks";" ";"Deux derni�es semaines";" " +"last.3.months";"Last 3 Months";" ";"Les 3 derniers mois";" " +"last.3.weeks";"Last 3 Weeks";" ";"Les 3 derni�es semaines";" " +"last.6.month";"Last 6 Months";" ";"Les 6 derniers mois";" " +"license.name";"License Name";"License Name";"Nom de la Licence";" " +"license.valid";"License Valid";"License Valid";"Licence valide";" " +"licensed.distribution";"Licensed Distribution";" ";"Distribution de la licence";" " +"licensed.module";"Licensed Modules";" ";"Module de la Licence";" " +"licensing.info";"Licensing Information";" ";"Information de la licence";" " +"list";"List";" ";"Liste";" " +"login.home.all.contents";"All content";" ";"Tout le contenu";" " +"login.home.loginForgot";"Forgot password?";" ";"Vous avez oubli�votre mot de passe?";" " +"login.home.message1";"Please enter your username and password";" ";"Veuillez entrer votre identifiant et votre mot de passe";" " +"login.home.message2";"Please enter PIN";" ";"Entrer votre code secret";" " +"login.home.password";"Password";" ";"Mot de passe";" " +"login.home.username";"Username";" ";"Nom utilisateur";" " +"login.password.backToLogin";"  Click Here to go back to the Login Screen";" ";" ";" " +"login.password.passwordSent";"Your password has been sent you should receive it in a few minutes";" ";"Votre mot de passe vous a ��envoy� vous devriez le recevoir d'ici quelques minutes";" " +"marked.price";"Marked Price";" ";"Prix affich�;" " +"max.active.users";"Max Active Users";" ";"Max d`utilisateur valide";" " +"max.sold.item";"Max sold Item";" ";"Items";" " +"menus";"Menus";" ";"Menus";" " +"min.item.sold";"Min Item Sold";" ";"Min d'article vendus";" " +"mixed";"Mixed";" ";"mixe";" " +"mobile";"Moblie No";" ";"GSM";" " +"model";"Model";" ";"Mod�e";" " +"month";"Month";" ";"Mois";" " +"net.amt";"Net Amount";" ";"Montant Net";" " +"net.cash.trx";"Net Cash Trx";" ";"Montant Net en esp�e";" " +"net.transaction";"Net Transaction";" ";"Transaction net";" " +"new.attribute.value";"New Attribute Value";" ";"Nouvel valeur pour l'attribue";" " +"new.credit.order";"New Credit Order";" ";"Nouvel vente �cr�it";" " +"new.customer";"New Customer";" ";"Nouveau client";" " +"new.customer.return.order";"New Customer Return Order";" ";"Nouveau retour client";" " +"new.goods.received.note";"New Goods Receive Note";" ";"Nouvel achat produit";" " +"new.goods.returned.note";"New Goods Returned Note";" ";"Nouveau retour produit";" " +"new.order";"New Order";" ";"Nouvel vente";" " +"new.price";"New Price";" ";"Nouveau prix";" " +"no";"No";" ";"No";" " +"no.customer.was.found.for";"No customer was found for";" ";"Aucun client n'a ��trouv�pour votre recherche:";" " +"no.shipment";"No Shipment";" ";"No d`exp�ition";" " +"no.vendor.was.found.for";"No vendor was found for";" ";"Aucun fournisseur n'a ��trouv�pour votre recherche:";" " +"normal.template";"Normal Template";" ";"Mod�e normal";" " +"not.authorised.to.give.discount";"It seems that you are not authorised to give discounts";" ";"Vous n'avez pas le droit de donner des remises";" " +"not.found";"Not Found";" ";"Ne peux pas �re trouv�;" " +"notes";"Notes";"Notes";"Coin";" " +"num.active.users";"No of Active Users";" ";"Nombre d`utilisateur actif";" " +"num.operations";"Number of Operations";" ";"Nombre d`op�ation";" " +"old.attribute.value";"Old Attribute Value";" ";"Ancienne valeur de l'attribue";" " +"open.invoices";"Open Invoices";" ";"Ouvrir factures";" " +"opening.balance";"Opening Balance";" ";"Balance d'ouverture";" " +"order.no";"Order No";" ";"num�o de facture";" " +"order.type";"Order Type";" ";"Type de facture";" " +"organisation.name";"Organisations";" ";"Organisation";" " +"partial.pos.order";"Partial POS Order";" ";"Vente partielle";" " +"partial.pos.order.history";"Partial POS Order History";" ";"Historique des ventes partielles";" " +"payment.allocation";"Payment Allocation";" ";"Allocation de payement";" " +"payment.by";"Payment By";" ";"Paiement par";" " +"payment.details";"Payment Details";" ";"D�ails des paiements";" " +"payment.num";"Payment No";"Payment No";"Num�o du paiement";" " +"payment.status";"Payment Status";"Payment Status";"Statue du paiement";" " +"payment.terms";"Payment Terms";" ";"Terme de paiement";" " +"payment.type";"Payment Type";" ";"Type de paiement";" " +"periodic.cash.details";"Periodic Cash Book Details";" ";"D�ails du livre de caisse par p�iode";" " +"please.enter.pin";"Please enter PIN";" ";"Entrer votre code secret";" " +"pmenu.administration";"Administration";" ";"Administration";" " +"pmenu.cash.sales";"Cash Sales";" ";"Ventes";" " +"pmenu.credit.sales";"Credit Sales";" ";"Ventes �Cr�it";" " +"pmenu.performance.analysis";"Performance Analysis";" ";"Tableaux de bords";" " +"pmenu.purchases";"Purchases";" ";"Achat";" " +"pmenu.stock";"Stock";" ";"Stock";" " +"pos.info";"POS Info";" ";"Information du point de vente";" " +"pos.info.current.month";"POS Info (Current Month)";" ";"Information du point de vente(du mois)";" " +"pos.info.custom";"POS Info (Custom)";" ";"Information du point de vente(Personnalis�";" " +"pos.info.today";"POS Info (Today)";" ";"Information du point de vente(aujourd'hui)";" " +"pos.name";"POS Name";" ";"Nom de point de vente";" " +"pos.order";"POS Order";" ";"Facture";" " +"pos.order.history";"POS Order History";" ";"Historique des factures";" " +"posPassowrd.welcome";"Welcome to Tamak POS";" ";"Bienvenue";" " +"postalAddr";"Postal Address";" ";"Adresse postale";" " +"preference.themes";"Themes";" ";"Th�es";" " +"preferences";"Preferences";" ";"Preferences";" " +"prepared.order";"Prepared Order";" ";"Ventes partielles";" " +"prev";"Prev";" ";"Pr��ent";" " +"print.barcode";"Print Barcode";" ";"Imprimer code barre";" " +"print.dunning.letters";"Print Dunning Letters";" ";"Imprimer lettres de rappels";" " +"print.fidelity.card";"Print Fidelity Card";" ";"Imprimer carte de fid�it�;" " +"print.order";"Print Order";" ";"Imprimer facture";" " +"print.pdf";"Print PDF";" ";"Imprimer PDF";" " +"printer.enabled";"Printer enabled";" ";"Imprimante active";" " +"printer.name";"Printer name";" ";"Nom de l`imprimante";" " +"product.already.exists";"Product name already exists!";" ";"Nom du produit est d��existant";" " +"product.id";"Product ID";" ";"ID Produit";" " +"product.info";"Product Info";" ";"Information Produit";" " +"product.type.item";"Item";" ";"Items";" " +"product.type.services";"Services";" ";"Services";" " +"product.updated";"The Products have been updated";" ";"Les produits ont ��mis �jour";" " +"profit.margin";"Profit Margin";" ";"Marge brute";" " +"purchase.price";"Purchase Price";" ";"Prix d'achat";" " +"qty.received";"Qty Received";" ";"Quantit� re�es";" " +"qty.returned.by.customer";"Qty Returned By Customer";" ";"Quantit�retourn�par le client";" " +"qty.returned.to.supplier";"Qty Returned to Supplier";" ";"Quantit�retourn�au fournisseur";" " +"qty.sold";"Qty Sold";" ";"Quantit�vendues";" " +"reason.message";"Reason";" ";"Raison";" " +"record.found";"Records found";" ";"Donn� trouv�s";" " +"records.per.page";"records per page";" ";"Donn� par page";" " +"remote.printing";"Remote printing";" ";"Imprim��distance";" " +"remove.customer.fidelity.card";"Remove Customer for fidelity card";" ";"Enlever client";" " +"report.filter.settings";"Report Filter Settings";" ";"R�lage du filtre des tableaux";" " +"reprint";"Reprint";" ";"R�mprimer";" " +"returned.order";"Returned Order";" ";"Retour";" " +"revenue";"Revenue";" ";"Chiffre d'affaires";" " +"sales.details";"Sales Details";" ";"D�ail de ventes";" " +"sales.order";"Sales Order";" ";"Ventes";" " +"sales.price";"Sales Price";" ";"Prix de vente";" " +"sales.reports";"Sales Reports";" ";"Tableau de vente";" " +"save";"Save";" ";"Save";" " +"save.as.csv";"Save as CSV";" ";"Sauvegarder en CSV";" " +"search";"Search";" ";"Rechercher";" " +"search.customer";"Search Customer";" ";"Rechercher un client";" " +"search.customer.notfound";"No customers were found for";" ";"Pas de clients trouv�pour";" " +"search.product";"Search Product";" ";"Rechercher un produit";" " +"search.product.notfound";"No products were found for:";" ";"Aucun produit n'a ��trouv�pour votre recherche:";" " +"search.result.displaying";"Displaying";" ";"Affichage";" " +"search.result.of";"of";" ";"De";" " +"search.result.to";"to";" ";"Jusqu'�;" " +"search.results";"Search Results";" ";"Rechercher r�ultats";" " +"select";"Select";" ";"S�ectionner";" " +"select.all";"Select All";" ";"Tout S�ectionner";" " +"select.bpartner.type";"Select partner type";" ";"Choisir type de tiers";" " +"select.range";"Select Range";" ";"S�ectionner une p�iode";" " +"selected.customers";"Selected Customers";" ";"S�ectionner les clients";" " +"settle.payment";"Settle Payment";" ";"Paiement d'une facture";" " +"settle.payment.message";"NOTE:-The Cash Payments would have effect only when the cash book is closed";" ";"NOTE:-The Cash Payments would have effect only when the cash book is closed";" " +"shipment.no";"Shipment No";" ";"Num�o d`exp�ition";" " +"shipment.required";"Shipment Required";" ";"Exp�ition requise";" " +"shipment.status";"Shipment Status";"Shipment Status";"Statue de l`exp�ition";" " +"show.details";"Show Details";" ";"Montrer d�ails";" " +"size";"Size";" ";"Taille";" " +"slow.moving.item";"Slow Moving Items";" ";"Produits lents";" " +"smenu.adjust.cashbook";"Adjust Cash Book";" ";"Ajuster le livre de caisse";" " +"smenu.adjust.inventory.id";"Adjust Inventory";" ";"Ajuster l'inventaire";" " +"smenu.adjust.stock.id";"Stock Adjustment";" ";"Ajuster le stock";" " +"smenu.bpartner.sales.details";"Business Partner Sales Details";" ";"Info sur tiers";" " +"smenu.bpartners";"Business Partners";" ";"Tiers";" " +"smenu.cash.sales";"Cash Sales";" ";"Ventes";" " +"smenu.cash.sales.customer.complusory";"Cash Sales (Customer Compulsory)";" ";"Ventes (Client obligatoire)";" " +"smenu.cash.sales.history";"Cash Sales History";" ";"Historique des ventes";" " +"smenu.cash.sales.multiple.payments";"Cash Sales (Discount/Multiple Payments)";" ";"Ventes (Remises/Paiements multiples)";" " +"smenu.cashbook.history";"Cash Book History";" ";"Historique du livre de caisse";" " +"smenu.cashbook.report";"Cash Book Report";" ";"Tableaux de bords du livre de caisse";" " +"smenu.check.repair.database.integrity";"Check/Repair Database Integrity";" ";"V�ifier/R�arer l'int�rit�de la base de donn�s";" " +"smenu.close.till";"Close Till";" ";"Fermer la caisse";" " +"smenu.complete.prepared.order";"Complete Prepared Order";" ";"Compl��une vente partielle";" " +"smenu.create.unallocated.payment.id";"Create General Payments";" ";"Cr�r un paiement g��al";" " +"smenu.credit.memo.history.id";"Credit Memo History";" ";"Credit Memo History";" " +"smenu.credit.sales";"Credit Sales";" ";"Ventes �cr�it";" " +"smenu.credit.sales.history";"Credit Sales History";" ";"Historique des ventes �cr�it";" " +"smenu.creditmemo.from.creditorder.id";"Invoke Credit Memo";" ";"Chercher r��ence pour vente �cr�it";" " +"smenu.current.money.in.terminal";"Current Money in Terminal";" ";"Montant du terminal";" " +"smenu.customer.return.history.id";"Customer Return History";" ";"Customer Return History";" " +"smenu.customer.returned.order";"Customer Returned Order";" ";"Retour client";" " +"smenu.customers";"Customers";" ";"Clients";" " +"smenu.document.history";"Document History";" ";"Historique des documents";" " +"smenu.dunning.letters";"Dunning Letters";" ";"Lettres de rappelles";" " +"smenu.edit.product.attribute.value";"Edit Product Attribute Value";" ";"�iter valeur de l'attribut du produit";" " +"smenu.fast.moving.items";"Fast Moving Items";" ";"Tableaux des produits les plus vendus";" " +"smenu.generate.commission";"Generate Commission";" ";"G��er les commissions";" " +"smenu.goods.received.note";"Goods Received Note";" ";"Achat produit";" " +"smenu.goods.received.note.history";"Goods Received Note History";" ";"Historique des achats produit";" " +"smenu.goods.returned.note";"Goods Returned Note";" ";"Retour produit";" " +"smenu.goods.returned.note.history";"Goods Returned Note History";" ";"Historique des retours produit";" " +"smenu.inventory.history.id";"Inventory History";" ";"Historique des inventaires";" " +"smenu.invoke.customer.returned.order";"Invoke Customer Returned Order";" ";"Rechercher retour client";" " +"smenu.logout";"Logout";" ";"Quitter";" " +"smenu.open.cashdrawer";"Open Cash Drawer";" ";"Ouvrir la caisse";" " +"smenu.order.history";"Order History";" ";"Historique des ventes";" " +"smenu.payment.allocation.history";"Payment Allocations History";" ";"Historique des allocations de paiement";" " +"smenu.payment.term";"Payment Term";" ";"Allocation de payement";" " +"smenu.performance.analysis.report";"Performance Analysis Report";" ";"Tableaux de bords";" " +"smenu.preferences";"Preferences";" ";"Pr��ences";" " +"smenu.prepare.order";"Prepare Order";" ";"Ventes partielles";" " +"smenu.prepared.order.history";"Prepared Order History";" ";"Historique des ventes partielles";" " +"smenu.products";"Products";" ";"Produits";" " +"smenu.quick.cash.sales";"Quick Cash Sales";" ";"Ventes rapide";" " +"smenu.role";"Role";" ";"R�e";" " +"smenu.sales.report.per.terminal";"Sales Report per Terminal";" ";"Tableaux de bords par terminal";" " +"smenu.settle.payment.credit.sales";"Settle Payment on a Credit Sales";" ";"Paiement pour ventes �cr�it";" " +"smenu.slow.moving.items";"Slow Moving Items";" ";"Tableaux des produits les moins vendus";" " +"smenu.stock";"Stock";" ";"Stock";" " +"smenu.stock.movement";"Stock Movement";" ";"Mouvement du stock";" " +"smenu.tax";"Tax";" ";"Taxe";" " +"smenu.users";"Users";" ";"Utilisateur";" " +"smenu.vendors";"Vendors";" ";"Fournisseurs";" " +"smenu.view.last.generated.commission";"Last Generated Commission";" ";"Visualiser les derni�es commissions g���s";" " +"smenu.view.licensing";"Licensing";" ";"Visualiser licence";" " +"status";"Status";"Status";"Statues";" " +"stock.in.hand";"Stock in Hand";" ";"Stock disponible";" " +"stock.inquiry";"Stock Inquiry";" ";"Interrogation du stock";" " +"stock.movement";"Stock Movement";" ";"Mouvement du stock";" " +"stock.movement.report";"Stock Movement Report";" ";"�ats sur les mouvements de stock";" " +"submit";"Submit";" ";"Soumettre";" " +"summary.by.periods";"Summary By Period";" ";"R�um�par p�iode";" " +"switch.to.paging";"Switch to Paging";" ";"Changer la pagination";" " +"tamak.pos";"TAMAK ICT WARMS";" ";"Tamak ICT ARMS";" " +"tax.credit";"Tax Credit";" ";"Cr�it de TVA";" " +"tax.due";"Tax Due";" ";"TVA d";" " +"texttile.products.only";"Textile Products Only";" ";"Produits textiles uniquement";" " +"the.cart.has";"The Cart has";" ";"Le caddie contient:";" " +"till.balance.entered";"Till Balance Entered";" ";"Balance de la caisse entr�par vendeur";" " +"till.management";"Till Mgt";" ";"G�er la caisse";" " +"till.no";"Till No";" ";"No de caisse";" " +"time.hour";"h";" ";"H";" " +"time.minute";"m";" ";"Min";" " +"to";"To";" ";"Jusqu'�;" " +"today";"Today";" ";"Aujourd'hui";" " +"total";"Total";" ";"Total";" " +"total.price";"Total Price";" ";"Prix total";" " +"trade.revenue";"Trade Revenue";" ";"Chiffre d'affaires";" " +"unallocated.payments";"Unallocated Payments";" ";"Paiements non assign�;" " +"update.details";"Update Details";" ";"Mise �jour";" " +"user";"User";" ";"Utilisateur";" " +"user.details";"User's Details";" ";"D�ails utilisateur";" " +"user.info";"Information";" ";"Information";" " +"vat";"VAT";" ";"TVA";" " +"vendor.details";"Vendor Details";" ";"D�ails fournisseurs";" " +"vendor.ref";"Vendor Ref";" ";"R��ence fournisseur";" " +"vendors";"Vendors";" ";"Fournisseurs";" " +"view";"View";" ";"Visualiser";" " +"view.attributes";"View Attributes";"View Attributes";"Visualiser attribues";" " +"view.by";"View By";" ";"Visualiser par";" " +"view.info";"View Info";" ";"Visualiser Info";" " +"view.product.cart";"View Product Cart";" ";"Visualiser caddie";" " +"view.report";"View Report";" ";"Visualiser tableaux de bords";" " +"view.role";"View Role";" ";"Visualiser R�e";" " +"view.vendor";"View Vendor";" ";"Visualiser fournisseur";" " +"year";"Year";" ";"Ann�";" " +"yes";"Yes";" ";"Oui";" " +"price.x";"Price(excl. VAT)";"Prix(excl. TVA)";" " +"price.i";"Price(incl. VAT)";"Prix(incl. TVA)";" " +"LogOut";"Log Out";"Sortir";" " +"smenu.price.check";"Price Check";"Verifier Prix";" " +"next";"Next";"Suivant";" " +"grouped.by";"Group by";"Grouper par";" " +"view.product";"View Product";"Produit de vue";" " +"activate.product";"Activate Ptoduct";"Activez le produit";" " +"deactivate.product";"Deactivate Produit";"Desactiver le produit";" " diff --git a/posterita/posterita/web/WEB-INF/c.tld b/posterita/posterita/web/WEB-INF/c.tld new file mode 100644 index 0000000000..ce80e8dd55 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/c.tld @@ -0,0 +1,416 @@ + + + + 1.0 + 1.2 + c + http://java.sun.com/jstl/core + JSTL core + JSTL 1.0 core library + + + + org.apache.taglibs.standard.tlv.JstlCoreTLV + + + expressionAttributes + + out:value + out:default + out:escapeXml + if:test + import:url + import:context + import:charEncoding + forEach:items + forEach:begin + forEach:end + forEach:step + forTokens:items + forTokens:begin + forTokens:end + forTokens:step + param:encode + param:name + param:value + redirect:context + redirect:url + set:property + set:target + set:value + url:context + url:value + when:test + + + Whitespace-separated list of colon-separated token pairs + describing tag:attribute combinations that accept expressions. + The validator uses this information to determine which + attributes need their syntax validated. + + + + + + catch + org.apache.taglibs.standard.tag.common.core.CatchTag + JSP + + Catches any Throwable that occurs in its body and optionally + exposes it. + + + var + false + false + + + + + choose + org.apache.taglibs.standard.tag.common.core.ChooseTag + JSP + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + + + + out + org.apache.taglibs.standard.tag.el.core.OutTag + JSP + + Like <%= ... >, but for expressions. + + + value + true + false + + + default + false + false + + + escapeXml + false + false + + + + + if + org.apache.taglibs.standard.tag.el.core.IfTag + JSP + + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + + + test + true + false + + + var + false + false + + + scope + false + false + + + + + import + org.apache.taglibs.standard.tag.el.core.ImportTag + org.apache.taglibs.standard.tei.ImportTEI + JSP + + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + + + url + true + false + + + var + false + false + + + scope + false + false + + + varReader + false + false + + + context + false + false + + + charEncoding + false + false + + + + + forEach + org.apache.taglibs.standard.tag.el.core.ForEachTag + org.apache.taglibs.standard.tei.ForEachTEI + JSP + + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + + + items + false + false + + + begin + false + false + + + end + false + false + + + step + false + false + + + var + false + false + + + varStatus + false + false + + + + + forTokens + org.apache.taglibs.standard.tag.el.core.ForTokensTag + JSP + + Iterates over tokens, separated by the supplied delimeters + + + items + true + false + + + delims + true + false + + + begin + false + false + + + end + false + false + + + step + false + false + + + var + false + false + + + varStatus + false + false + + + + + otherwise + org.apache.taglibs.standard.tag.common.core.OtherwiseTag + JSP + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + + + + param + org.apache.taglibs.standard.tag.el.core.ParamTag + JSP + + Adds a parameter to a containing 'import' tag's URL. + + + name + true + false + + + value + false + false + + + + + redirect + org.apache.taglibs.standard.tag.el.core.RedirectTag + JSP + + Redirects to a new URL. + + + var + false + false + + + scope + false + false + + + url + true + false + + + context + false + false + + + + + remove + org.apache.taglibs.standard.tag.common.core.RemoveTag + empty + + Removes a scoped variable (from a particular scope, if specified). + + + var + true + false + + + scope + false + false + + + + + set + org.apache.taglibs.standard.tag.el.core.SetTag + JSP + + Sets the result of an expression evaluation in a 'scope' + + + var + false + false + + + value + false + false + + + target + false + false + + + property + false + false + + + scope + false + false + + + + + url + org.apache.taglibs.standard.tag.el.core.UrlTag + JSP + + Prints or exposes a URL with optional query parameters + (via the c:param tag). + + + var + false + false + + + scope + false + false + + + value + true + false + + + context + false + false + + + + + when + org.apache.taglibs.standard.tag.el.core.WhenTag + JSP + + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + + + test + true + false + + + + diff --git a/posterita/posterita/web/WEB-INF/dcs.tld b/posterita/posterita/web/WEB-INF/dcs.tld new file mode 100644 index 0000000000..f24e99d210 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/dcs.tld @@ -0,0 +1,201 @@ + + + +1.0 +1.1 +dcs + + + + +orderStatus +org.posterita.taglib.OrderStatus +JSP + +name +true +true + + +property +true +true + + +scope +false +true + + + + +attributeValues +com.posterita.taglib.AttributeValues +JSP + +name +true +true + + +property +true +true + + +scope +false +true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/WEB-INF/fmt.tld b/posterita/posterita/web/WEB-INF/fmt.tld new file mode 100644 index 0000000000..20523ee619 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/fmt.tld @@ -0,0 +1,442 @@ + + + + 1.0 + 1.2 + fmt + http://java.sun.com/jstl/fmt + JSTL fmt + JSTL 1.0 i18n-capable formatting library + + + + org.apache.taglibs.standard.tlv.JstlFmtTLV + + + expressionAttributes + + requestEncoding:value + setLocale:value + setLocale:variant + timeZone:value + setTimeZone:value + bundle:basename + bundle:prefix + setBundle:basename + message:key + message:bundle + param:value + formatNumber:value + formatNumber:pattern + formatNumber:currencyCode + formatNumber:currencySymbol + formatNumber:groupingUsed + formatNumber:maxIntegerDigits + formatNumber:minIntegerDigits + formatNumber:maxFractionDigits + formatNumber:minFractionDigits + parseNumber:value + parseNumber:pattern + parseNumber:parseLocale + parseNumber:integerOnly + formatDate:value + formatDate:pattern + formatDate:timeZone + parseDate:value + parseDate:pattern + parseDate:timeZone + parseDate:parseLocale + + + Whitespace-separated list of colon-separated token pairs + describing tag:attribute combinations that accept expressions. + The validator uses this information to determine which + attributes need their syntax validated. + + + + + + requestEncoding + org.apache.taglibs.standard.tag.el.fmt.RequestEncodingTag + empty + + Sets the request character encoding + + + value + false + false + + + + + setLocale + org.apache.taglibs.standard.tag.el.fmt.SetLocaleTag + empty + + Stores the given locale in the locale configuration variable + + + value + true + false + + + variant + false + false + + + scope + false + false + + + + + timeZone + org.apache.taglibs.standard.tag.el.fmt.TimeZoneTag + JSP + + Specifies the time zone for any time formatting or parsing actions + nested in its body + + + value + true + false + + + + + setTimeZone + org.apache.taglibs.standard.tag.el.fmt.SetTimeZoneTag + empty + + Stores the given time zone in the time zone configuration variable + + + value + true + false + + + var + false + false + + + scope + false + false + + + + + bundle + org.apache.taglibs.standard.tag.el.fmt.BundleTag + JSP + + Loads a resource bundle to be used by its tag body + + + basename + true + false + + + prefix + false + false + + + + + setBundle + org.apache.taglibs.standard.tag.el.fmt.SetBundleTag + empty + + Loads a resource bundle and stores it in the named scoped variable or + the bundle configuration variable + + + basename + true + false + + + var + false + false + + + scope + false + false + + + + + message + org.apache.taglibs.standard.tag.el.fmt.MessageTag + JSP + + Maps key to localized message and performs parametric replacement + + + key + false + false + + + bundle + false + false + + + var + false + false + + + scope + false + false + + + + + param + org.apache.taglibs.standard.tag.el.fmt.ParamTag + JSP + + Supplies an argument for parametric replacement to a containing + <message> tag + + + value + false + false + + + + + formatNumber + org.apache.taglibs.standard.tag.el.fmt.FormatNumberTag + JSP + + Formats a numeric value as a number, currency, or percentage + + + value + false + false + + + type + false + false + + + pattern + false + false + + + currencyCode + false + false + + + currencySymbol + false + false + + + groupingUsed + false + false + + + maxIntegerDigits + false + false + + + minIntegerDigits + false + false + + + maxFractionDigits + false + false + + + minFractionDigits + false + false + + + var + false + false + + + scope + false + false + + + + + parseNumber + org.apache.taglibs.standard.tag.el.fmt.ParseNumberTag + JSP + + Parses the string representation of a number, currency, or percentage + + + value + false + false + + + type + false + false + + + pattern + false + false + + + parseLocale + false + false + + + integerOnly + false + false + + + var + false + false + + + scope + false + false + + + + + formatDate + org.apache.taglibs.standard.tag.el.fmt.FormatDateTag + empty + + Formats a date and/or time using the supplied styles and pattern + + + value + true + false + + + type + false + false + + + dateStyle + false + false + + + timeStyle + false + false + + + pattern + false + false + + + timeZone + false + false + + + var + false + false + + + scope + false + false + + + + + parseDate + org.apache.taglibs.standard.tag.el.fmt.ParseDateTag + JSP + + Parses the string representation of a date and/or time + + + value + false + false + + + type + false + false + + + dateStyle + false + false + + + timeStyle + false + false + + + pattern + false + false + + + timeZone + false + false + + + parseLocale + false + false + + + var + false + false + + + scope + false + false + + + + diff --git a/posterita/posterita/web/WEB-INF/pos.tld b/posterita/posterita/web/WEB-INF/pos.tld new file mode 100644 index 0000000000..b194ced21f --- /dev/null +++ b/posterita/posterita/web/WEB-INF/pos.tld @@ -0,0 +1,76 @@ + + + + 1.0 + 1.2 + pos + pos.tld + POSterita + $Id: pos.tld,v 1.2 2006/11/29 05:23:55 alok Exp $ + + + + message + org.posterita.pos.taglib.MessageTag + JSP + Display element + + key + true + true + + + printing + false + false + + + textOnly + false + false + + + + bpartner + org.posterita.pos.taglib.BPartnerSearchTag + JSP + Ajax search for BPartner + + name + true + true + + + property + true + true + + + disabled + false + true + + + isCustomer + false + false + + + isVendor + false + false + + + isEmployee + false + false + + + size + false + false + + + \ No newline at end of file diff --git a/posterita/posterita/web/WEB-INF/posterita.tld b/posterita/posterita/web/WEB-INF/posterita.tld new file mode 100644 index 0000000000..11315c500f --- /dev/null +++ b/posterita/posterita/web/WEB-INF/posterita.tld @@ -0,0 +1,146 @@ + + + +1.0 +1.1 +dms + + + + +regionName +com.dms.taglib.Region +JSP + +name +true +true + + +property +false +true + + +scope +true +true + + + + +warehouseName +com.dms.taglib.Warehouse +JSP + +name +true +true + + +property +false +true + + +scope +true +true + + + + + +productName +com.dms.taglib.ProductName +JSP + +name +true +true + + +property +false +true + + +scope +true +true + + + + + bankName + com.dms.taglib.BankName + JSP + + name + true + true + + + property + false + true + + + scope + true + true + + + + + +menuClose +com.dms.taglib.MenuClose +JSP + +name +true +true + + +property +false +true + + +scope +true +true + + + + + +sco +com.dms.taglib.SCONaming +JSP + +name +false +true + + +property +false +true + + +abbreviated +false +true + + +scope +false +true + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/WEB-INF/struts-bean.tld b/posterita/posterita/web/WEB-INF/struts-bean.tld new file mode 100644 index 0000000000..5fe94bd359 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/struts-bean.tld @@ -0,0 +1,382 @@ + + + + + + + + + + +1.2 +1.1 +bean +http://struts.apache.org/tags-bean + +cookie +org.apache.struts.taglib.bean.CookieTag +org.apache.struts.taglib.bean.CookieTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +define +org.apache.struts.taglib.bean.DefineTag +org.apache.struts.taglib.bean.DefineTei +JSP + +id +true +false + + +name +false +true + + +property +false +true + + +scope +false +true + + +toScope +false +true + + +type +false +true + + +value +false +true + + + +header +org.apache.struts.taglib.bean.HeaderTag +org.apache.struts.taglib.bean.HeaderTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +include +org.apache.struts.taglib.bean.IncludeTag +org.apache.struts.taglib.bean.IncludeTei +empty + +anchor +false +true + + +forward +false +true + + +href +false +true + + +id +true +false + + +name +false +true + + +page +false +true + + +transaction +false +true + + + +message +org.apache.struts.taglib.bean.MessageTag +empty + +arg0 +false +true + + +arg1 +false +true + + +arg2 +false +true + + +arg3 +false +true + + +arg4 +false +true + + +bundle +false +true + + +key +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +page +org.apache.struts.taglib.bean.PageTag +org.apache.struts.taglib.bean.PageTei +empty + +id +true +false + + +property +true +true + + + +parameter +org.apache.struts.taglib.bean.ParameterTag +org.apache.struts.taglib.bean.ParameterTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +resource +org.apache.struts.taglib.bean.ResourceTag +org.apache.struts.taglib.bean.ResourceTei +empty + +id +true +false + + +input +false +true + + +name +true +true + + + +size +org.apache.struts.taglib.bean.SizeTag +org.apache.struts.taglib.bean.SizeTei +empty + +collection +false +true + + +id +true +false + + +name +false +true + + +property +false +true + + +scope +false +true + + + +struts +org.apache.struts.taglib.bean.StrutsTag +org.apache.struts.taglib.bean.StrutsTei +empty + +id +true +false + + +formBean +false +true + + +forward +false +true + + +mapping +false +true + + + +write +org.apache.struts.taglib.bean.WriteTag +empty + +bundle +false +true + + +filter +false +true + + +format +false +true + + +formatKey +false +true + + +ignore +false +true + + +locale +false +true + + +name +true +true + + +property +false +true + + +scope +false +true + + + + + + diff --git a/posterita/posterita/web/WEB-INF/struts-config.xml b/posterita/posterita/web/WEB-INF/struts-config.xml new file mode 100644 index 0000000000..e33082530b --- /dev/null +++ b/posterita/posterita/web/WEB-INF/struts-config.xml @@ -0,0 +1,6673 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/WEB-INF/struts-config_1_2.dtd b/posterita/posterita/web/WEB-INF/struts-config_1_2.dtd new file mode 100644 index 0000000000..fa479f76b5 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/struts-config_1_2.dtd @@ -0,0 +1,686 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/WEB-INF/struts-html.tld b/posterita/posterita/web/WEB-INF/struts-html.tld new file mode 100644 index 0000000000..a53db16f66 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/struts-html.tld @@ -0,0 +1,3032 @@ + + + + + + + + + + +1.2 +1.1 +html +http://struts.apache.org/tags-html + +base +org.apache.struts.taglib.html.BaseTag +empty + +target +false +true + + +server +false +true + + + +button +org.apache.struts.taglib.html.ButtonTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +cancel +org.apache.struts.taglib.html.CancelTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +checkbox +org.apache.struts.taglib.html.CheckboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +errors +org.apache.struts.taglib.html.ErrorsTag +empty + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + + +file +org.apache.struts.taglib.html.FileTag + +accesskey +false +true + + +accept +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +form +org.apache.struts.taglib.html.FormTag +JSP + +action +true +true + + +acceptCharset +false +true + + +enctype +false +true + + +focus +false +true + + +focusIndex +false +true + + +method +false +true + + +onreset +false +true + + +onsubmit +false +true + + +scriptLanguage +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +target +false +true + + + +frame +org.apache.struts.taglib.html.FrameTag + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +frameborder +false +true + + +frameName +false +true + + +href +false +true + + +longdesc +false +true + + +marginheight +false +true + + +marginwidth +false +true + + +name +false +true + + +noresize +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +scrolling +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + + +hidden +org.apache.struts.taglib.html.HiddenTag +empty + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + +write +false +true + + + +html +org.apache.struts.taglib.html.HtmlTag +JSP + +lang +false +true + + +locale +false +true + + +xhtml +false +true + + + +image +org.apache.struts.taglib.html.ImageTag + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +locale +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +pageKey +false +true + + +property +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +img +org.apache.struts.taglib.html.ImgTag +empty + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +contextRelative +false +true + + +height +false +true + + +hspace +false +true + + +imageName +false +true + + +ismap +false +true + + +locale +false +true + + +lowsrc +false +true + + +name +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +paramId +false +true + + +page +false +true + + +pageKey +false +true + + +action +false +true + + +module +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +useLocalEncoding +false +true + + +usemap +false +true + + +vspace +false +true + + +width +false +true + + + +javascript +org.apache.struts.taglib.html.JavascriptValidatorTag +empty + +cdata +false +true + + +dynamicJavascript +false +false + + +formName +false +true + + +method +false +true + + +page +false +true + + +scriptLanguage +false +true + + +src +false +true + + +staticJavascript +false +false + + +htmlComment +false +true + + + +link +org.apache.struts.taglib.html.LinkTag + +accesskey +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +indexed +false +true + + +indexId +false +true + + +linkName +false +true + + +name +false +true + + +onblur +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +target +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +messages +org.apache.struts.taglib.html.MessagesTag +org.apache.struts.taglib.html.MessagesTei +JSP + +id +true +false + + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +header +false +true + + +footer +false +true + + +message +false +true + + + +multibox +org.apache.struts.taglib.html.MultiboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +option +org.apache.struts.taglib.html.OptionTag + +bundle +false +true + + +disabled +false +true + + +key +false +true + + +locale +false +true + + +style +false +true + + +styleId +false +true + + +styleClass +false +true + + +value +true +true + + + +options +org.apache.struts.taglib.html.OptionsTag +empty + +collection +false +true + + +filter +false +true + + +labelName +false +true + + +labelProperty +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + + +optionsCollection +org.apache.struts.taglib.html.OptionsCollectionTag +empty + +filter +false +true + + +label +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +value +false +true + + + +password +org.apache.struts.taglib.html.PasswordTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +redisplay +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +size +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +radio +org.apache.struts.taglib.html.RadioTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +property +true +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +true +true + + +idName +false +true + + + +reset +org.apache.struts.taglib.html.ResetTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +rewrite +org.apache.struts.taglib.html.RewriteTag +empty + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +name +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +select +org.apache.struts.taglib.html.SelectTag +JSP + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +multiple +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +size +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +submit +org.apache.struts.taglib.html.SubmitTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +text +org.apache.struts.taglib.html.TextTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +textarea +org.apache.struts.taglib.html.TextareaTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +cols +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +rows +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +xhtml +org.apache.struts.taglib.html.XhtmlTag +empty + + + diff --git a/posterita/posterita/web/WEB-INF/struts-logic.tld b/posterita/posterita/web/WEB-INF/struts-logic.tld new file mode 100644 index 0000000000..f920868073 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/struts-logic.tld @@ -0,0 +1,652 @@ + + + + + + + + + +1.2 +1.1 +logic +http://struts.apache.org/tags-logic + +empty +org.apache.struts.taglib.logic.EmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +equal +org.apache.struts.taglib.logic.EqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +forward +org.apache.struts.taglib.logic.ForwardTag +empty + +name +true +true + + + +greaterEqual +org.apache.struts.taglib.logic.GreaterEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterThan +org.apache.struts.taglib.logic.GreaterThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +iterate +org.apache.struts.taglib.logic.IterateTag +org.apache.struts.taglib.logic.IterateTei +JSP + +collection +false +true + + +id +true +false + + +indexId +false +false + + +length +false +true + + +name +false +true + + +offset +false +true + + +property +false +true + + +scope +false +true + + +type +false +true + + + +lessEqual +org.apache.struts.taglib.logic.LessEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +lessThan +org.apache.struts.taglib.logic.LessThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +match +org.apache.struts.taglib.logic.MatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +messagesNotPresent +org.apache.struts.taglib.logic.MessagesNotPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +messagesPresent +org.apache.struts.taglib.logic.MessagesPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +notEmpty +org.apache.struts.taglib.logic.NotEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +notEqual +org.apache.struts.taglib.logic.NotEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notMatch +org.apache.struts.taglib.logic.NotMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notPresent +org.apache.struts.taglib.logic.NotPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +present +org.apache.struts.taglib.logic.PresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +redirect +org.apache.struts.taglib.logic.RedirectTag + +action +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +name +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + + + + diff --git a/posterita/posterita/web/WEB-INF/struts-nested.tld b/posterita/posterita/web/WEB-INF/struts-nested.tld new file mode 100644 index 0000000000..f4a10d0f52 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/struts-nested.tld @@ -0,0 +1,2886 @@ + + + + + + + + + +1.2 +1.1 +nested +http://struts.apache.org/tags-nested + +nest +org.apache.struts.taglib.nested.NestedPropertyTag +JSP + +property +false +true + + + +writeNesting +org.apache.struts.taglib.nested.NestedWriteNestingTag +org.apache.struts.taglib.nested.NestedWriteNestingTei +JSP + +property +false +true + + +id +false +true + + +filter +false +true + + + +root +org.apache.struts.taglib.nested.NestedRootTag +JSP + +name +false +true + + + +define +org.apache.struts.taglib.nested.bean.NestedDefineTag +org.apache.struts.taglib.nested.bean.NestedDefineTei +empty + +id +true +true + + +name +false +true + + +property +false +true + + +scope +false +true + + +toScope +false +true + + +type +false +true + + +value +false +true + + + +message +org.apache.struts.taglib.nested.bean.NestedMessageTag +empty + +arg0 +false +true + + +arg1 +false +true + + +arg2 +false +true + + +arg3 +false +true + + +arg4 +false +true + + +bundle +false +true + + +key +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +size +org.apache.struts.taglib.nested.bean.NestedSizeTag +org.apache.struts.taglib.bean.SizeTei +empty + +collection +false +true + + +id +true +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +write +org.apache.struts.taglib.nested.bean.NestedWriteTag +empty + +bundle +false +true + + +filter +false +true + + +format +false +true + + +formatKey +false +true + + +ignore +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +checkbox +org.apache.struts.taglib.nested.html.NestedCheckboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +errors +org.apache.struts.taglib.nested.html.NestedErrorsTag +empty + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + + +file +org.apache.struts.taglib.nested.html.NestedFileTag + +accesskey +false +true + + +accept +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +form +org.apache.struts.taglib.nested.html.NestedFormTag +JSP + +action +true +true + + +enctype +false +true + + +focus +false +true + + +method +false +true + + +onreset +false +true + + +onsubmit +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +target +false +true + + + +hidden +org.apache.struts.taglib.nested.html.NestedHiddenTag + +alt +false +true + + +altKey +false +true + + +indexed +false +true + + +name +false +true + + +property +true +true + + +title +false +true + + +titleKey +false +true + + +styleClass +false +true + + +styleId +false +true + + +value +false +true + + +write +false +true + + + +image +org.apache.struts.taglib.nested.html.NestedImageTag + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +locale +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +pageKey +false +true + + +property +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +img +org.apache.struts.taglib.nested.html.NestedImgTag +empty + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +height +false +true + + +hspace +false +true + + +imageName +false +true + + +ismap +false +true + + +locale +false +true + + +lowsrc +false +true + + +name +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +paramId +false +true + + +page +false +true + + +pageKey +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +usemap +false +true + + +vspace +false +true + + +width +false +true + + + +link +org.apache.struts.taglib.nested.html.NestedLinkTag + +accesskey +false +true + + +action +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +indexed +false +true + + +indexId +false +true + + +linkName +false +true + + +name +false +true + + +onblur +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +target +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + + +messages +org.apache.struts.taglib.nested.html.NestedMessagesTag +org.apache.struts.taglib.html.MessagesTei +JSP + +id +true +true + + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +header +false +true + + +footer +false +true + + +message +false +true + + + +multibox +org.apache.struts.taglib.nested.html.NestedMultiboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +options +org.apache.struts.taglib.nested.html.NestedOptionsTag +empty + +collection +false +true + + +filter +false +true + + +labelName +false +true + + +labelProperty +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + + +optionsCollection +org.apache.struts.taglib.nested.html.NestedOptionsCollectionTag +empty + +filter +false +true + + +label +false +true + + +name +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +value +false +true + + + +password +org.apache.struts.taglib.nested.html.NestedPasswordTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +redisplay +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +size +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +radio +org.apache.struts.taglib.nested.html.NestedRadioTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +property +true +true + + +onmousedown +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +true +true + + + +select +org.apache.struts.taglib.nested.html.NestedSelectTag +JSP + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +multiple +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +size +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +submit +org.apache.struts.taglib.nested.html.NestedSubmitTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +text +org.apache.struts.taglib.nested.html.NestedTextTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +disabled +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +textarea +org.apache.struts.taglib.nested.html.NestedTextareaTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +cols +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +rows +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +empty +org.apache.struts.taglib.nested.logic.NestedEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +equal +org.apache.struts.taglib.nested.logic.NestedEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterEqual +org.apache.struts.taglib.nested.logic.NestedGreaterEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterThan +org.apache.struts.taglib.nested.logic.NestedGreaterThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +iterate +org.apache.struts.taglib.nested.logic.NestedIterateTag +org.apache.struts.taglib.nested.logic.NestedIterateTei +JSP + +collection +false +true + + +id +false +true + + +indexId +false +true + + +length +false +true + + +name +false +true + + +offset +false +true + + +property +false +true + + +scope +false +true + + +type +false +true + + + +lessEqual +org.apache.struts.taglib.nested.logic.NestedLessEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +lessThan +org.apache.struts.taglib.nested.logic.NestedLessThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +match +org.apache.struts.taglib.nested.logic.NestedMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +messagesNotPresent +org.apache.struts.taglib.nested.logic.NestedMessagesNotPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +messagesPresent +org.apache.struts.taglib.nested.logic.NestedMessagesPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +notEmpty +org.apache.struts.taglib.nested.logic.NestedNotEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +notEqual +org.apache.struts.taglib.nested.logic.NestedNotEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notMatch +org.apache.struts.taglib.nested.logic.NestedNotMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notPresent +org.apache.struts.taglib.nested.logic.NestedNotPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +present +org.apache.struts.taglib.nested.logic.NestedPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + + + + diff --git a/posterita/posterita/web/WEB-INF/struts-tiles.tld b/posterita/posterita/web/WEB-INF/struts-tiles.tld new file mode 100644 index 0000000000..657334ea94 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/struts-tiles.tld @@ -0,0 +1,344 @@ + + + + + + + + + + +1.2 +1.1 +tiles +http://struts.apache.org/tags-tiles + +insert +org.apache.struts.taglib.tiles.InsertTag +JSP + +template +false +true + + +component +false +true + + +page +false +true + + +definition +false +true + + +attribute +false +false + + +name +false +true + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +flush +false +false + + +ignore +false +true + + +role +false +true + + +controllerUrl +false +true + + +controllerClass +false +true + + + +definition +org.apache.struts.taglib.tiles.DefinitionTag +JSP + +id +true +false + + +scope +false +false + + +template +false +true + + +page +false +true + + +role +false +true + + +extends +false +true + + + +put +org.apache.struts.taglib.tiles.PutTag +JSP + +name +false +false + + +value +false +true + + +content +false +true + + +direct +false +false + + +type +false +false + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +role +false +true + + + +putList +org.apache.struts.taglib.tiles.PutListTag +JSP + +name +true +false + + + +add +org.apache.struts.taglib.tiles.AddTag +JSP + +value +false +false + + +content +false +true + + +direct +false +false + + +type +false +false + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +role +false +true + + + +get +org.apache.struts.taglib.tiles.GetTag +empty + +name +true +true + + +ignore +false +true + + +flush +false +false + + +role +false +true + + + +getAsString +org.apache.struts.taglib.tiles.GetAttributeTag +empty + +name +true +true + + +ignore +false +true + + +role +false +true + + + +useAttribute +org.apache.struts.taglib.tiles.UseAttributeTag +org.apache.struts.taglib.tiles.UseAttributeTei +empty + +id +false +false + + +classname +false +false + + +scope +false +false + + +name +true +true + + +ignore +false +true + + + +importAttribute +org.apache.struts.taglib.tiles.ImportAttributeTag +empty + +name +false +true + + +scope +false +false + + +ignore +false +true + + + +initComponentDefinitions +org.apache.struts.taglib.tiles.InitDefinitionsTag +empty + +file +true +false + + +classname +false +false + + + + + + diff --git a/posterita/posterita/web/WEB-INF/tiles-config_1_1.dtd b/posterita/posterita/web/WEB-INF/tiles-config_1_1.dtd new file mode 100644 index 0000000000..7568b78082 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/tiles-config_1_1.dtd @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/WEB-INF/tiles-defs.xml b/posterita/posterita/web/WEB-INF/tiles-defs.xml new file mode 100644 index 0000000000..8b8f66691a --- /dev/null +++ b/posterita/posterita/web/WEB-INF/tiles-defs.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/WEB-INF/validator-rules.xml b/posterita/posterita/web/WEB-INF/validator-rules.xml new file mode 100644 index 0000000000..6c502f73dd --- /dev/null +++ b/posterita/posterita/web/WEB-INF/validator-rules.xml @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/WEB-INF/web-app_2_2.dtd b/posterita/posterita/web/WEB-INF/web-app_2_2.dtd new file mode 100644 index 0000000000..172dafa712 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/web-app_2_2.dtd @@ -0,0 +1,565 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/WEB-INF/web-app_2_3.dtd b/posterita/posterita/web/WEB-INF/web-app_2_3.dtd new file mode 100644 index 0000000000..56bfb11dc2 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/web-app_2_3.dtd @@ -0,0 +1,1059 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/WEB-INF/web.xml b/posterita/posterita/web/WEB-INF/web.xml new file mode 100644 index 0000000000..60154ea3f4 --- /dev/null +++ b/posterita/posterita/web/WEB-INF/web.xml @@ -0,0 +1,190 @@ + + + + + + + /C32.gif + + + Posterita Ltd Enterprise Software Platform + + + + + #AD_Client_ID + 11 + + + #AD_Language + en_US + + + #AD_Org_ID + 11 + + + #AD_User_ID + 100 + + + #C_BankAccount_ID + 100 + + + #SalesRep_ID + 100 + + + #AD_Role_ID + 103 + + + #W_Store_ID + 11 + + + #POS_ID + 100 + + + REPORT_DIRECTORY + /config/reports/ + + + + + + action + org.apache.struts.action.ActionServlet + + config + /WEB-INF/struts-config.xml + + + debug + 2 + + + detail + 2 + + 2 + + + + DisplayChart + org.jfree.chart.servlet.DisplayChart + + + + DisplayReportServlet + org.posterita.core.utils.DisplayReportServlet + + + + action + *.do + + + + + + DisplayChart + /servlet/DisplayChart + + + + DisplayReportServlet + /servlet/DisplayReportServlet/* + + + + + + + 60 + + + + + + + + + index.jsp + + + + + + + + /tags/struts-bean + /WEB-INF/struts-bean.tld + + + + /tags/struts-html + /WEB-INF/struts-html.tld + + + + /tags/struts-logic + /WEB-INF/struts-logic.tld + + + + /tags/struts-nested + /WEB-INF/struts-nested.tld + + + + /tags/struts-tiles + /WEB-INF/struts-tiles.tld + + + + + + + + ResponseOverrideFilter + org.displaytag.filter.ResponseOverrideFilter + + + + ResponseOverrideFilter + *.do + + + ResponseOverrideFilter + *.jsp + + + diff --git a/posterita/posterita/web/WEB-INF/webStore.tld b/posterita/posterita/web/WEB-INF/webStore.tld new file mode 100644 index 0000000000..6ba28aa42e --- /dev/null +++ b/posterita/posterita/web/WEB-INF/webStore.tld @@ -0,0 +1,213 @@ + + + + 1.0 + 1.2 + cws + webStore.tld + Compiere WebStore + $Id: webStore.tld,v 1.1 2005/06/23 08:33:30 vishee Exp $ + + + + requestType + org.compiere.wstore.RequestTypeTag + empty + Request Type Selection + + + + loginLink + org.compiere.wstore.LoginLinkTag + empty + Login Links + + + + checkOutLink + org.compiere.wstore.CheckOutLinkTag + empty + CheckOut Links + + oneLine + false + false + + + + + infoLink + org.compiere.wstore.InfoLinkTag + empty + Info Links + + oneLine + false + false + + + + + priceList + org.compiere.wstore.PriceListTag + empty + Initializes + loads Price List + + priceList_ID + false + false + + + + + productCategoryList + org.compiere.wstore.ProductCategoryListTag + empty + Login Links + + + + workflow + org.compiere.wstore.WorkflowTag + empty + Workflow Choices + + activityID + true + false + + + + + location + org.compiere.wstore.LocationTag + empty + Location table rows + + countryID + true + false + + + regionID + false + false + + + regionName + false + false + + + postal + false + false + + + city + true + false + + + + + message + org.compiere.wstore.MessageTag + empty + Translate Messages + + txt + true + false + + + + + tableBorder + com.tamak.webstore.util.TableBorder + JSP + + scope + false + true + + + lcTopImg + false + true + + + bgTopImg + false + true + + + rcTopImg + false + true + + + topBorderHeight + false + true + + + bgLeftImg + false + true + + + sideBorderHeight + false + true + + + borderBgColor + false + true + + + contentBgColor + false + true + + + classStyleSheet + false + true + + + bgRightImg + false + true + + + lcBtmImg + false + true + + + bgBtmImg + false + true + + + rcBtmImg + false + true + + + btmBorderHeight + false + true + + + borderWidth + false + true + + + + diff --git a/posterita/posterita/web/css/alternative.css b/posterita/posterita/web/css/alternative.css new file mode 100644 index 0000000000..c44429bdec --- /dev/null +++ b/posterita/posterita/web/css/alternative.css @@ -0,0 +1,85 @@ +/* alternative styles */ +table.its thead tr { + background-color: #69c; +} + +table.its tr.even { + background-color: #def; +} + +table.mars thead tr { + background-color: #9c9; +} + +table.mars tr.even { + background-color: #ccb; +} + +table.mars tr.odd { + background-color: #eec; +} + +table.simple thead tr th { + background-color: #eee; +} + +table.simple tr.even { + background-color: #fff; +} + +table.simple { + border: 1px solid #ccc; + border-collapse: collapse; +} + +table.simple td,table.simple th { + border: 1px solid #ccc; +} + +table.nocol tbody td,table.nocol tbody th { + border-left: none; + border-right: none; +} + +table.report td,table.report th { + font: menu; +} + +table.report th { + background: buttonface; + border-width: 1px; + border-style: solid; + border-color: threedhighlight threedshadow threedshadow threedhighlight; + cursor: hand; +} + +table.report idcol { + background: buttonface; +} + +table.report tr.even { + background-color: #399; +} + +table.report tbody { + height: 100px; + overflow: auto; +} + +table.report { + height: 120px; + overflow: auto; +} + +table.report tbody tr { + height: 10px; +} + +table.mark td.tableCellError { + background-color: #d00; + color: #fff; +} + +table.simple td.textRed { + color: #b11; +} \ No newline at end of file diff --git a/posterita/posterita/web/css/common.jsp b/posterita/posterita/web/css/common.jsp new file mode 100644 index 0000000000..6c120a1586 --- /dev/null +++ b/posterita/posterita/web/css/common.jsp @@ -0,0 +1,1688 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author tamak + */ + + +<% +response.setContentType("text/css"); +String path = request.getContextPath() + "/"; +%> + +div.main +{ + width:100%; + text-align: center; + overflow: inherit; +} + + +#header { + background: #fff; + position:relative; + vertical-align:top; + height:30px; + width: 100%; + overflow:hidden; + text-overflow:ellipsis + + +} + +#headerTitle +{ + float:left; + margin-left:200px; + font-weight: bold; +} + +#logo{ +height:30px; +float:left; +} + +#context{ +float:right; +margin-right:50px; +height:30px; +white-space:nowrap; +overflow:hidden; +text-align:right; +text-overflow:ellipsis + +} + +#timer{ +position:relative; +vertical-align:top; +float:right; +border: 0px #E83530 solid; +background-color: #ffffff; +color: #666666; +font-size: 13px; +font-weight: bold; +} + +#actionlink +{ +position:relative; +vertical-align:top; +float:right; + +} + +#menu +{ + position:relative; + background-color: #D8D8D8; +} + +#menulink +{ + background-color: #D8D8D8; + position:relative; + width:100%; + float:right; + text-align: right; + height:20px; + overflow:hidden; + text-overflow: ellipsis; +} + + + +#content { + text-align:left; + background-color: #F4F4F4; + width: 100%; + min-height: 500px; + padding:0px; +} + +#cart td{ + text-align: left; +} + +div.container +{ + +} + +div.leftContainer +{ + width:50%; + float:left; + text-align:left; +} + +div.rightContainer +{ + width:50%; + float:right; + text-align:right; +} + + +/*#footer { + background: #D8D8D8; + clear: both; + width: 100%; +} +*/ + +/*body +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + color: #000000; +}*/ + +#content div, #main div +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + color: #000000; +} + +mandatory +{ + font-weight: bold; + text-align:right; + font-size:12px; + color: blue; +} + +p.loginHeader +{ + color: #666666; + font-size: 36px; + font-weight: bold; + font-family: arial,sans-serif; +} + + + +div.copyright +{ + background-color: #666666; + text-align: center; + color: #FFFFFF; + font-family: arial,sans-serif; + font-weight: bold; + font-size: 10pt; + letter-spacing: 1px; + padding: 2; +} + +/*label +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #000000; + padding-right: 4px; +}*/ + +label.red +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #E83530; +} + + + + +label.green +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #0A9409; +} + +td.green +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + background-color: #80FFC9; +} + +td.green input +{ + visibility:hidden; +} + +td.red +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + background-color: #FF9980; +} +td.blue +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + background-color: #80C9FF; +} +td.yellow +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + background-color: #FFE680; +} + +#messagebox div, .errormsg +{ + background-image: url("<%= path + "images/newUI/icon-err.gif" %>"); + background-repeat: no-repeat; + background-position: left center; + font-family: arial,sans-serif; + font-weight: bold; + font-size: 10pt; + letter-spacing: 1px; + padding-left: 30px; + color: #E83530; +} + +.successmsg +{ + background-image: url("<%= path + "images/pos/success.gif" %>"); + background-repeat: no-repeat; + background-position: left top; + font-family: arial,sans-serif; + font-weight: bold; + font-size: 12pt; + letter-spacing: 1px; + padding-left: 30px; + color: #008000; +} + +legend +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color:#0A9409; +} + + +input.text +{ + border: solid 1px #666666; + /*font-family: arial,sans-serif;*/ + font-size: 10pt; +} + +textarea.text +{ + border: solid 1px #666666; + /*font-family: arial,sans-serif;*/ + font-size: 10pt; +} + +select.text +{ + border: solid 1px #666666; + /*font-family: arial,sans-serif;*/ + font-size: 10pt; + color: #51585F; +} + + +input.medium +{ + width:100px; +} + +input:focus +{ + background-color: #CDD4E9; + border: solid 1px #333333; +} + + +.greencolor +{ + color:#0A9409; +} + +.completecolor +{ + color:#E83530; +} + +font.pagetitle +{ + font-size: 14pt; + color: #990000; +} + +font.reporttitle +{ + font-size: 14pt; +} + +font.reportsubtitle +{ + font-size: 12pt; +} + +font +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #555555; +} + +li.submenu +{ + list-style-image: url("<%= path + "images/pos/buttons/bullet_red.gif" %>"); + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #000000; +} + +img.topmenu +{ + border-style: none; + +} + +img.button +{ + cursor:pointer; +} + +/* anchor sytles */ +/*a:hover +{ + color:#0A9409; +} +*/ +a.topmenu +{ + text-decoration: none; + border-width: 0px; + border-style: none; +} + +a.submenu +{ + text-decoration: none; + color:#666666; + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; +} + +a +{ + text-decoration: none; + font-family:tahoma,san-serif; + font-size: 10pt; + letter-spacing: 0px; +} + +a.forgotpassword +{ + color:#0A9409; + font-family: arial,sans-serif; + font-size: 12pt; + letter-spacing: 1px; + font-weight: bold; +} + +/* end of anchor styles */ + +/* Auto complete style */ +div.autocomplete { + position:absolute; + width:250px; + height:300px; + background-color:white; + border:1px solid #888; + margin:0px; + padding:0px; + overflow: scroll; +} + +div.autocomplete ul { + list-style-type:none; + margin:0px; + padding:0px; +} +div.autocomplete ul li.selected { background-color: #ffb;} +div.autocomplete ul li { + list-style-type:none; + display:block; + margin:0; + padding:2px; + cursor:pointer; + letter-spacing: 1px; + font-size: 10pt; + font-family:arial,sans-serif; +} +div.notfound { + background-color: #ffb; +} + +div.autocomplete2 { + position:absolute; + width:250px; + background-color:white; + border:1px solid #888; + margin:0px; + padding:0px; + overflow: auto; +} + +div.autocomplete2 ul { + list-style-type:none; + margin:0px; + padding:0px; +} +div.autocomplete2 ul li.selected { background-color: #9ACF30;} +div.autocomplete2 ul li { + list-style-type:none; + display:block; + margin:0; + padding:2px; + cursor:pointer; + letter-spacing: 1px; + font-size: 10pt; + font-family:arial,sans-serif; + text-align:left; +} + +/* tables styles */ +table.view +{ + border-collapse: collapse; + /*border: solid 1px black;*/ +} + +table.view td +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 0px 5px 0px; +} + +table.layout +{ + padding-left: 10; + padding-right: 10; + padding-top: 0; + padding-bottom: 5; + + /* border:solid 1px #000000; */ +} + +table.main +{ + width: 100%; + /*border: solid 1px black;*/ + border-collapse: collapse; +} + +table.main td +{ + padding: 5px 0px 5px 0px; +} + +table.topmenu +{ + padding-left: 0; + padding-right: 0; + + /* border:solid 1px #000000; */ +} + +td.buttoncell +{ + padding-right: 0px; +} + +table.login +{ + width: 800px; + /*height: 600px;*/ + border: solid black 1px; + border-spacing: 0; +} + +table.content +{ + width: 100%; + /* border: solid 1px black; */ + border-collapse: collapse; +} + +table.content th +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #909090; +} + +table.content td.total +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #BBBBBB; +} + +table.content td +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + padding: 5px 0px 5px 0px; + +} + +table.cart +{ + width: 100%; + /*border: solid 1px black;*/ + border-collapse: collapse; + border-spacing: 0px; + border: 0px; +} + +table.cart td +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + padding: 5px 5px 5px 5px; +} + +table.cart th +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #909090; + padding: 5px 5px 5px 5px; +} + +table.cart td.total +{ + color: #FFFFFF; + background-color: #909090; +} + +table.cart td.label +{ + color: #000000; + background-color: #D8D8D8; +} + +table.cart td.contentname +{ + color: #000000; + background-color: #C9C9C9; +} + +table.content td.label +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + background-color: #D8D8D8; +} + +table.content td.contentname +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #ffffff; + background-color: #C9C9C9; +} + +table.orderheader td +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + padding: 5px 0px 5px 0px; + color: #000000; +} + +/* +td.copyright +{ + height: 60px; + vertical-align: top; + padding: 0; +} +*/ + +table.display td a +{ + text-decoration: none; + color:blue; + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; +} + +table.display +{ + width: 100%; + border-color: #000000; + border-collapse: collapse; +} + +table.display td.label +{ + /* + font-family: arial,sans-serif; + letter-spacing: 1px; + color: #000000; + */ + font-size: 8pt; + background-color: #D8D8D8; +} + +table.display td.contentname +{ + /* + font-family: arial,sans-serif; + letter-spacing: 1px; + color: #000000; + */ + font-size: 8pt; + background-color: #C9C9C9; +} + +table.display td +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; +} + +table.display th +{ + font-family: arial,sans-serif; + font-size: 9pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #909090; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; +} + +table.displaytag +{ + border-width: 1px; + width: 100%; + border-color: #000000; + border-collapse: collapse; + border-style: solid; +} + +table.displaytag th +{ + font-family: arial,sans-serif; + font-size: 9pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #909090; + border-color: #000000; + padding: 5px 5px 5px 5px; + border-width: 1px; + border-style: solid; +} + +table.displaytag th a +{ + color: #FFFFFF; +} + +table.displaytag td +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; + border-width: 1px; + border-style: solid; +} + +table.displaytag td.amount +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; + border-width: 1px; + border-style: solid; + text-align: right; +} + +table.displaytag td.numeric +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; + border-width: 1px; + border-style: solid; + text-align: right; + font-weight: bold; +} + +table.displaytag td.negativenumeric +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; + border-width: 1px; + border-style: solid; + text-align: right; + color: #FF0000; + font-weight: bold; +} + + +table.displaytag td a +{ + text-decoration: none; + color:blue; + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; +} + +table.displaytag tr.odd +{ + border-width: 1px; + border-style: solid; + text-align: left; + background-color: #D8D8D8; +} + +table.displaytag tr.even +{ + border-width: 1px; + border-style: solid; + background-color: #C9C9C9; + text-align: left; +} + +div.exportlinks +{ + text-align: right; +} + +caption +{ + font-family: arial,sans-serif; + font-size: 12pt; + font-weight: bold; + letter-spacing: 1px; + padding: 5px 5px 5px 5px; +} +/* end of table styles */ + +/* buttons styles */ +.advanced +{ + background-image: url("<%= path + "images/pos/buttons/button_advanced.gif" %>"); +} + +.continue +{ + background-image: url("<%= path + "images/pos/buttons/button_continue.gif" %>"); +} + +.create +{ + background-image: url("<%= path + "images/pos/buttons/button_create.gif" %>"); +} + +.complete +{ + background-image: url("<%= path + "images/pos/buttons/button_complete.gif" %>"); +} + +.addtocart +{ + background-image: url("<%= path + "images/pos/buttons/button_addtocart.gif" %>"); +} + +.newcustomer +{ + background-image: url("<%= path + "images/pos/buttons/button_newcustomer.gif" %>"); +} + +.checkout +{ + background-image: url("<%= path + "images/pos/buttons/button_checkout.gif" %>"); +} + +.delete +{ + background-image: url("<%= path + "images/pos/buttons/button_delete.gif" %>"); +} + +.neworder +{ + background-image: url("<%= path + "images/pos/buttons/button_neworder.gif" %>"); +} +.newnote +{ + background-image: url("<%= path + "images/pos/buttons/button_newnote.gif" %>"); +} + +.cash +{ + background-image: url("<%= path + "images/pos/buttons/button_cash.gif" %>"); +} + +.card +{ + background-image: url("<%= path + "images/pos/buttons/button_card.gif" %>"); +} + +.cheque +{ + background-image: url("<%= path + "images/pos/buttons/button_cheque.gif" %>"); +} + +.mixed +{ + background-image: url("<%= path + "images/pos/buttons/button_mixed.gif" %>"); +} + +.save +{ + background-image: url("<%= path + "images/pos/buttons/button_save.gif" %>"); +} + +.search +{ + background-image: url("<%= path + "images/pos/buttons/button_search.gif" %>"); +} + +.edit +{ + background-image: url("<%= path + "images/pos/buttons/button_edit.gif" %>"); +} + +.tangoSearch +{ + background-image: url("<%= path + "images/tango/system-search.png" %>"); + margin-top: -3px; +} + +.selectall +{ + background-image: url("<%= path + "images/pos/buttons/button_selectall.gif" %>"); +} + +.submit +{ + background-image: url("<%= path + "images/pos/buttons/button_submit.gif" %>"); +} + +.refresh +{ + background-image: url("<%= path + "images/pos/buttons/button_refresh.gif" %>"); +} + +.piechart +{ + background-image: url("<%= path + "images/pos/buttons/button_piechart.gif" %>"); +} + +.barchart +{ + background-image: url("<%= path + "images/pos/buttons/button_barchart.gif" %>"); +} + +.timeseries +{ + background-image: url("<%= path + "images/pos/buttons/button_timeseries.gif" %>"); +} + +.tabular +{ + background-image: url("<%= path + "images/pos/buttons/button_tabular.gif" %>"); +} + +.saveascsv +{ + background-image: url("<%= path + "images/pos/buttons/button_saveascsv.gif" %>"); +} + +.saveaspdf +{ + background-image: url("<%= path + "images/pos/buttons/button_saveaspdf.gif" %>"); +} + +.blank +{ + background-image: url("<%= path + "images/pos/buttons/button_blank.gif" %>"); +} + +.bigbutton +{ + background-repeat: no-repeat; + cursor: pointer; + border: 0px; + width: 127px; + height: 42px; + font-family: arial,sans-serif; + font-size: 12pt; + letter-spacing: 1px; + font-weight: bolder; + color: #666666; + padding: 0px; +} + +.smallbutton +{ + background-repeat: no-repeat; + cursor: pointer; + border: 0px; + width: 87px; + height: 42px; + font-family: arial,sans-serif; + font-size: 12pt; + letter-spacing: 1px; + font-weight: bolder; + color: #666666; + padding: 0px; +} + +.tangoButton +{ + background-repeat: no-repeat; + cursor: pointer; + border: 0px; + width: 32px; + height: 32px; + font-family: arial,sans-serif; + letter-spacing: 1px; + font-weight: bolder; + v-align:middle; + background-color:transparent; +} + +/* end of buttons styles */ + +div.space +{ + height:10px; + /* + border: solid 1px black; + background-color: #0000FF; + */ +} + +span.link +{ + cursor:pointer; + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + color: #0A9409; +} + +span.shortcutkey +{ + padding:0px 4px; + /*float:left;*/ +} + +span.shortcutkey label +{ + font-size: 10pt; + padding-right: 0px; +} + +span.shortcutkey label.red +{ + padding-left: 0px; +} + +/* Shopping Cart */ +div#shoppingCart +{ +/* + height:200; + overflow:auto; + border: solid 1px #555555; +*/ +} + +table.scroll +{ + border-color: #000000; + border-collapse: collapse; +} + +table.scroll td.label +{ + background-color: #D8D8D8; +} + +table.scroll td.contentname +{ + background-color: #C9C9C9; +} + +table.scroll td +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; +} + +table.scroll th +{ + font-family: arial,sans-serif; + font-size: 9pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #909090; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; +} + +table.scroll a +{ + font-family: arial,sans-serif; + font-size: 9pt; +} + +table.popup +{ + background-color: #FFFFFF; + border: solid 1px #000000; +} + +table.popup td +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 5px 5px 5px; + border-color: #000000; + border-collapse: collapse; +} + +div.popup +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + position:absolute; + display:none; + background-color:#FFFFFF; +} + + +table.cart td.label div.popupDiv:hover +{ + background-color:#CDD4E9;; +} + +table.cart td.contentname div.popupDiv:hover +{ + background-color:#CDD4E9; +} + +/* +table.cart tr.popup:hover td.label,td.contentname +{ + background-color:#CDD4E9; +} +*/ + +table.report +{ + border-color: #000000; + border-collapse: collapse; + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; +} + +table.cart tbody +{ +/* + style="height:200px; + overflow:auto"; +*/ +} + +.border +{ + border:solid 1px #000000; +} + +.error +{ + background-color:#E83530; + border:solid 1px #000000; +} + +div.scrollpane +{ + overflow:auto; + /*height:500px;*/ +} + + +table.numericpad td +{ + text-align:center; + v-align:middle; +} + +div.key +{ + width:50px; + height:50px; + border:solid 1px #000000; + cursor:pointer; + text-align:center; + vertical-align: middle; + font-family: arial,sans-serif; + font-size: 14pt; + font-weight:bold; +} + +a.button +{ + text-decoration: none; + cursor: pointer; + border: 0px; + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bolder; + color: #606760; + padding: 2px 4px 2px 4px; + border:solid 1px #000000; + text-align:center; + background-color: #F2F2F2; +} + +a.button:hover +{ + background-color: #D8D8D8; +} + +div#PINPanel +{ + border:solid 2px #000000; + z-index:1000; + height:120px; + width:200px; + background-color: #F2F2F2; + padding: 4px; + display:none; +} + +div#divBack +{ + background-image: url("<%= path + "images/pos/maskBG.png" %>"); + filter: alpha(opacity=40); +} + +span.draftedcolor +{ + color:red; +} + +div.draftedcolor +{ + color:red; +} + +div.completecolor +{ + color:green; +} + +div.inprogresscolor +{ + color:yellow; +} + +div.closed +{ + color:blue; +} + +div.negativecolor +{ + color:red; +} +div.nomalcolor +{ + color:black; +} + +div#keyboard{ + position:absolute; + background-color: #FFFFFF; + border:solid 1px #000000; + z-index:3000; + display:none; +} + +div#uppercase{ + display:none; +} + +div#lowercase{ + display:block; +} + +div.keyboardHandler{ + background-color:#777777; + height:20px; + cursor:move; +} + +table.keyboard{ + background-color: #FFFFFF; +} + +table.keyboard td{ + vertical-align:middle; + text-align:center; + width:50px; + height:50px; + border:solid 1px #444444; + background-color: #FFFFFF; + cursor:pointer; + background-color:#F4F4F4; + font-family: arial,sans-serif; + font-size: 13pt; + letter-spacing: 1px; + font-weight: bolder; + color: #000000; +} + +table.keyboard td:hover{ + background-color:#FFFFFF; +} + +img#keyboardicon{ + display:none; + cursor: pointer; +} + +div.tooltip{ + width:200px; + z-index:1000; + background-color:#FDFDDB; + position:absolute; + border: solid 1px #000000; + padding:4px; + font-color:#333333; + font-size:10pt; +} + +div.pager{ + //border: dashed 1px #000000; + padding:4px; + font-color:#333333; + font-size:10pt; + text-align:center; +} + +.pager label{ + color: #51585F; + font-weight: normal; + font-family: Verdana,Arial,Helvetica,san-serif; +} + +div.button { + float:left; + border:solid 1px #333333; + margin-right: 4px; + margin-top: 4px; + margin-bottom: 4px; + padding:6px; + font-size:14px; + font-weight: bold; + font-family: Verdana, Arial, Helvetica, sans-serif; + color:#FFFFFF; + background-color:#333333; + cursor:pointer; +} + +div.pager a{ + font-color:#333333; + font-size:10pt; + text-decoration:none; +} + +span.menu{ + text-decoration: none; + color:#000000; + padding:1px; + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; +} + +a.nodecoration:active,a.nodecoration:visited{ + text-decoration:none; +} + +fieldset.submenu{ + height:165px; +} + +.newbutton{ + background-repeat: repeat-x; + cursor: pointer; + font-family: verdana,arial,sans-serif; + font-size: 11pt; + font-weight:bold; + letter-spacing: 1px; + font-weight: bolder; + color: #666666; + height: 42px; + /*min-width:87px;*/ + background-image: url("<%= path + "images/pos/buttons/button_middle.gif" %>"); + border-left: solid 1px #9b9b9b; + border-right: solid 1px #9b9b9b; + border-top-width: 0px; + border-bottom-width: 0px; + padding-left:4px; + padding-right:4px; +} + +fieldset#createcustomer{ + height:150px; +} + +/* +.searchBox{ + background-image:url("<%= path + "images/pos/magnifying-glass.gif" %>"); + background-repeat:no-repeat; + padding-left:20px; +} +*/ + +span.drafted +{ + color:red; +} + +span.completed +{ + color:green; +} + +span.inprogress +{ + color:yellow; +} + +span.closed +{ + color:blue; +} + +div#errorbox +{ + background-color:CC1515; + border: solid 1px #D41616; + padding: 4px; +} + +div#msgbox +{ + background-color:#E6F3D8; + border: solid 1px #75D416; + padding: 4px; +} + +/***************************************************************************/ +div.popupwindow{ + display:inline; + position:absolute; + z-index:1000; + border: solid 1px #636363; + padding:0px; + visibility:hidden; +} + +div.popupwindow div{ + padding:4px; +} + +div.popupwindow div.title{ + color:#FFFFFF; + background:#ACACAC; + font-weight:bold; + /*font-size:13pt;*/ +} + +div.popupwindow div.footer{ + background:#EDEDED; + text-align:right; + background:#ACACAC; +} + +div.popupwindow div.messagebody{ + background:#EDEDED; +} + +div.popupwindow div.footer a{ + font-size:10pt; +} + +div#tenderPanel{ + /*height:170px;*/ + width:300px; +} + +div#customerInfoPanel{ + width:400px; +} + +div.disableMask +{ + background-image: url("<%= path + "images/pos/maskBG.png" %>"); + filter: alpha(opacity=40); +} + +div.ajaxindicator +{ + width:150px; + padding:10px; + border:solid 1px #000000; + background-color:#FFFFFF; + /*background-image: url("<%= path + "images/ajax-indicators/indicator.gif" %>");*/ + background-repeat:no-repeat; + background-position:left center; + padding-left:20px; + +} + +.redcolor +{ + color:#E83530; +} + +td.loginHeader +{ + height: 210px; + width: 800px; + background-image: url("<%= path + "images/pos/logo.jpg" %>"); + background-position:center center; + background-repeat:no-repeat; +} + +td.headerLogo +{ + background-image: url("<%= path + "images/pos/logo.gif" %>"); + background-position:top left; + background-repeat:no-repeat; + height: 40px; + width: 320px; +} + +td.headerDetails +{ + vertical-align: top; + background-color:#EEEEEE; +} + +a.sortheader +{ + color:#000; +} + +input.calendar-icon +{ + width: 28px; + height: 22px; + background-image: url("<%= path + "images/pos/calendar.gif" %>"); +} + +.floatleft +{ + float: left; + display: block; + padding: 0px 2px; +} + +#footerContainer{ + position: relative; +} + +.footer{ +background: #9A9A9A url("../images/newUI/footerbg.gif") repeat-x; +padding: 8px; +margin: 0; +height: 41px; +color: #FFFFFF; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: bold; +border-top: #FFFFFF solid 1px; +position: relative; +} + +.roleButton{ + background: url("../images/newUI/pricedetbg.gif") repeat; + border: 1px solid #FFF; + line-height: 15px; + float: left; + height: 15px; + width: 90px; + font-family: tahoma, san-serif; + font-weight: normal; + color: #FFF; + padding-top: 0px; + padding-bottom: 0px; + vertical-align: middle; + text-align: center; + cursor: pointer; + margin-left: 15px; + margin-top: 1px; +} + +.buttonLabel{ + font-family: tahoma, san-serif; + font-weight: normal; + color: #FFF; +} + +.button span{ + color: #FFFFFF; +} + +#remainingDetailsBtn, #remainingDetailsBtn1, #switchBack, #switchBack1{ + + float: right; +} + +#previousFirst div { + float:left; +} + +#previousFirst span{ + float: right; +} + +#nextLast div{ + float: right; +} + +#nextLast span{ + float:left; +} + +#nextLast{ + margin-top: -17px; +} + +.pagerContainer{ + border-top: solid 1px #FFFFFF; + font-family:tahoma,san-serif; + background: #9A9A9A +} + +.pagerContainer a{ + color: #669ACF; +} diff --git a/posterita/posterita/web/css/displaytag.css b/posterita/posterita/web/css/displaytag.css new file mode 100644 index 0000000000..a77fc712df --- /dev/null +++ b/posterita/posterita/web/css/displaytag.css @@ -0,0 +1,147 @@ + +table { + border: 0px solid #666; + width: 100%; + margin: 20px 0 20px 0 !important; +} + + +th,td { + padding: 2px 4px 2px 4px !important; + text-align: left; + vertical-align: top; +} + +thead tr { + background-color: #fc0; +} + +th.sorted { + background-color: orange; +} + +th a,th a:visited { + color: black; +} + +th a:hover { + text-decoration: underline; + color: black; +} + +th.sorted a,th.sortable a { + background-position: right; + display: block; + width: 100%; +} + +th.sortable a { + background: transparent url(../images/pos/arrow_off.png) no-repeat right; + +} + +th.order1 a { + background: transparent url(../images/pos/arrow_down.png) no-repeat right; + +} + +th.order2 a { + background: transparent url(../images/pos/arrow_up.png) no-repeat right; + +} + +tr.odd { + background-color: #fff +} + +tr.tableRowEven,tr.even { + background-color: #fea +} + +div.exportlinks { + background-color: #eee; + border: 1px dotted #999; + padding: 2px 4px 2px 4px; + margin: 2px 0 10px 0; + width: 100%; +} + +span.export { + padding: 0 4px 1px 20px; + display: inline; + display: inline-block; + cursor: pointer; +} + +span.excel { + background: transparent url(../images/pos/ico_file_excel.png) no-repeat; +} + +span.csv { + background: transparent url(../images/pos/ico_file_csv.png) no-repeat; +} + +span.xml { + background: transparent url(../images/pos/ico_file_xml.png) no-repeat; +} + +span.pdf { + background: transparent url(../images/pos/ico_file_pdf.png) no-repeat; +} + +span.rtf { + background: transparent url(../images/pos/ico_file_rtf.png) no-repeat; +} + +span.pagebanner { + background-color: #eee; + border: 1px dotted #999; + padding: 2px 4px 2px 4px; + width: 100%; + margin-top: 10px; + display: block; + border-bottom: none; +} + +span.pagelinks { + background-color: #eee; + border: 1px dotted #999; + padding: 2px 4px 2px 4px; + width: 100%; + display: block; + border-top: none; + margin-bottom: -5px; +} + + +.group-1 { + font-weight:bold; + padding-bottom:10px; + border-top:1px solid black; +} +.group-2 { + font-style:italic; + border-top: 1px solid black; + +} +.subtotal-sum, .grandtotal-sum { + font-weight:bold; + text-align:right; +} +.subtotal-header { + padding-bottom: 0px; + border-top: 1px solid white; +} +.subtotal-label, .grandtotal-label { + border-top: 1px solid white; + font-weight: bold; +} +.grouped-table tr.even { + background-color: #fff; +} +.grouped-table tr.odd { + background-color: #fff; +} +.grandtotal-row { + border-top: 2px solid black; +} diff --git a/posterita/posterita/web/css/frame.css b/posterita/posterita/web/css/frame.css new file mode 100644 index 0000000000..6af85573d8 --- /dev/null +++ b/posterita/posterita/web/css/frame.css @@ -0,0 +1,30 @@ +/* Send link +============================== */ + +MB_content fieldset input { + float: left; + margin: 0.5em 0; + font: 100%/1.2 Arial, Helvetica, Geneva, sans-serif; +} +#MB_content fieldset textarea { + width: 98%; + margin: 0 0 0.5em; + color: #666; + font: 100%/1.2 Arial, Helvetica, Geneva, sans-serif; +} +#MB_content fieldset label { + float: left; + padding-bottom: .25em; + margin: 0.5em 0; + width: 100px; +} +#MB_content fieldset label.long { width: 100%; } +#MB_content br { clear: both } + +#MB_content .error-msg { + padding: .5em; + color: #FFF; + font-weight: bold; + background-color: #C30; + border: 1px solid #930; +} \ No newline at end of file diff --git a/posterita/posterita/web/css/global.css b/posterita/posterita/web/css/global.css new file mode 100644 index 0000000000..9f66e3253a --- /dev/null +++ b/posterita/posterita/web/css/global.css @@ -0,0 +1,390 @@ +body { + padding:0; + margin:0; + font:12px Arial, Helvetica, sans-serif; + line-height:130%; + color:#333; + text-align:center; + background:#FFF; + font-size:x-small; + voice-family: "\"}\""; + voice-family: inherit; + font-size:small; +} + + +/* General definitions */ +a { color:#06C; } +a:visited { color:#A9D; } +a:hover { color:#C63 } +a img { border:0px solid } + +h2 { + margin:1.5em 0 .5em; + font-size:135%; + font-weight:normal; + color:#000; +} +h3 { + font-size:115%; + color:#666; +} + +p { + margin:.75em 0; + line-height:1.5; +} + +ol li, ul li { margin:.5em 0; } +ul li { list-style:square; } + +code { + padding: .15em; + font: 100% "Monaco", "Courier New", Courier, monospace; + border-bottom: 1px dotted #FFCC66; + background-color: #FFFFCC; +} + +pre { + margin: .5em 0; + padding: .5em; + font: 100% "Monaco", "Courier New", Courier, monospace; + border: 1px solid #D3DAE4; + background-color: #F4F6F8; + width: 97%; + overflow: auto; +} + +/* General Layout */ +#page { + position:relative; + margin:0 auto; + text-align:left; + width:700px; +} + +#container { + position:relative; + background:#FFF; + z-index:1; +} +#container:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +/* Hides from IE-mac \*/ +* html #container { height: 1%; } +/* End hide from IE-mac */ + + +.xtop, .xbottom {display:block; background:transparent; font-size:1px; } +.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;} +.xb1, .xb2, .xb3 {height:1px;} +.xb2, .xb3, .xb4 {background:#F4F6F8; border-left:1px solid #D3DAE4; border-right:1px solid #D3DAE4;} +.xbottom .xb2, .xbottom .xb3, .xbottom .xb4 {background:#FFF;} +.xb1 {margin:0 5px; background:#D3DAE4;} +.xb2 {margin:0 3px; border-width:0 2px;} +.xb3 {margin:0 2px;} +.xb4 {height:2px; margin:0 1px; } + +.xboxcontent { + background:#FFF; + border:1px solid #D3DAE4; + border-top:0 solid; + border-bottom:1px solid #FFF; +} +.block-content { + border:0px solid; + background:none; +} + +/* Badge */ +#badge { + position: absolute; + top: 0; + right: 0; + width: 111px; + height: 114px; + background: url(../images/newversion-badge.gif) 0 0 no-repeat; +} + #badge * { display: none; } + +/* Header section */ +#header { + position:relative; + margin:30px 10px; + text-align:center; + overflow: hidden; + //height: 1%; +} + +/* Wildbit Logotype */ +#wildbit { + float: left; + margin:0 18px 0 0; + padding:0 18px 0 18px; + width:96px; + height:57px; + border-right: 1px solid #CCC; + overflow:hidden; +} + #wildbit a { + position:relative; + display:block; + width:96px; + height:57px; + } + #wildbit a span { + position:absolute; + left:0; top:0; + display:block; + width:96px; + height:57px; + background:url(../images/wildbit-logo.gif) left top no-repeat; + } + + +/* Columns wrappers */ +.twocolwrapper { clear:both; margin:0; width:100%; overflow:hidden; } +html>body .twocolwrapper { width:auto; border-top:1px solid #FFF; } + +.twocolwrapper .firstcol { + float:left; + width:59%; +} +.twocolwrapper .secondcol { + margin:0 0 0 60%; + padding:0; + width:100%; + voice-family: "\"}\""; + voice-family: inherit; + width:39%; +} +html>body .twocolwrapper .secondcol { width:40%; overflow:visible; } + + +/* Content Area */ +#content { + margin: 0 28px; + padding-bottom: 2em; +} + +.new { + padding:.15em .35em; + font-size:85%; + font-style:italic; + background-color:#CBE564; +} +.note { + font-style:italic; +} + +/* Demo buttons */ +.demo-hint { + padding-left: .5em; + line-height: 2.5em; + color: #999; +} + +a.demo-btn { + display: block; + float: left; + font-weight: bold; + text-decoration: none; + text-shadow: #FFF 2px 2px 0; + color: #000!important; + background: url('../images/btn-demo-l.gif') 0 0 no-repeat; +} +a.demo-btn:hover { text-decoration: underline; } + a.demo-btn span { + display: block; + padding: 8px 15px 12px 34px; + background: url('../images/btn-demo-r.gif') 100% 0 no-repeat; + } + +ul#features { + padding:0; + margin:1em 0; +} + #features li { + margin:1em 0; + padding-left:18px; + font-size: 90%; + list-style:none; + background:url(../images/bul-feature.gif) 0 0 no-repeat; + } + +/* Download block */ +.download { + position: relative; + padding: 1em 1em 1em 28px; + background: #F4F6F8; + //height: 1%; +} + .download .download-lnk { + margin-right: 270px; + + } + .download .download-lnk h2 { + position: relative; + margin: 0; + padding: 1em 0 .75em; + font-weight: bold; + } + .download .download-lnk h2 a { + display: block; + position: absolute; + left: -52px; top: 0; + margin: 0; + padding: 1em 0 .75em 52px; + background: url(../images/download.gif) 0 0 no-repeat; + } + + /* Donate form section */ + .form-donate { + margin: 0; + padding: 0; + margin-left: -14px; + } + .form-donate .xtop, .form-donate .xbottom {display:block; background:transparent; font-size:1px; } + .form-donate .xb1, .form-donate .xb2, .form-donate .xb3, .form-donate .xb4 {display:block; overflow:hidden;} + .form-donate .xb1, .form-donate .xb2, .form-donate .xb3 {height:1px;} + .form-donate .xb2, .form-donate .xb3, .form-donate .xb4 {background:#FCFCFF; border-left:1px solid #FCFCFF; border-right:1px solid #FCFCFF;} + .form-donate .xbottom .xb2, .form-donate .xbottom .xb3, .form-donate .xbottom .xb4 {background:#FCFCFF;} + .form-donate .xb1 {margin:0 5px; background:#FCFCFF;} + .form-donate .xb2 {margin:0 3px; border-width:0 2px;} + .form-donate .xb3 {margin:0 2px;} + .form-donate .xb4 {height:2px; margin:0 1px; } + + .form-donate .xboxcontent { + padding: .25em 1em; + margin: 0; + color: #000; + border: 1px solid #FCFCFF; + border-width: 0px 1px 0 1px; + background-color: #FCFCFF; + } + .form-donate p { + margin: 0; + padding: 0; + } + .form-donate .secondcol input { margin-left: 6px; } + /* Huge demo button */ + .download .demo-btn { + position: absolute; + float: none; + left: 416px; top: 20px; + width: 182px; + height: 67px; + background: url(../images/button-demo.gif) 0 0 no-repeat; + } + .download .demo-btn span { + display: block; + text-indent: -2000px; + background-image: none; + } + +/* Demos */ +.warning { + padding: .5em .5em 1em 28px; + font-weight: bold; + background: url('../images/warn.gif') 0 15px no-repeat; +} + +/* Google Code Block */ +#gcode { + padding-left: 110px; + background: url('../images/google-logo.png') 0 0 no-repeat; + +} + +/* Annouce balloon block */ +.balloon { + position: relative; + margin: -20px 0 20px; +} + + .balloon .xtop, .balloon .xbottom {display:block; background:transparent; font-size:1px; } + .balloon .xb1, .balloon .xb2, .balloon .xb3, .balloon .xb4 {display:block; overflow:hidden;} + .balloon .xb1, .balloon .xb2, .balloon .xb3 {height:1px;} + .balloon .xb2, .balloon .xb3, .balloon .xb4 {background:#FFFFEC; border-left:1px solid #EEC; border-right:1px solid #EEC;} + .balloon .xbottom .xb2, .balloon .xbottom .xb3, .balloon .xbottom .xb4 {background:#FFFFEC;} + .balloon .xb1 {margin:0 5px; background:#EEC;} + .balloon .xb2 {margin:0 3px; border-width:0 2px;} + .balloon .xb3 {margin:0 2px;} + .balloon .xb4 {height:2px; margin:0 1px; } + + .balloon .xarrow { + position: relative; + top: 1px; left: 70px; + width: 15px; + height: 16px; + } + .balloon .xarrow b { + display: block; + background:#FFFFEC; + border-left:1px solid #EEC; + border-right:1px solid #EEC; + font-size:1px; + height: 2px; + } + .balloon .xarrow .a1 { margin: 0 7px; background-color: #EEC; border: 0 solid; width: 1px; } + .balloon .xarrow .a2 { width: 1px; margin: 0 6px;} + .balloon .xarrow .a3 { width: 3px; margin: 0 5px;} + .balloon .xarrow .a4 { width: 5px; margin: 0 4px;} + .balloon .xarrow .a5 { width: 7px; margin: 0 3px;} + .balloon .xarrow .a6 { width: 9px; margin: 0 2px;} + .balloon .xarrow .a7 { width: 11px; margin: 0 1px;} + .balloon .xarrow .a8 { width: 13px; margin: 0;} + + .balloon .xboxcontent { + padding: .25em 27px; + margin: 0; + color: #000; + font-size: 135%; + border: 1px solid #EEC; + border-width: 0px 1px 0 1px; + background-color: #FFFFEC; + } + .balloon .xboxcontent a:link, + .balloon .xboxcontent a:visited { + display: block; + padding: .5em 0; + color: #000; + text-decoration: none; + } + .balloon .xboxcontent a:hover { + color: #C63; + text-decoration: underline; + } + + + +/* Footer Section */ +#footer { + margin-top:10px; + font-size:85%; + color:#99C; + text-align:center; +} + +/* Clear */ +.clear { + clear: both; + margin: 0; + padding: 0; + font-size: 1px; +} + +/* Hire us badge */ +.label-hire { + position: absolute; + margin: 0; + padding: 0; + top: 0; + left: 0; + z-index: 1010; +} \ No newline at end of file diff --git a/posterita/posterita/web/css/inventory.css b/posterita/posterita/web/css/inventory.css new file mode 100644 index 0000000000..2853b2e4eb --- /dev/null +++ b/posterita/posterita/web/css/inventory.css @@ -0,0 +1,118 @@ +div#status{ + font-size: 12px; + font-weight: bold; +} +div#uploadCsv{ + height: 150px; + font-size: 14px; + font-weight: bold; + border-top: solid 1px #000; + border-bottom: solid 1px #000; +} + +div#priceLists{ + font-size: 10px; + font-weight: bold; + border-top: solid 1px #000; + border-left: solid 1px #000; + border-right: solid 1px #000; + border-bottom: solid 1px #000; + background-color: #dddddd; +} + +select#priceList{ + font-size: 10px; + font-weight: bold; + border-top: solid 1px #000; + border-left: solid 1px #000; + border-right: solid 1px #000; + border-bottom: solid 1px #000; + background-color: #ffffff +} + + + +.descButton { + float:left; + border:solid 1px #333333; + margin-right: 4px; + margin-top: 4px; + margin-bottom: 4px; + padding:6px; + font-size:8px; + font-weight: bold; + font-family: Verdana, Arial, Helvetica, sans-serif; + color:#FFFFFF; + background-color:#333333; + cursor:pointer; +} + +.upbutton { + float:left; + border:solid 1px #333333; + margin-right: 4px; + margin-top: 4px; + margin-bottom: 4px; + padding:6px; + font-size:10px; + font-weight: bold; + font-family: Verdana, Arial, Helvetica, sans-serif; + color:#FFFFFF; + background-color:#333333; + cursor:pointer; +} + +div#detailsInfo label{ + width : 190px; + display:block; + /*border: solid 1px #000;*/ + float:left; +} + +div#invDescription label{ + width : 100px; + display:block; + font-size: 12px; + float:left; +} + +/* Sortable tables */ +table.sortable thead { + background-color:#eee; + color:#666666; + font-weight: bold; + cursor: default; +} + +.highlighted { background: yellow; } + +.box .filter { display: none; } + + +div.popup { + max-width: 600px; + border: 1px solid red; + padding: 5px; + background-color: white; + /* The following properties should not be changed */ + position: absolute; +} +.popup_overlay { + background-color: #000000; + /* The following properties should not be changed */ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 500px; + z-index:9999; +} + +span.popup_link, a.popup_link { + cursor: pointer; + border-bottom: 1px dotted; +} + +.popup_draghandle { + cursor: move; +} diff --git a/posterita/posterita/web/css/js-calendar/calendar-win2k-1.css b/posterita/posterita/web/css/js-calendar/calendar-win2k-1.css new file mode 100644 index 0000000000..e7c888c6aa --- /dev/null +++ b/posterita/posterita/web/css/js-calendar/calendar-win2k-1.css @@ -0,0 +1,296 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author tamak + */ + + +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #d4d0c8; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #d4d0c8; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #848078; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #f4f0e8; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #e4e0d8; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #c4c0b8; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #f4f0e8; +} + +.calendar tbody .rowhilite td { + background: #e4e0d8; +} + +.calendar tbody .rowhilite td.wn { + background: #d4d0c8; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #e4e0d8; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #f4f0e8; + padding: 1px; + border: 1px solid #000; + background: #848078; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4e0d8; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #e4e0d8; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c4c0b8; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #fea; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #f4f0e8; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #766; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/posterita/posterita/web/css/logo.css b/posterita/posterita/web/css/logo.css new file mode 100644 index 0000000000..d13a1e6359 --- /dev/null +++ b/posterita/posterita/web/css/logo.css @@ -0,0 +1,23 @@ +/* Logotype */ +#logo { + float: left; + margin:0; + padding:0; + width:265px; + height:57px; + overflow:hidden; +} + #logo a { + position:relative; + display:block; + width:265px; + height:57px; + } + #logo a span { + position:absolute; + left:0; top:0; + display:block; + width:265px; + height:57px; + background:url(../images/logo.gif) left top no-repeat; + } \ No newline at end of file diff --git a/posterita/posterita/web/css/mainMenu.css b/posterita/posterita/web/css/mainMenu.css new file mode 100644 index 0000000000..6cb65890b0 --- /dev/null +++ b/posterita/posterita/web/css/mainMenu.css @@ -0,0 +1,841 @@ +/*MAIN POS MENU CSS*/ + +#posHeader{ +background: #9A9A9A url("../images/newUI/topmenubg.gif") repeat-x; +position: relative; +float: left; +width: 100%;} + + +#backButn{ +position: relative; +float: left; +width: 28px; +cursor: pointer; +} + +#logo{ +position: relative; +width: 133px; +float: left; +} + +#mainTitle{ +position: relative; +color: #FFFFFF; +font-family: tahoma, san-serif; +font-size: 13px; +font-weight: bold; +text-transform: uppercase; +margin: 10px 0 0 10px; +float: left; + +} +#acDetailsContainer{ +margin: 5px 10px 0 10px;} + +#acDetailsL{ +position: relative; +margin: 0; +float: right; +color: #fff; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: normal; +padding-right: 10px; + +} + +#acDetailsR{ +position: relative; +margin: 0; +float: right; +color: #fff; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: normal; +} + +#systemMenuContainer{ +background: #9A9A9A url("../images/newUI/pricedetbg.gif") no-repeat; +height: 41px; +} + +#systemMenuBg{ +background: url("../images/newUI/pricedetbgtile.gif") repeat-x; +height: 41px; +position: relative; +margin: 0 0 0 5px; +} + +#choosePOS{ + color: #FFFFFF; + text-align: center; + font-size: 11pt; +} + +#systemMenu{ +padding-top: 3px; +padding-left: 13px;} + + +img.center{ +padding-right: 10px; +float: left; +} + +.posSubNavContainer, .category h1{ +font-size: 11px; +font-family: tahoma; +color: #fff; +text-transform: uppercase; +padding: 6px 0 10px 0; +margin-top: -40px; +margin-left: 0px; +text-indent: 30px; + +} + +#categoryImg +{ + height: 19px; + width: 18px; + margin-right: 13px; + margin-top: 5px; + margin-left: -30px; +} + +#posNavContainer { + margin: 0; + padding: 0; + } + +#posNavContainer ul{ + margin: 0; + padding: 0; + list-style-type: none; + line-height: 30px; +} + +#posNavContainer li { + margin: 0; + padding: 0; + } + +#posNavContainer a{ + display: table-row; + color: #777; + padding: 2px 0px 2px 20px; + text-decoration: none; + font-size: 11px; + font-weight: bold; + text-transform: normal; + font-family: tahoma, verdana, san-serif; + width: 1em; + margin: 0px; + text-indent: 20px; + } + +#posNavContainer a:hover{ + color: #333; + } + +#posSubNavContainer .posNews h1{ + font-size: 11px; + font-family: tahoma; + color: #fff; + text-transform: uppercase; + padding: 6px 0 10px 0; + margin-top: -30px; + margin-left: 0px; + text-indent: 30px; + background: url(../images/newUI/hicon-news.gif) 0 0 no-repeat; +} + +#posSubNavContainer .posHelp h1{ + font-size: 11px; + font-family: tahoma; + color: #fff; + text-transform: uppercase; + padding: 6px 0 10px 0; + margin-top: -30px; + margin-left: 0px; + text-indent: 30px; + background: url(../images/newUI/hicon-help.gif) 0 0 no-repeat; +} + + +#posSubNavContainer .posDonate h1{ + font-size: 11px; + font-family: tahoma; + color: #fff; + text-transform: uppercase; + padding: 6px 0 10px 0; + margin-top: -30px; + margin-left: 0px; + text-indent: 30px; + background: url(../images/newUI/hicon-donate.gif) 0 0 no-repeat; +} + +.currentpage { + background: url(../images/newUI/navbg.gif) left; + background-repeat: no-repeat; + width: 100%; + margin-left: 1px; +} + +.currentpage span{ + color: #3B6DAA; +} + +/*END*/ + + +/*POS SUB CONTENT MENU CSS*/ + +#posSubNavContainer { + margin-right: 0px; + margin-left: 0px; + + } + +#posSubNavContainer ul{ + margin: 0px 0 0 0 ; + padding: 0; + list-style-type: none; + line-height: 12px; + } + +#posSubNavContainer li { + margin: 0 0 0 0px; + } + +#posSubNavContainer a{ + width: 98%; + text-align: left; + color: #777; + display: block; + padding: 5px 0 5px 0px; + text-decoration: none; + font-size: 11px; + font-weight: bold; + text-transform: normal; + font-family: tahoma, verdana, san-serif; + text-indent: 0px; + + border-top: 1px solid #ddd} + +#posSubNavContainer a:hover{ + color: #3B6DAA; + } + + +/*END*/ + + +#rightContainer{ +margin: 0; +padding: 0; +min-height: 525px; +} + +.rightContainer{ +background:#EBEFF7 url(../images/newUI/palebluebg.gif) repeat-y 0 0; +} + + +#mainHeaderTitleContainer{ +text-align: left; +margin-top: 0px; +padding-left: 20px; +border-bottom: 1px solid #fff; +height: 30px;} + + +#mainHeaderTitleContainer h1{ +font-size: 14px; +font-family: tahoma; +color: #669ACF; +text-transform: uppercase; +padding: 5px 0 0 0; +margin: 0; + +} + +.liquid-round { +padding-right: 5px; +float: left; +width:32%; +/* set to 49% for 2 column layout. can also set exact px width if you dont want to auto resize width */ +margin-top: 5px; +margin-right: auto; +margin-bottom: 5px; +margin-left: auto; +background:#fff url(../images/newUI/leftside.gif) repeat-y left top; +position: relative; + +} + +.top { +width:100%; +height:40px; +background:url(../images/newUI/top.gif) no-repeat left top; +} + +.top span { +display:block; +position:relative; +height:40px; +background:url(../images/newUI/top-right.gif) no-repeat right top; +} + +.center-content { +position:relative; +background:url(../images/newUI/rightside.gif) repeat-y right top; +padding:1px 20px 1px 25px; +margin:-1px 0 -50px 0; +} + +.bottom{ +width:100%; +height:60px; +background:url(../images/newUI/bottom.gif) no-repeat left bottom; +} + +.bottom span { +display:block; +/*remove because of ie position:relative;*/ +height:60px; +background:url(../images/newUI/bottom-right.gif) no-repeat right top; +} + + .mainContainer{ +background: #fff; +padding: 5px; +} + +#mainFields{ +padding: 0px; +margin: 0; +background: #FFF; +} + +#mainFields td, #mainFields table, #mainFields tr{ +background: #DFDFDF; +color: #51585F; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-transform: uppercase; +padding: 0px 0 0 0; +margin: 0; +} + +.footer{ +background: #9A9A9A url("../images/newUI/footerbg.gif") repeat-x; +padding: 8px; +margin: 0; +height: 41px; +color: #FFFFFF; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: bold; +border-top: #FFFFFF solid 1px; +position: relative; +} + +.floatRight{ + float: right; +} + +.floatLeft{ + float: left; +} + +#newHeader, #footer, #body, .form{ + padding: 0px; + margin: 0px; +} + +#content{ + padding: 0px; + min-height: 525px; + margin: 0px; +} + +#search{ + display:none; + border:solid 1px #FFF; + background-color: #EBEFF7; + padding: 10px; + width : 280px; + height: 100px; + position: absolute; + z-index: 8000; + color: #333; + font-family: tahoma, san-serif; + font-size: 12px; + text-align: center; + left: 40%; + top: 40%; +} + +#bulletList { + margin-right: 0px; + margin-left: 0px; +} + +#bulletList ul{ + margin: 0px 0 0 0 ; + padding: 0; + list-style-type: none; + line-height: 12px; +} + +#bulletList li { + margin: 0 0 0 0px; +} + +#bulletList a{ + width: 98%; + text-align: left; + color: #777; + display: block; + padding: 8px 0 3px 0px; + text-decoration: none; + font-size: 11px; + font-weight: bold; + text-transform: normal; + font-family: tahoma, verdana, san-serif; + text-indent: 18px; + background: url(../images/newUI/icon-newwindow.gif) no-repeat 0 8px; + border-top: none +} + +#bulletList a:hover{ + color: #3B6DAA; +} + +#bulletList2 { + margin-right: 0px; + margin-left: 20px; +} + +#bulletList2 ul{ + margin: 0px 0 0 0 ; + padding: 0; + list-style-type: none; + line-height: 12px; +} + +#bulletList2 li { + margin: 0 0 0 0px; +} + +#bulletList2 a{ + width: 98%; + text-align: left; + color: #777; + display: block; + padding: 8px 0 3px 0px; + text-decoration: none; + font-size: 11px; + font-weight: bold; + text-transform: normal; + font-family: tahoma, verdana, san-serif; + text-indent: 18px; + background: url(../images/newUI/bullet-arrow.gif) no-repeat 0 8px; + border-top: none +} + +#bulletList2 a:hover{ + color: #3B6DAA; + } + +#rightContainer{ + margin: 0; + padding: 0; +} + +.rightContainer{ + background:#EBEFF7 url(../images/newUI/palebluebg.gif) repeat-y 0 0; +} + +#rightHeaderTitleContainer a{ + text-decoration: none; + font-size: 11px; + color: #777; + text-align: left; +} + +#rightHeaderTitleContainer a:hover{ + text-decoration: none; + font-size: 11px; + color: #3B6DAA; +} + + +#rightHeaderTitleContainer{ + text-align: center; + margin-top: 3px; + padding-left: 20px; + border-bottom: 1px solid #fff; + height: 27px; +} + +#mainHeaderTitleContainer{ + text-align: center; + margin-top: 0px; + padding-left: 20px; + border-bottom: 1px solid #fff; + height: 30px; +} + + +#mainHeaderTitleContainer h1{ + font-size: 14px; + font-family: tahoma; + color: #669ACF; + text-transform: uppercase; + padding: 5px 0 0 0; + margin: 0; +} + +#liquid-roundFull { + padding-right: 0px; + float: left; + width:99%; + /* set to 49% for 2 column layout. can also set exact px width if you dont want to auto resize width */ + margin:5px auto; + background:#fff url(../images/newUI/leftside.gif) repeat-y left top; +} + +#liquid-roundHalf { + padding-right: 7px; + float: left; + width:49%; + /* set to 49% for 2 column layout. can also set exact px width if you dont want to auto resize width */ + margin:0px auto; + background:#fff url(../images/newUI/leftside.gif) repeat-y left top; +} + +.browse{ + background: url(../images/newUI/butn-browse.gif) no-repeat 0 1px; + width: 89px; + height: 22px; + margin: 0px 0 0px 5px; + padding: 0; + cursor: pointer; /* hand-shaped cursor */ + cursor: hand; /* for IE 5.x */ + border: 0; + font-size: 10px; + text-transform: uppercase; +} + +.radioBox{ + padding: 0; + margin: 0; +} + +#generalSystemActions{ + position: relative; + margin: 0; + float: right; + color: #fff; + font-family: tahoma, san-serif; + font-size: 11px; + font-weight: normal; + padding: 3px 8px 0 10px; +} + +#generalSystemActions img{ + margin-right:2px; +} + +#acDetailsR{ + position: relative; + margin: 0; + float: right; + color: #fff; + font-family: tahoma, san-serif; + font-size: 11px; + font-weight: normal; +} + +.strong{ + font-weight: bold; +} + +#systemMenu{ + padding-top: 3px; + padding-left: 13px; + color: #fff; + font-size: 11px; + text-align: center; +} + +#systemActionContainer{ + text-align: center; + padding: 5px 0 0 0; +} +#systemActionContainer img{ + margin: 0px 2px 0 0; + cursor: pointer; +} + +#loginContainer{ + background: #fff ; + position: relative; + clear: both; + height: 100%; + font-size: 12px; +} + +#loginContainer td{ + font-size: 12px; + font-weight: bold; + color: #666; +} +#loginContainer a{ + color: #3B6DAA; +} + +#loginContainer a:hover{ + color: #3B6DAA; + text-decoration: none; +} + +#pinLoginContainer, .paleBlueBg{ + background: #EBEFF7 url("../images/newUI/palebluebg.gif") repeat-y; + margin: 0 0 0 0px; + clear: both; + height: 100%; +} + +#loginPinContent td{ + font-size: 12px; + font-weight: bold; + text-transform: uppercase; + color: #666; +} + +.input{ + width: 200px; + height: 30px; + font-size: 12px; + font-weight: normal; +} + +.butnLogin{ + background: url(../images/newUI/butn-login.gif) no-repeat center top; + width: 81px; + height: 25px; + margin: 0px 0 0px 0px; + padding: 0; + cursor: pointer; /* hand-shaped cursor */ + cursor: hand; /* for IE 5.x */ + border: 0; + text-indent: -1000em; +} + +.systemMsg{ + padding-top: 8px; + text-transform: none; +} + +input.usernameMissing, input.passwordMissing, input.pinnumberMissing{ + border: 1px solid #CC0000; +} + +#pinLoginContainer input{ + width: 162px; + height: 30px; + font-size: 20px; + margin: 5px 0; +} + +#loginPinContent input{ + height: 30px; + font-size: 12px; + font-weight: normal; +} + +.divsystemerror{ + width: 250px; + color: #CC0000; + margin-bottom: 0px; +} +.systemerror{ + //background: url(../images/newUI/icon-err.gif) no-repeat 0 top; + width: 30px; + height: 35px; + float: left; + margin-right: 10px; +} + +#loginContent{ + padding: 55px 0 30% 0; +} + +#loginPinContent{ + padding: 15% 0 15% 0; +} + +.systemKey{ + background: url(../images/newUI/singlekey.gif) no-repeat 0 top; + width: 51px; + height: 51px; + float: left; + margin: 0 5px 5px 0; + cursor: pointer; +} + +.systemKey div{ + color : #333; + display: block; + width: 51px; + height: 36px; + text-decoration: none; + text-align: center; + font-weight: bold; + padding-top: 15px; +} + +.numPad{ + width: 168px; +} + +.dateTag{ + font-size: 11px; + color: #666; + width: 20px; + border-right: 1px solid #999; + padding-right: 12px; + text-align: center; + clear: both; +} + +.date{ + font-size: 13px; +} + +.month, .upperCase{ + text-transform: uppercase; + font-weight: bold; +} + +.newsContent{ + font-size: 11px; + color: #666; + clear: left; + margin-left: 40px; + margin-top: -28px; +} + +.newsContainer{ +width: 100%; +clear: both; +margin-bottom: 15px; + +} + +.infoContainer{ + font-size: 11px; + color: #666; +} + +.reg10UC{ + font-weight: normal; + font-size: 10px; + text-transform: uppercase; +} + +.reg10{ + font-weight: normal; + font-size: 10px; +} + +.bold11{ + font-weight: bold; + font-size: 11px; +} + +.bold13{ + font-weight: bold; + font-size: 13px; + text-transform: uppercase; +} + +#headerContainerRight{ + background: #9A9A9A url("../images/newUI/pricedetbg.gif") no-repeat; + height: 41px; +} + +#headerRight{ + background: url("../images/newUI/pricedetbgtile.gif") repeat-x; + height: 41px; + position: relative; + margin: 0 0 0 5px; +} + +#donate a{ + text-align: center; +} + +#rightBtnContainer{ + background: #EBEFF7 url("../images/newUI/palebluebg.gif") repeat-y; + position: relative; + margin: 0 0 0 0px; + border-top: 1px solid #fff; + clear: both; + height: 100%; +} + +#rightBtn{ + padding: 6px; + color: #669ACF; + font-family: tahoma, san-serif; + font-size: 12px; + font-weight: bold; + text-align: center; + clear: both; +} + +#messagebox div, .errormsg{ + background: url(../images/newUI/icon-err.gif) no-repeat left center; + min-height: 35px; + line-height: 35px; +} + +.errormsgs { + background-color: #CC1515; + color:#FFFFFF; + z-index: 9000; + background: url(../images/newUI/icon-err.gif) no-repeat left center; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 40px; + padding-top: 5px; + min-height: 35px; + line-height: 35px; +} + +#errorsbox +{ + vertical-align: middle; + background-color:CC1515; + border: solid 1px #D41616; + padding: 4px; +} + +.errorRight{ + height: 99%; + text-align: center; + text-transform: uppercase; + color: #CC1515; + vertical-align: middle; + font-family: tahoma, san-serif; + font-size: 16px; + font-weight: bold; + border-bottom: 1px solid #FFF; +} \ No newline at end of file diff --git a/posterita/posterita/web/css/modalbox.css b/posterita/posterita/web/css/modalbox.css new file mode 100644 index 0000000000..4685eb5a24 --- /dev/null +++ b/posterita/posterita/web/css/modalbox.css @@ -0,0 +1,101 @@ +#MB_overlay { + position: absolute; + margin: auto; + top: 0; left: 0; + width: 100%; height: 100%; + z-index: 9999; + background-color: #000!important; +} +#MB_overlay[id] { position: fixed; } + +#MB_window { + position: absolute; + top: 0; + border: 0 solid; + text-align: left; + z-index: 10000; +} +#MB_window[id] { position: fixed!important; } + +#MB_frame { + position: relative; + background-color: #EFEFEF; + height: 100%; +} + +#MB_header { + margin: 0; + padding: 0; +} + +#MB_content { + padding: 6px .75em; + overflow: auto; +} + +#MB_caption { + font: bold 100% "Lucida Grande", Arial, sans-serif; + text-shadow: #FFF 0 1px 0; + padding: .5em 2em .5em .75em; + margin: 0; + text-align: left; +} + +#MB_close { + display: block; + position: absolute; + right: 5px; top: 4px; + padding: 2px 3px; + font-weight: bold; + text-decoration: none; + font-size: 13px; +} +#MB_close:hover { + background: transparent; +} + +#MB_loading { + padding: 1.5em; + text-indent: -10000px; + background: transparent url(/posterita/images/spinner.gif) 50% 0 no-repeat; +} + +/* Color scheme */ +#MB_frame { + padding-bottom: 7px; + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + border-radius: 7px; +} +#MB_window { + background-color: #EFEFEF; + color: #000; + -webkit-box-shadow: 0 8px 64px #000; + -moz-box-shadow: 0 0 64px #000; + box-shadow: 0 0 64px #000; + + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + border-radius: 7px; +} +#MB_content { border-top: 1px solid #F9F9F9; } +#MB_header { + background-color: #DDD; + border-bottom: 1px solid #CCC; +} +#MB_caption { color: #000 } +#MB_close { color: #777 } +#MB_close:hover { color: #000 } + + +/* Alert message */ +.MB_alert { + margin: 10px 0; + text-align: center; +} + +.popup{ + text-decoration:none; + color:#FFFFFF; + background-color:#333333; +} \ No newline at end of file diff --git a/posterita/posterita/web/css/newPOS.css b/posterita/posterita/web/css/newPOS.css new file mode 100644 index 0000000000..1758d4d473 --- /dev/null +++ b/posterita/posterita/web/css/newPOS.css @@ -0,0 +1,723 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author tamak + */ + + +body +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + color: #000000; + +} + +mandatory +{ + font-weight: bold; + text-align:right; + font-size:18px; + color: blue; +} + +p.loginHeader +{ + color: #666666; + font-size: 36px; + font-weight: bold; + font-family: arial,sans-serif; +} + + + +div.copyright +{ + background-color: #666666; + text-align: center; + color: #FFFFFF; + font-family: arial,sans-serif; + font-weight: bold; + font-size: 10pt; + letter-spacing: 1px; + padding: 2; +} + +label +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #000000; + padding-right: 4px; +} + +label.red +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #E83530; +} + +label.green +{ + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #0A9409; +} + +li.errormsg +{ + list-style-image: url("../images/pos/error.jpg"); + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #000000; +} + +legend +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color:#0A9409; +} + + +input.text +{ + border: solid 1px #666666; + /*font-family: arial,sans-serif;*/ + font-size: 10pt; +} + +textarea.text +{ + border: solid 1px #666666; + /*font-family: arial,sans-serif;*/ + font-size: 10pt; +} + +select.text +{ + border: solid 1px #666666; + /*font-family: arial,sans-serif;*/ + font-size: 10pt; +} + + +input.medium +{ + width:100px; +} + +input:focus +{ + background-color: #CDD4E9; + border: solid 1px #333333; +} + + +font.greencolor +{ + color:#0A9409; +} + +font.redcolor +{ + color:#E83530; +} + +font.title +{ + font-size: 16pt; +} + +div.main +{ + width:800px; + border:solid 1px #000000; + text-align: center; + overflow: inherit; + /* height: 600px; */ +} + +div.header +{ + width:800px; + /* height: 110px; */ +} + +div.menu +{ + width:800px; + background-color: #D8D8D8; +} + +div.content +{ + width:800px; + min-height: 300px; + background-color: #F4F4F4; +} + +font +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #555555; +} + +li.submenu +{ + list-style-image: url("../images/pos/buttons/bullet_red.gif"); + font-family: arial,sans-serif; + font-size: 10pt; + /*font-weight: bold;*/ + letter-spacing: 1px; + color: #000000; +} + +img.topmenu +{ + border-style: none; + +} + +img.button +{ + cursor:pointer; +} + +/* anchor sytles */ +a:hover +{ + color:#0A9409; +} + +a.topmenu +{ + text-decoration: none; + border-width: 0px; + border-style: none; +} + +a.submenu +{ + text-decoration: none; + color:#666666; + font-family: arial,sans-serif; + font-size: 11pt; + letter-spacing: 1px; + font-weight: bold; +} + +td.submenu +{ + text-decoration: none; + color:#666666; + font-family: arial,sans-serif; + font-size: 11pt; + letter-spacing: 1px; + font-weight: bold; +} + +a +{ + text-decoration: none; + font-family: arial,sans-serif; + font-size: 11pt; + letter-spacing: 1px; +} + +a.forgotpassword +{ + color:#0A9409; + font-family: arial,sans-serif; + font-size: 12pt; + letter-spacing: 1px; + font-weight: bold; +} + +/* end of anchor styles */ + +/* Auto complete style */ +div.autocomplete { + position:absolute; + width:250px; + background-color:white; + border:1px solid #888; + margin:0px; + padding:0px; + overflow: auto; +} + +div.autocomplete ul { + list-style-type:none; + margin:0px; + padding:0px; +} +div.autocomplete ul li.selected { background-color: #ffb;} +div.autocomplete ul li { + list-style-type:none; + display:block; + margin:0; + padding:2px; + cursor:pointer; + letter-spacing: 1px; + font-size: 10pt; + font-family:arial,sans-serif; +} +div.notfound { + background-color: #ffb; +} + +/* tables styles */ +table.view +{ + border-collapse: collapse; + /*border: solid 1px black;*/ +} + +table.view td +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 0px 5px 0px; +} + +table.layout +{ + padding-left: 10; + padding-right: 10; + padding-top: 10; + padding-bottom: 10; + + /* border:solid 1px #000000; */ +} + +table.main +{ + width: 100%; + /*border: solid 1px black;*/ + border-collapse: collapse; +} + +table.main td +{ + padding: 5px 0px 5px 0px; +} + +table.topmenu +{ + padding-left: 10; + padding-right: 10; + + /* border:solid 1px #000000; */ +} + +td.buttoncell +{ + padding-right: 0px; +} + +table.login +{ + width: 800px; + /*height: 600px;*/ + border: solid black 1px; + border-spacing: 0; +} + +td.loginHeader +{ + height: 210px; + background-image: url("../images/pos/POS-LOGIN_01.gif"); + background-repeat: no-repeat; +} + +table.content +{ + width: 100%; + /* border: solid 1px black; */ + border-collapse: collapse; +} + +table.content th +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #909090; +} + +table.content td.total +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #BBBBBB; +} + +table.content td +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + padding: 5px 0px 5px 0px; + +} + +table.cart +{ + width: 100%; + /*border: solid 1px black;*/ + border-collapse: collapse; + border-spacing: 0px; + border: 0px; +} + +table.cart td +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + padding: 5px 5px 5px 5px; +} + +table.cart th +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #909090; + padding: 5px 5px 5px 5px; +} + +table.cart td.total +{ + font-family: arial,sans-serif; + font-size: 10pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #BBBBBB; +} + +table.cart td.label +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + background-color: #D8D8D8; +} + +table.cart td.contentname +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + background-color: #C9C9C9; +} + +table.content td.label +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + background-color: #D8D8D8; +} + +table.content td.contentname +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + font-weight: bold; + color: #000000; + background-color: #C9C9C9; +} + +table.orderheader td +{ + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + padding: 5px 0px 5px 0px; + color: #000000; +} + +/* +td.copyright +{ + height: 60px; + vertical-align: top; + padding: 0; +} +*/ + +table.display td a +{ + text-decoration: none; + color:blue; + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; +} + +table.display +{ + width: 100%; + border: solid 1px black; + border-collapse: collapse; +} + +table.display td.label +{ + /* + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + color: #000000; + */ + background-color: #D8D8D8; +} + +table.display td.contentname +{ + /* + font-family: arial,sans-serif; + font-size: 10pt; + letter-spacing: 1px; + color: #000000; + */ + background-color: #C9C9C9; +} + +table.display td +{ + font-family: arial,sans-serif; + font-size: 9pt; + letter-spacing: 1px; + color: #000000; + padding: 5px 5px 5px 5px; +} + +table.display th +{ + font-family: arial,sans-serif; + font-size: 9pt; + font-weight: bold; + letter-spacing: 1px; + color: #FFFFFF; + background-color: #909090; + padding: 5px 5px 5px 5px; +} + +caption +{ + font-family: arial,sans-serif; + font-size: 12pt; + font-weight: bold; + letter-spacing: 1px; + padding: 5px 5px 5px 5px; +} +/* end of table styles */ + +/* buttons styles */ +.advanced +{ + background-image: url("../images/pos/buttons/button_advanced.gif"); +} + +.continue +{ + background-image: url("../images/pos/buttons/button_continue.gif"); +} + +.complete +{ + background-image: url("../images/pos/buttons/button_continue.gif"); +} + +.addtocart +{ + background-image: url("../images/pos/buttons/button_addtocart.gif"); +} + +.newcustomer +{ + background-image: url("../images/pos/buttons/button_newcustomer.gif"); +} + +.checkout +{ + background-image: url("../images/pos/buttons/button_checkout.gif"); +} + +.delete +{ + background-image: url("../images/pos/buttons/button_delete.gif"); +} + +.neworder +{ + background-image: url("../images/pos/buttons/button_neworder.gif"); +} + +.cash +{ + background-image: url("../images/pos/buttons/button_cash.gif"); +} + +.card +{ + background-image: url("../images/pos/buttons/button_card.gif"); +} + +.cheque +{ + background-image: url("../images/pos/buttons/button_cheque.gif"); +} + +.mixed +{ + background-image: url("../images/pos/buttons/button_mixed.gif"); +} + +.save +{ + background-image: url("../images/pos/buttons/button_submit.gif"); +} + +.submit +{ + background-image: url("../images/pos/buttons/button_submit.gif"); +} + +.refresh +{ + background-image: url("../images/pos/buttons/button_refresh.gif"); +} + +.piechart +{ + background-image: url("../images/pos/buttons/button_piechart.gif"); +} + +.barchart +{ + background-image: url("../images/pos/buttons/button_barchart.gif"); +} + +.timeseries +{ + background-image: url("../images/pos/buttons/button_timeseries.gif"); +} + +.tabular +{ + background-image: url("../images/pos/buttons/button_tabular.gif"); +} + +.bigbutton +{ + background-repeat: no-repeat; + cursor: pointer; + border: 0px; + width: 127px; + height: 42px; + font-family: arial,sans-serif; + font-size: 12pt; + letter-spacing: 1px; + font-weight: bolder; + color: #666666; + padding: 0px; +} + +.smallbutton +{ + background-repeat: no-repeat; + cursor: pointer; + border: 0px; + width: 87px; + height: 42px; + font-family: arial,sans-serif; + font-size: 12pt; + letter-spacing: 1px; + font-weight: bolder; + color: #666666; + padding: 0px; +} + +.tangobutton +{ + background-repeat: no-repeat; + cursor: pointer; + border: 0px; + width: 87px; + height: 42px; + font-family: arial,sans-serif; + font-size: 12pt; + letter-spacing: 1px; + font-weight: bolder; + color: #666666; + padding: 0px; +} + +/* end of buttons styles */ + +div.space +{ + height:10px; + /* + border: solid 1px black; + background-color: #0000FF; + */ +} diff --git a/posterita/posterita/web/css/orderScreen.css b/posterita/posterita/web/css/orderScreen.css new file mode 100644 index 0000000000..f15c9b34ee --- /dev/null +++ b/posterita/posterita/web/css/orderScreen.css @@ -0,0 +1,828 @@ +#controls, div#centerShortcuts{ +background: #9A9A9A url("../images/newUI/footerbg.gif") repeat-x; +padding: 8px; +margin: 0; +height: 41px; +color: #FFFFFF; +font-family: tahoma, san-serif; +font-size: 11px; +text-align: center; +} + +body{ +padding: 0; +margin: 0; +background: #DFDFDF; +} + +.divider{ +color: #AEAEB0; +padding: 0 2px 0 2px; +} + +#posHeader{ +background: #9A9A9A url("../images/newUI/topmenubg.gif") repeat-x; +position: relative; +float: left; +width: 100%;} + + +.backButn{ +position: relative; +float: left; +width: 28px; +cursor: pointer; +} + +#logo{ +position: relative; +width: 133px; +float: left; +} + +#mainTitle{ +position: relative; +color: #FFFFFF; +font-family: tahoma, san-serif; +font-size: 13px; +font-weight: bold; +text-transform: uppercase; +margin: 10px 0 0 10px; +float: left; + +} +#acDetailsContainer{ +margin: 5px 10px 0 10px;} + +#acDetailsL{ +position: relative; +margin: 0; +float: right; +color: #fff; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: normal; +padding-right: 10px; + +} + +#acDetailsR{ +position: relative; +margin: 0; +float: right; +color: #fff; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: normal; +} + +.strong{ +font-weight: bold; +} + +#priceContainer{ +background: #9A9A9A url("../images/newUI/pricedetbg.gif") no-repeat; +height: 41px; +} + +#priceContainerBg{ +background: url("../images/newUI/pricedetbgtile.gif") repeat-x; +height: 41px; +position: relative; +margin: 0 0 0 5px; +} + +#priceValue{ +color: #FFFFFF; +font-family: tahoma, san-serif; +font-size: 16px; +font-weight: bold; +text-align: center; +padding: 10px 0 0 0; +} + +#priceListDetailsContainer{ +background: #EBEFF7 url("../images/newUI/palebluebg.gif") repeat-y; +position: relative; +margin: 0 0 0 0px; +clear: both; +} + +#priceListDetails{ +padding: 10px; +color: #669ACF; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: center; +clear: both; +} + +.productValue, .discountDetails{ +color: #333; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: bold; +margin-left: 5px; +} + +#pgTitle{ +color: #fff; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: bold; +text-transform: uppercase; +position: relative; +margin-left: 170px; +padding-top: 25px; +} + +#productFieldsContainer{ +background: #DFDFDF; +padding: 0px; +margin: 0px; +} + +#productFields{ +padding: 1px; +margin: 0; +background: #DFDFDF; +} + +#productFields td, #productFields table, #productFields tr{ +background: #DFDFDF; +color: #51585F; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-transform: uppercase; +padding: 0px 0 0 0; +margin: 0; +} + +#productFields form{ +padding: 0; +margin:0; + +} + +input, textarea{ +background-color: #fff; +border: 1px solid #9A9A9A; +height: 18px; +padding: 0px; +margin: 0; +color: #51585F; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: normal; + +} + + input:focus, textarea:focus{ + border:1px solid #9ACF30; + background:#E3F3C3; +} + + +#productDetailsContainer, div#discountDetailsContainer{ +background: #EBEFF7 url("../images/newUI/palebluebg.gif") repeat-y; +position: relative; +margin: 0 0 0 0px; +clear: both; +border-top: 1px solid #fff; +height: 100%; +line-height: 16px; +} + +#productDetails, div#discountDetails{ +padding: 10px; +color: #9A9A9A; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: normal; +text-align: left; +} + +div#productImage{ +background: #EBEFF7; +width: 90px; +height: 90px; +float: right; +} + +#editProductContainer, .rightColSubContainer{ +position: relative; +margin: 0; +border-top: 1px solid #fff; +} + +#editProductDetails{ +position: relative; +padding: 10px; +color: #9A9A9A; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: center; +} + +#editProductDetails input{ +margin-bottom: 10px; +margin-right: 5px; +} + +#customerContainer, #changePricelistContainer, #choosePrintDetailsContainer, .inventoryDetails{ +position: relative; +margin: 0; +border-top: 1px solid #fff; +} + +#choosePrintDetailsContainer span{ + font-family: tahoma, san-serif; + font-size: 12px; + font-weight: bold; + color: #333; + text-align: left; +} + +#choosePrintDetailsContainer table, input{ + margin-top: 8px; +} + +.inventoryDetails table{ + margin-top: 5px; + margin-bottom: 5px; +} + +#changePricelist{ + margin-top: 10px; + text-transform: uppercase; + color: #333; + font-weight: bold; +} + +#customerDetails{ +position: relative; +padding: 10px; +color: #9A9A9A; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: left; +} + +#paymentContainer{ +position: relative; +margin: 0; +border-top: 1px solid #fff; +} + +#paymentDetails{ +padding: 10px; +color: #9A9A9A; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: center; +} + +#quickDiscountDetails{ +position: relative; +border-top: 1px solid #fff; +padding: 10px; +color: #9A9A9A; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: left; +width: 300px; +display:block; +float:left; +} + +#docStatus{ +position: relative; +border-top: 1px solid #fff; +padding: 10px; +color: #9A9A9A; +font-family: tahoma, san-serif; +font-size: 10px; +font-weight: bold; +text-align: left; +width: 300px; +display:block; +float:left; +} + +#paymentDetails h1{ +padding-bottom: 5px; +margin: 0; +color: #9A9A9A; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: center; +} + +#contentContainer{ +position: relative; +margin: 0 0 0 0px; +clear: both; +border-top: 1px solid #fff; +height: 100%; +} + +#content{ +padding: 0px; +color: #333333; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: center; +} + +#contentContainer div{ + background: #DFDFDF; +} + + +#systemButnContainer{ +position: relative; +margin: 0 0 0 0px; +clear: both; +border-top: 1px solid #fff; +height: 100%; +} + +#systemButn{ +padding: 6px; +color: #669ACF; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: left; +} + +#checkoutContainer{ +background: #EBEFF7 url("../images/newUI/palebluebg.gif") repeat-y; +position: relative; +margin: 0 0 0 0px; +border-top: 1px solid #fff; +clear: both; +height: 100%; +} + +#checkout{ +padding: 6px; +color: #669ACF; +font-family: tahoma, san-serif; +font-size: 12px; +font-weight: bold; +text-align: center; +clear: both; +} + +.itemTitleList{ +background: #929292; +color: #fff; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: bold; +} + +.itemTitleList th{ +padding: 4px; +border: none; +text-align: left; +} + + +.highlight { +background-color: #9ACF30; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: normal; +color: #fff; +text-align: left; +} + +.highlight td{ +padding: 4px; +border: none; +} + +.totalItem{ +text-align: right; +} + +.totalSales{ +text-align: right; +} + +.oddRow{ +background: #F7F7F7; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: normal; +text-align: left; +} + +.oddRow td{ +padding: 4px; +border: none; +} + +.evenRow{ +background: #FFF; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: normal; +text-align: left; +} + +.evenRow td{ +padding: 4px; +border: none; +} + +.itemsTotal{ +background: #fff; +color: #333; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: bold; +} + +.itemsTotal td{ +background: #fff; +padding: 4px; +border-top: 2px solid #656565; +border-bottom: 2px solid #656565; +border-left: none; +border-right: none; +text-align: left; +} + +/* Auto complete style */ +div.autocomplete { + position: absolute; + /*width:250px;*/ + height:200px; + display:none; + background-color:white; + border:1px solid #888; + margin:0px; + padding:0px; + overflow: auto; + font-size: 11px; + font-family: tahoma, san-serif; + z-index: 9000; +} + +div.autocomplete ul { + list-style-type:none; + margin:0px; + padding:0px; +} + +div.autocomplete ul li.selected { + background-color: #9ACF30; + } + +div.autocomplete ul li { + list-style-type:none; + display:block; + margin:0; + padding:2px; + cursor:pointer; + letter-spacing: 1px; + font-size: 11px; + font-family: tahoma, san-serif; +} +div.notfound { + background-color: #ffb; +} + +div.errormsg { + padding: 10px; + border: solid 2px #BA0B0B; + background-color: #CC1515; + color:#FFFFFF; + position:absolute; + float:left; + z-index: 9000; + width:300px; + min-height: 60px; + padding-left: 60px; + background-image: url(../images/pos/icon-error.gif); + background-repeat: no-repeat; + background-position: 5px 5px; +} + +div.mask { + position:absolute; + float:left; + z-index: 8500; + background-image: url(../images/pos/maskBG.png); + top:0px; + left: 0px; +} + +div#indicator { + top:0px; + border: solid 2px #CC1515; + padding: 5px 5px 5px 5px; + display: none; + background-color: #FFFFFF; + z-index:10000; + right: 0px; + position: absolute; +} + +div#cashPanel, div#cardPanel, div#chequePanel, div#debitPanel, div#mixPanel, div#PINPanel { + display:none; + border:solid 10px #FFF; + background-color: #EBEFF7; + padding: 20px; + width : 400px; + position: absolute; + + margin: 0px; + z-index: 8000; + color: #333; + font-family: tahoma, san-serif; + font-weight: bold; + font-size: 14px; +} + +div#cash, div#card, div#cheque, div#mix, div#debit{ + overflow: auto; +} + +div#PINPanel { + width : 200px; + height : 100px; + position: absolute; + z-index: 8000; +} + +div#reciept { + text-align: center; +} + +div#reciept h1, div#reciept h2, div#reciept h3 { + text-align: center; +} + +div.floatDown { + position:absolute; + top: 560px; +} + +div#shoppingCart, div#cart { + height: 450px; + overflow: auto; +} + +.pointer{ + cursor:pointer; +} + +.selected{ + border:solid 1px #9ACF30; + cursor:pointer; +} + +.alignDetails td{ + border: 0px; + vertical-align: top; + text-align: left; + font-family: tahoma, san-serif; + font-size: 11px; + font-weight: normal; +} + +br.clear{ + clear:both; +} + +tr#customerName, tr#customerCode , tr#creditAvailable, tr#creditLimit, tr#openBalance{ + display: none; +} + +#receipt{ + overflow: auto; + background: #EBEFF7 url("../images/newUI/palebluebg.gif") repeat-y; + border-top: 1px solid #fff; + line-height: 16px; + height: 450px; +} + +#receiptDetails{ + margin-left: 10px; +} + +.buttonLeft, .buttonRight{ + background: url("../images/newUI/pricedetbg.gif") repeat; + border: 1px solid #FFF; + line-height: 23px; + float: left; + height: 21px; + width: 95px; + font-family: tahoma, san-serif; + font-size: 11px; + font-weight: bold; + color: #FFF; + margin-right: 5px; + padding-top: 0px; + padding-bottom: 0px; + vertical-align: middle; + text-align: center; + margin-top:5px; + margin-bottom: 5px; + cursor: pointer; +} + +.buttonRight{ + position: absolute; + margin-left: 110px; +} + +div#leftBtnContainer, div#rightBtnContainer{ + position: relative; + margin: 0 0 0 0px; + padding-top: 3px; + padding-bottom: 0px; + border-top: 1px solid #fff; + height: 38px; + padding-left: 7px; +} + +div#rightBtnContainer, .paleBlueBg{ + background: #EBEFF7 url("../images/newUI/palebluebg.gif") repeat-y; + padding-left: 0px; +} + +div#discountDetails{ + height: 430px; + position: relative; +} + +div#centerShortcuts{ + line-height: 41px; +} + +#discount td{ + text-align: left; + padding-left: 5px; + background-color: #FFFFFF; +} + +div#frameHandle{ + text-align: right; + border-bottom: solid 1px #CCC; + padding: 2px; + background-color: #333; +} + +div#frameHandle a{ + text-decoration: none; + color: #FFF; + font-weight: bold; +} + +.error { + font-size: 11px; + color: white; + text-decoration: blink; + background-color: #FF0000; +} + +#pop_overlay + { + display: none; + position: fixed; + width: 100%; + height: 100%; + top: 0px; + left: 0px; + background: #000000; + filter: alpha(opacity=60); + -moz-opacity: 0.6; + opacity: 0.6; + } + + #pop_container + { + display: none; + position: fixed; + width: 100%; + height: 100%; + top: 0px; + left: 0px; + background: transparent; + } + + #pop_inner + { + display: block; + width: 320px; + height: 320px; + margin: 120px auto 0 auto; + background: #FFFFFF + border: 1px solid #999999 + text-align: center; + } + +#productCount{ + font-size: 14px; + font-weight: bold; + vertical-align: middle; + color: #CC0000; + text-transform: uppercase; + line-height: 450px; + margin-left: 30%; +} + +.noProduct{ + color: #CC0000; + font-size: 12px; + font-weight: bold; +} + +.salesFiguresHeader{ +background: #929292; +color: #fff; +font-family: tahoma, san-serif; +font-size: 11px; +font-weight: bold; +} + +.salesFiguresHeader th{ +padding: 2px; +border: none; +text-align: left; +} + +.salesFiguresRow{ + background: #DFDFDF; +} + +.captionStyle{ + padding: 10px; + color: #669ACF; + font-family: tahoma, san-serif; + font-size: 12px; + font-weight: bold; + letter-spacing: 0px; +} + +#productImage img{ + padding-top: 10px; +} + +#productEditFieldsContainer +{ +background: #fff; +padding: 0px; +margin: 0px; +height: 100%; +color: #666; +} + +#productEditFieldsContainer .prodFields{ +width: 270px;} + +#productEditFieldsContainer .prodTaxFields{ +width: 100%;} + +#productEditFieldsContainer .prodDescription +{ +font-size: 11px; +width: 270px; +padding: 0; +margin: 0;} + +#productEditFieldsContainer select +{ +border: 1px solid #777; +font-size: 11px; +} + +#productEditFieldsContainer td +{ +font-size: 11px; +} + +#productDetails td{ + font-size: 11px; +} + +#productEditFieldsContainer .checkbox, #productEditFieldsContainer .radioBox{ + vertical-align: middle; +} + +#productDetails .checkbox{ + vertical-align: middle; +} \ No newline at end of file diff --git a/posterita/posterita/web/css/popup.css b/posterita/posterita/web/css/popup.css new file mode 100644 index 0000000000..e74efdc479 --- /dev/null +++ b/posterita/posterita/web/css/popup.css @@ -0,0 +1,30 @@ +/* + popup.js +*/ +div.popup { + max-width: 600px; + border: 1px solid grey; + padding: 5px; + background-color: white; + /* The following properties should not be changed */ + position: absolute; +} + +#popup_overlay { + background-color: #000000; + /* The following properties should not be changed */ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 500px; +} + +span.popup_link, a.popup_link { + cursor: pointer; + border-bottom: 1px dotted; +} + +.popup_draghandle { + cursor: move; +} diff --git a/posterita/posterita/web/css/print.css b/posterita/posterita/web/css/print.css new file mode 100644 index 0000000000..56bf0f385d --- /dev/null +++ b/posterita/posterita/web/css/print.css @@ -0,0 +1,76 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author tamak + */ + + +body, td, th, input { /* redundant rules for bad browsers */ + font-family: verdana, sans-serif; + font-size: 12px; + voice-family: "\"}\""; + voice-family: inherit; +} + +body{ + margin:40px; +} + +table.header{ + background-color:#FFFFFF; +} + +table.content { + border: 1px solid black; + border-collapse: collapse; + background-color: white; +} + +table.footer{ + background-color:#CCCCCC; +} + +th { + color: #333333; + font-weight:bold; + background-color: #CCCCCC; + text-align: left; +} + +td.contentname { + background-color: #F2F2F2; + font-family: Arial, Helvetica, sans-serif; + text-align: left; +} + +td.label { + background-color: #FAFAFA; + font-family: Arial, Helvetica, sans-serif; + text-align: left; +} + +.nodisplay{ + display:none; +} + +.big{ + height:50px; +} \ No newline at end of file diff --git a/posterita/posterita/web/css/screen.css b/posterita/posterita/web/css/screen.css new file mode 100644 index 0000000000..4c69f4b028 --- /dev/null +++ b/posterita/posterita/web/css/screen.css @@ -0,0 +1,118 @@ +@import url("displaytag.css"); + +@import url("alternative.css"); + +@import url("teststyles.css"); + +body,input,select,td,textarea { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 11px; +} + +h4,h5,h6,p,strong,div,form,acronym,label,table,td,th,span,a,hr,code,pre,hr + { + margin: 0; + padding: 0; + font-size: 1em; + background-repeat: no-repeat; + list-style-type: none; +} + +a,a:visited,a:hover { + color: #666; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +img { + border: none; +} + +table hr { + height: 1px; + clear: both; + margin: none; + width: 100%; +} + +textarea { + width: 80%; + height: 200px; +} + +dt { + font-weight: bold; +} + +acronym { + border-bottom: 1px dashed #000; + cursor: help; +} + +ul#stylelist { + margin: 0 0 20px 0; + height: 20px; + padding: 0; +} + +ul#stylelist li { + list-style-type: none; + float: left; + width: 100px; + border: 1px solid #ccc; + background-color: #eee; + padding: 2px;; + float: left; + width: 100px; + border: 1px solid #ccc; + background-color: #eee; + padding: 2px; + margin: 0 2px 0 0; +} + +ul#showsource { + float: right; + padding: 0; + margin: 15px 20px 0 0; + width: 100px; + height: 33px; + list-style-type: none; + background-image: url("../img/viewsource.png"); + background-repeat: no-repeat; + margin-bottom: -30px; + text-align: center; + line-height: 30px; + font-weight: bold; +} + +ul#showsource a,ul#showsource a:visited { + font-size: 11px; + font-family: verdana; + color: #fff; +} + +table.sublist { + margin: 0 0 0 0; + width: 100%; +} + +table.sublist td,table.sublist th { + width: 50%; +} + +code { + background-color: #eee; + padding: 0 2px 0 2px; +} + +hr { + height: 1px; + color: #fff; + border: none; + border-top: 1px dotted #ccc; + margin: 20px 0 20px 0; + width: 50%; +} \ No newline at end of file diff --git a/posterita/posterita/web/css/style.css b/posterita/posterita/web/css/style.css new file mode 100644 index 0000000000..1c52557fad --- /dev/null +++ b/posterita/posterita/web/css/style.css @@ -0,0 +1,566 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author tamak + */ + + +body { + margin: 10px; + font-family: Arial, Helvetica, sans-serif; + color: #000000; + font-size: 12px; + background-color: #C3C1A9; +} +a { + color: #be0027; + text-decoration: none; + font-size:11px; + font-weight:500; +} +a:hover { + color: #666666; + text-decoration: underline; + font-weight:500; + font-size:10px; +} +a:visited { + color: #be0027; + text-decoration: underline; + font-size:11px; + font-weight:500; +} +a.left, a:hover.left, a:active.left, a:visited.left{ + color: #be0027; + text-decoration: none; + font-size:10px; + font-weight:500; +} + +a.message { + color: #be0027; + font-size:11px; + text-decoration: none; + font-weight:500; +} +a:hover.message { + color: #666666; + font-size:11px; + text-decoration: none; + font-weight:500; +} +a:visited.message { + color: #CC0000; + text-decoration: none; + font-weight:500; +} + + +a:hover.submenu, a:link.submenu, a:visited.submenu, a:active.submenu { + color: #be0027; + text-decoration: none; + font-size:11px; +font-weight:500; +} + +/* +a:submenu.left { + color: #666666; + text-decoration: none; + font-size:11px; + font-weight:500; +} +a:submenu.left { + color: #CC0000; + text-decoration: none; + font-size:11px; + font-weight:500; +} +*/ + +h2 { + color: #be0027; + font-size: 20px; + text-align: center; +} +h3 { + color: #be0027; + font-size: 18px; +} + +h1 { + color: #be0027; + font-size: 16px; +} + +.titleleft { + background-image: url(../images/titleleft.png); + background-repeat: no-repeat; + width: 202px; +} +.titlemiddle { + background-image: url(../images/titlemiddle.png); + background-repeat: repeat-x; +} +.titleright { + background-image: url(../images/titleright.png); + background-repeat: no-repeat; + width: 21px; +} +.menutop { + background-image: url(../images/menutop.png); + background-repeat: no-repeat; + width: 168px; + height: 15px; +} +.menumiddle { + background-image: url(../images/menumiddle.png); + background-repeat: repeat-y; + width: 168px; + padding: 10px; +} +.menubottom { + background-image: url(../images/menubottom.png); + background-repeat: no-repeat; + width: 168px; + height: 15px; +} +.contenttopleft { + background-image: url(../images/contenttopleft.png); + background-repeat: no-repeat; + width: 15px; +} +.contenttop { + background-image: url(../images/contenttop.png); + background-repeat: repeat-x; + text-align:right; +} +.contenttopright { + background-image: url(../images/contenttopright.png); + background-repeat: no-repeat; + width: 17px; +} +.contentleft { + background-image: url(../images/contentleft.png); + background-repeat: repeat-y; + width: 15px; +} +.contentright { + background-image: url(../images/contentright.png); + background-repeat: repeat-y; + width: 17px; +} +.contentbottomleft { + background-image: url(../images/contentbottomleft.png); + background-repeat: no-repeat; + width: 15px; +} +.contentbottom { + background-image: url(../images/contentbottom.png); + background-repeat: repeat-x; +} +.contentbottomright { + background-image: url(../images/contentbottomright.png); + background-repeat: no-repeat; + width: 17px; + +} +.copy { + font-size:10px; + color: #666666; + text-align: center; +} + +tr.noborder +{ + border: hidden; + +} + +.borderBottom +{ + + color: #be0027; + border-bottom: 1px solid #be0027; +} + +.createcustomer +{ + border-bottom: 1px solid #be0027; + border-top: 1px solid #be0027; + border-left: 1px solid #be0027; + border-right: 1px solid #be0027; +} + + +table.content { + background-color: #CCCCCC; +} +td.contentname { + background-color: #F2F2F2; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + text-align: left; +} + +tr.contentname { + background-color: #F2F2F2; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + text-align: left; +} + +td.label { + background-color: #FAFAFA; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + text-align: left; +} + +td.rightLabel { + background-color: #FAFAFA; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + text-align: right; +} + +td.greyBgTextBold { + background-color: #F2F2F2; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + font-weight: bold; +} + +td.contentnameCenter { + background-color: #F2F2F2; + text-align: center; +} +td.contentred { + background-color: #F2F2F2; + color: #CC0000; + font-weight: bold; +} +td.contenthead { + font-weight: bold; +} +tr.white { + background-color: #FFFFFF; +} +th { + color: #333333; + font-weight:bold; + background-color: #CCCCCC; + text-align: left; + font-size:12px; + +} +.nb { + color: #be0027; + font-weight: bold; +} +.loginbox { + border: 1px solid #999999; +} +.buttonwide{ + background-color: #cccccc; + border: 1px #999999 solid; + font-family: verdana; + font-weight: bold; + color: #333333; + font-size: 10px; + text-transform: uppercase; + text-align: center; + width: 130px; + height: 18px; + } +.button{ + background-color: #cccccc; + border: 1px #999999 solid; + font-family: verdana; + font-weight: bold; + color: #333333; + font-size: 10px; + text-transform: uppercase; + text-align:center; + width: 100px; + height: 18px; +} + +.button1{ + background-color: #cccccc; + border: 1px #999999 solid; + font-family: verdana; + font-weight: bold; + color: #333333; + font-size: 10px; + text-transform: uppercase; + text-align: center; + width: 120px; + height: 18px; +} + +.button2{ + background-color: #cccccc; + border: 1px #999999 solid; + font-family: verdana; + font-weight: bold; + color: #333333; + font-size: 10px; + text-transform: uppercase; + text-align: center; + width: 160px; + height: 18px; +} + +.pagetitle +{ +background-image: url(../images/tab.jpg); + background-repeat: repeat; + color: #be0027; + font-size: 18px; + font-family: verdana; + text-align:center; + padding-top: 9px; + height: 29px; +} +.pagetitlefont +{ +color: #be0027; + font-size: 18px; + font-family: verdana; + text-align:center; + padding-top: 9px; + height: 29px; +} +.buttonClass +{ +background: #FF6F0E; +color: white; +border: 0; +font-weight: bold; +font-size: 12 px; +} +.buttonClassHeight +{ +background: #FFFFFF; +color:#FF6F0E ; +border: 0; +font-family:Times New Roman; +font-weight: bold; +font-size: 36px; +} +.border0 +{ +border: 0; +} + +table.officeTable { + border: 1px solid black; + border-collapse: collapse; + background-color: white; +} +table.officeTable th { + border: 1px solid black; + background-color: white; +} +table.officeTable td +{ + border: 1px solid black; +} + + +table.content { + border: 1px solid black; + border-collapse: collapse; + background-color: white; +} + +.label +{ + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + text-align: left; +} + +.label12pxbold +{ + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + font-weight: bold; +} + + +td.borderBottom +{ + border-bottom: 1px solid #000000;; +} + +td.contentbold { + font-weight: bold; +} + +.orderTitle +{ + font-size: 14px; + font-family: Helvetica, Helvetica, sans-serif; + font-weight: bold; +} + +.ZZMessage +{ + font-size: 14px; + font-family: Helvetica, Helvetica, sans-serif; + font-weight: normal; + color:#CC0000; +} + +tr.noBorder +{ + border-collapse: collapse; + border-top: 0px solid #FFFFFF; + border-bottom: 0px solid #FFFFFF; + border-left: 0px solid #FFFFFF; + border-right: 0px solid #FFFFFF; +} + +.border +{ + border-top: 1px solid #000000; + border-bottom: 1px solid #000000; + border-left: 1px solid #000000; + font-family:Verdana, Arial, Helvetica; + font-size:12px; +} + + +.borderRight +{ + border-top: 1px solid #000000; + border-bottom: 1px solid #000000; + border-left: 1px solid #000000; + border-right: 1px solid #000000; + font-family:Verdana, Arial, Helvetica; + font-size:12px; +} + +.daySelectBox +{ + font-family:Verdana,Arial,Helvetica; + font-size:10px; + width:70px; + color:#000000; + border-width:0.2px; + border-color:#ededed; +} + +.monthSelectBox +{ + font-family:Verdana,Arial,Helvetica; + font-size:10px; + width:70px; + color:#000000; +} + +.yearSelectBox +{ + font-family:Verdana,Arial,Helvetica; + font-size:10px; + width:70px; + color:#000000; +} + +.customerDetails +{ + font-size: 12px; + font-family: Helvetica, Helvetica, sans-serif; + font-weight: bold; +} + +.header +{ + border-style:solid; + border-width:4px; + border-color: #CCCCCC; + font-size: 20px; +} + +select +{ + font-family: Arial, Helvetica, sans-serif; + font-size: 10px; +} +.boldgraysmall +{ +font-family: verdana; +font-size :11px; +color: #999999; +font-weight: 700; +} +.bolddarkgraysmall +{ +font-family: verdana; +font-size: 11px; +color: #333333; +font-weight: 700; +} + +a.breadcr +{ +font-family: verdana; +font-size: 12px; +color: #999999; +text-decoration: none; +font-weight: 500; +} + +a.viewcert +{ +font-family: verdana; +font-size: 10px; +color: #be0027; +font-weight: 500; +} +.breadcr +{ +font-family: verdana; +font-size: 12px; +color: #999999; +text-decoration: none; +font-weight: 500; +} +.darkgray +{ +font-family: verdana; +font-size: 12px; +color: #333333; +font-weight: 500; +} +.bolddarkgray +{ +font-family: verdana; +font-size: 12px; +color: #333333; +font-weight: 600; +} + + + + diff --git a/posterita/posterita/web/css/teststyles.css b/posterita/posterita/web/css/teststyles.css new file mode 100644 index 0000000000..796871382f --- /dev/null +++ b/posterita/posterita/web/css/teststyles.css @@ -0,0 +1,50 @@ +tr.good td { + color: red; + font-weight: bold; +} + +tr.bad td { + color: blue; +} + +td.money { + text-align: right; + padding-right: 2px; +} + +tr.bad td.money { + font-weight: bold; + background-color: blue; + color: #fff; +} + +td.r,th.r { + text-align: right; + padding-right: 10px; +} + +tr.total td,tr.subtotal td { + background-color: #eee; + font-weight: bold; +} + + +.DR +{ + color:red; +} + +.CO +{ + color:green; +} + +.PR +{ + color:yellow; +} + +.CL +{ + color:blue; +} diff --git a/posterita/posterita/web/images/back-menu.gif b/posterita/posterita/web/images/back-menu.gif new file mode 100644 index 0000000000..dc02cd77a1 Binary files /dev/null and b/posterita/posterita/web/images/back-menu.gif differ diff --git a/posterita/posterita/web/images/bar.gif b/posterita/posterita/web/images/bar.gif new file mode 100644 index 0000000000..abc513f888 Binary files /dev/null and b/posterita/posterita/web/images/bar.gif differ diff --git a/posterita/posterita/web/images/barcode.jpg b/posterita/posterita/web/images/barcode.jpg new file mode 100644 index 0000000000..e3f0042f33 Binary files /dev/null and b/posterita/posterita/web/images/barcode.jpg differ diff --git a/posterita/posterita/web/images/bg_header.jpg b/posterita/posterita/web/images/bg_header.jpg new file mode 100644 index 0000000000..10dbd74e8a Binary files /dev/null and b/posterita/posterita/web/images/bg_header.jpg differ diff --git a/posterita/posterita/web/images/bg_td.gif b/posterita/posterita/web/images/bg_td.gif new file mode 100644 index 0000000000..dc5fb47476 Binary files /dev/null and b/posterita/posterita/web/images/bg_td.gif differ diff --git a/posterita/posterita/web/images/bullet1.gif b/posterita/posterita/web/images/bullet1.gif new file mode 100644 index 0000000000..ae352c2b69 Binary files /dev/null and b/posterita/posterita/web/images/bullet1.gif differ diff --git a/posterita/posterita/web/images/bullet2.gif b/posterita/posterita/web/images/bullet2.gif new file mode 100644 index 0000000000..04b293d4b7 Binary files /dev/null and b/posterita/posterita/web/images/bullet2.gif differ diff --git a/posterita/posterita/web/images/calendar_icon.png b/posterita/posterita/web/images/calendar_icon.png new file mode 100644 index 0000000000..92cb163d12 Binary files /dev/null and b/posterita/posterita/web/images/calendar_icon.png differ diff --git a/posterita/posterita/web/images/ico_printer.gif b/posterita/posterita/web/images/ico_printer.gif new file mode 100644 index 0000000000..de27b46458 Binary files /dev/null and b/posterita/posterita/web/images/ico_printer.gif differ diff --git a/posterita/posterita/web/images/iconCSV.jpg b/posterita/posterita/web/images/iconCSV.jpg new file mode 100644 index 0000000000..231da309aa Binary files /dev/null and b/posterita/posterita/web/images/iconCSV.jpg differ diff --git a/posterita/posterita/web/images/loader.gif b/posterita/posterita/web/images/loader.gif new file mode 100644 index 0000000000..240d4e17dc Binary files /dev/null and b/posterita/posterita/web/images/loader.gif differ diff --git a/posterita/posterita/web/images/logo.gif b/posterita/posterita/web/images/logo.gif new file mode 100644 index 0000000000..d990762f63 Binary files /dev/null and b/posterita/posterita/web/images/logo.gif differ diff --git a/posterita/posterita/web/images/logo.jpg b/posterita/posterita/web/images/logo.jpg new file mode 100644 index 0000000000..77c8b5142c Binary files /dev/null and b/posterita/posterita/web/images/logo.jpg differ diff --git a/posterita/posterita/web/images/logo1.jpg b/posterita/posterita/web/images/logo1.jpg new file mode 100644 index 0000000000..7b543ace26 Binary files /dev/null and b/posterita/posterita/web/images/logo1.jpg differ diff --git a/posterita/posterita/web/images/newUI/Thumbs.db b/posterita/posterita/web/images/newUI/Thumbs.db new file mode 100644 index 0000000000..4dc2ce4a3b Binary files /dev/null and b/posterita/posterita/web/images/newUI/Thumbs.db differ diff --git a/posterita/posterita/web/images/newUI/back-menu.gif b/posterita/posterita/web/images/newUI/back-menu.gif new file mode 100644 index 0000000000..dc02cd77a1 Binary files /dev/null and b/posterita/posterita/web/images/newUI/back-menu.gif differ diff --git a/posterita/posterita/web/images/newUI/blankimage.png b/posterita/posterita/web/images/newUI/blankimage.png new file mode 100644 index 0000000000..b87bb24850 Binary files /dev/null and b/posterita/posterita/web/images/newUI/blankimage.png differ diff --git a/posterita/posterita/web/images/newUI/bottom-right.gif b/posterita/posterita/web/images/newUI/bottom-right.gif new file mode 100644 index 0000000000..9b13d8c551 Binary files /dev/null and b/posterita/posterita/web/images/newUI/bottom-right.gif differ diff --git a/posterita/posterita/web/images/newUI/bottom.gif b/posterita/posterita/web/images/newUI/bottom.gif new file mode 100644 index 0000000000..5d8c4bbdd7 Binary files /dev/null and b/posterita/posterita/web/images/newUI/bottom.gif differ diff --git a/posterita/posterita/web/images/newUI/btn_changepin.gif b/posterita/posterita/web/images/newUI/btn_changepin.gif new file mode 100644 index 0000000000..104b1c7497 Binary files /dev/null and b/posterita/posterita/web/images/newUI/btn_changepin.gif differ diff --git a/posterita/posterita/web/images/newUI/btn_quickdiscount.gif b/posterita/posterita/web/images/newUI/btn_quickdiscount.gif new file mode 100644 index 0000000000..1fc42b3a69 Binary files /dev/null and b/posterita/posterita/web/images/newUI/btn_quickdiscount.gif differ diff --git a/posterita/posterita/web/images/newUI/btn_resetuser.gif b/posterita/posterita/web/images/newUI/btn_resetuser.gif new file mode 100644 index 0000000000..aa942b4c88 Binary files /dev/null and b/posterita/posterita/web/images/newUI/btn_resetuser.gif differ diff --git a/posterita/posterita/web/images/newUI/btun_complete.gif b/posterita/posterita/web/images/newUI/btun_complete.gif new file mode 100644 index 0000000000..0856eb919c Binary files /dev/null and b/posterita/posterita/web/images/newUI/btun_complete.gif differ diff --git a/posterita/posterita/web/images/newUI/btun_generic.gif b/posterita/posterita/web/images/newUI/btun_generic.gif new file mode 100644 index 0000000000..e8f508c112 Binary files /dev/null and b/posterita/posterita/web/images/newUI/btun_generic.gif differ diff --git a/posterita/posterita/web/images/newUI/btun_save.gif b/posterita/posterita/web/images/newUI/btun_save.gif new file mode 100644 index 0000000000..f728bf2da9 Binary files /dev/null and b/posterita/posterita/web/images/newUI/btun_save.gif differ diff --git a/posterita/posterita/web/images/newUI/bullet-arrow.gif b/posterita/posterita/web/images/newUI/bullet-arrow.gif new file mode 100644 index 0000000000..838613f26c Binary files /dev/null and b/posterita/posterita/web/images/newUI/bullet-arrow.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-add.gif b/posterita/posterita/web/images/newUI/butn-add.gif new file mode 100644 index 0000000000..35bdefd42b Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-add.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-addnew.gif b/posterita/posterita/web/images/newUI/butn-addnew.gif new file mode 100644 index 0000000000..8baad87b55 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-addnew.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-browse.gif b/posterita/posterita/web/images/newUI/butn-browse.gif new file mode 100644 index 0000000000..a8583d97bd Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-browse.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-card.gif b/posterita/posterita/web/images/newUI/butn-card.gif new file mode 100644 index 0000000000..8eec29d7d7 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-card.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-cash.gif b/posterita/posterita/web/images/newUI/butn-cash.gif new file mode 100644 index 0000000000..9a3e64b6ea Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-cash.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-checkout.gif b/posterita/posterita/web/images/newUI/butn-checkout.gif new file mode 100644 index 0000000000..466dad3c2d Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-checkout.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-cheque.gif b/posterita/posterita/web/images/newUI/butn-cheque.gif new file mode 100644 index 0000000000..3e0e4a5ada Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-cheque.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-clearall.gif b/posterita/posterita/web/images/newUI/butn-clearall.gif new file mode 100644 index 0000000000..16b4e1d570 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-clearall.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-copy.gif b/posterita/posterita/web/images/newUI/butn-copy.gif new file mode 100644 index 0000000000..ba1908bff8 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-copy.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-createpos.gif b/posterita/posterita/web/images/newUI/butn-createpos.gif new file mode 100644 index 0000000000..3081b76eb0 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-createpos.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-credit.gif b/posterita/posterita/web/images/newUI/butn-credit.gif new file mode 100644 index 0000000000..c547c536a6 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-credit.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-delete.gif b/posterita/posterita/web/images/newUI/butn-delete.gif new file mode 100644 index 0000000000..1052bc5d9c Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-delete.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-delprod.gif b/posterita/posterita/web/images/newUI/butn-delprod.gif new file mode 100644 index 0000000000..59538f2415 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-delprod.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-discount.gif b/posterita/posterita/web/images/newUI/butn-discount.gif new file mode 100644 index 0000000000..9255a33ee7 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-discount.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-donate.gif b/posterita/posterita/web/images/newUI/butn-donate.gif new file mode 100644 index 0000000000..68c8385e65 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-donate.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-edit-off.gif b/posterita/posterita/web/images/newUI/butn-edit-off.gif new file mode 100644 index 0000000000..b378bad364 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-edit-off.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-edit.gif b/posterita/posterita/web/images/newUI/butn-edit.gif new file mode 100644 index 0000000000..7fa4759e1a Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-edit.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-exit.gif b/posterita/posterita/web/images/newUI/butn-exit.gif new file mode 100644 index 0000000000..f79382042f Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-exit.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-import.gif b/posterita/posterita/web/images/newUI/butn-import.gif new file mode 100644 index 0000000000..1932c4377a Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-import.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-login.gif b/posterita/posterita/web/images/newUI/butn-login.gif new file mode 100644 index 0000000000..97ec014e2c Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-login.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-mix.gif b/posterita/posterita/web/images/newUI/butn-mix.gif new file mode 100644 index 0000000000..cb20ad935f Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-mix.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-new.gif b/posterita/posterita/web/images/newUI/butn-new.gif new file mode 100644 index 0000000000..840ddf1a91 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-new.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-next.gif b/posterita/posterita/web/images/newUI/butn-next.gif new file mode 100644 index 0000000000..ef7500e89f Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-next.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-opendrawer.gif b/posterita/posterita/web/images/newUI/butn-opendrawer.gif new file mode 100644 index 0000000000..2e59a54032 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-opendrawer.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-prev.gif b/posterita/posterita/web/images/newUI/butn-prev.gif new file mode 100644 index 0000000000..64c165c643 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-prev.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-save.gif b/posterita/posterita/web/images/newUI/butn-save.gif new file mode 100644 index 0000000000..d2f24c6f32 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-save.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-subtract.gif b/posterita/posterita/web/images/newUI/butn-subtract.gif new file mode 100644 index 0000000000..4d07a54c12 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-subtract.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-system.gif b/posterita/posterita/web/images/newUI/butn-system.gif new file mode 100644 index 0000000000..92d41f4563 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-system.gif differ diff --git a/posterita/posterita/web/images/newUI/butn-touchscreen.gif b/posterita/posterita/web/images/newUI/butn-touchscreen.gif new file mode 100644 index 0000000000..64a6b8c432 Binary files /dev/null and b/posterita/posterita/web/images/newUI/butn-touchscreen.gif differ diff --git a/posterita/posterita/web/images/newUI/donate.gif b/posterita/posterita/web/images/newUI/donate.gif new file mode 100644 index 0000000000..68c8385e65 Binary files /dev/null and b/posterita/posterita/web/images/newUI/donate.gif differ diff --git a/posterita/posterita/web/images/newUI/footerbg.gif b/posterita/posterita/web/images/newUI/footerbg.gif new file mode 100644 index 0000000000..41c0aab47e Binary files /dev/null and b/posterita/posterita/web/images/newUI/footerbg.gif differ diff --git a/posterita/posterita/web/images/newUI/headblc.gif b/posterita/posterita/web/images/newUI/headblc.gif new file mode 100644 index 0000000000..12e9bc7f6a Binary files /dev/null and b/posterita/posterita/web/images/newUI/headblc.gif differ diff --git a/posterita/posterita/web/images/newUI/headbody.gif b/posterita/posterita/web/images/newUI/headbody.gif new file mode 100644 index 0000000000..9eabd859e4 Binary files /dev/null and b/posterita/posterita/web/images/newUI/headbody.gif differ diff --git a/posterita/posterita/web/images/newUI/headbrc.gif b/posterita/posterita/web/images/newUI/headbrc.gif new file mode 100644 index 0000000000..bb51f2879c Binary files /dev/null and b/posterita/posterita/web/images/newUI/headbrc.gif differ diff --git a/posterita/posterita/web/images/newUI/headtlc.gif b/posterita/posterita/web/images/newUI/headtlc.gif new file mode 100644 index 0000000000..916b90b76e Binary files /dev/null and b/posterita/posterita/web/images/newUI/headtlc.gif differ diff --git a/posterita/posterita/web/images/newUI/headtrc.gif b/posterita/posterita/web/images/newUI/headtrc.gif new file mode 100644 index 0000000000..5b24715cd7 Binary files /dev/null and b/posterita/posterita/web/images/newUI/headtrc.gif differ diff --git a/posterita/posterita/web/images/newUI/hicon-cashbook.gif b/posterita/posterita/web/images/newUI/hicon-cashbook.gif new file mode 100644 index 0000000000..59dbabab72 Binary files /dev/null and b/posterita/posterita/web/images/newUI/hicon-cashbook.gif differ diff --git a/posterita/posterita/web/images/newUI/hicon-donate.gif b/posterita/posterita/web/images/newUI/hicon-donate.gif new file mode 100644 index 0000000000..c0188f44d8 Binary files /dev/null and b/posterita/posterita/web/images/newUI/hicon-donate.gif differ diff --git a/posterita/posterita/web/images/newUI/hicon-help.gif b/posterita/posterita/web/images/newUI/hicon-help.gif new file mode 100644 index 0000000000..97c669da65 Binary files /dev/null and b/posterita/posterita/web/images/newUI/hicon-help.gif differ diff --git a/posterita/posterita/web/images/newUI/hicon-news.gif b/posterita/posterita/web/images/newUI/hicon-news.gif new file mode 100644 index 0000000000..dcd84be349 Binary files /dev/null and b/posterita/posterita/web/images/newUI/hicon-news.gif differ diff --git a/posterita/posterita/web/images/newUI/hicon-salesorder.gif b/posterita/posterita/web/images/newUI/hicon-salesorder.gif new file mode 100644 index 0000000000..229eca3f3b Binary files /dev/null and b/posterita/posterita/web/images/newUI/hicon-salesorder.gif differ diff --git a/posterita/posterita/web/images/newUI/hicon-tillmgt.gif b/posterita/posterita/web/images/newUI/hicon-tillmgt.gif new file mode 100644 index 0000000000..4771367e5e Binary files /dev/null and b/posterita/posterita/web/images/newUI/hicon-tillmgt.gif differ diff --git a/posterita/posterita/web/images/newUI/icon-err.gif b/posterita/posterita/web/images/newUI/icon-err.gif new file mode 100644 index 0000000000..dd9f54fa24 Binary files /dev/null and b/posterita/posterita/web/images/newUI/icon-err.gif differ diff --git a/posterita/posterita/web/images/newUI/icon-help.gif b/posterita/posterita/web/images/newUI/icon-help.gif new file mode 100644 index 0000000000..fce1a0409e Binary files /dev/null and b/posterita/posterita/web/images/newUI/icon-help.gif differ diff --git a/posterita/posterita/web/images/newUI/icon-newwindow.gif b/posterita/posterita/web/images/newUI/icon-newwindow.gif new file mode 100644 index 0000000000..e09df2291c Binary files /dev/null and b/posterita/posterita/web/images/newUI/icon-newwindow.gif differ diff --git a/posterita/posterita/web/images/newUI/left.gif b/posterita/posterita/web/images/newUI/left.gif new file mode 100644 index 0000000000..421bee6b1e Binary files /dev/null and b/posterita/posterita/web/images/newUI/left.gif differ diff --git a/posterita/posterita/web/images/newUI/leftside.gif b/posterita/posterita/web/images/newUI/leftside.gif new file mode 100644 index 0000000000..370463fe63 Binary files /dev/null and b/posterita/posterita/web/images/newUI/leftside.gif differ diff --git a/posterita/posterita/web/images/newUI/logo.gif b/posterita/posterita/web/images/newUI/logo.gif new file mode 100644 index 0000000000..7d7366242b Binary files /dev/null and b/posterita/posterita/web/images/newUI/logo.gif differ diff --git a/posterita/posterita/web/images/newUI/navbg.gif b/posterita/posterita/web/images/newUI/navbg.gif new file mode 100644 index 0000000000..7c24e5bd73 Binary files /dev/null and b/posterita/posterita/web/images/newUI/navbg.gif differ diff --git a/posterita/posterita/web/images/newUI/palebluebg.gif b/posterita/posterita/web/images/newUI/palebluebg.gif new file mode 100644 index 0000000000..25d2fbefeb Binary files /dev/null and b/posterita/posterita/web/images/newUI/palebluebg.gif differ diff --git a/posterita/posterita/web/images/newUI/pricedetbg.gif b/posterita/posterita/web/images/newUI/pricedetbg.gif new file mode 100644 index 0000000000..7dfc094b13 Binary files /dev/null and b/posterita/posterita/web/images/newUI/pricedetbg.gif differ diff --git a/posterita/posterita/web/images/newUI/pricedetbgtile.gif b/posterita/posterita/web/images/newUI/pricedetbgtile.gif new file mode 100644 index 0000000000..b8954d01fc Binary files /dev/null and b/posterita/posterita/web/images/newUI/pricedetbgtile.gif differ diff --git a/posterita/posterita/web/images/newUI/productpreview.gif b/posterita/posterita/web/images/newUI/productpreview.gif new file mode 100644 index 0000000000..cf20c558fc Binary files /dev/null and b/posterita/posterita/web/images/newUI/productpreview.gif differ diff --git a/posterita/posterita/web/images/newUI/rightside.gif b/posterita/posterita/web/images/newUI/rightside.gif new file mode 100644 index 0000000000..a0e4253901 Binary files /dev/null and b/posterita/posterita/web/images/newUI/rightside.gif differ diff --git a/posterita/posterita/web/images/newUI/singlekey.gif b/posterita/posterita/web/images/newUI/singlekey.gif new file mode 100644 index 0000000000..d822f9e795 Binary files /dev/null and b/posterita/posterita/web/images/newUI/singlekey.gif differ diff --git a/posterita/posterita/web/images/newUI/spacer.gif b/posterita/posterita/web/images/newUI/spacer.gif new file mode 100644 index 0000000000..35d42e808f Binary files /dev/null and b/posterita/posterita/web/images/newUI/spacer.gif differ diff --git a/posterita/posterita/web/images/newUI/top-right.gif b/posterita/posterita/web/images/newUI/top-right.gif new file mode 100644 index 0000000000..6ced494d44 Binary files /dev/null and b/posterita/posterita/web/images/newUI/top-right.gif differ diff --git a/posterita/posterita/web/images/newUI/top.gif b/posterita/posterita/web/images/newUI/top.gif new file mode 100644 index 0000000000..b948640c05 Binary files /dev/null and b/posterita/posterita/web/images/newUI/top.gif differ diff --git a/posterita/posterita/web/images/newUI/topmenubg.gif b/posterita/posterita/web/images/newUI/topmenubg.gif new file mode 100644 index 0000000000..d03b3abff9 Binary files /dev/null and b/posterita/posterita/web/images/newUI/topmenubg.gif differ diff --git a/posterita/posterita/web/images/nok.gif b/posterita/posterita/web/images/nok.gif new file mode 100644 index 0000000000..7e9e3cff9e Binary files /dev/null and b/posterita/posterita/web/images/nok.gif differ diff --git a/posterita/posterita/web/images/ok.gif b/posterita/posterita/web/images/ok.gif new file mode 100644 index 0000000000..34da177364 Binary files /dev/null and b/posterita/posterita/web/images/ok.gif differ diff --git a/posterita/posterita/web/images/pdfIcon.jpg b/posterita/posterita/web/images/pdfIcon.jpg new file mode 100644 index 0000000000..bbf0b6dd7b Binary files /dev/null and b/posterita/posterita/web/images/pdfIcon.jpg differ diff --git a/posterita/posterita/web/images/pdf_icon_small.gif b/posterita/posterita/web/images/pdf_icon_small.gif new file mode 100644 index 0000000000..502fb77ed6 Binary files /dev/null and b/posterita/posterita/web/images/pdf_icon_small.gif differ diff --git a/posterita/posterita/web/images/pos/-----.gif b/posterita/posterita/web/images/pos/-----.gif new file mode 100644 index 0000000000..2030a5f450 Binary files /dev/null and b/posterita/posterita/web/images/pos/-----.gif differ diff --git a/posterita/posterita/web/images/pos/ADMINISTRATION.gif b/posterita/posterita/web/images/pos/ADMINISTRATION.gif new file mode 100644 index 0000000000..62bf4be6a9 Binary files /dev/null and b/posterita/posterita/web/images/pos/ADMINISTRATION.gif differ diff --git a/posterita/posterita/web/images/pos/BULLET_reddd.gif b/posterita/posterita/web/images/pos/BULLET_reddd.gif new file mode 100644 index 0000000000..88c72711b7 Binary files /dev/null and b/posterita/posterita/web/images/pos/BULLET_reddd.gif differ diff --git a/posterita/posterita/web/images/pos/Contacts 1.gif b/posterita/posterita/web/images/pos/Contacts 1.gif new file mode 100644 index 0000000000..e31cfab365 Binary files /dev/null and b/posterita/posterita/web/images/pos/Contacts 1.gif differ diff --git a/posterita/posterita/web/images/pos/Contacts 2.gif b/posterita/posterita/web/images/pos/Contacts 2.gif new file mode 100644 index 0000000000..b750e7063f Binary files /dev/null and b/posterita/posterita/web/images/pos/Contacts 2.gif differ diff --git a/posterita/posterita/web/images/pos/ImageBack.jpg b/posterita/posterita/web/images/pos/ImageBack.jpg new file mode 100644 index 0000000000..394390b137 Binary files /dev/null and b/posterita/posterita/web/images/pos/ImageBack.jpg differ diff --git a/posterita/posterita/web/images/pos/LOGOUT.gif b/posterita/posterita/web/images/pos/LOGOUT.gif new file mode 100644 index 0000000000..72a91a124c Binary files /dev/null and b/posterita/posterita/web/images/pos/LOGOUT.gif differ diff --git a/posterita/posterita/web/images/pos/ORDER.gif b/posterita/posterita/web/images/pos/ORDER.gif new file mode 100644 index 0000000000..8fe689cd80 Binary files /dev/null and b/posterita/posterita/web/images/pos/ORDER.gif differ diff --git a/posterita/posterita/web/images/pos/REPORTS.gif b/posterita/posterita/web/images/pos/REPORTS.gif new file mode 100644 index 0000000000..add87aa820 Binary files /dev/null and b/posterita/posterita/web/images/pos/REPORTS.gif differ diff --git a/posterita/posterita/web/images/pos/arrow_down.png b/posterita/posterita/web/images/pos/arrow_down.png new file mode 100644 index 0000000000..107b59f444 Binary files /dev/null and b/posterita/posterita/web/images/pos/arrow_down.png differ diff --git a/posterita/posterita/web/images/pos/arrow_off.png b/posterita/posterita/web/images/pos/arrow_off.png new file mode 100644 index 0000000000..c507cb5679 Binary files /dev/null and b/posterita/posterita/web/images/pos/arrow_off.png differ diff --git a/posterita/posterita/web/images/pos/arrow_up.png b/posterita/posterita/web/images/pos/arrow_up.png new file mode 100644 index 0000000000..b4e9bbb3c9 Binary files /dev/null and b/posterita/posterita/web/images/pos/arrow_up.png differ diff --git a/posterita/posterita/web/images/pos/blankimage.png b/posterita/posterita/web/images/pos/blankimage.png new file mode 100644 index 0000000000..b87bb24850 Binary files /dev/null and b/posterita/posterita/web/images/pos/blankimage.png differ diff --git a/posterita/posterita/web/images/pos/button-login.gif b/posterita/posterita/web/images/pos/button-login.gif new file mode 100644 index 0000000000..ac11f25cda Binary files /dev/null and b/posterita/posterita/web/images/pos/button-login.gif differ diff --git a/posterita/posterita/web/images/pos/button_add to cart.gif b/posterita/posterita/web/images/pos/button_add to cart.gif new file mode 100644 index 0000000000..0638845afe Binary files /dev/null and b/posterita/posterita/web/images/pos/button_add to cart.gif differ diff --git a/posterita/posterita/web/images/pos/button_advanced.gif b/posterita/posterita/web/images/pos/button_advanced.gif new file mode 100644 index 0000000000..3537dcf733 Binary files /dev/null and b/posterita/posterita/web/images/pos/button_advanced.gif differ diff --git a/posterita/posterita/web/images/pos/button_card.gif b/posterita/posterita/web/images/pos/button_card.gif new file mode 100644 index 0000000000..7413c289b2 Binary files /dev/null and b/posterita/posterita/web/images/pos/button_card.gif differ diff --git a/posterita/posterita/web/images/pos/button_cash.gif b/posterita/posterita/web/images/pos/button_cash.gif new file mode 100644 index 0000000000..720026d03d Binary files /dev/null and b/posterita/posterita/web/images/pos/button_cash.gif differ diff --git a/posterita/posterita/web/images/pos/button_checkout.gif b/posterita/posterita/web/images/pos/button_checkout.gif new file mode 100644 index 0000000000..f5e023e5f6 Binary files /dev/null and b/posterita/posterita/web/images/pos/button_checkout.gif differ diff --git a/posterita/posterita/web/images/pos/button_cheque.gif b/posterita/posterita/web/images/pos/button_cheque.gif new file mode 100644 index 0000000000..6c286714bb Binary files /dev/null and b/posterita/posterita/web/images/pos/button_cheque.gif differ diff --git a/posterita/posterita/web/images/pos/button_newcustomer.gif b/posterita/posterita/web/images/pos/button_newcustomer.gif new file mode 100644 index 0000000000..3a20ccd4cc Binary files /dev/null and b/posterita/posterita/web/images/pos/button_newcustomer.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/Thumbs.db b/posterita/posterita/web/images/pos/buttons/Thumbs.db new file mode 100644 index 0000000000..99b1dbba55 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/Thumbs.db differ diff --git a/posterita/posterita/web/images/pos/buttons/browser.gif b/posterita/posterita/web/images/pos/buttons/browser.gif new file mode 100644 index 0000000000..561173d83a Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/browser.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/bullet_red.gif b/posterita/posterita/web/images/pos/buttons/bullet_red.gif new file mode 100644 index 0000000000..88c72711b7 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/bullet_red.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_addtocart.gif b/posterita/posterita/web/images/pos/buttons/button_addtocart.gif new file mode 100644 index 0000000000..0638845afe Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_addtocart.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_administration.gif b/posterita/posterita/web/images/pos/buttons/button_administration.gif new file mode 100644 index 0000000000..62bf4be6a9 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_administration.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_advanced.gif b/posterita/posterita/web/images/pos/buttons/button_advanced.gif new file mode 100644 index 0000000000..3537dcf733 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_advanced.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_background.gif b/posterita/posterita/web/images/pos/buttons/button_background.gif new file mode 100644 index 0000000000..c6beb23d71 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_background.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_barchart.gif b/posterita/posterita/web/images/pos/buttons/button_barchart.gif new file mode 100644 index 0000000000..2171c739fa Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_barchart.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_blank.gif b/posterita/posterita/web/images/pos/buttons/button_blank.gif new file mode 100644 index 0000000000..26707e2aed Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_blank.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_card.gif b/posterita/posterita/web/images/pos/buttons/button_card.gif new file mode 100644 index 0000000000..7413c289b2 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_card.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_cart.jpeg b/posterita/posterita/web/images/pos/buttons/button_cart.jpeg new file mode 100644 index 0000000000..d88f4c78c2 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_cart.jpeg differ diff --git a/posterita/posterita/web/images/pos/buttons/button_cash.gif b/posterita/posterita/web/images/pos/buttons/button_cash.gif new file mode 100644 index 0000000000..720026d03d Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_cash.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_checkout.gif b/posterita/posterita/web/images/pos/buttons/button_checkout.gif new file mode 100644 index 0000000000..f5e023e5f6 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_checkout.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_cheque.gif b/posterita/posterita/web/images/pos/buttons/button_cheque.gif new file mode 100644 index 0000000000..6c286714bb Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_cheque.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_complete.gif b/posterita/posterita/web/images/pos/buttons/button_complete.gif new file mode 100644 index 0000000000..9980c9268b Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_complete.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_continue.gif b/posterita/posterita/web/images/pos/buttons/button_continue.gif new file mode 100644 index 0000000000..8a00291315 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_continue.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_delete.gif b/posterita/posterita/web/images/pos/buttons/button_delete.gif new file mode 100644 index 0000000000..8de32e1fcb Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_delete.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_edit.gif b/posterita/posterita/web/images/pos/buttons/button_edit.gif new file mode 100644 index 0000000000..e5df0f5a91 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_edit.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_import.gif b/posterita/posterita/web/images/pos/buttons/button_import.gif new file mode 100644 index 0000000000..b73a6b7ef3 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_import.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_login.gif b/posterita/posterita/web/images/pos/buttons/button_login.gif new file mode 100644 index 0000000000..ac11f25cda Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_login.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_logout.gif b/posterita/posterita/web/images/pos/buttons/button_logout.gif new file mode 100644 index 0000000000..72a91a124c Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_logout.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_middle.gif b/posterita/posterita/web/images/pos/buttons/button_middle.gif new file mode 100644 index 0000000000..be4927b44e Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_middle.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_minus.gif b/posterita/posterita/web/images/pos/buttons/button_minus.gif new file mode 100644 index 0000000000..2030a5f450 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_minus.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_mixed.gif b/posterita/posterita/web/images/pos/buttons/button_mixed.gif new file mode 100644 index 0000000000..e5146729cb Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_mixed.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_newcustomer.gif b/posterita/posterita/web/images/pos/buttons/button_newcustomer.gif new file mode 100644 index 0000000000..3a20ccd4cc Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_newcustomer.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_newnote.gif b/posterita/posterita/web/images/pos/buttons/button_newnote.gif new file mode 100644 index 0000000000..ea2c0cb576 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_newnote.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_neworder.gif b/posterita/posterita/web/images/pos/buttons/button_neworder.gif new file mode 100644 index 0000000000..c1a9d54039 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_neworder.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_order.gif b/posterita/posterita/web/images/pos/buttons/button_order.gif new file mode 100644 index 0000000000..8fe689cd80 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_order.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_piechart.gif b/posterita/posterita/web/images/pos/buttons/button_piechart.gif new file mode 100644 index 0000000000..bdeb6b06fe Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_piechart.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_plus.gif b/posterita/posterita/web/images/pos/buttons/button_plus.gif new file mode 100644 index 0000000000..f14e73fe83 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_plus.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_refresh.gif b/posterita/posterita/web/images/pos/buttons/button_refresh.gif new file mode 100644 index 0000000000..554c9e7a7f Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_refresh.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_reports.gif b/posterita/posterita/web/images/pos/buttons/button_reports.gif new file mode 100644 index 0000000000..add87aa820 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_reports.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_save.gif b/posterita/posterita/web/images/pos/buttons/button_save.gif new file mode 100644 index 0000000000..6c18606669 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_save.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_saveascsv.gif b/posterita/posterita/web/images/pos/buttons/button_saveascsv.gif new file mode 100644 index 0000000000..9f099f2905 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_saveascsv.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_saveaspdf.gif b/posterita/posterita/web/images/pos/buttons/button_saveaspdf.gif new file mode 100644 index 0000000000..bff11a3d4c Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_saveaspdf.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_search.gif b/posterita/posterita/web/images/pos/buttons/button_search.gif new file mode 100644 index 0000000000..bcebc9db78 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_search.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_selectall.gif b/posterita/posterita/web/images/pos/buttons/button_selectall.gif new file mode 100644 index 0000000000..03bb547870 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_selectall.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_submit.gif b/posterita/posterita/web/images/pos/buttons/button_submit.gif new file mode 100644 index 0000000000..d9b2fcf53c Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_submit.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_tabular.gif b/posterita/posterita/web/images/pos/buttons/button_tabular.gif new file mode 100644 index 0000000000..dc93499596 Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_tabular.gif differ diff --git a/posterita/posterita/web/images/pos/buttons/button_timeseries.gif b/posterita/posterita/web/images/pos/buttons/button_timeseries.gif new file mode 100644 index 0000000000..1943bc0f2e Binary files /dev/null and b/posterita/posterita/web/images/pos/buttons/button_timeseries.gif differ diff --git a/posterita/posterita/web/images/pos/calendar.gif b/posterita/posterita/web/images/pos/calendar.gif new file mode 100644 index 0000000000..18801096ac Binary files /dev/null and b/posterita/posterita/web/images/pos/calendar.gif differ diff --git a/posterita/posterita/web/images/pos/charts/barchart_icon.gif b/posterita/posterita/web/images/pos/charts/barchart_icon.gif new file mode 100644 index 0000000000..417a1ae334 Binary files /dev/null and b/posterita/posterita/web/images/pos/charts/barchart_icon.gif differ diff --git a/posterita/posterita/web/images/pos/charts/piechart_icon.gif b/posterita/posterita/web/images/pos/charts/piechart_icon.gif new file mode 100644 index 0000000000..4a8b0bb799 Binary files /dev/null and b/posterita/posterita/web/images/pos/charts/piechart_icon.gif differ diff --git a/posterita/posterita/web/images/pos/charts/tabular_icon.gif b/posterita/posterita/web/images/pos/charts/tabular_icon.gif new file mode 100644 index 0000000000..e90b927886 Binary files /dev/null and b/posterita/posterita/web/images/pos/charts/tabular_icon.gif differ diff --git a/posterita/posterita/web/images/pos/charts/timeseries_icon.gif b/posterita/posterita/web/images/pos/charts/timeseries_icon.gif new file mode 100644 index 0000000000..c7409ab9bf Binary files /dev/null and b/posterita/posterita/web/images/pos/charts/timeseries_icon.gif differ diff --git a/posterita/posterita/web/images/pos/cross.gif b/posterita/posterita/web/images/pos/cross.gif new file mode 100644 index 0000000000..84ef48f084 Binary files /dev/null and b/posterita/posterita/web/images/pos/cross.gif differ diff --git a/posterita/posterita/web/images/pos/delprod.gif b/posterita/posterita/web/images/pos/delprod.gif new file mode 100644 index 0000000000..e03a79165b Binary files /dev/null and b/posterita/posterita/web/images/pos/delprod.gif differ diff --git a/posterita/posterita/web/images/pos/error.gif b/posterita/posterita/web/images/pos/error.gif new file mode 100644 index 0000000000..8533edbb08 Binary files /dev/null and b/posterita/posterita/web/images/pos/error.gif differ diff --git a/posterita/posterita/web/images/pos/error.jpg b/posterita/posterita/web/images/pos/error.jpg new file mode 100644 index 0000000000..78ec8a06ff Binary files /dev/null and b/posterita/posterita/web/images/pos/error.jpg differ diff --git a/posterita/posterita/web/images/pos/error.png b/posterita/posterita/web/images/pos/error.png new file mode 100644 index 0000000000..242be63fa4 Binary files /dev/null and b/posterita/posterita/web/images/pos/error.png differ diff --git a/posterita/posterita/web/images/pos/helpIcon.gif b/posterita/posterita/web/images/pos/helpIcon.gif new file mode 100644 index 0000000000..e04ad56f15 Binary files /dev/null and b/posterita/posterita/web/images/pos/helpIcon.gif differ diff --git a/posterita/posterita/web/images/pos/helpIcon2.gif b/posterita/posterita/web/images/pos/helpIcon2.gif new file mode 100644 index 0000000000..01389860c4 Binary files /dev/null and b/posterita/posterita/web/images/pos/helpIcon2.gif differ diff --git a/posterita/posterita/web/images/pos/ico_file_csv.png b/posterita/posterita/web/images/pos/ico_file_csv.png new file mode 100644 index 0000000000..1192a9a715 Binary files /dev/null and b/posterita/posterita/web/images/pos/ico_file_csv.png differ diff --git a/posterita/posterita/web/images/pos/ico_file_excel.png b/posterita/posterita/web/images/pos/ico_file_excel.png new file mode 100644 index 0000000000..378ae0b739 Binary files /dev/null and b/posterita/posterita/web/images/pos/ico_file_excel.png differ diff --git a/posterita/posterita/web/images/pos/ico_file_pdf.png b/posterita/posterita/web/images/pos/ico_file_pdf.png new file mode 100644 index 0000000000..468e082811 Binary files /dev/null and b/posterita/posterita/web/images/pos/ico_file_pdf.png differ diff --git a/posterita/posterita/web/images/pos/ico_file_rtf.png b/posterita/posterita/web/images/pos/ico_file_rtf.png new file mode 100644 index 0000000000..e1e8255795 Binary files /dev/null and b/posterita/posterita/web/images/pos/ico_file_rtf.png differ diff --git a/posterita/posterita/web/images/pos/ico_file_xml.png b/posterita/posterita/web/images/pos/ico_file_xml.png new file mode 100644 index 0000000000..dd0fb16db5 Binary files /dev/null and b/posterita/posterita/web/images/pos/ico_file_xml.png differ diff --git a/posterita/posterita/web/images/pos/icon-error.gif b/posterita/posterita/web/images/pos/icon-error.gif new file mode 100644 index 0000000000..397b655ab8 Binary files /dev/null and b/posterita/posterita/web/images/pos/icon-error.gif differ diff --git a/posterita/posterita/web/images/pos/icon-info.gif b/posterita/posterita/web/images/pos/icon-info.gif new file mode 100644 index 0000000000..58281c3067 Binary files /dev/null and b/posterita/posterita/web/images/pos/icon-info.gif differ diff --git a/posterita/posterita/web/images/pos/icon-question.gif b/posterita/posterita/web/images/pos/icon-question.gif new file mode 100644 index 0000000000..08abd82ae8 Binary files /dev/null and b/posterita/posterita/web/images/pos/icon-question.gif differ diff --git a/posterita/posterita/web/images/pos/icon-warning.gif b/posterita/posterita/web/images/pos/icon-warning.gif new file mode 100644 index 0000000000..27ff98b4f7 Binary files /dev/null and b/posterita/posterita/web/images/pos/icon-warning.gif differ diff --git a/posterita/posterita/web/images/pos/indicator.gif b/posterita/posterita/web/images/pos/indicator.gif new file mode 100644 index 0000000000..6bdefde949 Binary files /dev/null and b/posterita/posterita/web/images/pos/indicator.gif differ diff --git a/posterita/posterita/web/images/pos/kbicon.gif b/posterita/posterita/web/images/pos/kbicon.gif new file mode 100644 index 0000000000..0c5d53e5bc Binary files /dev/null and b/posterita/posterita/web/images/pos/kbicon.gif differ diff --git a/posterita/posterita/web/images/pos/logo.jpg b/posterita/posterita/web/images/pos/logo.jpg new file mode 100644 index 0000000000..c6ab5ebb2a Binary files /dev/null and b/posterita/posterita/web/images/pos/logo.jpg differ diff --git a/posterita/posterita/web/images/pos/magnifying-glass.gif b/posterita/posterita/web/images/pos/magnifying-glass.gif new file mode 100644 index 0000000000..18e046b144 Binary files /dev/null and b/posterita/posterita/web/images/pos/magnifying-glass.gif differ diff --git a/posterita/posterita/web/images/pos/maskBG.png b/posterita/posterita/web/images/pos/maskBG.png new file mode 100644 index 0000000000..b89babc2f1 Binary files /dev/null and b/posterita/posterita/web/images/pos/maskBG.png differ diff --git a/posterita/posterita/web/images/pos/paginazione.png b/posterita/posterita/web/images/pos/paginazione.png new file mode 100644 index 0000000000..afe9a4b6e7 Binary files /dev/null and b/posterita/posterita/web/images/pos/paginazione.png differ diff --git a/posterita/posterita/web/images/pos/paginazione_ahead.png b/posterita/posterita/web/images/pos/paginazione_ahead.png new file mode 100644 index 0000000000..430ef3556a Binary files /dev/null and b/posterita/posterita/web/images/pos/paginazione_ahead.png differ diff --git a/posterita/posterita/web/images/pos/paginazione_back.png b/posterita/posterita/web/images/pos/paginazione_back.png new file mode 100644 index 0000000000..598151550d Binary files /dev/null and b/posterita/posterita/web/images/pos/paginazione_back.png differ diff --git a/posterita/posterita/web/images/pos/plus.gif b/posterita/posterita/web/images/pos/plus.gif new file mode 100644 index 0000000000..f14e73fe83 Binary files /dev/null and b/posterita/posterita/web/images/pos/plus.gif differ diff --git a/posterita/posterita/web/images/pos/success.gif b/posterita/posterita/web/images/pos/success.gif new file mode 100644 index 0000000000..59e2108ca1 Binary files /dev/null and b/posterita/posterita/web/images/pos/success.gif differ diff --git a/posterita/posterita/web/images/posterita.jpg b/posterita/posterita/web/images/posterita.jpg new file mode 100644 index 0000000000..cab0493e71 Binary files /dev/null and b/posterita/posterita/web/images/posterita.jpg differ diff --git a/posterita/posterita/web/images/progress.gif b/posterita/posterita/web/images/progress.gif new file mode 100644 index 0000000000..2988647327 Binary files /dev/null and b/posterita/posterita/web/images/progress.gif differ diff --git a/posterita/posterita/web/images/spacer.gif b/posterita/posterita/web/images/spacer.gif new file mode 100644 index 0000000000..35d42e808f Binary files /dev/null and b/posterita/posterita/web/images/spacer.gif differ diff --git a/posterita/posterita/web/images/spinner.gif b/posterita/posterita/web/images/spinner.gif new file mode 100644 index 0000000000..39615c8925 Binary files /dev/null and b/posterita/posterita/web/images/spinner.gif differ diff --git a/posterita/posterita/web/images/tango/accessories-calculator.png b/posterita/posterita/web/images/tango/accessories-calculator.png new file mode 100644 index 0000000000..7de1c447d1 Binary files /dev/null and b/posterita/posterita/web/images/tango/accessories-calculator.png differ diff --git a/posterita/posterita/web/images/tango/accessories-character-map.png b/posterita/posterita/web/images/tango/accessories-character-map.png new file mode 100644 index 0000000000..a86c23ee25 Binary files /dev/null and b/posterita/posterita/web/images/tango/accessories-character-map.png differ diff --git a/posterita/posterita/web/images/tango/accessories-text-editor.png b/posterita/posterita/web/images/tango/accessories-text-editor.png new file mode 100644 index 0000000000..c6b6285144 Binary files /dev/null and b/posterita/posterita/web/images/tango/accessories-text-editor.png differ diff --git a/posterita/posterita/web/images/tango/address-book-new.png b/posterita/posterita/web/images/tango/address-book-new.png new file mode 100644 index 0000000000..420139d307 Binary files /dev/null and b/posterita/posterita/web/images/tango/address-book-new.png differ diff --git a/posterita/posterita/web/images/tango/applications-system.png b/posterita/posterita/web/images/tango/applications-system.png new file mode 100644 index 0000000000..565f406dd1 Binary files /dev/null and b/posterita/posterita/web/images/tango/applications-system.png differ diff --git a/posterita/posterita/web/images/tango/appointment-new.png b/posterita/posterita/web/images/tango/appointment-new.png new file mode 100644 index 0000000000..85daef3b0b Binary files /dev/null and b/posterita/posterita/web/images/tango/appointment-new.png differ diff --git a/posterita/posterita/web/images/tango/bookmark-new.png b/posterita/posterita/web/images/tango/bookmark-new.png new file mode 100644 index 0000000000..621312a89b Binary files /dev/null and b/posterita/posterita/web/images/tango/bookmark-new.png differ diff --git a/posterita/posterita/web/images/tango/contact-new.png b/posterita/posterita/web/images/tango/contact-new.png new file mode 100644 index 0000000000..8b10c1e9a2 Binary files /dev/null and b/posterita/posterita/web/images/tango/contact-new.png differ diff --git a/posterita/posterita/web/images/tango/document-new.png b/posterita/posterita/web/images/tango/document-new.png new file mode 100644 index 0000000000..e6d64bb90b Binary files /dev/null and b/posterita/posterita/web/images/tango/document-new.png differ diff --git a/posterita/posterita/web/images/tango/document-open.png b/posterita/posterita/web/images/tango/document-open.png new file mode 100644 index 0000000000..2b135a17f3 Binary files /dev/null and b/posterita/posterita/web/images/tango/document-open.png differ diff --git a/posterita/posterita/web/images/tango/document-print-preview.png b/posterita/posterita/web/images/tango/document-print-preview.png new file mode 100644 index 0000000000..772efe5a8a Binary files /dev/null and b/posterita/posterita/web/images/tango/document-print-preview.png differ diff --git a/posterita/posterita/web/images/tango/document-print.png b/posterita/posterita/web/images/tango/document-print.png new file mode 100644 index 0000000000..3ef393029e Binary files /dev/null and b/posterita/posterita/web/images/tango/document-print.png differ diff --git a/posterita/posterita/web/images/tango/document-properties.png b/posterita/posterita/web/images/tango/document-properties.png new file mode 100644 index 0000000000..fa697db405 Binary files /dev/null and b/posterita/posterita/web/images/tango/document-properties.png differ diff --git a/posterita/posterita/web/images/tango/document-save-as.png b/posterita/posterita/web/images/tango/document-save-as.png new file mode 100644 index 0000000000..5c9f6b343b Binary files /dev/null and b/posterita/posterita/web/images/tango/document-save-as.png differ diff --git a/posterita/posterita/web/images/tango/document-save.png b/posterita/posterita/web/images/tango/document-save.png new file mode 100644 index 0000000000..db5c52b769 Binary files /dev/null and b/posterita/posterita/web/images/tango/document-save.png differ diff --git a/posterita/posterita/web/images/tango/edit-clear.png b/posterita/posterita/web/images/tango/edit-clear.png new file mode 100644 index 0000000000..5542948bca Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-clear.png differ diff --git a/posterita/posterita/web/images/tango/edit-copy.png b/posterita/posterita/web/images/tango/edit-copy.png new file mode 100644 index 0000000000..3348ee08fd Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-copy.png differ diff --git a/posterita/posterita/web/images/tango/edit-cut.png b/posterita/posterita/web/images/tango/edit-cut.png new file mode 100644 index 0000000000..217663b19c Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-cut.png differ diff --git a/posterita/posterita/web/images/tango/edit-delete.png b/posterita/posterita/web/images/tango/edit-delete.png new file mode 100644 index 0000000000..9becb3e2f3 Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-delete.png differ diff --git a/posterita/posterita/web/images/tango/edit-find-replace.png b/posterita/posterita/web/images/tango/edit-find-replace.png new file mode 100644 index 0000000000..0f1b117ff7 Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-find-replace.png differ diff --git a/posterita/posterita/web/images/tango/edit-find.png b/posterita/posterita/web/images/tango/edit-find.png new file mode 100644 index 0000000000..5594785d10 Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-find.png differ diff --git a/posterita/posterita/web/images/tango/edit-paste.png b/posterita/posterita/web/images/tango/edit-paste.png new file mode 100644 index 0000000000..dd429ced62 Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-paste.png differ diff --git a/posterita/posterita/web/images/tango/edit-redo.png b/posterita/posterita/web/images/tango/edit-redo.png new file mode 100644 index 0000000000..3eb7b05c84 Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-redo.png differ diff --git a/posterita/posterita/web/images/tango/edit-select-all.png b/posterita/posterita/web/images/tango/edit-select-all.png new file mode 100644 index 0000000000..107fc60741 Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-select-all.png differ diff --git a/posterita/posterita/web/images/tango/edit-undo.png b/posterita/posterita/web/images/tango/edit-undo.png new file mode 100644 index 0000000000..61b2ce9a53 Binary files /dev/null and b/posterita/posterita/web/images/tango/edit-undo.png differ diff --git a/posterita/posterita/web/images/tango/folder-new.png b/posterita/posterita/web/images/tango/folder-new.png new file mode 100644 index 0000000000..fcd15c0184 Binary files /dev/null and b/posterita/posterita/web/images/tango/folder-new.png differ diff --git a/posterita/posterita/web/images/tango/format-indent-less.png b/posterita/posterita/web/images/tango/format-indent-less.png new file mode 100644 index 0000000000..7ced16f725 Binary files /dev/null and b/posterita/posterita/web/images/tango/format-indent-less.png differ diff --git a/posterita/posterita/web/images/tango/format-indent-more.png b/posterita/posterita/web/images/tango/format-indent-more.png new file mode 100644 index 0000000000..6a18867ca7 Binary files /dev/null and b/posterita/posterita/web/images/tango/format-indent-more.png differ diff --git a/posterita/posterita/web/images/tango/format-justify-center.png b/posterita/posterita/web/images/tango/format-justify-center.png new file mode 100644 index 0000000000..a0db2bb30a Binary files /dev/null and b/posterita/posterita/web/images/tango/format-justify-center.png differ diff --git a/posterita/posterita/web/images/tango/format-justify-fill.png b/posterita/posterita/web/images/tango/format-justify-fill.png new file mode 100644 index 0000000000..2a34a8fd6c Binary files /dev/null and b/posterita/posterita/web/images/tango/format-justify-fill.png differ diff --git a/posterita/posterita/web/images/tango/format-justify-left.png b/posterita/posterita/web/images/tango/format-justify-left.png new file mode 100644 index 0000000000..ba0e914a00 Binary files /dev/null and b/posterita/posterita/web/images/tango/format-justify-left.png differ diff --git a/posterita/posterita/web/images/tango/format-justify-right.png b/posterita/posterita/web/images/tango/format-justify-right.png new file mode 100644 index 0000000000..2144cb915e Binary files /dev/null and b/posterita/posterita/web/images/tango/format-justify-right.png differ diff --git a/posterita/posterita/web/images/tango/format-text-bold.png b/posterita/posterita/web/images/tango/format-text-bold.png new file mode 100644 index 0000000000..99ed19c580 Binary files /dev/null and b/posterita/posterita/web/images/tango/format-text-bold.png differ diff --git a/posterita/posterita/web/images/tango/format-text-italic.png b/posterita/posterita/web/images/tango/format-text-italic.png new file mode 100644 index 0000000000..87ed6f9f6e Binary files /dev/null and b/posterita/posterita/web/images/tango/format-text-italic.png differ diff --git a/posterita/posterita/web/images/tango/format-text-strikethrough.png b/posterita/posterita/web/images/tango/format-text-strikethrough.png new file mode 100644 index 0000000000..b9b55ab250 Binary files /dev/null and b/posterita/posterita/web/images/tango/format-text-strikethrough.png differ diff --git a/posterita/posterita/web/images/tango/format-text-underline.png b/posterita/posterita/web/images/tango/format-text-underline.png new file mode 100644 index 0000000000..0de6b1cfd3 Binary files /dev/null and b/posterita/posterita/web/images/tango/format-text-underline.png differ diff --git a/posterita/posterita/web/images/tango/go-bottom.png b/posterita/posterita/web/images/tango/go-bottom.png new file mode 100644 index 0000000000..bf973fedc2 Binary files /dev/null and b/posterita/posterita/web/images/tango/go-bottom.png differ diff --git a/posterita/posterita/web/images/tango/go-down.png b/posterita/posterita/web/images/tango/go-down.png new file mode 100644 index 0000000000..dce3f15ef5 Binary files /dev/null and b/posterita/posterita/web/images/tango/go-down.png differ diff --git a/posterita/posterita/web/images/tango/go-first.png b/posterita/posterita/web/images/tango/go-first.png new file mode 100644 index 0000000000..5e2a6b1ea8 Binary files /dev/null and b/posterita/posterita/web/images/tango/go-first.png differ diff --git a/posterita/posterita/web/images/tango/go-home.png b/posterita/posterita/web/images/tango/go-home.png new file mode 100644 index 0000000000..a3ca103e35 Binary files /dev/null and b/posterita/posterita/web/images/tango/go-home.png differ diff --git a/posterita/posterita/web/images/tango/go-jump.png b/posterita/posterita/web/images/tango/go-jump.png new file mode 100644 index 0000000000..34dc4c04e2 Binary files /dev/null and b/posterita/posterita/web/images/tango/go-jump.png differ diff --git a/posterita/posterita/web/images/tango/go-last.png b/posterita/posterita/web/images/tango/go-last.png new file mode 100644 index 0000000000..48fe95bd3b Binary files /dev/null and b/posterita/posterita/web/images/tango/go-last.png differ diff --git a/posterita/posterita/web/images/tango/go-next.png b/posterita/posterita/web/images/tango/go-next.png new file mode 100644 index 0000000000..a68e2db775 Binary files /dev/null and b/posterita/posterita/web/images/tango/go-next.png differ diff --git a/posterita/posterita/web/images/tango/go-previous.png b/posterita/posterita/web/images/tango/go-previous.png new file mode 100644 index 0000000000..c37bc0414c Binary files /dev/null and b/posterita/posterita/web/images/tango/go-previous.png differ diff --git a/posterita/posterita/web/images/tango/go-top.png b/posterita/posterita/web/images/tango/go-top.png new file mode 100644 index 0000000000..d99552b694 Binary files /dev/null and b/posterita/posterita/web/images/tango/go-top.png differ diff --git a/posterita/posterita/web/images/tango/go-up.png b/posterita/posterita/web/images/tango/go-up.png new file mode 100644 index 0000000000..afb307b18c Binary files /dev/null and b/posterita/posterita/web/images/tango/go-up.png differ diff --git a/posterita/posterita/web/images/tango/help-browser.png b/posterita/posterita/web/images/tango/help-browser.png new file mode 100644 index 0000000000..d60425f7ec Binary files /dev/null and b/posterita/posterita/web/images/tango/help-browser.png differ diff --git a/posterita/posterita/web/images/tango/input-keyboard.png b/posterita/posterita/web/images/tango/input-keyboard.png new file mode 100644 index 0000000000..5bb1298cd3 Binary files /dev/null and b/posterita/posterita/web/images/tango/input-keyboard.png differ diff --git a/posterita/posterita/web/images/tango/internet-group-chat.png b/posterita/posterita/web/images/tango/internet-group-chat.png new file mode 100644 index 0000000000..9cb1d3be11 Binary files /dev/null and b/posterita/posterita/web/images/tango/internet-group-chat.png differ diff --git a/posterita/posterita/web/images/tango/internet-mail.png b/posterita/posterita/web/images/tango/internet-mail.png new file mode 100644 index 0000000000..dc3b9dd3a6 Binary files /dev/null and b/posterita/posterita/web/images/tango/internet-mail.png differ diff --git a/posterita/posterita/web/images/tango/internet-news-reader.png b/posterita/posterita/web/images/tango/internet-news-reader.png new file mode 100644 index 0000000000..ebc528fed8 Binary files /dev/null and b/posterita/posterita/web/images/tango/internet-news-reader.png differ diff --git a/posterita/posterita/web/images/tango/internet-web-browser.png b/posterita/posterita/web/images/tango/internet-web-browser.png new file mode 100644 index 0000000000..10d2ed4f47 Binary files /dev/null and b/posterita/posterita/web/images/tango/internet-web-browser.png differ diff --git a/posterita/posterita/web/images/tango/list-add.png b/posterita/posterita/web/images/tango/list-add.png new file mode 100644 index 0000000000..2acdd8f514 Binary files /dev/null and b/posterita/posterita/web/images/tango/list-add.png differ diff --git a/posterita/posterita/web/images/tango/list-remove.png b/posterita/posterita/web/images/tango/list-remove.png new file mode 100644 index 0000000000..c5524f7284 Binary files /dev/null and b/posterita/posterita/web/images/tango/list-remove.png differ diff --git a/posterita/posterita/web/images/tango/mail-forward.png b/posterita/posterita/web/images/tango/mail-forward.png new file mode 100644 index 0000000000..bea94ab0c8 Binary files /dev/null and b/posterita/posterita/web/images/tango/mail-forward.png differ diff --git a/posterita/posterita/web/images/tango/mail-mark-junk.png b/posterita/posterita/web/images/tango/mail-mark-junk.png new file mode 100644 index 0000000000..0af3006673 Binary files /dev/null and b/posterita/posterita/web/images/tango/mail-mark-junk.png differ diff --git a/posterita/posterita/web/images/tango/mail-mark-not-junk.png b/posterita/posterita/web/images/tango/mail-mark-not-junk.png new file mode 100644 index 0000000000..296e92ad13 Binary files /dev/null and b/posterita/posterita/web/images/tango/mail-mark-not-junk.png differ diff --git a/posterita/posterita/web/images/tango/mail-message-new.png b/posterita/posterita/web/images/tango/mail-message-new.png new file mode 100644 index 0000000000..9f51246f1e Binary files /dev/null and b/posterita/posterita/web/images/tango/mail-message-new.png differ diff --git a/posterita/posterita/web/images/tango/mail-reply-all.png b/posterita/posterita/web/images/tango/mail-reply-all.png new file mode 100644 index 0000000000..0216e390b6 Binary files /dev/null and b/posterita/posterita/web/images/tango/mail-reply-all.png differ diff --git a/posterita/posterita/web/images/tango/mail-reply-sender.png b/posterita/posterita/web/images/tango/mail-reply-sender.png new file mode 100644 index 0000000000..3f248dc3a2 Binary files /dev/null and b/posterita/posterita/web/images/tango/mail-reply-sender.png differ diff --git a/posterita/posterita/web/images/tango/mail-send-receive.png b/posterita/posterita/web/images/tango/mail-send-receive.png new file mode 100644 index 0000000000..99349b9aac Binary files /dev/null and b/posterita/posterita/web/images/tango/mail-send-receive.png differ diff --git a/posterita/posterita/web/images/tango/media-eject.png b/posterita/posterita/web/images/tango/media-eject.png new file mode 100644 index 0000000000..b218e7ae98 Binary files /dev/null and b/posterita/posterita/web/images/tango/media-eject.png differ diff --git a/posterita/posterita/web/images/tango/media-playback-pause.png b/posterita/posterita/web/images/tango/media-playback-pause.png new file mode 100644 index 0000000000..1e9f4d5357 Binary files /dev/null and b/posterita/posterita/web/images/tango/media-playback-pause.png differ diff --git a/posterita/posterita/web/images/tango/media-playback-start.png b/posterita/posterita/web/images/tango/media-playback-start.png new file mode 100644 index 0000000000..66f32d89b5 Binary files /dev/null and b/posterita/posterita/web/images/tango/media-playback-start.png differ diff --git a/posterita/posterita/web/images/tango/media-playback-stop.png b/posterita/posterita/web/images/tango/media-playback-stop.png new file mode 100644 index 0000000000..a0947879ee Binary files /dev/null and b/posterita/posterita/web/images/tango/media-playback-stop.png differ diff --git a/posterita/posterita/web/images/tango/media-record.png b/posterita/posterita/web/images/tango/media-record.png new file mode 100644 index 0000000000..43f034b59a Binary files /dev/null and b/posterita/posterita/web/images/tango/media-record.png differ diff --git a/posterita/posterita/web/images/tango/media-seek-backward.png b/posterita/posterita/web/images/tango/media-seek-backward.png new file mode 100644 index 0000000000..535c536157 Binary files /dev/null and b/posterita/posterita/web/images/tango/media-seek-backward.png differ diff --git a/posterita/posterita/web/images/tango/media-seek-forward.png b/posterita/posterita/web/images/tango/media-seek-forward.png new file mode 100644 index 0000000000..96ebe01c5f Binary files /dev/null and b/posterita/posterita/web/images/tango/media-seek-forward.png differ diff --git a/posterita/posterita/web/images/tango/media-skip-backward.png b/posterita/posterita/web/images/tango/media-skip-backward.png new file mode 100644 index 0000000000..aa082513b9 Binary files /dev/null and b/posterita/posterita/web/images/tango/media-skip-backward.png differ diff --git a/posterita/posterita/web/images/tango/media-skip-forward.png b/posterita/posterita/web/images/tango/media-skip-forward.png new file mode 100644 index 0000000000..52be9420da Binary files /dev/null and b/posterita/posterita/web/images/tango/media-skip-forward.png differ diff --git a/posterita/posterita/web/images/tango/office-calendar.png b/posterita/posterita/web/images/tango/office-calendar.png new file mode 100644 index 0000000000..7817c12b4f Binary files /dev/null and b/posterita/posterita/web/images/tango/office-calendar.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-accessibility.png b/posterita/posterita/web/images/tango/preferences-desktop-accessibility.png new file mode 100644 index 0000000000..adfe247e29 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-accessibility.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-assistive-technology.png b/posterita/posterita/web/images/tango/preferences-desktop-assistive-technology.png new file mode 100644 index 0000000000..70adb92b52 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-assistive-technology.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-font.png b/posterita/posterita/web/images/tango/preferences-desktop-font.png new file mode 100644 index 0000000000..b4ec434ca1 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-font.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-keyboard-shortcuts.png b/posterita/posterita/web/images/tango/preferences-desktop-keyboard-shortcuts.png new file mode 100644 index 0000000000..178dd294c3 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-keyboard-shortcuts.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-locale.png b/posterita/posterita/web/images/tango/preferences-desktop-locale.png new file mode 100644 index 0000000000..608a0b1e95 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-locale.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-remote-desktop.png b/posterita/posterita/web/images/tango/preferences-desktop-remote-desktop.png new file mode 100644 index 0000000000..6da67c65f7 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-remote-desktop.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-screensaver.png b/posterita/posterita/web/images/tango/preferences-desktop-screensaver.png new file mode 100644 index 0000000000..dba245586f Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-screensaver.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-sound.png b/posterita/posterita/web/images/tango/preferences-desktop-sound.png new file mode 100644 index 0000000000..56a5662eee Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-sound.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-theme.png b/posterita/posterita/web/images/tango/preferences-desktop-theme.png new file mode 100644 index 0000000000..7af777d6e7 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-theme.png differ diff --git a/posterita/posterita/web/images/tango/preferences-desktop-wallpaper.png b/posterita/posterita/web/images/tango/preferences-desktop-wallpaper.png new file mode 100644 index 0000000000..4eb744ca14 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-desktop-wallpaper.png differ diff --git a/posterita/posterita/web/images/tango/preferences-system-network-proxy.png b/posterita/posterita/web/images/tango/preferences-system-network-proxy.png new file mode 100644 index 0000000000..e75f6f769c Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-system-network-proxy.png differ diff --git a/posterita/posterita/web/images/tango/preferences-system-session.png b/posterita/posterita/web/images/tango/preferences-system-session.png new file mode 100644 index 0000000000..f8c2d112c9 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-system-session.png differ diff --git a/posterita/posterita/web/images/tango/preferences-system-windows.png b/posterita/posterita/web/images/tango/preferences-system-windows.png new file mode 100644 index 0000000000..517e48ae08 Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-system-windows.png differ diff --git a/posterita/posterita/web/images/tango/preferences-system.png b/posterita/posterita/web/images/tango/preferences-system.png new file mode 100644 index 0000000000..6e52db7cfd Binary files /dev/null and b/posterita/posterita/web/images/tango/preferences-system.png differ diff --git a/posterita/posterita/web/images/tango/process-stop.png b/posterita/posterita/web/images/tango/process-stop.png new file mode 100644 index 0000000000..e7a8d1722f Binary files /dev/null and b/posterita/posterita/web/images/tango/process-stop.png differ diff --git a/posterita/posterita/web/images/tango/system-file-manager.png b/posterita/posterita/web/images/tango/system-file-manager.png new file mode 100644 index 0000000000..1d6ce31510 Binary files /dev/null and b/posterita/posterita/web/images/tango/system-file-manager.png differ diff --git a/posterita/posterita/web/images/tango/system-installer.png b/posterita/posterita/web/images/tango/system-installer.png new file mode 100644 index 0000000000..c26576ee8f Binary files /dev/null and b/posterita/posterita/web/images/tango/system-installer.png differ diff --git a/posterita/posterita/web/images/tango/system-lock-screen.png b/posterita/posterita/web/images/tango/system-lock-screen.png new file mode 100644 index 0000000000..2c220fcb62 Binary files /dev/null and b/posterita/posterita/web/images/tango/system-lock-screen.png differ diff --git a/posterita/posterita/web/images/tango/system-log-out.png b/posterita/posterita/web/images/tango/system-log-out.png new file mode 100644 index 0000000000..780411d3ea Binary files /dev/null and b/posterita/posterita/web/images/tango/system-log-out.png differ diff --git a/posterita/posterita/web/images/tango/system-password.png b/posterita/posterita/web/images/tango/system-password.png new file mode 100644 index 0000000000..b0109750ac Binary files /dev/null and b/posterita/posterita/web/images/tango/system-password.png differ diff --git a/posterita/posterita/web/images/tango/system-search.png b/posterita/posterita/web/images/tango/system-search.png new file mode 100644 index 0000000000..950d792af5 Binary files /dev/null and b/posterita/posterita/web/images/tango/system-search.png differ diff --git a/posterita/posterita/web/images/tango/system-shutdown.png b/posterita/posterita/web/images/tango/system-shutdown.png new file mode 100644 index 0000000000..36acd46bd3 Binary files /dev/null and b/posterita/posterita/web/images/tango/system-shutdown.png differ diff --git a/posterita/posterita/web/images/tango/system-software-update.png b/posterita/posterita/web/images/tango/system-software-update.png new file mode 100644 index 0000000000..470b5d46f4 Binary files /dev/null and b/posterita/posterita/web/images/tango/system-software-update.png differ diff --git a/posterita/posterita/web/images/tango/system-users.png b/posterita/posterita/web/images/tango/system-users.png new file mode 100644 index 0000000000..749c825e07 Binary files /dev/null and b/posterita/posterita/web/images/tango/system-users.png differ diff --git a/posterita/posterita/web/images/tango/tab-new.png b/posterita/posterita/web/images/tango/tab-new.png new file mode 100644 index 0000000000..294d150697 Binary files /dev/null and b/posterita/posterita/web/images/tango/tab-new.png differ diff --git a/posterita/posterita/web/images/tango/user-trash.png b/posterita/posterita/web/images/tango/user-trash.png new file mode 100644 index 0000000000..9b7a462d7d Binary files /dev/null and b/posterita/posterita/web/images/tango/user-trash.png differ diff --git a/posterita/posterita/web/images/tango/utilities-system-monitor.png b/posterita/posterita/web/images/tango/utilities-system-monitor.png new file mode 100644 index 0000000000..b62959e4f3 Binary files /dev/null and b/posterita/posterita/web/images/tango/utilities-system-monitor.png differ diff --git a/posterita/posterita/web/images/tango/utilities-terminal.png b/posterita/posterita/web/images/tango/utilities-terminal.png new file mode 100644 index 0000000000..f86c784002 Binary files /dev/null and b/posterita/posterita/web/images/tango/utilities-terminal.png differ diff --git a/posterita/posterita/web/images/tango/view-fullscreen.png b/posterita/posterita/web/images/tango/view-fullscreen.png new file mode 100644 index 0000000000..00e6b83cc0 Binary files /dev/null and b/posterita/posterita/web/images/tango/view-fullscreen.png differ diff --git a/posterita/posterita/web/images/tango/view-refresh.png b/posterita/posterita/web/images/tango/view-refresh.png new file mode 100644 index 0000000000..606ea9eba4 Binary files /dev/null and b/posterita/posterita/web/images/tango/view-refresh.png differ diff --git a/posterita/posterita/web/images/tango/window-new.png b/posterita/posterita/web/images/tango/window-new.png new file mode 100644 index 0000000000..e091702e33 Binary files /dev/null and b/posterita/posterita/web/images/tango/window-new.png differ diff --git a/posterita/posterita/web/images/tango/x-office-calendar.png b/posterita/posterita/web/images/tango/x-office-calendar.png new file mode 100644 index 0000000000..0c224e9f01 Binary files /dev/null and b/posterita/posterita/web/images/tango/x-office-calendar.png differ diff --git a/posterita/posterita/web/images/tick.png b/posterita/posterita/web/images/tick.png new file mode 100644 index 0000000000..1d7ef37770 Binary files /dev/null and b/posterita/posterita/web/images/tick.png differ diff --git a/posterita/posterita/web/images/trash.png b/posterita/posterita/web/images/trash.png new file mode 100644 index 0000000000..17d5dbcdc9 Binary files /dev/null and b/posterita/posterita/web/images/trash.png differ diff --git a/posterita/posterita/web/images/wrong.png b/posterita/posterita/web/images/wrong.png new file mode 100644 index 0000000000..9fcdd470e2 Binary files /dev/null and b/posterita/posterita/web/images/wrong.png differ diff --git a/posterita/posterita/web/import/importGarmentTemplate.csv b/posterita/posterita/web/import/importGarmentTemplate.csv new file mode 100644 index 0000000000..8b085861e0 --- /dev/null +++ b/posterita/posterita/web/import/importGarmentTemplate.csv @@ -0,0 +1 @@ +"Barcode","Brand","Design","Model","Colour","Size","Revenue Recognition","Purchase Price","Marked Price","Discounted Price","Limit Price","VAT %","Stock in Hand" diff --git a/posterita/posterita/web/import/importTemplate.csv b/posterita/posterita/web/import/importTemplate.csv new file mode 100644 index 0000000000..2c8e62915b --- /dev/null +++ b/posterita/posterita/web/import/importTemplate.csv @@ -0,0 +1 @@ +"Revenue Recognition",Barcode,Name,Description,UOM,"Purchase Price","Marked Price","Discounted Price","Limit Price","VAT %","Stock in Hand" diff --git a/posterita/posterita/web/index.jsp b/posterita/posterita/web/index.jsp new file mode 100644 index 0000000000..fb62a96c53 --- /dev/null +++ b/posterita/posterita/web/index.jsp @@ -0,0 +1,21 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +--%> + + diff --git a/posterita/posterita/web/javascripts/actb.js b/posterita/posterita/web/javascripts/actb.js new file mode 100644 index 0000000000..c6800f2f14 --- /dev/null +++ b/posterita/posterita/web/javascripts/actb.js @@ -0,0 +1,645 @@ +function addEvent(obj,event_name,func_name){ + if (obj.attachEvent){ + obj.attachEvent("on"+event_name, func_name); + }else if(obj.addEventListener){ + obj.addEventListener(event_name,func_name,true); + }else{ + obj["on"+event_name] = func_name; + } +} +function removeEvent(obj,event_name,func_name){ + if (obj.detachEvent){ + obj.detachEvent("on"+event_name,func_name); + }else if(obj.removeEventListener){ + obj.removeEventListener(event_name,func_name,true); + }else{ + obj["on"+event_name] = null; + } +} +function stopEvent(evt){ + evt || window.event; + if (evt.stopPropagation){ + evt.stopPropagation(); + evt.preventDefault(); + }else if(typeof evt.cancelBubble != "undefined"){ + evt.cancelBubble = true; + evt.returnValue = false; + } + return false; +} +function getElement(evt){ + if (window.event){ + return window.event.srcElement; + }else{ + return evt.currentTarget; + } +} +function getTargetElement(evt){ + if (window.event){ + return window.event.srcElement; + }else{ + return evt.target; + } +} +function stopSelect(obj){ + if (typeof obj.onselectstart != 'undefined'){ + addEvent(obj,"selectstart",function(){ return false;}); + } +} +function getCaretEnd(obj){ + if(typeof obj.selectionEnd != "undefined"){ + return obj.selectionEnd; + }else if(document.selection&&document.selection.createRange){ + var M=document.selection.createRange(); + try{ + var Lp = M.duplicate(); + Lp.moveToElementText(obj); + }catch(e){ + var Lp=obj.createTextRange(); + } + Lp.setEndPoint("EndToEnd",M); + var rb=Lp.text.length; + if(rb>obj.value.length){ + return -1; + } + return rb; + } +} +function getCaretStart(obj){ + if(typeof obj.selectionStart != "undefined"){ + return obj.selectionStart; + }else if(document.selection&&document.selection.createRange){ + var M=document.selection.createRange(); + try{ + var Lp = M.duplicate(); + Lp.moveToElementText(obj); + }catch(e){ + var Lp=obj.createTextRange(); + } + Lp.setEndPoint("EndToStart",M); + var rb=Lp.text.length; + if(rb>obj.value.length){ + return -1; + } + return rb; + } +} +function setCaret(obj,l){ + obj.focus(); + if (obj.setSelectionRange){ + obj.setSelectionRange(l,l); + }else if(obj.createTextRange){ + m = obj.createTextRange(); + m.moveStart('character',l); + m.collapse(); + m.select(); + } +} +function setSelection(obj,s,e){ + obj.focus(); + if (obj.setSelectionRange){ + obj.setSelectionRange(s,e); + }else if(obj.createTextRange){ + m = obj.createTextRange(); + m.moveStart('character',s); + m.moveEnd('character',e); + m.select(); + } +} +String.prototype.addslashes = function(){ + return this.replace(/(["\\\.\|\[\]\^\*\+\?\$\(\)])/g, '\\$1'); +} +String.prototype.trim = function () { + return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"); +}; +function curTop(obj){ + toreturn = 0; + while(obj){ + toreturn += obj.offsetTop; + obj = obj.offsetParent; + } + return toreturn; +} +function curLeft(obj){ + toreturn = 0; + while(obj){ + toreturn += obj.offsetLeft; + obj = obj.offsetParent; + } + return toreturn; +} +function isNumber(a) { + return typeof a == 'number' && isFinite(a); +} +function replaceHTML(obj,text){ + while(el = obj.childNodes[0]){ + obj.removeChild(el); + }; + obj.appendChild(document.createTextNode(text)); +} + +function actb(obj,ca){ + /* ---- Public Variables ---- */ + this.actb_timeOut = -1; // Autocomplete Timeout in ms (-1: autocomplete never time out) + this.actb_lim = 4; // Number of elements autocomplete can show (-1: no limit) + this.actb_firstText = false; // should the auto complete be limited to the beginning of keyword? + this.actb_mouse = true; // Enable Mouse Support + this.actb_delimiter = new Array(';',','); // Delimiter for multiple autocomplete. Set it to empty array for single autocomplete + this.actb_startcheck = 1; // Show widget only after this number of characters is typed in. + /* ---- Public Variables ---- */ + + /* --- Styles --- */ + this.actb_bgColor = '#888888'; + this.actb_textColor = '#FFFFFF'; + this.actb_hColor = '#000000'; + this.actb_fFamily = 'Verdana'; + this.actb_fSize = '11px'; + this.actb_hStyle = 'text-decoration:underline;font-weight="bold"'; + /* --- Styles --- */ + + /* ---- Private Variables ---- */ + var actb_delimwords = new Array(); + var actb_cdelimword = 0; + var actb_delimchar = new Array(); + var actb_display = false; + var actb_pos = 0; + var actb_total = 0; + var actb_curr = null; + var actb_rangeu = 0; + var actb_ranged = 0; + var actb_bool = new Array(); + var actb_pre = 0; + var actb_toid; + var actb_tomake = false; + var actb_getpre = ""; + var actb_mouse_on_list = 1; + var actb_kwcount = 0; + var actb_caretmove = false; + this.actb_keywords = new Array(); + /* ---- Private Variables---- */ + + this.actb_keywords = ca; + var actb_self = this; + + actb_curr = obj; + + addEvent(actb_curr,"focus",actb_setup); + function actb_setup(){ + addEvent(document,"keydown",actb_checkkey); + addEvent(actb_curr,"blur",actb_clear); + addEvent(document,"keypress",actb_keypress); + } + + function actb_clear(evt){ + if (!evt) evt = event; + removeEvent(document,"keydown",actb_checkkey); + removeEvent(actb_curr,"blur",actb_clear); + removeEvent(document,"keypress",actb_keypress); + actb_removedisp(); + } + function actb_parse(n){ + if (actb_self.actb_delimiter.length > 0){ + var t = actb_delimwords[actb_cdelimword].trim().addslashes(); + var plen = actb_delimwords[actb_cdelimword].trim().length; + }else{ + var t = actb_curr.value.addslashes(); + var plen = actb_curr.value.length; + } + var tobuild = ''; + var i; + + if (actb_self.actb_firstText){ + var re = new RegExp("^" + t, "i"); + }else{ + var re = new RegExp(t, "i"); + } + var p = n.search(re); + + for (i=0;i" + for (i=p;i 1){ + r = a.insertRow(-1); + r.style.backgroundColor = actb_self.actb_bgColor; + c = r.insertCell(-1); + c.style.color = actb_self.actb_textColor; + c.style.fontFamily = 'arial narrow'; + c.style.fontSize = actb_self.actb_fSize; + c.align='center'; + replaceHTML(c,'/\\'); + if (actb_self.actb_mouse){ + c.style.cursor = 'pointer'; + c.onclick = actb_mouse_up; + } + } + for (i=0;i= actb_rangeu && j <= actb_ranged){ + r = a.insertRow(-1); + r.style.backgroundColor = actb_self.actb_bgColor; + r.id = 'tat_tr'+(j); + c = r.insertCell(-1); + c.style.color = actb_self.actb_textColor; + c.style.fontFamily = actb_self.actb_fFamily; + c.style.fontSize = actb_self.actb_fSize; + c.innerHTML = actb_parse(actb_self.actb_keywords[i]); + c.id = 'tat_td'+(j); + c.setAttribute('pos',j); + if (actb_self.actb_mouse){ + c.style.cursor = 'pointer'; + c.onclick=actb_mouseclick; + c.onmouseover = actb_table_highlight; + } + j++; + }else{ + j++; + } + } + if (j > actb_ranged) break; + } + if (j-1 < actb_total){ + r = a.insertRow(-1); + r.style.backgroundColor = actb_self.actb_bgColor; + c = r.insertCell(-1); + c.style.color = actb_self.actb_textColor; + c.style.fontFamily = 'arial narrow'; + c.style.fontSize = actb_self.actb_fSize; + c.align='center'; + replaceHTML(c,'\\/'); + if (actb_self.actb_mouse){ + c.style.cursor = 'pointer'; + c.onclick = actb_mouse_down; + } + } + } + function actb_goup(){ + if (!actb_display) return; + if (actb_pos == 1) return; + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor; + actb_pos--; + if (actb_pos < actb_rangeu) actb_moveup(); + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor; + if (actb_toid) clearTimeout(actb_toid); + if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut); + } + function actb_godown(){ + if (!actb_display) return; + if (actb_pos == actb_total) return; + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor; + actb_pos++; + if (actb_pos > actb_ranged) actb_movedown(); + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor; + if (actb_toid) clearTimeout(actb_toid); + if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut); + } + function actb_movedown(){ + actb_rangeu++; + actb_ranged++; + actb_remake(); + } + function actb_moveup(){ + actb_rangeu--; + actb_ranged--; + actb_remake(); + } + + /* Mouse */ + function actb_mouse_down(){ + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor; + actb_pos++; + actb_movedown(); + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor; + actb_curr.focus(); + actb_mouse_on_list = 0; + if (actb_toid) clearTimeout(actb_toid); + if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut); + } + function actb_mouse_up(evt){ + if (!evt) evt = event; + if (evt.stopPropagation){ + evt.stopPropagation(); + }else{ + evt.cancelBubble = true; + } + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor; + actb_pos--; + actb_moveup(); + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor; + actb_curr.focus(); + actb_mouse_on_list = 0; + if (actb_toid) clearTimeout(actb_toid); + if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut); + } + function actb_mouseclick(evt){ + if (!evt) evt = event; + if (!actb_display) return; + actb_mouse_on_list = 0; + actb_pos = this.getAttribute('pos'); + actb_penter(); + } + function actb_table_focus(){ + actb_mouse_on_list = 1; + } + function actb_table_unfocus(){ + actb_mouse_on_list = 0; + if (actb_toid) clearTimeout(actb_toid); + if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut); + } + function actb_table_highlight(){ + actb_mouse_on_list = 1; + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor; + actb_pos = this.getAttribute('pos'); + while (actb_pos < actb_rangeu) actb_moveup(); + while (actb_pos > actb_ranged) actb_movedown(); + document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor; + if (actb_toid) clearTimeout(actb_toid); + if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut); + } + /* ---- */ + + function actb_insertword(a){ + if (actb_self.actb_delimiter.length > 0){ + str = ''; + l=0; + for (i=0;i=0;--j){ + if (actb_delimwords[i].charAt(j) != ' ') break; + postspace += ' '; + } + str += prespace; + str += a; + l = str.length; + if (gotbreak) str += postspace; + }else{ + str += actb_delimwords[i]; + } + if (i != actb_delimwords.length - 1){ + str += actb_delimchar[i]; + } + } + actb_curr.value = str; + setCaret(actb_curr,l); + }else{ + actb_curr.value = a; + } + actb_mouse_on_list = 0; + actb_removedisp(); + } + function actb_penter(){ + if (!actb_display) return; + actb_display = false; + var word = ''; + var c = 0; + for (var i=0;i<=actb_self.actb_keywords.length;i++){ + if (actb_bool[i]) c++; + if (c == actb_pos){ + word = actb_self.actb_keywords[i]; + break; + } + } + actb_insertword(word); + l = getCaretStart(actb_curr); + } + function actb_removedisp(){ + if (actb_mouse_on_list==0){ + actb_display = 0; + if (document.getElementById('tat_table')){ document.body.removeChild(document.getElementById('tat_table')); } + if (actb_toid) clearTimeout(actb_toid); + } + } + function actb_keypress(e){ + if (actb_caretmove) stopEvent(e); + return !actb_caretmove; + } + function actb_checkkey(evt){ + if (!evt) evt = event; + a = evt.keyCode; + caret_pos_start = getCaretStart(actb_curr); + actb_caretmove = 0; + switch (a){ + case 38: + actb_goup(); + actb_caretmove = 1; + return false; + break; + case 40: + actb_godown(); + actb_caretmove = 1; + return false; + break; + case 13: case 9: + if (actb_display){ + actb_caretmove = 1; + actb_penter(); + return false; + }else{ + return true; + } + break; + default: + setTimeout(function(){actb_tocomplete(a)},50); + break; + } + } + + function actb_tocomplete(kc){ + if (kc == 38 || kc == 40 || kc == 13) return; + var i; + if (actb_display){ + var word = 0; + var c = 0; + for (var i=0;i<=actb_self.actb_keywords.length;i++){ + if (actb_bool[i]) c++; + if (c == actb_pos){ + word = i; + break; + } + } + actb_pre = word; + }else{ actb_pre = -1}; + + if (actb_curr.value == ''){ + actb_mouse_on_list = 0; + actb_removedisp(); + return; + } + if (actb_self.actb_delimiter.length > 0){ + caret_pos_start = getCaretStart(actb_curr); + caret_pos_end = getCaretEnd(actb_curr); + + delim_split = ''; + for (i=0;i= l && caret_pos_end <= l + actb_delimwords[i].length){ + actb_cdelimword = i; + } + l+=actb_delimwords[i].length + 1; + } + var ot = actb_delimwords[actb_cdelimword].trim(); + var t = actb_delimwords[actb_cdelimword].addslashes().trim(); + }else{ + var ot = actb_curr.value; + var t = actb_curr.value.addslashes(); + } + if (ot.length == 0){ + actb_mouse_on_list = 0; + actb_removedisp(); + } + if (ot.length < actb_self.actb_startcheck) return this; + if (actb_self.actb_firstText){ + var re = new RegExp("^" + t, "i"); + }else{ + var re = new RegExp(t, "i"); + } + + actb_total = 0; + actb_tomake = false; + actb_kwcount = 0; + for (i=0;i 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut); + actb_generate(); + } + return this; +} \ No newline at end of file diff --git a/posterita/posterita/web/javascripts/builder.js b/posterita/posterita/web/javascripts/builder.js new file mode 100644 index 0000000000..8301999444 --- /dev/null +++ b/posterita/posterita/web/javascripts/builder.js @@ -0,0 +1,136 @@ +// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +var Builder = { + NODEMAP: { + AREA: 'map', + CAPTION: 'table', + COL: 'table', + COLGROUP: 'table', + LEGEND: 'fieldset', + OPTGROUP: 'select', + OPTION: 'select', + PARAM: 'object', + TBODY: 'table', + TD: 'table', + TFOOT: 'table', + TH: 'table', + THEAD: 'table', + TR: 'table' + }, + // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, + // due to a Firefox bug + node: function(elementName) { + elementName = elementName.toUpperCase(); + + // try innerHTML approach + var parentTag = this.NODEMAP[elementName] || 'div'; + var parentElement = document.createElement(parentTag); + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" + elementName + ">"; + } catch(e) {} + var element = parentElement.firstChild || null; + + // see if browser added wrapping tags + if(element && (element.tagName.toUpperCase() != elementName)) + element = element.getElementsByTagName(elementName)[0]; + + // fallback to createElement approach + if(!element) element = document.createElement(elementName); + + // abort if nothing could be created + if(!element) return; + + // attributes (or text) + if(arguments[1]) + if(this._isStringOrNumber(arguments[1]) || + (arguments[1] instanceof Array) || + arguments[1].tagName) { + this._children(element, arguments[1]); + } else { + var attrs = this._attributes(arguments[1]); + if(attrs.length) { + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 + parentElement.innerHTML = "<" +elementName + " " + + attrs + ">"; + } catch(e) {} + element = parentElement.firstChild || null; + // workaround firefox 1.0.X bug + if(!element) { + element = document.createElement(elementName); + for(attr in arguments[1]) + element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; + } + if(element.tagName.toUpperCase() != elementName) + element = parentElement.getElementsByTagName(elementName)[0]; + } + } + + // text, or array of children + if(arguments[2]) + this._children(element, arguments[2]); + + return element; + }, + _text: function(text) { + return document.createTextNode(text); + }, + + ATTR_MAP: { + 'className': 'class', + 'htmlFor': 'for' + }, + + _attributes: function(attributes) { + var attrs = []; + for(attribute in attributes) + attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + + '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"'); + return attrs.join(" "); + }, + _children: function(element, children) { + if(children.tagName) { + element.appendChild(children); + return; + } + if(typeof children=='object') { // array can hold nodes and text + children.flatten().each( function(e) { + if(typeof e=='object') + element.appendChild(e) + else + if(Builder._isStringOrNumber(e)) + element.appendChild(Builder._text(e)); + }); + } else + if(Builder._isStringOrNumber(children)) + element.appendChild(Builder._text(children)); + }, + _isStringOrNumber: function(param) { + return(typeof param=='string' || typeof param=='number'); + }, + build: function(html) { + var element = this.node('div'); + $(element).update(html.strip()); + return element.down(); + }, + dump: function(scope) { + if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope + + var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ + "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ + "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ + "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); + + tags.each( function(tag){ + scope[tag] = function() { + return Builder.node.apply(Builder, [tag].concat($A(arguments))); + } + }); + } +} diff --git a/posterita/posterita/web/javascripts/controls.js b/posterita/posterita/web/javascripts/controls.js new file mode 100644 index 0000000000..fc7968dfe1 --- /dev/null +++ b/posterita/posterita/web/javascripts/controls.js @@ -0,0 +1,965 @@ +// script.aculo.us controls.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan) +// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) +// Contributors: +// Richard Livsey +// Rahul Bhargava +// Rob Wills +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// Autocompleter.Base handles all the autocompletion functionality +// that's independent of the data source for autocompletion. This +// includes drawing the autocompletion menu, observing keyboard +// and mouse events, and similar. +// +// Specific autocompleters need to provide, at the very least, +// a getUpdatedChoices function that will be invoked every time +// the text inside the monitored textbox changes. This method +// should get the text for which to provide autocompletion by +// invoking this.getToken(), NOT by directly accessing +// this.element.value. This is to allow incremental tokenized +// autocompletion. Specific auto-completion logic (AJAX, etc) +// belongs in getUpdatedChoices. +// +// Tokenized incremental autocompletion is enabled automatically +// when an autocompleter is instantiated with the 'tokens' option +// in the options parameter, e.g.: +// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); +// will incrementally autocomplete with a comma as the token. +// Additionally, ',' in the above example can be replaced with +// a token array, e.g. { tokens: [',', '\n'] } which +// enables autocompletion on multiple tokens. This is most +// useful when one of the tokens is \n (a newline), as it +// allows smart autocompletion after linebreaks. + +if(typeof Effect == 'undefined') + throw("controls.js requires including script.aculo.us' effects.js library"); + +var Autocompleter = { } +Autocompleter.Base = Class.create({ + baseInitialize: function(element, update, options) { + element = $(element) + this.element = element; + this.update = $(update); + this.hasFocus = false; + this.changed = false; + this.active = false; + this.index = 0; + this.entryCount = 0; + this.oldElementValue = this.element.value; + + if(this.setOptions) + this.setOptions(options); + else + this.options = options || { }; + + this.options.paramName = this.options.paramName || this.element.name; + this.options.tokens = this.options.tokens || []; + this.options.frequency = this.options.frequency || 0.4; + this.options.minChars = this.options.minChars || 1; + this.options.onShow = this.options.onShow || + function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, { + setHeight: false, + offsetTop: element.offsetHeight + }); + } + Effect.Appear(update,{duration:0.15}); + }; + this.options.onHide = this.options.onHide || + function(element, update){ new Effect.Fade(update,{duration:0.15}) }; + + if(typeof(this.options.tokens) == 'string') + this.options.tokens = new Array(this.options.tokens); + // Force carriage returns as token delimiters anyway + if (!this.options.tokens.include('\n')) + this.options.tokens.push('\n'); + + this.observer = null; + + this.element.setAttribute('autocomplete','off'); + + Element.hide(this.update); + + Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); + Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); + }, + + show: function() { + if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); + if(!this.iefix && + (Prototype.Browser.IE) && + (Element.getStyle(this.update, 'position')=='absolute')) { + new Insertion.After(this.update, + ''); + this.iefix = $(this.update.id+'_iefix'); + } + if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); + }, + + fixIEOverlapping: function() { + Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); + this.iefix.style.zIndex = 1; + this.update.style.zIndex = 2; + Element.show(this.iefix); + }, + + hide: function() { + this.stopIndicator(); + if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); + if(this.iefix) Element.hide(this.iefix); + }, + + startIndicator: function() { + if(this.options.indicator) Element.show(this.options.indicator); + }, + + stopIndicator: function() { + if(this.options.indicator) Element.hide(this.options.indicator); + }, + + onKeyPress: function(event) { + if(this.active) + switch(event.keyCode) { + case Event.KEY_TAB: + case Event.KEY_RETURN: + this.selectEntry(); + Event.stop(event); + case Event.KEY_ESC: + this.hide(); + this.active = false; + Event.stop(event); + return; + case Event.KEY_LEFT: + case Event.KEY_RIGHT: + return; + case Event.KEY_UP: + this.markPrevious(); + this.render(); + Event.stop(event); + return; + case Event.KEY_DOWN: + this.markNext(); + this.render(); + Event.stop(event); + return; + } + else + if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || + (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; + + this.changed = true; + this.hasFocus = true; + + if(this.observer) clearTimeout(this.observer); + this.observer = + setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); + }, + + activate: function() { + this.changed = false; + this.hasFocus = true; + this.getUpdatedChoices(); + }, + + onHover: function(event) { + var element = Event.findElement(event, 'LI'); + if(this.index != element.autocompleteIndex) + { + this.index = element.autocompleteIndex; + this.render(); + } + Event.stop(event); + }, + + onClick: function(event) { + var element = Event.findElement(event, 'LI'); + this.index = element.autocompleteIndex; + this.selectEntry(); + this.hide(); + }, + + onBlur: function(event) { + // needed to make click events working + setTimeout(this.hide.bind(this), 250); + this.hasFocus = false; + this.active = false; + }, + + render: function() { + if(this.entryCount > 0) { + for (var i = 0; i < this.entryCount; i++) + this.index==i ? + Element.addClassName(this.getEntry(i),"selected") : + Element.removeClassName(this.getEntry(i),"selected"); + if(this.hasFocus) { + this.show(); + this.active = true; + } + } else { + this.active = false; + this.hide(); + } + }, + + markPrevious: function() { + if(this.index > 0) this.index-- + else this.index = this.entryCount-1; + this.getEntry(this.index).scrollIntoView(true); + }, + + markNext: function() { + if(this.index < this.entryCount-1) this.index++ + else this.index = 0; + this.getEntry(this.index).scrollIntoView(false); + }, + + getEntry: function(index) { + return this.update.firstChild.childNodes[index]; + }, + + getCurrentEntry: function() { + return this.getEntry(this.index); + }, + + selectEntry: function() { + this.active = false; + this.updateElement(this.getCurrentEntry()); + }, + + updateElement: function(selectedElement) { + if (this.options.updateElement) { + this.options.updateElement(selectedElement); + return; + } + var value = ''; + if (this.options.select) { + var nodes = $(selectedElement).select('.' + this.options.select) || []; + if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); + } else + value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); + + var bounds = this.getTokenBounds(); + if (bounds[0] != -1) { + var newValue = this.element.value.substr(0, bounds[0]); + var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); + if (whitespace) + newValue += whitespace[0]; + this.element.value = newValue + value + this.element.value.substr(bounds[1]); + } else { + this.element.value = value; + } + this.oldElementValue = this.element.value; + this.element.focus(); + + if (this.options.afterUpdateElement) + this.options.afterUpdateElement(this.element, selectedElement); + }, + + updateChoices: function(choices) { + if(!this.changed && this.hasFocus) { + this.update.innerHTML = choices; + Element.cleanWhitespace(this.update); + Element.cleanWhitespace(this.update.down()); + + if(this.update.firstChild && this.update.down().childNodes) { + this.entryCount = + this.update.down().childNodes.length; + for (var i = 0; i < this.entryCount; i++) { + var entry = this.getEntry(i); + entry.autocompleteIndex = i; + this.addObservers(entry); + } + } else { + this.entryCount = 0; + } + + this.stopIndicator(); + this.index = 0; + + if(this.entryCount==1 && this.options.autoSelect) { + this.selectEntry(); + this.hide(); + } else { + this.render(); + } + } + }, + + addObservers: function(element) { + Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); + Event.observe(element, "click", this.onClick.bindAsEventListener(this)); + }, + + onObserverEvent: function() { + this.changed = false; + this.tokenBounds = null; + if(this.getToken().length>=this.options.minChars) { + this.getUpdatedChoices(); + } else { + this.active = false; + this.hide(); + } + this.oldElementValue = this.element.value; + }, + + getToken: function() { + var bounds = this.getTokenBounds(); + return this.element.value.substring(bounds[0], bounds[1]).strip(); + }, + + getTokenBounds: function() { + if (null != this.tokenBounds) return this.tokenBounds; + var value = this.element.value; + if (value.strip().empty()) return [-1, 0]; + var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); + var offset = (diff == this.oldElementValue.length ? 1 : 0); + var prevTokenPos = -1, nextTokenPos = value.length; + var tp; + for (var index = 0, l = this.options.tokens.length; index < l; ++index) { + tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); + if (tp > prevTokenPos) prevTokenPos = tp; + tp = value.indexOf(this.options.tokens[index], diff + offset); + if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; + } + return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); + } +}); + +Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { + var boundary = Math.min(newS.length, oldS.length); + for (var index = 0; index < boundary; ++index) + if (newS[index] != oldS[index]) + return index; + return boundary; +}; + +Ajax.Autocompleter = Class.create(Autocompleter.Base, { + initialize: function(element, update, url, options) { + this.baseInitialize(element, update, options); + this.options.asynchronous = true; + this.options.onComplete = this.onComplete.bind(this); + this.options.defaultParams = this.options.parameters || null; + this.url = url; + }, + + getUpdatedChoices: function() { + this.startIndicator(); + + var entry = encodeURIComponent(this.options.paramName) + '=' + + encodeURIComponent(this.getToken()); + + this.options.parameters = this.options.callback ? + this.options.callback(this.element, entry) : entry; + + if(this.options.defaultParams) + this.options.parameters += '&' + this.options.defaultParams; + + new Ajax.Request(this.url, this.options); + }, + + onComplete: function(request) { + this.updateChoices(request.responseText); + } +}); + +// The local array autocompleter. Used when you'd prefer to +// inject an array of autocompletion options into the page, rather +// than sending out Ajax queries, which can be quite slow sometimes. +// +// The constructor takes four parameters. The first two are, as usual, +// the id of the monitored textbox, and id of the autocompletion menu. +// The third is the array you want to autocomplete from, and the fourth +// is the options block. +// +// Extra local autocompletion options: +// - choices - How many autocompletion choices to offer +// +// - partialSearch - If false, the autocompleter will match entered +// text only at the beginning of strings in the +// autocomplete array. Defaults to true, which will +// match text at the beginning of any *word* in the +// strings in the autocomplete array. If you want to +// search anywhere in the string, additionally set +// the option fullSearch to true (default: off). +// +// - fullSsearch - Search anywhere in autocomplete array strings. +// +// - partialChars - How many characters to enter before triggering +// a partial match (unlike minChars, which defines +// how many characters are required to do any match +// at all). Defaults to 2. +// +// - ignoreCase - Whether to ignore case when autocompleting. +// Defaults to true. +// +// It's possible to pass in a custom function as the 'selector' +// option, if you prefer to write your own autocompletion logic. +// In that case, the other options above will not apply unless +// you support them. + +Autocompleter.Local = Class.create(Autocompleter.Base, { + initialize: function(element, update, array, options) { + this.baseInitialize(element, update, options); + this.options.array = array; + }, + + getUpdatedChoices: function() { + this.updateChoices(this.options.selector(this)); + }, + + setOptions: function(options) { + this.options = Object.extend({ + choices: 10, + partialSearch: true, + partialChars: 2, + ignoreCase: true, + fullSearch: false, + selector: function(instance) { + var ret = []; // Beginning matches + var partial = []; // Inside matches + var entry = instance.getToken(); + var count = 0; + + for (var i = 0; i < instance.options.array.length && + ret.length < instance.options.choices ; i++) { + + var elem = instance.options.array[i]; + var foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase()) : + elem.indexOf(entry); + + while (foundPos != -1) { + if (foundPos == 0 && elem.length != entry.length) { + ret.push("
  • " + elem.substr(0, entry.length) + "" + + elem.substr(entry.length) + "
  • "); + break; + } else if (entry.length >= instance.options.partialChars && + instance.options.partialSearch && foundPos != -1) { + if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { + partial.push("
  • " + elem.substr(0, foundPos) + "" + + elem.substr(foundPos, entry.length) + "" + elem.substr( + foundPos + entry.length) + "
  • "); + break; + } + } + + foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : + elem.indexOf(entry, foundPos + 1); + + } + } + if (partial.length) + ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)) + return "
      " + ret.join('') + "
    "; + } + }, options || { }); + } +}); + +// AJAX in-place editor and collection editor +// Full rewrite by Christophe Porteneuve (April 2007). + +// Use this if you notice weird scrolling problems on some browsers, +// the DOM might be a bit confused when this gets called so do this +// waits 1 ms (with setTimeout) until it does the activation +Field.scrollFreeActivate = function(field) { + setTimeout(function() { + Field.activate(field); + }, 1); +} + +Ajax.InPlaceEditor = Class.create({ + initialize: function(element, url, options) { + this.url = url; + this.element = element = $(element); + this.prepareOptions(); + this._controls = { }; + arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! + Object.extend(this.options, options || { }); + if (!this.options.formId && this.element.id) { + this.options.formId = this.element.id + '-inplaceeditor'; + if ($(this.options.formId)) + this.options.formId = ''; + } + if (this.options.externalControl) + this.options.externalControl = $(this.options.externalControl); + if (!this.options.externalControl) + this.options.externalControlOnly = false; + this._originalBackground = this.element.getStyle('background-color') || 'transparent'; + this.element.title = this.options.clickToEditText; + this._boundCancelHandler = this.handleFormCancellation.bind(this); + this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); + this._boundFailureHandler = this.handleAJAXFailure.bind(this); + this._boundSubmitHandler = this.handleFormSubmission.bind(this); + this._boundWrapperHandler = this.wrapUp.bind(this); + this.registerListeners(); + }, + checkForEscapeOrReturn: function(e) { + if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; + if (Event.KEY_ESC == e.keyCode) + this.handleFormCancellation(e); + else if (Event.KEY_RETURN == e.keyCode) + this.handleFormSubmission(e); + }, + createControl: function(mode, handler, extraClasses) { + var control = this.options[mode + 'Control']; + var text = this.options[mode + 'Text']; + if ('button' == control) { + var btn = document.createElement('input'); + btn.type = 'submit'; + btn.value = text; + btn.className = 'editor_' + mode + '_button'; + if ('cancel' == mode) + btn.onclick = this._boundCancelHandler; + this._form.appendChild(btn); + this._controls[mode] = btn; + } else if ('link' == control) { + var link = document.createElement('a'); + link.href = '#'; + link.appendChild(document.createTextNode(text)); + link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; + link.className = 'editor_' + mode + '_link'; + if (extraClasses) + link.className += ' ' + extraClasses; + this._form.appendChild(link); + this._controls[mode] = link; + } + }, + createEditField: function() { + var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); + var fld; + if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { + fld = document.createElement('input'); + fld.type = 'text'; + var size = this.options.size || this.options.cols || 0; + if (0 < size) fld.size = size; + } else { + fld = document.createElement('textarea'); + fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); + fld.cols = this.options.cols || 40; + } + fld.name = this.options.paramName; + fld.value = text; // No HTML breaks conversion anymore + fld.className = 'editor_field'; + if (this.options.submitOnBlur) + fld.onblur = this._boundSubmitHandler; + this._controls.editor = fld; + if (this.options.loadTextURL) + this.loadExternalText(); + this._form.appendChild(this._controls.editor); + }, + createForm: function() { + var ipe = this; + function addText(mode, condition) { + var text = ipe.options['text' + mode + 'Controls']; + if (!text || condition === false) return; + ipe._form.appendChild(document.createTextNode(text)); + }; + this._form = $(document.createElement('form')); + this._form.id = this.options.formId; + this._form.addClassName(this.options.formClassName); + this._form.onsubmit = this._boundSubmitHandler; + this.createEditField(); + if ('textarea' == this._controls.editor.tagName.toLowerCase()) + this._form.appendChild(document.createElement('br')); + if (this.options.onFormCustomization) + this.options.onFormCustomization(this, this._form); + addText('Before', this.options.okControl || this.options.cancelControl); + this.createControl('ok', this._boundSubmitHandler); + addText('Between', this.options.okControl && this.options.cancelControl); + this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); + addText('After', this.options.okControl || this.options.cancelControl); + }, + destroy: function() { + if (this._oldInnerHTML) + this.element.innerHTML = this._oldInnerHTML; + this.leaveEditMode(); + this.unregisterListeners(); + }, + enterEditMode: function(e) { + if (this._saving || this._editing) return; + this._editing = true; + this.triggerCallback('onEnterEditMode'); + if (this.options.externalControl) + this.options.externalControl.hide(); + this.element.hide(); + this.createForm(); + this.element.parentNode.insertBefore(this._form, this.element); + if (!this.options.loadTextURL) + this.postProcessEditField(); + if (e) Event.stop(e); + }, + enterHover: function(e) { + if (this.options.hoverClassName) + this.element.addClassName(this.options.hoverClassName); + if (this._saving) return; + this.triggerCallback('onEnterHover'); + }, + getText: function() { + return this.element.innerHTML; + }, + handleAJAXFailure: function(transport) { + this.triggerCallback('onFailure', transport); + if (this._oldInnerHTML) { + this.element.innerHTML = this._oldInnerHTML; + this._oldInnerHTML = null; + } + }, + handleFormCancellation: function(e) { + this.wrapUp(); + if (e) Event.stop(e); + }, + handleFormSubmission: function(e) { + var form = this._form; + var value = $F(this._controls.editor); + this.prepareSubmission(); + var params = this.options.callback(form, value) || ''; + if (Object.isString(params)) + params = params.toQueryParams(); + params.editorId = this.element.id; + if (this.options.htmlResponse) { + var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); + Object.extend(options, { + parameters: params, + onComplete: this._boundWrapperHandler, + onFailure: this._boundFailureHandler + }); + new Ajax.Updater({ success: this.element }, this.url, options); + } else { + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: params, + onComplete: this._boundWrapperHandler, + onFailure: this._boundFailureHandler + }); + new Ajax.Request(this.url, options); + } + if (e) Event.stop(e); + }, + leaveEditMode: function() { + this.element.removeClassName(this.options.savingClassName); + this.removeForm(); + this.leaveHover(); + this.element.style.backgroundColor = this._originalBackground; + this.element.show(); + if (this.options.externalControl) + this.options.externalControl.show(); + this._saving = false; + this._editing = false; + this._oldInnerHTML = null; + this.triggerCallback('onLeaveEditMode'); + }, + leaveHover: function(e) { + if (this.options.hoverClassName) + this.element.removeClassName(this.options.hoverClassName); + if (this._saving) return; + this.triggerCallback('onLeaveHover'); + }, + loadExternalText: function() { + this._form.addClassName(this.options.loadingClassName); + this._controls.editor.disabled = true; + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + this._form.removeClassName(this.options.loadingClassName); + var text = transport.responseText; + if (this.options.stripLoadedTextTags) + text = text.stripTags(); + this._controls.editor.value = text; + this._controls.editor.disabled = false; + this.postProcessEditField(); + }.bind(this), + onFailure: this._boundFailureHandler + }); + new Ajax.Request(this.options.loadTextURL, options); + }, + postProcessEditField: function() { + var fpc = this.options.fieldPostCreation; + if (fpc) + $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); + }, + prepareOptions: function() { + this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); + Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); + [this._extraDefaultOptions].flatten().compact().each(function(defs) { + Object.extend(this.options, defs); + }.bind(this)); + }, + prepareSubmission: function() { + this._saving = true; + this.removeForm(); + this.leaveHover(); + this.showSaving(); + }, + registerListeners: function() { + this._listeners = { }; + var listener; + $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { + listener = this[pair.value].bind(this); + this._listeners[pair.key] = listener; + if (!this.options.externalControlOnly) + this.element.observe(pair.key, listener); + if (this.options.externalControl) + this.options.externalControl.observe(pair.key, listener); + }.bind(this)); + }, + removeForm: function() { + if (!this._form) return; + this._form.remove(); + this._form = null; + this._controls = { }; + }, + showSaving: function() { + this._oldInnerHTML = this.element.innerHTML; + this.element.innerHTML = this.options.savingText; + this.element.addClassName(this.options.savingClassName); + this.element.style.backgroundColor = this._originalBackground; + this.element.show(); + }, + triggerCallback: function(cbName, arg) { + if ('function' == typeof this.options[cbName]) { + this.options[cbName](this, arg); + } + }, + unregisterListeners: function() { + $H(this._listeners).each(function(pair) { + if (!this.options.externalControlOnly) + this.element.stopObserving(pair.key, pair.value); + if (this.options.externalControl) + this.options.externalControl.stopObserving(pair.key, pair.value); + }.bind(this)); + }, + wrapUp: function(transport) { + this.leaveEditMode(); + // Can't use triggerCallback due to backward compatibility: requires + // binding + direct element + this._boundComplete(transport, this.element); + } +}); + +Object.extend(Ajax.InPlaceEditor.prototype, { + dispose: Ajax.InPlaceEditor.prototype.destroy +}); + +Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { + initialize: function($super, element, url, options) { + this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; + $super(element, url, options); + }, + + createEditField: function() { + var list = document.createElement('select'); + list.name = this.options.paramName; + list.size = 1; + this._controls.editor = list; + this._collection = this.options.collection || []; + if (this.options.loadCollectionURL) + this.loadCollection(); + else + this.checkForExternalText(); + this._form.appendChild(this._controls.editor); + }, + + loadCollection: function() { + this._form.addClassName(this.options.loadingClassName); + this.showLoadingText(this.options.loadingCollectionText); + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + var js = transport.responseText.strip(); + if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check + throw 'Server returned an invalid collection representation.'; + this._collection = eval(js); + this.checkForExternalText(); + }.bind(this), + onFailure: this.onFailure + }); + new Ajax.Request(this.options.loadCollectionURL, options); + }, + + showLoadingText: function(text) { + this._controls.editor.disabled = true; + var tempOption = this._controls.editor.firstChild; + if (!tempOption) { + tempOption = document.createElement('option'); + tempOption.value = ''; + this._controls.editor.appendChild(tempOption); + tempOption.selected = true; + } + tempOption.update((text || '').stripScripts().stripTags()); + }, + + checkForExternalText: function() { + this._text = this.getText(); + if (this.options.loadTextURL) + this.loadExternalText(); + else + this.buildOptionList(); + }, + + loadExternalText: function() { + this.showLoadingText(this.options.loadingText); + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + this._text = transport.responseText.strip(); + this.buildOptionList(); + }.bind(this), + onFailure: this.onFailure + }); + new Ajax.Request(this.options.loadTextURL, options); + }, + + buildOptionList: function() { + this._form.removeClassName(this.options.loadingClassName); + this._collection = this._collection.map(function(entry) { + return 2 === entry.length ? entry : [entry, entry].flatten(); + }); + var marker = ('value' in this.options) ? this.options.value : this._text; + var textFound = this._collection.any(function(entry) { + return entry[0] == marker; + }.bind(this)); + this._controls.editor.update(''); + var option; + this._collection.each(function(entry, index) { + option = document.createElement('option'); + option.value = entry[0]; + option.selected = textFound ? entry[0] == marker : 0 == index; + option.appendChild(document.createTextNode(entry[1])); + this._controls.editor.appendChild(option); + }.bind(this)); + this._controls.editor.disabled = false; + Field.scrollFreeActivate(this._controls.editor); + } +}); + +//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** +//**** This only exists for a while, in order to let **** +//**** users adapt to the new API. Read up on the new **** +//**** API and convert your code to it ASAP! **** + +Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { + if (!options) return; + function fallback(name, expr) { + if (name in options || expr === undefined) return; + options[name] = expr; + }; + fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : + options.cancelLink == options.cancelButton == false ? false : undefined))); + fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : + options.okLink == options.okButton == false ? false : undefined))); + fallback('highlightColor', options.highlightcolor); + fallback('highlightEndColor', options.highlightendcolor); +}; + +Object.extend(Ajax.InPlaceEditor, { + DefaultOptions: { + ajaxOptions: { }, + autoRows: 3, // Use when multi-line w/ rows == 1 + cancelControl: 'link', // 'link'|'button'|false + cancelText: 'cancel', + clickToEditText: 'Click to edit', + externalControl: null, // id|elt + externalControlOnly: false, + fieldPostCreation: 'activate', // 'activate'|'focus'|false + formClassName: 'inplaceeditor-form', + formId: null, // id|elt + highlightColor: '#ffff99', + highlightEndColor: '#ffffff', + hoverClassName: '', + htmlResponse: true, + loadingClassName: 'inplaceeditor-loading', + loadingText: 'Loading...', + okControl: 'button', // 'link'|'button'|false + okText: 'ok', + paramName: 'value', + rows: 1, // If 1 and multi-line, uses autoRows + savingClassName: 'inplaceeditor-saving', + savingText: 'Saving...', + size: 0, + stripLoadedTextTags: false, + submitOnBlur: false, + textAfterControls: '', + textBeforeControls: '', + textBetweenControls: '' + }, + DefaultCallbacks: { + callback: function(form) { + return Form.serialize(form); + }, + onComplete: function(transport, element) { + // For backward compatibility, this one is bound to the IPE, and passes + // the element directly. It was too often customized, so we don't break it. + new Effect.Highlight(element, { + startcolor: this.options.highlightColor, keepBackgroundImage: true }); + }, + onEnterEditMode: null, + onEnterHover: function(ipe) { + ipe.element.style.backgroundColor = ipe.options.highlightColor; + if (ipe._effect) + ipe._effect.cancel(); + }, + onFailure: function(transport, ipe) { + alert('Error communication with the server: ' + transport.responseText.stripTags()); + }, + onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. + onLeaveEditMode: null, + onLeaveHover: function(ipe) { + ipe._effect = new Effect.Highlight(ipe.element, { + startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, + restorecolor: ipe._originalBackground, keepBackgroundImage: true + }); + } + }, + Listeners: { + click: 'enterEditMode', + keydown: 'checkForEscapeOrReturn', + mouseover: 'enterHover', + mouseout: 'leaveHover' + } +}); + +Ajax.InPlaceCollectionEditor.DefaultOptions = { + loadingCollectionText: 'Loading options...' +}; + +// Delayed observer, like Form.Element.Observer, +// but waits for delay after last key input +// Ideal for live-search fields + +Form.Element.DelayedObserver = Class.create({ + initialize: function(element, delay, callback) { + this.delay = delay || 0.5; + this.element = $(element); + this.callback = callback; + this.timer = null; + this.lastValue = $F(this.element); + Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); + }, + delayedListener: function(event) { + if(this.lastValue == $F(this.element)) return; + if(this.timer) clearTimeout(this.timer); + this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); + this.lastValue = $F(this.element); + }, + onTimerEvent: function() { + this.timer = null; + this.callback(this.element, $F(this.element)); + } +}); diff --git a/posterita/posterita/web/javascripts/dialogbox.js b/posterita/posterita/web/javascripts/dialogbox.js new file mode 100644 index 0000000000..472a962e19 --- /dev/null +++ b/posterita/posterita/web/javascripts/dialogbox.js @@ -0,0 +1,81 @@ +/* +Copyright sprsquish +All rights reserved. + +http://snippets.dzone.com/user/sprsquish +*/ + +var Dialog = {}; +Dialog.Box = Class.create(); +Object.extend(Dialog.Box.prototype, { + initialize: function(id) { + this.createOverlay(); + + this.dialog_box = $(id); + this.dialog_box.show = this.show.bind(this); + this.dialog_box.hide = this.hide.bind(this); + + this.parent_element = this.dialog_box.parentNode; + + this.dialog_box.style.position = "absolute"; + var e_dims = Element.getDimensions(this.dialog_box); + var b_dims = Element.getDimensions(this.overlay); + this.dialog_box.style.left = ((b_dims.width/2) - (e_dims.width/2)) + 'px'; + this.dialog_box.style.top = '12px'; + this.dialog_box.style.zIndex = this.overlay.style.zIndex + 1; + + }, + + createOverlay: function() { + if($('dialog_overlay')) { + this.overlay = $('dialog_overlay'); + } else { + this.overlay = document.createElement('div'); + this.overlay.id = 'dialog_overlay'; + Object.extend(this.overlay.style, { + position: 'absolute', + top: 0, + left: 0, + zIndex: 90, + width: '100%', + backgroundColor: '#000', + display: 'none' + }); + document.body.insertBefore(this.overlay, document.body.childNodes[0]); + } + }, + + moveDialogBox: function(where) { + Element.remove(this.dialog_box); + if(where == 'back') + this.dialog_box = this.parent_element.appendChild(this.dialog_box); + else + this.dialog_box = this.overlay.parentNode.insertBefore(this.dialog_box, this.overlay); + }, + + show: function() { + this.overlay.style.height = document.body.getHeight()+'px'; + this.moveDialogBox('out'); + this.overlay.onclick = this.hide.bind(this); + this.selectBoxes('hide'); + new Effect.Appear(this.overlay, {duration: 0.1, from: 0.0, to: 0.3}); + this.dialog_box.style.display = ''; + }, + + hide: function() { + this.selectBoxes('show'); + new Effect.Fade(this.overlay, {duration: 0.1}); + this.dialog_box.style.display = 'none'; + this.moveDialogBox('back'); + $A(this.dialog_box.getElementsByTagName('input')).each(function(e){if(e.type!='submit')e.value=''}); + }, + + selectBoxes: function(what) { + $A(document.getElementsByTagName('select')).each(function(select) { + Element[what](select); + }); + + if(what == 'hide') + $A(this.dialog_box.getElementsByTagName('select')).each(function(select){Element.show(select)}) + } +}); \ No newline at end of file diff --git a/posterita/posterita/web/javascripts/dragdrop.js b/posterita/posterita/web/javascripts/dragdrop.js new file mode 100644 index 0000000000..bf429c2616 --- /dev/null +++ b/posterita/posterita/web/javascripts/dragdrop.js @@ -0,0 +1,974 @@ +// script.aculo.us dragdrop.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +if(Object.isUndefined(Effect)) + throw("dragdrop.js requires including script.aculo.us' effects.js library"); + +var Droppables = { + drops: [], + + remove: function(element) { + this.drops = this.drops.reject(function(d) { return d.element==$(element) }); + }, + + add: function(element) { + element = $(element); + var options = Object.extend({ + greedy: true, + hoverclass: null, + tree: false + }, arguments[1] || { }); + + // cache containers + if(options.containment) { + options._containers = []; + var containment = options.containment; + if(Object.isArray(containment)) { + containment.each( function(c) { options._containers.push($(c)) }); + } else { + options._containers.push($(containment)); + } + } + + if(options.accept) options.accept = [options.accept].flatten(); + + Element.makePositioned(element); // fix IE + options.element = element; + + this.drops.push(options); + }, + + findDeepestChild: function(drops) { + deepest = drops[0]; + + for (i = 1; i < drops.length; ++i) + if (Element.isParent(drops[i].element, deepest.element)) + deepest = drops[i]; + + return deepest; + }, + + isContained: function(element, drop) { + var containmentNode; + if(drop.tree) { + containmentNode = element.treeNode; + } else { + containmentNode = element.parentNode; + } + return drop._containers.detect(function(c) { return containmentNode == c }); + }, + + isAffected: function(point, element, drop) { + return ( + (drop.element!=element) && + ((!drop._containers) || + this.isContained(element, drop)) && + ((!drop.accept) || + (Element.classNames(element).detect( + function(v) { return drop.accept.include(v) } ) )) && + Position.within(drop.element, point[0], point[1]) ); + }, + + deactivate: function(drop) { + if(drop.hoverclass) + Element.removeClassName(drop.element, drop.hoverclass); + this.last_active = null; + }, + + activate: function(drop) { + if(drop.hoverclass) + Element.addClassName(drop.element, drop.hoverclass); + this.last_active = drop; + }, + + show: function(point, element) { + if(!this.drops.length) return; + var drop, affected = []; + + this.drops.each( function(drop) { + if(Droppables.isAffected(point, element, drop)) + affected.push(drop); + }); + + if(affected.length>0) + drop = Droppables.findDeepestChild(affected); + + if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); + if (drop) { + Position.within(drop.element, point[0], point[1]); + if(drop.onHover) + drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); + + if (drop != this.last_active) Droppables.activate(drop); + } + }, + + fire: function(event, element) { + if(!this.last_active) return; + Position.prepare(); + + if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) + if (this.last_active.onDrop) { + this.last_active.onDrop(element, this.last_active.element, event); + return true; + } + }, + + reset: function() { + if(this.last_active) + this.deactivate(this.last_active); + } +} + +var Draggables = { + drags: [], + observers: [], + + register: function(draggable) { + if(this.drags.length == 0) { + this.eventMouseUp = this.endDrag.bindAsEventListener(this); + this.eventMouseMove = this.updateDrag.bindAsEventListener(this); + this.eventKeypress = this.keyPress.bindAsEventListener(this); + + Event.observe(document, "mouseup", this.eventMouseUp); + Event.observe(document, "mousemove", this.eventMouseMove); + Event.observe(document, "keypress", this.eventKeypress); + } + this.drags.push(draggable); + }, + + unregister: function(draggable) { + this.drags = this.drags.reject(function(d) { return d==draggable }); + if(this.drags.length == 0) { + Event.stopObserving(document, "mouseup", this.eventMouseUp); + Event.stopObserving(document, "mousemove", this.eventMouseMove); + Event.stopObserving(document, "keypress", this.eventKeypress); + } + }, + + activate: function(draggable) { + if(draggable.options.delay) { + this._timeout = setTimeout(function() { + Draggables._timeout = null; + window.focus(); + Draggables.activeDraggable = draggable; + }.bind(this), draggable.options.delay); + } else { + window.focus(); // allows keypress events if window isn't currently focused, fails for Safari + this.activeDraggable = draggable; + } + }, + + deactivate: function() { + this.activeDraggable = null; + }, + + updateDrag: function(event) { + if(!this.activeDraggable) return; + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + // Mozilla-based browsers fire successive mousemove events with + // the same coordinates, prevent needless redrawing (moz bug?) + if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; + this._lastPointer = pointer; + + this.activeDraggable.updateDrag(event, pointer); + }, + + endDrag: function(event) { + if(this._timeout) { + clearTimeout(this._timeout); + this._timeout = null; + } + if(!this.activeDraggable) return; + this._lastPointer = null; + this.activeDraggable.endDrag(event); + this.activeDraggable = null; + }, + + keyPress: function(event) { + if(this.activeDraggable) + this.activeDraggable.keyPress(event); + }, + + addObserver: function(observer) { + this.observers.push(observer); + this._cacheObserverCallbacks(); + }, + + removeObserver: function(element) { // element instead of observer fixes mem leaks + this.observers = this.observers.reject( function(o) { return o.element==element }); + this._cacheObserverCallbacks(); + }, + + notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' + if(this[eventName+'Count'] > 0) + this.observers.each( function(o) { + if(o[eventName]) o[eventName](eventName, draggable, event); + }); + if(draggable.options[eventName]) draggable.options[eventName](draggable, event); + }, + + _cacheObserverCallbacks: function() { + ['onStart','onEnd','onDrag'].each( function(eventName) { + Draggables[eventName+'Count'] = Draggables.observers.select( + function(o) { return o[eventName]; } + ).length; + }); + } +} + +/*--------------------------------------------------------------------------*/ + +var Draggable = Class.create({ + initialize: function(element) { + var defaults = { + handle: false, + reverteffect: function(element, top_offset, left_offset) { + var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; + new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, + queue: {scope:'_draggable', position:'end'} + }); + }, + endeffect: function(element) { + var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; + new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, + queue: {scope:'_draggable', position:'end'}, + afterFinish: function(){ + Draggable._dragging[element] = false + } + }); + }, + zindex: 1000, + revert: false, + quiet: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } + delay: 0 + }; + + if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) + Object.extend(defaults, { + starteffect: function(element) { + element._opacity = Element.getOpacity(element); + Draggable._dragging[element] = true; + new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); + } + }); + + var options = Object.extend(defaults, arguments[1] || { }); + + this.element = $(element); + + if(options.handle && Object.isString(options.handle)) + this.handle = this.element.down('.'+options.handle, 0); + + if(!this.handle) this.handle = $(options.handle); + if(!this.handle) this.handle = this.element; + + if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { + options.scroll = $(options.scroll); + this._isScrollChild = Element.childOf(this.element, options.scroll); + } + + Element.makePositioned(this.element); // fix IE + + this.options = options; + this.dragging = false; + + this.eventMouseDown = this.initDrag.bindAsEventListener(this); + Event.observe(this.handle, "mousedown", this.eventMouseDown); + + Draggables.register(this); + }, + + destroy: function() { + Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); + Draggables.unregister(this); + }, + + currentDelta: function() { + return([ + parseInt(Element.getStyle(this.element,'left') || '0'), + parseInt(Element.getStyle(this.element,'top') || '0')]); + }, + + initDrag: function(event) { + if(!Object.isUndefined(Draggable._dragging[this.element]) && + Draggable._dragging[this.element]) return; + if(Event.isLeftClick(event)) { + // abort on form elements, fixes a Firefox issue + var src = Event.element(event); + if((tag_name = src.tagName.toUpperCase()) && ( + tag_name=='INPUT' || + tag_name=='SELECT' || + tag_name=='OPTION' || + tag_name=='BUTTON' || + tag_name=='TEXTAREA')) return; + + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var pos = Position.cumulativeOffset(this.element); + this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); + + Draggables.activate(this); + Event.stop(event); + } + }, + + startDrag: function(event) { + this.dragging = true; + if(!this.delta) + this.delta = this.currentDelta(); + + if(this.options.zindex) { + this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); + this.element.style.zIndex = this.options.zindex; + } + + if(this.options.ghosting) { + this._clone = this.element.cloneNode(true); + this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); + if (!this.element._originallyAbsolute) + Position.absolutize(this.element); + this.element.parentNode.insertBefore(this._clone, this.element); + } + + if(this.options.scroll) { + if (this.options.scroll == window) { + var where = this._getWindowScroll(this.options.scroll); + this.originalScrollLeft = where.left; + this.originalScrollTop = where.top; + } else { + this.originalScrollLeft = this.options.scroll.scrollLeft; + this.originalScrollTop = this.options.scroll.scrollTop; + } + } + + Draggables.notify('onStart', this, event); + + if(this.options.starteffect) this.options.starteffect(this.element); + }, + + updateDrag: function(event, pointer) { + if(!this.dragging) this.startDrag(event); + + if(!this.options.quiet){ + Position.prepare(); + Droppables.show(pointer, this.element); + } + + Draggables.notify('onDrag', this, event); + + this.draw(pointer); + if(this.options.change) this.options.change(this); + + if(this.options.scroll) { + this.stopScrolling(); + + var p; + if (this.options.scroll == window) { + with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } + } else { + p = Position.page(this.options.scroll); + p[0] += this.options.scroll.scrollLeft + Position.deltaX; + p[1] += this.options.scroll.scrollTop + Position.deltaY; + p.push(p[0]+this.options.scroll.offsetWidth); + p.push(p[1]+this.options.scroll.offsetHeight); + } + var speed = [0,0]; + if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); + if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); + if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); + if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); + this.startScrolling(speed); + } + + // fix AppleWebKit rendering + if(Prototype.Browser.WebKit) window.scrollBy(0,0); + + Event.stop(event); + }, + + finishDrag: function(event, success) { + this.dragging = false; + + if(this.options.quiet){ + Position.prepare(); + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + Droppables.show(pointer, this.element); + } + + if(this.options.ghosting) { + if (!this.element._originallyAbsolute) + Position.relativize(this.element); + delete this.element._originallyAbsolute; + Element.remove(this._clone); + this._clone = null; + } + + var dropped = false; + if(success) { + dropped = Droppables.fire(event, this.element); + if (!dropped) dropped = false; + } + if(dropped && this.options.onDropped) this.options.onDropped(this.element); + Draggables.notify('onEnd', this, event); + + var revert = this.options.revert; + if(revert && Object.isFunction(revert)) revert = revert(this.element); + + var d = this.currentDelta(); + if(revert && this.options.reverteffect) { + if (dropped == 0 || revert != 'failure') + this.options.reverteffect(this.element, + d[1]-this.delta[1], d[0]-this.delta[0]); + } else { + this.delta = d; + } + + if(this.options.zindex) + this.element.style.zIndex = this.originalZ; + + if(this.options.endeffect) + this.options.endeffect(this.element); + + Draggables.deactivate(this); + Droppables.reset(); + }, + + keyPress: function(event) { + if(event.keyCode!=Event.KEY_ESC) return; + this.finishDrag(event, false); + Event.stop(event); + }, + + endDrag: function(event) { + if(!this.dragging) return; + this.stopScrolling(); + this.finishDrag(event, true); + Event.stop(event); + }, + + draw: function(point) { + var pos = Position.cumulativeOffset(this.element); + if(this.options.ghosting) { + var r = Position.realOffset(this.element); + pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; + } + + var d = this.currentDelta(); + pos[0] -= d[0]; pos[1] -= d[1]; + + if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { + pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; + pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; + } + + var p = [0,1].map(function(i){ + return (point[i]-pos[i]-this.offset[i]) + }.bind(this)); + + if(this.options.snap) { + if(Object.isFunction(this.options.snap)) { + p = this.options.snap(p[0],p[1],this); + } else { + if(Object.isArray(this.options.snap)) { + p = p.map( function(v, i) { + return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)) + } else { + p = p.map( function(v) { + return (v/this.options.snap).round()*this.options.snap }.bind(this)) + } + }} + + var style = this.element.style; + if((!this.options.constraint) || (this.options.constraint=='horizontal')) + style.left = p[0] + "px"; + if((!this.options.constraint) || (this.options.constraint=='vertical')) + style.top = p[1] + "px"; + + if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering + }, + + stopScrolling: function() { + if(this.scrollInterval) { + clearInterval(this.scrollInterval); + this.scrollInterval = null; + Draggables._lastScrollPointer = null; + } + }, + + startScrolling: function(speed) { + if(!(speed[0] || speed[1])) return; + this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; + this.lastScrolled = new Date(); + this.scrollInterval = setInterval(this.scroll.bind(this), 10); + }, + + scroll: function() { + var current = new Date(); + var delta = current - this.lastScrolled; + this.lastScrolled = current; + if(this.options.scroll == window) { + with (this._getWindowScroll(this.options.scroll)) { + if (this.scrollSpeed[0] || this.scrollSpeed[1]) { + var d = delta / 1000; + this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); + } + } + } else { + this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; + this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; + } + + Position.prepare(); + Droppables.show(Draggables._lastPointer, this.element); + Draggables.notify('onDrag', this); + if (this._isScrollChild) { + Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); + Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; + Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; + if (Draggables._lastScrollPointer[0] < 0) + Draggables._lastScrollPointer[0] = 0; + if (Draggables._lastScrollPointer[1] < 0) + Draggables._lastScrollPointer[1] = 0; + this.draw(Draggables._lastScrollPointer); + } + + if(this.options.change) this.options.change(this); + }, + + _getWindowScroll: function(w) { + var T, L, W, H; + with (w.document) { + if (w.document.documentElement && documentElement.scrollTop) { + T = documentElement.scrollTop; + L = documentElement.scrollLeft; + } else if (w.document.body) { + T = body.scrollTop; + L = body.scrollLeft; + } + if (w.innerWidth) { + W = w.innerWidth; + H = w.innerHeight; + } else if (w.document.documentElement && documentElement.clientWidth) { + W = documentElement.clientWidth; + H = documentElement.clientHeight; + } else { + W = body.offsetWidth; + H = body.offsetHeight + } + } + return { top: T, left: L, width: W, height: H }; + } +}); + +Draggable._dragging = { }; + +/*--------------------------------------------------------------------------*/ + +var SortableObserver = Class.create({ + initialize: function(element, observer) { + this.element = $(element); + this.observer = observer; + this.lastValue = Sortable.serialize(this.element); + }, + + onStart: function() { + this.lastValue = Sortable.serialize(this.element); + }, + + onEnd: function() { + Sortable.unmark(); + if(this.lastValue != Sortable.serialize(this.element)) + this.observer(this.element) + } +}); + +var Sortable = { + SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, + + sortables: { }, + + _findRootElement: function(element) { + while (element.tagName.toUpperCase() != "BODY") { + if(element.id && Sortable.sortables[element.id]) return element; + element = element.parentNode; + } + }, + + options: function(element) { + element = Sortable._findRootElement($(element)); + if(!element) return; + return Sortable.sortables[element.id]; + }, + + destroy: function(element){ + var s = Sortable.options(element); + + if(s) { + Draggables.removeObserver(s.element); + s.droppables.each(function(d){ Droppables.remove(d) }); + s.draggables.invoke('destroy'); + + delete Sortable.sortables[s.element.id]; + } + }, + + create: function(element) { + element = $(element); + var options = Object.extend({ + element: element, + tag: 'li', // assumes li children, override with tag: 'tagname' + dropOnEmpty: false, + tree: false, + treeTag: 'ul', + overlap: 'vertical', // one of 'vertical', 'horizontal' + constraint: 'vertical', // one of 'vertical', 'horizontal', false + containment: element, // also takes array of elements (or id's); or false + handle: false, // or a CSS class + only: false, + delay: 0, + hoverclass: null, + ghosting: false, + quiet: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + format: this.SERIALIZE_RULE, + + // these take arrays of elements or ids and can be + // used for better initialization performance + elements: false, + handles: false, + + onChange: Prototype.emptyFunction, + onUpdate: Prototype.emptyFunction + }, arguments[1] || { }); + + // clear any old sortable with same element + this.destroy(element); + + // build options for the draggables + var options_for_draggable = { + revert: true, + quiet: options.quiet, + scroll: options.scroll, + scrollSpeed: options.scrollSpeed, + scrollSensitivity: options.scrollSensitivity, + delay: options.delay, + ghosting: options.ghosting, + constraint: options.constraint, + handle: options.handle }; + + if(options.starteffect) + options_for_draggable.starteffect = options.starteffect; + + if(options.reverteffect) + options_for_draggable.reverteffect = options.reverteffect; + else + if(options.ghosting) options_for_draggable.reverteffect = function(element) { + element.style.top = 0; + element.style.left = 0; + }; + + if(options.endeffect) + options_for_draggable.endeffect = options.endeffect; + + if(options.zindex) + options_for_draggable.zindex = options.zindex; + + // build options for the droppables + var options_for_droppable = { + overlap: options.overlap, + containment: options.containment, + tree: options.tree, + hoverclass: options.hoverclass, + onHover: Sortable.onHover + } + + var options_for_tree = { + onHover: Sortable.onEmptyHover, + overlap: options.overlap, + containment: options.containment, + hoverclass: options.hoverclass + } + + // fix for gecko engine + Element.cleanWhitespace(element); + + options.draggables = []; + options.droppables = []; + + // drop on empty handling + if(options.dropOnEmpty || options.tree) { + Droppables.add(element, options_for_tree); + options.droppables.push(element); + } + + (options.elements || this.findElements(element, options) || []).each( function(e,i) { + var handle = options.handles ? $(options.handles[i]) : + (options.handle ? $(e).select('.' + options.handle)[0] : e); + options.draggables.push( + new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); + Droppables.add(e, options_for_droppable); + if(options.tree) e.treeNode = element; + options.droppables.push(e); + }); + + if(options.tree) { + (Sortable.findTreeElements(element, options) || []).each( function(e) { + Droppables.add(e, options_for_tree); + e.treeNode = element; + options.droppables.push(e); + }); + } + + // keep reference + this.sortables[element.id] = options; + + // for onupdate + Draggables.addObserver(new SortableObserver(element, options.onUpdate)); + + }, + + // return all suitable-for-sortable elements in a guaranteed order + findElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.tag); + }, + + findTreeElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.treeTag); + }, + + onHover: function(element, dropon, overlap) { + if(Element.isParent(dropon, element)) return; + + if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { + return; + } else if(overlap>0.5) { + Sortable.mark(dropon, 'before'); + if(dropon.previousSibling != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, dropon); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } else { + Sortable.mark(dropon, 'after'); + var nextElement = dropon.nextSibling || null; + if(nextElement != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, nextElement); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } + }, + + onEmptyHover: function(element, dropon, overlap) { + var oldParentNode = element.parentNode; + var droponOptions = Sortable.options(dropon); + + if(!Element.isParent(dropon, element)) { + var index; + + var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); + var child = null; + + if(children) { + var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); + + for (index = 0; index < children.length; index += 1) { + if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { + offset -= Element.offsetSize (children[index], droponOptions.overlap); + } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { + child = index + 1 < children.length ? children[index + 1] : null; + break; + } else { + child = children[index]; + break; + } + } + } + + dropon.insertBefore(element, child); + + Sortable.options(oldParentNode).onChange(element); + droponOptions.onChange(element); + } + }, + + unmark: function() { + if(Sortable._marker) Sortable._marker.hide(); + }, + + mark: function(dropon, position) { + // mark on ghosting only + var sortable = Sortable.options(dropon.parentNode); + if(sortable && !sortable.ghosting) return; + + if(!Sortable._marker) { + Sortable._marker = + ($('dropmarker') || Element.extend(document.createElement('DIV'))). + hide().addClassName('dropmarker').setStyle({position:'absolute'}); + document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); + } + var offsets = Position.cumulativeOffset(dropon); + Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); + + if(position=='after') + if(sortable.overlap == 'horizontal') + Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); + else + Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); + + Sortable._marker.show(); + }, + + _tree: function(element, options, parent) { + var children = Sortable.findElements(element, options) || []; + + for (var i = 0; i < children.length; ++i) { + var match = children[i].id.match(options.format); + + if (!match) continue; + + var child = { + id: encodeURIComponent(match ? match[1] : null), + element: element, + parent: parent, + children: [], + position: parent.children.length, + container: $(children[i]).down(options.treeTag) + } + + /* Get the element containing the children and recurse over it */ + if (child.container) + this._tree(child.container, options, child) + + parent.children.push (child); + } + + return parent; + }, + + tree: function(element) { + element = $(element); + var sortableOptions = this.options(element); + var options = Object.extend({ + tag: sortableOptions.tag, + treeTag: sortableOptions.treeTag, + only: sortableOptions.only, + name: element.id, + format: sortableOptions.format + }, arguments[1] || { }); + + var root = { + id: null, + parent: null, + children: [], + container: element, + position: 0 + } + + return Sortable._tree(element, options, root); + }, + + /* Construct a [i] index for a particular node */ + _constructIndex: function(node) { + var index = ''; + do { + if (node.id) index = '[' + node.position + ']' + index; + } while ((node = node.parent) != null); + return index; + }, + + sequence: function(element) { + element = $(element); + var options = Object.extend(this.options(element), arguments[1] || { }); + + return $(this.findElements(element, options) || []).map( function(item) { + return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; + }); + }, + + setSequence: function(element, new_sequence) { + element = $(element); + var options = Object.extend(this.options(element), arguments[2] || { }); + + var nodeMap = { }; + this.findElements(element, options).each( function(n) { + if (n.id.match(options.format)) + nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; + n.parentNode.removeChild(n); + }); + + new_sequence.each(function(ident) { + var n = nodeMap[ident]; + if (n) { + n[1].appendChild(n[0]); + delete nodeMap[ident]; + } + }); + }, + + serialize: function(element) { + element = $(element); + var options = Object.extend(Sortable.options(element), arguments[1] || { }); + var name = encodeURIComponent( + (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); + + if (options.tree) { + return Sortable.tree(element, arguments[1]).children.map( function (item) { + return [name + Sortable._constructIndex(item) + "[id]=" + + encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); + }).flatten().join('&'); + } else { + return Sortable.sequence(element, arguments[1]).map( function(item) { + return name + "[]=" + encodeURIComponent(item); + }).join('&'); + } + } +} + +// Returns true if child is contained within element +Element.isParent = function(child, element) { + if (!child.parentNode || child == element) return false; + if (child.parentNode == element) return true; + return Element.isParent(child.parentNode, element); +} + +Element.findChildren = function(element, only, recursive, tagName) { + if(!element.hasChildNodes()) return null; + tagName = tagName.toUpperCase(); + if(only) only = [only].flatten(); + var elements = []; + $A(element.childNodes).each( function(e) { + if(e.tagName && e.tagName.toUpperCase()==tagName && + (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) + elements.push(e); + if(recursive) { + var grandchildren = Element.findChildren(e, only, recursive, tagName); + if(grandchildren) elements.push(grandchildren); + } + }); + + return (elements.length>0 ? elements.flatten() : []); +} + +Element.offsetSize = function (element, type) { + return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; +} diff --git a/posterita/posterita/web/javascripts/effects.js b/posterita/posterita/web/javascripts/effects.js new file mode 100644 index 0000000000..b8c0259f55 --- /dev/null +++ b/posterita/posterita/web/javascripts/effects.js @@ -0,0 +1,1122 @@ +// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// Contributors: +// Justin Palmer (http://encytemedia.com/) +// Mark Pilgrim (http://diveintomark.org/) +// Martin Bialasinki +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// converts rgb() and #xxx to #xxxxxx format, +// returns self (or first argument) if not convertable +String.prototype.parseColor = function() { + var color = '#'; + if (this.slice(0,4) == 'rgb(') { + var cols = this.slice(4,this.length-1).split(','); + var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); + } else { + if (this.slice(0,1) == '#') { + if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); + if (this.length==7) color = this.toLowerCase(); + } + } + return (color.length==7 ? color : (arguments[0] || this)); +}; + +/*--------------------------------------------------------------------------*/ + +Element.collectTextNodes = function(element) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); + }).flatten().join(''); +}; + +Element.collectTextNodesIgnoreClass = function(element, className) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? + Element.collectTextNodesIgnoreClass(node, className) : '')); + }).flatten().join(''); +}; + +Element.setContentZoom = function(element, percent) { + element = $(element); + element.setStyle({fontSize: (percent/100) + 'em'}); + if (Prototype.Browser.WebKit) window.scrollBy(0,0); + return element; +}; + +Element.getInlineOpacity = function(element){ + return $(element).style.opacity || ''; +}; + +Element.forceRerendering = function(element) { + try { + element = $(element); + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch(e) { } +}; + +/*--------------------------------------------------------------------------*/ + +var Effect = { + _elementDoesNotExistError: { + name: 'ElementDoesNotExistError', + message: 'The specified DOM element does not exist, but is required for this effect to operate' + }, + Transitions: { + linear: Prototype.K, + sinoidal: function(pos) { + return (-Math.cos(pos*Math.PI)/2) + 0.5; + }, + reverse: function(pos) { + return 1-pos; + }, + flicker: function(pos) { + var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; + return pos > 1 ? 1 : pos; + }, + wobble: function(pos) { + return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; + }, + pulse: function(pos, pulses) { + pulses = pulses || 5; + return ( + ((pos % (1/pulses)) * pulses).round() == 0 ? + ((pos * pulses * 2) - (pos * pulses * 2).floor()) : + 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor()) + ); + }, + spring: function(pos) { + return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); + }, + none: function(pos) { + return 0; + }, + full: function(pos) { + return 1; + } + }, + DefaultOptions: { + duration: 1.0, // seconds + fps: 100, // 100= assume 66fps max. + sync: false, // true for combining + from: 0.0, + to: 1.0, + delay: 0.0, + queue: 'parallel' + }, + tagifyText: function(element) { + var tagifyStyle = 'position:relative'; + if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; + + element = $(element); + $A(element.childNodes).each( function(child) { + if (child.nodeType==3) { + child.nodeValue.toArray().each( function(character) { + element.insertBefore( + new Element('span', {style: tagifyStyle}).update( + character == ' ' ? String.fromCharCode(160) : character), + child); + }); + Element.remove(child); + } + }); + }, + multiple: function(element, effect) { + var elements; + if (((typeof element == 'object') || + Object.isFunction(element)) && + (element.length)) + elements = element; + else + elements = $(element).childNodes; + + var options = Object.extend({ + speed: 0.1, + delay: 0.0 + }, arguments[2] || { }); + var masterDelay = options.delay; + + $A(elements).each( function(element, index) { + new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); + }); + }, + PAIRS: { + 'slide': ['SlideDown','SlideUp'], + 'blind': ['BlindDown','BlindUp'], + 'appear': ['Appear','Fade'] + }, + toggle: function(element, effect) { + element = $(element); + effect = (effect || 'appear').toLowerCase(); + var options = Object.extend({ + queue: { position:'end', scope:(element.id || 'global'), limit: 1 } + }, arguments[2] || { }); + Effect[element.visible() ? + Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); + } +}; + +Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; + +/* ------------- core effects ------------- */ + +Effect.ScopedQueue = Class.create(Enumerable, { + initialize: function() { + this.effects = []; + this.interval = null; + }, + _each: function(iterator) { + this.effects._each(iterator); + }, + add: function(effect) { + var timestamp = new Date().getTime(); + + var position = Object.isString(effect.options.queue) ? + effect.options.queue : effect.options.queue.position; + + switch(position) { + case 'front': + // move unstarted effects after this effect + this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { + e.startOn += effect.finishOn; + e.finishOn += effect.finishOn; + }); + break; + case 'with-last': + timestamp = this.effects.pluck('startOn').max() || timestamp; + break; + case 'end': + // start effect after last queued effect has finished + timestamp = this.effects.pluck('finishOn').max() || timestamp; + break; + } + + effect.startOn += timestamp; + effect.finishOn += timestamp; + + if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) + this.effects.push(effect); + + if (!this.interval) + this.interval = setInterval(this.loop.bind(this), 15); + }, + remove: function(effect) { + this.effects = this.effects.reject(function(e) { return e==effect }); + if (this.effects.length == 0) { + clearInterval(this.interval); + this.interval = null; + } + }, + loop: function() { + var timePos = new Date().getTime(); + for(var i=0, len=this.effects.length;i= this.startOn) { + if (timePos >= this.finishOn) { + this.render(1.0); + this.cancel(); + this.event('beforeFinish'); + if (this.finish) this.finish(); + this.event('afterFinish'); + return; + } + var pos = (timePos - this.startOn) / this.totalTime, + frame = (pos * this.totalFrames).round(); + if (frame > this.currentFrame) { + this.render(pos); + this.currentFrame = frame; + } + } + }, + cancel: function() { + if (!this.options.sync) + Effect.Queues.get(Object.isString(this.options.queue) ? + 'global' : this.options.queue.scope).remove(this); + this.state = 'finished'; + }, + event: function(eventName) { + if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); + if (this.options[eventName]) this.options[eventName](this); + }, + inspect: function() { + var data = $H(); + for(property in this) + if (!Object.isFunction(this[property])) data.set(property, this[property]); + return '#'; + } +}); + +Effect.Parallel = Class.create(Effect.Base, { + initialize: function(effects) { + this.effects = effects || []; + this.start(arguments[1]); + }, + update: function(position) { + this.effects.invoke('render', position); + }, + finish: function(position) { + this.effects.each( function(effect) { + effect.render(1.0); + effect.cancel(); + effect.event('beforeFinish'); + if (effect.finish) effect.finish(position); + effect.event('afterFinish'); + }); + } +}); + +Effect.Tween = Class.create(Effect.Base, { + initialize: function(object, from, to) { + object = Object.isString(object) ? $(object) : object; + var args = $A(arguments), method = args.last(), + options = args.length == 5 ? args[3] : null; + this.method = Object.isFunction(method) ? method.bind(object) : + Object.isFunction(object[method]) ? object[method].bind(object) : + function(value) { object[method] = value }; + this.start(Object.extend({ from: from, to: to }, options || { })); + }, + update: function(position) { + this.method(position); + } +}); + +Effect.Event = Class.create(Effect.Base, { + initialize: function() { + this.start(Object.extend({ duration: 0 }, arguments[0] || { })); + }, + update: Prototype.emptyFunction +}); + +Effect.Opacity = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + // make this work on IE on elements without 'layout' + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + var options = Object.extend({ + from: this.element.getOpacity() || 0.0, + to: 1.0 + }, arguments[1] || { }); + this.start(options); + }, + update: function(position) { + this.element.setOpacity(position); + } +}); + +Effect.Move = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + x: 0, + y: 0, + mode: 'relative' + }, arguments[1] || { }); + this.start(options); + }, + setup: function() { + this.element.makePositioned(); + this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); + this.originalTop = parseFloat(this.element.getStyle('top') || '0'); + if (this.options.mode == 'absolute') { + this.options.x = this.options.x - this.originalLeft; + this.options.y = this.options.y - this.originalTop; + } + }, + update: function(position) { + this.element.setStyle({ + left: (this.options.x * position + this.originalLeft).round() + 'px', + top: (this.options.y * position + this.originalTop).round() + 'px' + }); + } +}); + +// for backwards compatibility +Effect.MoveBy = function(element, toTop, toLeft) { + return new Effect.Move(element, + Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); +}; + +Effect.Scale = Class.create(Effect.Base, { + initialize: function(element, percent) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + scaleX: true, + scaleY: true, + scaleContent: true, + scaleFromCenter: false, + scaleMode: 'box', // 'box' or 'contents' or { } with provided values + scaleFrom: 100.0, + scaleTo: percent + }, arguments[2] || { }); + this.start(options); + }, + setup: function() { + this.restoreAfterFinish = this.options.restoreAfterFinish || false; + this.elementPositioning = this.element.getStyle('position'); + + this.originalStyle = { }; + ['top','left','width','height','fontSize'].each( function(k) { + this.originalStyle[k] = this.element.style[k]; + }.bind(this)); + + this.originalTop = this.element.offsetTop; + this.originalLeft = this.element.offsetLeft; + + var fontSize = this.element.getStyle('font-size') || '100%'; + ['em','px','%','pt'].each( function(fontSizeType) { + if (fontSize.indexOf(fontSizeType)>0) { + this.fontSize = parseFloat(fontSize); + this.fontSizeType = fontSizeType; + } + }.bind(this)); + + this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; + + this.dims = null; + if (this.options.scaleMode=='box') + this.dims = [this.element.offsetHeight, this.element.offsetWidth]; + if (/^content/.test(this.options.scaleMode)) + this.dims = [this.element.scrollHeight, this.element.scrollWidth]; + if (!this.dims) + this.dims = [this.options.scaleMode.originalHeight, + this.options.scaleMode.originalWidth]; + }, + update: function(position) { + var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); + if (this.options.scaleContent && this.fontSize) + this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); + this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); + }, + finish: function(position) { + if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); + }, + setDimensions: function(height, width) { + var d = { }; + if (this.options.scaleX) d.width = width.round() + 'px'; + if (this.options.scaleY) d.height = height.round() + 'px'; + if (this.options.scaleFromCenter) { + var topd = (height - this.dims[0])/2; + var leftd = (width - this.dims[1])/2; + if (this.elementPositioning == 'absolute') { + if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; + if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; + } else { + if (this.options.scaleY) d.top = -topd + 'px'; + if (this.options.scaleX) d.left = -leftd + 'px'; + } + } + this.element.setStyle(d); + } +}); + +Effect.Highlight = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); + this.start(options); + }, + setup: function() { + // Prevent executing on elements not in the layout flow + if (this.element.getStyle('display')=='none') { this.cancel(); return; } + // Disable background image during the effect + this.oldStyle = { }; + if (!this.options.keepBackgroundImage) { + this.oldStyle.backgroundImage = this.element.getStyle('background-image'); + this.element.setStyle({backgroundImage: 'none'}); + } + if (!this.options.endcolor) + this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); + if (!this.options.restorecolor) + this.options.restorecolor = this.element.getStyle('background-color'); + // init color calculations + this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); + this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); + }, + update: function(position) { + this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ + return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); + }, + finish: function() { + this.element.setStyle(Object.extend(this.oldStyle, { + backgroundColor: this.options.restorecolor + })); + } +}); + +Effect.ScrollTo = function(element) { + var options = arguments[1] || { }, + scrollOffsets = document.viewport.getScrollOffsets(), + elementOffsets = $(element).cumulativeOffset(), + max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); + + if (options.offset) elementOffsets[1] += options.offset; + + return new Effect.Tween(null, + scrollOffsets.top, + elementOffsets[1] > max ? max : elementOffsets[1], + options, + function(p){ scrollTo(scrollOffsets.left, p.round()) } + ); +}; + +/* ------------- combination effects ------------- */ + +Effect.Fade = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + var options = Object.extend({ + from: element.getOpacity() || 1.0, + to: 0.0, + afterFinishInternal: function(effect) { + if (effect.options.to!=0) return; + effect.element.hide().setStyle({opacity: oldOpacity}); + } + }, arguments[1] || { }); + return new Effect.Opacity(element,options); +}; + +Effect.Appear = function(element) { + element = $(element); + var options = Object.extend({ + from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), + to: 1.0, + // force Safari to render floated elements properly + afterFinishInternal: function(effect) { + effect.element.forceRerendering(); + }, + beforeSetup: function(effect) { + effect.element.setOpacity(effect.options.from).show(); + }}, arguments[1] || { }); + return new Effect.Opacity(element,options); +}; + +Effect.Puff = function(element) { + element = $(element); + var oldStyle = { + opacity: element.getInlineOpacity(), + position: element.getStyle('position'), + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height + }; + return new Effect.Parallel( + [ new Effect.Scale(element, 200, + { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], + Object.extend({ duration: 1.0, + beforeSetupInternal: function(effect) { + Position.absolutize(effect.effects[0].element) + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().setStyle(oldStyle); } + }, arguments[1] || { }) + ); +}; + +Effect.BlindUp = function(element) { + element = $(element); + element.makeClipping(); + return new Effect.Scale(element, 0, + Object.extend({ scaleContent: false, + scaleX: false, + restoreAfterFinish: true, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }, arguments[1] || { }) + ); +}; + +Effect.BlindDown = function(element) { + element = $(element); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: 0, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping(); + } + }, arguments[1] || { })); +}; + +Effect.SwitchOff = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + return new Effect.Appear(element, Object.extend({ + duration: 0.4, + from: 0, + transition: Effect.Transitions.flicker, + afterFinishInternal: function(effect) { + new Effect.Scale(effect.element, 1, { + duration: 0.3, scaleFromCenter: true, + scaleX: false, scaleContent: false, restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); + } + }) + } + }, arguments[1] || { })); +}; + +Effect.DropOut = function(element) { + element = $(element); + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left'), + opacity: element.getInlineOpacity() }; + return new Effect.Parallel( + [ new Effect.Move(element, {x: 0, y: 100, sync: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 }) ], + Object.extend( + { duration: 0.5, + beforeSetup: function(effect) { + effect.effects[0].element.makePositioned(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); + } + }, arguments[1] || { })); +}; + +Effect.Shake = function(element) { + element = $(element); + var options = Object.extend({ + distance: 20, + duration: 0.5 + }, arguments[1] || {}); + var distance = parseFloat(options.distance); + var split = parseFloat(options.duration) / 10.0; + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left') }; + return new Effect.Move(element, + { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { + effect.element.undoPositioned().setStyle(oldStyle); + }}) }}) }}) }}) }}) }}); +}; + +Effect.SlideDown = function(element) { + element = $(element).cleanWhitespace(); + // SlideDown need to have the content of the element wrapped in a container element with fixed height! + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: window.opera ? 0 : 1, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if (window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } + }, arguments[1] || { }) + ); +}; + +Effect.SlideUp = function(element) { + element = $(element).cleanWhitespace(); + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, window.opera ? 0 : 1, + Object.extend({ scaleContent: false, + scaleX: false, + scaleMode: 'box', + scaleFrom: 100, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if (window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); + } + }, arguments[1] || { }) + ); +}; + +// Bug in opera makes the TD containing this element expand for a instance after finish +Effect.Squish = function(element) { + return new Effect.Scale(element, window.opera ? 1 : 0, { + restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }); +}; + +Effect.Grow = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.full + }, arguments[1] || { }); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var initialMoveX, initialMoveY; + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + initialMoveX = initialMoveY = moveX = moveY = 0; + break; + case 'top-right': + initialMoveX = dims.width; + initialMoveY = moveY = 0; + moveX = -dims.width; + break; + case 'bottom-left': + initialMoveX = moveX = 0; + initialMoveY = dims.height; + moveY = -dims.height; + break; + case 'bottom-right': + initialMoveX = dims.width; + initialMoveY = dims.height; + moveX = -dims.width; + moveY = -dims.height; + break; + case 'center': + initialMoveX = dims.width / 2; + initialMoveY = dims.height / 2; + moveX = -dims.width / 2; + moveY = -dims.height / 2; + break; + } + + return new Effect.Move(element, { + x: initialMoveX, + y: initialMoveY, + duration: 0.01, + beforeSetup: function(effect) { + effect.element.hide().makeClipping().makePositioned(); + }, + afterFinishInternal: function(effect) { + new Effect.Parallel( + [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), + new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), + new Effect.Scale(effect.element, 100, { + scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, + sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) + ], Object.extend({ + beforeSetup: function(effect) { + effect.effects[0].element.setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); + } + }, options) + ) + } + }); +}; + +Effect.Shrink = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.none + }, arguments[1] || { }); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + moveX = moveY = 0; + break; + case 'top-right': + moveX = dims.width; + moveY = 0; + break; + case 'bottom-left': + moveX = 0; + moveY = dims.height; + break; + case 'bottom-right': + moveX = dims.width; + moveY = dims.height; + break; + case 'center': + moveX = dims.width / 2; + moveY = dims.height / 2; + break; + } + + return new Effect.Parallel( + [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), + new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), + new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) + ], Object.extend({ + beforeStartInternal: function(effect) { + effect.effects[0].element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } + }, options) + ); +}; + +Effect.Pulsate = function(element) { + element = $(element); + var options = arguments[1] || { }; + var oldOpacity = element.getInlineOpacity(); + var transition = options.transition || Effect.Transitions.sinoidal; + var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) }; + reverser.bind(transition); + return new Effect.Opacity(element, + Object.extend(Object.extend({ duration: 2.0, from: 0, + afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } + }, options), {transition: reverser})); +}; + +Effect.Fold = function(element) { + element = $(element); + var oldStyle = { + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height }; + element.makeClipping(); + return new Effect.Scale(element, 5, Object.extend({ + scaleContent: false, + scaleX: false, + afterFinishInternal: function(effect) { + new Effect.Scale(element, 1, { + scaleContent: false, + scaleY: false, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().setStyle(oldStyle); + } }); + }}, arguments[1] || { })); +}; + +Effect.Morph = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + style: { } + }, arguments[1] || { }); + + if (!Object.isString(options.style)) this.style = $H(options.style); + else { + if (options.style.include(':')) + this.style = options.style.parseStyle(); + else { + this.element.addClassName(options.style); + this.style = $H(this.element.getStyles()); + this.element.removeClassName(options.style); + var css = this.element.getStyles(); + this.style = this.style.reject(function(style) { + return style.value == css[style.key]; + }); + options.afterFinishInternal = function(effect) { + effect.element.addClassName(effect.options.style); + effect.transforms.each(function(transform) { + effect.element.style[transform.style] = ''; + }); + } + } + } + this.start(options); + }, + + setup: function(){ + function parseColor(color){ + if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; + color = color.parseColor(); + return $R(0,2).map(function(i){ + return parseInt( color.slice(i*2+1,i*2+3), 16 ) + }); + } + this.transforms = this.style.map(function(pair){ + var property = pair[0], value = pair[1], unit = null; + + if (value.parseColor('#zzzzzz') != '#zzzzzz') { + value = value.parseColor(); + unit = 'color'; + } else if (property == 'opacity') { + value = parseFloat(value); + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + } else if (Element.CSS_LENGTH.test(value)) { + var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); + value = parseFloat(components[1]); + unit = (components.length == 3) ? components[2] : null; + } + + var originalValue = this.element.getStyle(property); + return { + style: property.camelize(), + originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), + targetValue: unit=='color' ? parseColor(value) : value, + unit: unit + }; + }.bind(this)).reject(function(transform){ + return ( + (transform.originalValue == transform.targetValue) || + ( + transform.unit != 'color' && + (isNaN(transform.originalValue) || isNaN(transform.targetValue)) + ) + ) + }); + }, + update: function(position) { + var style = { }, transform, i = this.transforms.length; + while(i--) + style[(transform = this.transforms[i]).style] = + transform.unit=='color' ? '#'+ + (Math.round(transform.originalValue[0]+ + (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + + (Math.round(transform.originalValue[1]+ + (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + + (Math.round(transform.originalValue[2]+ + (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : + (transform.originalValue + + (transform.targetValue - transform.originalValue) * position).toFixed(3) + + (transform.unit === null ? '' : transform.unit); + this.element.setStyle(style, true); + } +}); + +Effect.Transform = Class.create({ + initialize: function(tracks){ + this.tracks = []; + this.options = arguments[1] || { }; + this.addTracks(tracks); + }, + addTracks: function(tracks){ + tracks.each(function(track){ + track = $H(track); + var data = track.values().first(); + this.tracks.push($H({ + ids: track.keys().first(), + effect: Effect.Morph, + options: { style: data } + })); + }.bind(this)); + return this; + }, + play: function(){ + return new Effect.Parallel( + this.tracks.map(function(track){ + var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); + var elements = [$(ids) || $$(ids)].flatten(); + return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); + }).flatten(), + this.options + ); + } +}); + +Element.CSS_PROPERTIES = $w( + 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + + 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + + 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + + 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + + 'fontSize fontWeight height left letterSpacing lineHeight ' + + 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ + 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + + 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + + 'right textIndent top width wordSpacing zIndex'); + +Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; + +String.__parseStyleElement = document.createElement('div'); +String.prototype.parseStyle = function(){ + var style, styleRules = $H(); + if (Prototype.Browser.WebKit) + style = new Element('div',{style:this}).style; + else { + String.__parseStyleElement.innerHTML = '
    '; + style = String.__parseStyleElement.childNodes[0].style; + } + + Element.CSS_PROPERTIES.each(function(property){ + if (style[property]) styleRules.set(property, style[property]); + }); + + if (Prototype.Browser.IE && this.include('opacity')) + styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); + + return styleRules; +}; + +if (document.defaultView && document.defaultView.getComputedStyle) { + Element.getStyles = function(element) { + var css = document.defaultView.getComputedStyle($(element), null); + return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { + styles[property] = css[property]; + return styles; + }); + }; +} else { + Element.getStyles = function(element) { + element = $(element); + var css = element.currentStyle, styles; + styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { + results[property] = css[property]; + return results; + }); + if (!styles.opacity) styles.opacity = element.getOpacity(); + return styles; + }; +}; + +Effect.Methods = { + morph: function(element, style) { + element = $(element); + new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); + return element; + }, + visualEffect: function(element, effect, options) { + element = $(element) + var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); + new Effect[klass](element, options); + return element; + }, + highlight: function(element, options) { + element = $(element); + new Effect.Highlight(element, options); + return element; + } +}; + +$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ + 'pulsate shake puff squish switchOff dropOut').each( + function(effect) { + Effect.Methods[effect] = function(element, options){ + element = $(element); + Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); + return element; + } + } +); + +$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( + function(f) { Effect.Methods[f] = Element[f]; } +); + +Element.addMethods(Effect.Methods); diff --git a/posterita/posterita/web/javascripts/js-calendar/calendar-en.js b/posterita/posterita/web/javascripts/js-calendar/calendar-en.js new file mode 100644 index 0000000000..0dbde793d8 --- /dev/null +++ b/posterita/posterita/web/javascripts/js-calendar/calendar-en.js @@ -0,0 +1,127 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat", + "Sun"); + +// First day of the week. "0" means display Sunday first, "1" means display +// Monday first, etc. +Calendar._FD = 0; + +// full month names +Calendar._MN = new Array +("January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "About the calendar"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Date selection:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + +"- Hold mouse button on any of the above buttons for faster selection."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Time selection:\n" + +"- Click on any of the time parts to increase it\n" + +"- or Shift-click to decrease it\n" + +"- or click and drag for faster selection."; + +Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; +Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; +Calendar._TT["GO_TODAY"] = "Go Today"; +Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; +Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; +Calendar._TT["SEL_DATE"] = "Select date"; +Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; +Calendar._TT["PART_TODAY"] = " (today)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Display %s first"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Close"; +Calendar._TT["TODAY"] = "Today"; +Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Time:"; diff --git a/posterita/posterita/web/javascripts/js-calendar/calendar-setup.js b/posterita/posterita/web/javascripts/js-calendar/calendar-setup.js new file mode 100644 index 0000000000..f2b4854308 --- /dev/null +++ b/posterita/posterita/web/javascripts/js-calendar/calendar-setup.js @@ -0,0 +1,200 @@ +/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ + * --------------------------------------------------------------------------- + * + * The DHTML Calendar + * + * Details and latest version at: + * http://dynarch.com/mishoo/calendar.epl + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + * + * This file defines helper functions for setting up the calendar. They are + * intended to help non-programmers get a working calendar on their site + * quickly. This script should not be seen as part of the calendar. It just + * shows you what one can do with the calendar, while in the same time + * providing a quick and simple method for setting it up. If you need + * exhaustive customization of the calendar creation process feel free to + * modify this code to suit your needs (this is recommended and much better + * than modifying calendar.js itself). + */ + +// $Id: calendar-setup.js,v 1.25 2005/03/07 09:51:33 mishoo Exp $ + +/** + * This function "patches" an input field (or other element) to use a calendar + * widget for date selection. + * + * The "params" is a single object that can have the following properties: + * + * prop. name | description + * ------------------------------------------------------------------------------------------------- + * inputField | the ID of an input field to store the date + * displayArea | the ID of a DIV or other element to show the date + * button | ID of a button or other element that will trigger the calendar + * eventName | event that will trigger the calendar, without the "on" prefix (default: "click") + * ifFormat | date format that will be stored in the input field + * daFormat | the date format that will be used to display the date in displayArea + * singleClick | (true/false) wether the calendar is in single click mode or not (default: true) + * firstDay | numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc. + * align | alignment (default: "Br"); if you don't know what's this see the calendar documentation + * range | array with 2 elements. Default: [1900, 2999] -- the range of years available + * weekNumbers | (true/false) if it's true (default) the calendar will display week numbers + * flat | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID + * flatCallback | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar) + * disableFunc | function that receives a JS Date object and should return true if that date has to be disabled in the calendar + * onSelect | function that gets called when a date is selected. You don't _have_ to supply this (the default is generally okay) + * onClose | function that gets called when the calendar is closed. [default] + * onUpdate | function that gets called after the date is updated in the input field. Receives a reference to the calendar. + * date | the date that the calendar will be initially displayed to + * showsTime | default: false; if true the calendar will include a time selector + * timeFormat | the time format; can be "12" or "24", default is "12" + * electric | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close + * step | configures the step of the years in drop-down boxes; default: 2 + * position | configures the calendar absolute position; default: null + * cache | if "true" (but default: "false") it will reuse the same calendar object, where possible + * showOthers | if "true" (but default: "false") it will show days from other months too + * + * None of them is required, they all have default values. However, if you + * pass none of "inputField", "displayArea" or "button" you'll get a warning + * saying "nothing to setup". + */ +Calendar.setup = function (params) { + function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } }; + + param_default("inputField", null); + param_default("displayArea", null); + param_default("button", null); + param_default("eventName", "click"); + param_default("ifFormat", "%Y/%m/%d"); + param_default("daFormat", "%Y/%m/%d"); + param_default("singleClick", true); + param_default("disableFunc", null); + param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined + param_default("dateText", null); + param_default("firstDay", null); + param_default("align", "Br"); + param_default("range", [1900, 2999]); + param_default("weekNumbers", true); + param_default("flat", null); + param_default("flatCallback", null); + param_default("onSelect", null); + param_default("onClose", null); + param_default("onUpdate", null); + param_default("date", null); + param_default("showsTime", false); + param_default("timeFormat", "24"); + param_default("electric", true); + param_default("step", 2); + param_default("position", null); + param_default("cache", false); + param_default("showOthers", false); + param_default("multiple", null); + + var tmp = ["inputField", "displayArea", "button"]; + for (var i in tmp) { + if (typeof params[tmp[i]] == "string") { + params[tmp[i]] = document.getElementById(params[tmp[i]]); + } + } + if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) { + alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code"); + return false; + } + + function onSelect(cal) { + var p = cal.params; + var update = (cal.dateClicked || p.electric); + if (update && p.inputField) { + p.inputField.value = cal.date.print(p.ifFormat); + if (typeof p.inputField.onchange == "function") + p.inputField.onchange(); + } + if (update && p.displayArea) + p.displayArea.innerHTML = cal.date.print(p.daFormat); + if (update && typeof p.onUpdate == "function") + p.onUpdate(cal); + if (update && p.flat) { + if (typeof p.flatCallback == "function") + p.flatCallback(cal); + } + if (update && p.singleClick && cal.dateClicked) + cal.callCloseHandler(); + }; + + if (params.flat != null) { + if (typeof params.flat == "string") + params.flat = document.getElementById(params.flat); + if (!params.flat) { + alert("Calendar.setup:\n Flat specified but can't find parent."); + return false; + } + var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect); + cal.showsOtherMonths = params.showOthers; + cal.showsTime = params.showsTime; + cal.time24 = (params.timeFormat == "24"); + cal.params = params; + cal.weekNumbers = params.weekNumbers; + cal.setRange(params.range[0], params.range[1]); + cal.setDateStatusHandler(params.dateStatusFunc); + cal.getDateText = params.dateText; + if (params.ifFormat) { + cal.setDateFormat(params.ifFormat); + } + if (params.inputField && typeof params.inputField.value == "string") { + cal.parseDate(params.inputField.value); + } + cal.create(params.flat); + cal.show(); + return false; + } + + var triggerEl = params.button || params.displayArea || params.inputField; + triggerEl["on" + params.eventName] = function() { + var dateEl = params.inputField || params.displayArea; + var dateFmt = params.inputField ? params.ifFormat : params.daFormat; + var mustCreate = false; + var cal = window.calendar; + if (dateEl) + params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt); + if (!(cal && params.cache)) { + window.calendar = cal = new Calendar(params.firstDay, + params.date, + params.onSelect || onSelect, + params.onClose || function(cal) { cal.hide(); }); + cal.showsTime = params.showsTime; + cal.time24 = (params.timeFormat == "24"); + cal.weekNumbers = params.weekNumbers; + mustCreate = true; + } else { + if (params.date) + cal.setDate(params.date); + cal.hide(); + } + if (params.multiple) { + cal.multiple = {}; + for (var i = params.multiple.length; --i >= 0;) { + var d = params.multiple[i]; + var ds = d.print("%Y%m%d"); + cal.multiple[ds] = d; + } + } + cal.showsOtherMonths = params.showOthers; + cal.yearStep = params.step; + cal.setRange(params.range[0], params.range[1]); + cal.params = params; + cal.setDateStatusHandler(params.dateStatusFunc); + cal.getDateText = params.dateText; + cal.setDateFormat(dateFmt); + if (mustCreate) + cal.create(); + cal.refresh(); + if (!params.position) + cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); + else + cal.showAt(params.position[0], params.position[1]); + return false; + }; + + return cal; +}; diff --git a/posterita/posterita/web/javascripts/js-calendar/calendar.js b/posterita/posterita/web/javascripts/js-calendar/calendar.js new file mode 100644 index 0000000000..9088e0e897 --- /dev/null +++ b/posterita/posterita/web/javascripts/js-calendar/calendar.js @@ -0,0 +1,1806 @@ +/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo + * ----------------------------------------------------------- + * + * The DHTML Calendar, version 1.0 "It is happening again" + * + * Details and latest version at: + * www.dynarch.com/projects/calendar + * + * This script is developed by Dynarch.com. Visit us at www.dynarch.com. + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + */ + +// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $ + +/** The Calendar object constructor. */ +Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { + // member variables + this.activeDiv = null; + this.currentDateEl = null; + this.getDateStatus = null; + this.getDateToolTip = null; + this.getDateText = null; + this.timeout = null; + this.onSelected = onSelected || null; + this.onClose = onClose || null; + this.dragging = false; + this.hidden = false; + this.minYear = 1970; + this.maxYear = 2050; + this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; + this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; + this.isPopup = true; + this.weekNumbers = true; + this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. + this.showsOtherMonths = false; + this.dateStr = dateStr; + this.ar_days = null; + this.showsTime = false; + this.time24 = true; + this.yearStep = 2; + this.hiliteToday = true; + this.multiple = null; + // HTML elements + this.table = null; + this.element = null; + this.tbody = null; + this.firstdayname = null; + // Combo boxes + this.monthsCombo = null; + this.yearsCombo = null; + this.hilitedMonth = null; + this.activeMonth = null; + this.hilitedYear = null; + this.activeYear = null; + // Information + this.dateClicked = false; + + // one-time initializations + if (typeof Calendar._SDN == "undefined") { + // table of short day names + if (typeof Calendar._SDN_len == "undefined") + Calendar._SDN_len = 3; + var ar = new Array(); + for (var i = 8; i > 0;) { + ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); + } + Calendar._SDN = ar; + // table of short month names + if (typeof Calendar._SMN_len == "undefined") + Calendar._SMN_len = 3; + ar = new Array(); + for (var i = 12; i > 0;) { + ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); + } + Calendar._SMN = ar; + } +}; + +// ** constants + +/// "static", needed for event handlers. +Calendar._C = null; + +/// detect a special case of "web browser" +Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && + !/opera/i.test(navigator.userAgent) ); + +Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); + +/// detect Opera browser +Calendar.is_opera = /opera/i.test(navigator.userAgent); + +/// detect KHTML-based browsers +Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); + +// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate +// library, at some point. + +Calendar.getAbsolutePos = function(el) { + var SL = 0, ST = 0; + var is_div = /^div$/i.test(el.tagName); + if (is_div && el.scrollLeft) + SL = el.scrollLeft; + if (is_div && el.scrollTop) + ST = el.scrollTop; + var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; + if (el.offsetParent) { + var tmp = this.getAbsolutePos(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; +}; + +Calendar.isRelated = function (el, evt) { + var related = evt.relatedTarget; + if (!related) { + var type = evt.type; + if (type == "mouseover") { + related = evt.fromElement; + } else if (type == "mouseout") { + related = evt.toElement; + } + } + while (related) { + if (related == el) { + return true; + } + related = related.parentNode; + } + return false; +}; + +Calendar.removeClass = function(el, className) { + if (!(el && el.className)) { + return; + } + var cls = el.className.split(" "); + var ar = new Array(); + for (var i = cls.length; i > 0;) { + if (cls[--i] != className) { + ar[ar.length] = cls[i]; + } + } + el.className = ar.join(" "); +}; + +Calendar.addClass = function(el, className) { + Calendar.removeClass(el, className); + el.className += " " + className; +}; + +// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. +Calendar.getElement = function(ev) { + var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; + while (f.nodeType != 1 || /^div$/i.test(f.tagName)) + f = f.parentNode; + return f; +}; + +Calendar.getTargetElement = function(ev) { + var f = Calendar.is_ie ? window.event.srcElement : ev.target; + while (f.nodeType != 1) + f = f.parentNode; + return f; +}; + +Calendar.stopEvent = function(ev) { + ev || (ev = window.event); + if (Calendar.is_ie) { + ev.cancelBubble = true; + ev.returnValue = false; + } else { + ev.preventDefault(); + ev.stopPropagation(); + } + return false; +}; + +Calendar.addEvent = function(el, evname, func) { + if (el.attachEvent) { // IE + el.attachEvent("on" + evname, func); + } else if (el.addEventListener) { // Gecko / W3C + el.addEventListener(evname, func, true); + } else { + el["on" + evname] = func; + } +}; + +Calendar.removeEvent = function(el, evname, func) { + if (el.detachEvent) { // IE + el.detachEvent("on" + evname, func); + } else if (el.removeEventListener) { // Gecko / W3C + el.removeEventListener(evname, func, true); + } else { + el["on" + evname] = null; + } +}; + +Calendar.createElement = function(type, parent) { + var el = null; + if (document.createElementNS) { + // use the XHTML namespace; IE won't normally get here unless + // _they_ "fix" the DOM2 implementation. + el = document.createElementNS("http://www.w3.org/1999/xhtml", type); + } else { + el = document.createElement(type); + } + if (typeof parent != "undefined") { + parent.appendChild(el); + } + return el; +}; + +// END: UTILITY FUNCTIONS + +// BEGIN: CALENDAR STATIC FUNCTIONS + +/** Internal -- adds a set of events to make some element behave like a button. */ +Calendar._add_evs = function(el) { + with (Calendar) { + addEvent(el, "mouseover", dayMouseOver); + addEvent(el, "mousedown", dayMouseDown); + addEvent(el, "mouseout", dayMouseOut); + if (is_ie) { + addEvent(el, "dblclick", dayMouseDblClick); + el.setAttribute("unselectable", true); + } + } +}; + +Calendar.findMonth = function(el) { + if (typeof el.month != "undefined") { + return el; + } else if (typeof el.parentNode.month != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.findYear = function(el) { + if (typeof el.year != "undefined") { + return el; + } else if (typeof el.parentNode.year != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.showMonthsCombo = function () { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var mc = cal.monthsCombo; + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + if (cal.activeMonth) { + Calendar.removeClass(cal.activeMonth, "active"); + } + var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; + Calendar.addClass(mon, "active"); + cal.activeMonth = mon; + var s = mc.style; + s.display = "block"; + if (cd.navtype < 0) + s.left = cd.offsetLeft + "px"; + else { + var mcw = mc.offsetWidth; + if (typeof mcw == "undefined") + // Konqueror brain-dead techniques + mcw = 50; + s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; + } + s.top = (cd.offsetTop + cd.offsetHeight) + "px"; +}; + +Calendar.showYearsCombo = function (fwd) { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var yc = cal.yearsCombo; + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + if (cal.activeYear) { + Calendar.removeClass(cal.activeYear, "active"); + } + cal.activeYear = null; + var Y = cal.date.getFullYear() + (fwd ? 1 : -1); + var yr = yc.firstChild; + var show = false; + for (var i = 12; i > 0; --i) { + if (Y >= cal.minYear && Y <= cal.maxYear) { + yr.innerHTML = Y; + yr.year = Y; + yr.style.display = "block"; + show = true; + } else { + yr.style.display = "none"; + } + yr = yr.nextSibling; + Y += fwd ? cal.yearStep : -cal.yearStep; + } + if (show) { + var s = yc.style; + s.display = "block"; + if (cd.navtype < 0) + s.left = cd.offsetLeft + "px"; + else { + var ycw = yc.offsetWidth; + if (typeof ycw == "undefined") + // Konqueror brain-dead techniques + ycw = 50; + s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; + } + s.top = (cd.offsetTop + cd.offsetHeight) + "px"; + } +}; + +// event handlers + +Calendar.tableMouseUp = function(ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + if (cal.timeout) { + clearTimeout(cal.timeout); + } + var el = cal.activeDiv; + if (!el) { + return false; + } + var target = Calendar.getTargetElement(ev); + ev || (ev = window.event); + Calendar.removeClass(el, "active"); + if (target == el || target.parentNode == el) { + Calendar.cellClick(el, ev); + } + var mon = Calendar.findMonth(target); + var date = null; + if (mon) { + date = new Date(cal.date); + if (mon.month != date.getMonth()) { + date.setMonth(mon.month); + cal.setDate(date); + cal.dateClicked = false; + cal.callHandler(); + } + } else { + var year = Calendar.findYear(target); + if (year) { + date = new Date(cal.date); + if (year.year != date.getFullYear()) { + date.setFullYear(year.year); + cal.setDate(date); + cal.dateClicked = false; + cal.callHandler(); + } + } + } + with (Calendar) { + removeEvent(document, "mouseup", tableMouseUp); + removeEvent(document, "mouseover", tableMouseOver); + removeEvent(document, "mousemove", tableMouseOver); + cal._hideCombos(); + _C = null; + return stopEvent(ev); + } +}; + +Calendar.tableMouseOver = function (ev) { + var cal = Calendar._C; + if (!cal) { + return; + } + var el = cal.activeDiv; + var target = Calendar.getTargetElement(ev); + if (target == el || target.parentNode == el) { + Calendar.addClass(el, "hilite active"); + Calendar.addClass(el.parentNode, "rowhilite"); + } else { + if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) + Calendar.removeClass(el, "active"); + Calendar.removeClass(el, "hilite"); + Calendar.removeClass(el.parentNode, "rowhilite"); + } + ev || (ev = window.event); + if (el.navtype == 50 && target != el) { + var pos = Calendar.getAbsolutePos(el); + var w = el.offsetWidth; + var x = ev.clientX; + var dx; + var decrease = true; + if (x > pos.x + w) { + dx = x - pos.x - w; + decrease = false; + } else + dx = pos.x - x; + + if (dx < 0) dx = 0; + var range = el._range; + var current = el._current; + var count = Math.floor(dx / 10) % range.length; + for (var i = range.length; --i >= 0;) + if (range[i] == current) + break; + while (count-- > 0) + if (decrease) { + if (--i < 0) + i = range.length - 1; + } else if ( ++i >= range.length ) + i = 0; + var newval = range[i]; + el.innerHTML = newval; + + cal.onUpdateTime(); + } + var mon = Calendar.findMonth(target); + if (mon) { + if (mon.month != cal.date.getMonth()) { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + Calendar.addClass(mon, "hilite"); + cal.hilitedMonth = mon; + } else if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + } else { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + var year = Calendar.findYear(target); + if (year) { + if (year.year != cal.date.getFullYear()) { + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + Calendar.addClass(year, "hilite"); + cal.hilitedYear = year; + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } + return Calendar.stopEvent(ev); +}; + +Calendar.tableMouseDown = function (ev) { + if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { + return Calendar.stopEvent(ev); + } +}; + +Calendar.calDragIt = function (ev) { + var cal = Calendar._C; + if (!(cal && cal.dragging)) { + return false; + } + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posX = ev.pageX; + posY = ev.pageY; + } + cal.hideShowCovered(); + var st = cal.element.style; + st.left = (posX - cal.xOffs) + "px"; + st.top = (posY - cal.yOffs) + "px"; + return Calendar.stopEvent(ev); +}; + +Calendar.calDragEnd = function (ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + cal.dragging = false; + with (Calendar) { + removeEvent(document, "mousemove", calDragIt); + removeEvent(document, "mouseup", calDragEnd); + tableMouseUp(ev); + } + cal.hideShowCovered(); +}; + +Calendar.dayMouseDown = function(ev) { + var el = Calendar.getElement(ev); + if (el.disabled) { + return false; + } + var cal = el.calendar; + cal.activeDiv = el; + Calendar._C = cal; + if (el.navtype != 300) with (Calendar) { + if (el.navtype == 50) { + el._current = el.innerHTML; + addEvent(document, "mousemove", tableMouseOver); + } else + addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); + addClass(el, "hilite active"); + addEvent(document, "mouseup", tableMouseUp); + } else if (cal.isPopup) { + cal._dragStart(ev); + } + if (el.navtype == -1 || el.navtype == 1) { + if (cal.timeout) clearTimeout(cal.timeout); + cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); + } else if (el.navtype == -2 || el.navtype == 2) { + if (cal.timeout) clearTimeout(cal.timeout); + cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); + } else { + cal.timeout = null; + } + return Calendar.stopEvent(ev); +}; + +Calendar.dayMouseDblClick = function(ev) { + Calendar.cellClick(Calendar.getElement(ev), ev || window.event); + if (Calendar.is_ie) { + document.selection.empty(); + } +}; + +Calendar.dayMouseOver = function(ev) { + var el = Calendar.getElement(ev); + if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { + return false; + } + if (el.ttip) { + if (el.ttip.substr(0, 1) == "_") { + el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); + } + el.calendar.tooltips.innerHTML = el.ttip; + } + if (el.navtype != 300) { + Calendar.addClass(el, "hilite"); + if (el.caldate) { + Calendar.addClass(el.parentNode, "rowhilite"); + } + } + return Calendar.stopEvent(ev); +}; + +Calendar.dayMouseOut = function(ev) { + with (Calendar) { + var el = getElement(ev); + if (isRelated(el, ev) || _C || el.disabled) + return false; + removeClass(el, "hilite"); + if (el.caldate) + removeClass(el.parentNode, "rowhilite"); + if (el.calendar) + el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; + return stopEvent(ev); + } +}; + +/** + * A generic "click" handler :) handles all types of buttons defined in this + * calendar. + */ +Calendar.cellClick = function(el, ev) { + var cal = el.calendar; + var closing = false; + var newdate = false; + var date = null; + if (typeof el.navtype == "undefined") { + if (cal.currentDateEl) { + Calendar.removeClass(cal.currentDateEl, "selected"); + Calendar.addClass(el, "selected"); + closing = (cal.currentDateEl == el); + if (!closing) { + cal.currentDateEl = el; + } + } + cal.date.setDateOnly(el.caldate); + date = cal.date; + var other_month = !(cal.dateClicked = !el.otherMonth); + if (!other_month && !cal.currentDateEl) + cal._toggleMultipleDate(new Date(date)); + else + newdate = !el.disabled; + // a date was clicked + if (other_month) + cal._init(cal.firstDayOfWeek, date); + } else { + if (el.navtype == 200) { + Calendar.removeClass(el, "hilite"); + cal.callCloseHandler(); + return; + } + date = new Date(cal.date); + if (el.navtype == 0) + date.setDateOnly(new Date()); // TODAY + // unless "today" was clicked, we assume no date was clicked so + // the selected handler will know not to close the calenar when + // in single-click mode. + // cal.dateClicked = (el.navtype == 0); + cal.dateClicked = false; + var year = date.getFullYear(); + var mon = date.getMonth(); + function setMonth(m) { + var day = date.getDate(); + var max = date.getMonthDays(m); + if (day > max) { + date.setDate(max); + } + date.setMonth(m); + }; + switch (el.navtype) { + case 400: + Calendar.removeClass(el, "hilite"); + var text = Calendar._TT["ABOUT"]; + if (typeof text != "undefined") { + text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; + } else { + // FIXME: this should be removed as soon as lang files get updated! + text = "Help and about box text is not translated into this language.\n" + + "If you know this language and you feel generous please update\n" + + "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + + "and send it back to to get it into the distribution ;-)\n\n" + + "Thank you!\n" + + "http://dynarch.com/mishoo/calendar.epl\n"; + } + alert(text); + return; + case -2: + if (year > cal.minYear) { + date.setFullYear(year - 1); + } + break; + case -1: + if (mon > 0) { + setMonth(mon - 1); + } else if (year-- > cal.minYear) { + date.setFullYear(year); + setMonth(11); + } + break; + case 1: + if (mon < 11) { + setMonth(mon + 1); + } else if (year < cal.maxYear) { + date.setFullYear(year + 1); + setMonth(0); + } + break; + case 2: + if (year < cal.maxYear) { + date.setFullYear(year + 1); + } + break; + case 100: + cal.setFirstDayOfWeek(el.fdow); + return; + case 50: + var range = el._range; + var current = el.innerHTML; + for (var i = range.length; --i >= 0;) + if (range[i] == current) + break; + if (ev && ev.shiftKey) { + if (--i < 0) + i = range.length - 1; + } else if ( ++i >= range.length ) + i = 0; + var newval = range[i]; + el.innerHTML = newval; + cal.onUpdateTime(); + return; + case 0: + // TODAY will bring us here + if ((typeof cal.getDateStatus == "function") && + cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { + return false; + } + break; + } + if (!date.equalsTo(cal.date)) { + cal.setDate(date); + newdate = true; + } else if (el.navtype == 0) + newdate = closing = true; + } + if (newdate) { + ev && cal.callHandler(); + } + if (closing) { + Calendar.removeClass(el, "hilite"); + ev && cal.callCloseHandler(); + } +}; + +// END: CALENDAR STATIC FUNCTIONS + +// BEGIN: CALENDAR OBJECT FUNCTIONS + +/** + * This function creates the calendar inside the given parent. If _par is + * null than it creates a popup calendar inside the BODY element. If _par is + * an element, be it BODY, then it creates a non-popup calendar (still + * hidden). Some properties need to be set before calling this function. + */ +Calendar.prototype.create = function (_par) { + var parent = null; + if (! _par) { + // default parent is the document body, in which case we create + // a popup calendar. + parent = document.getElementsByTagName("body")[0]; + this.isPopup = true; + } else { + parent = _par; + this.isPopup = false; + } + this.date = this.dateStr ? new Date(this.dateStr) : new Date(); + + var table = Calendar.createElement("table"); + this.table = table; + table.cellSpacing = 0; + table.cellPadding = 0; + table.calendar = this; + Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); + + var div = Calendar.createElement("div"); + this.element = div; + div.className = "calendar"; + if (this.isPopup) { + div.style.position = "absolute"; + div.style.display = "none"; + } + div.appendChild(table); + + var thead = Calendar.createElement("thead", table); + var cell = null; + var row = null; + + var cal = this; + var hh = function (text, cs, navtype) { + cell = Calendar.createElement("td", row); + cell.colSpan = cs; + cell.className = "button"; + if (navtype != 0 && Math.abs(navtype) <= 2) + cell.className += " nav"; + Calendar._add_evs(cell); + cell.calendar = cal; + cell.navtype = navtype; + cell.innerHTML = "
    " + text + "
    "; + return cell; + }; + + row = Calendar.createElement("tr", thead); + var title_length = 6; + (this.isPopup) && --title_length; + (this.weekNumbers) && ++title_length; + + hh("?", 1, 400).ttip = Calendar._TT["INFO"]; + this.title = hh("", title_length, 300); + this.title.className = "title"; + if (this.isPopup) { + this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; + this.title.style.cursor = "move"; + hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; + } + + row = Calendar.createElement("tr", thead); + row.className = "headrow"; + + this._nav_py = hh("«", 1, -2); + this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; + + this._nav_pm = hh("‹", 1, -1); + this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; + + this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); + this._nav_now.ttip = Calendar._TT["GO_TODAY"]; + + this._nav_nm = hh("›", 1, 1); + this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; + + this._nav_ny = hh("»", 1, 2); + this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; + + // day names + row = Calendar.createElement("tr", thead); + row.className = "daynames"; + if (this.weekNumbers) { + cell = Calendar.createElement("td", row); + cell.className = "name wn"; + cell.innerHTML = Calendar._TT["WK"]; + } + for (var i = 7; i > 0; --i) { + cell = Calendar.createElement("td", row); + if (!i) { + cell.navtype = 100; + cell.calendar = this; + Calendar._add_evs(cell); + } + } + this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; + this._displayWeekdays(); + + var tbody = Calendar.createElement("tbody", table); + this.tbody = tbody; + + for (i = 6; i > 0; --i) { + row = Calendar.createElement("tr", tbody); + if (this.weekNumbers) { + cell = Calendar.createElement("td", row); + } + for (var j = 7; j > 0; --j) { + cell = Calendar.createElement("td", row); + cell.calendar = this; + Calendar._add_evs(cell); + } + } + + if (this.showsTime) { + row = Calendar.createElement("tr", tbody); + row.className = "time"; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + cell.innerHTML = Calendar._TT["TIME"] || " "; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = this.weekNumbers ? 4 : 3; + + (function(){ + function makeTimePart(className, init, range_start, range_end) { + var part = Calendar.createElement("span", cell); + part.className = className; + part.innerHTML = init; + part.calendar = cal; + part.ttip = Calendar._TT["TIME_PART"]; + part.navtype = 50; + part._range = []; + if (typeof range_start != "number") + part._range = range_start; + else { + for (var i = range_start; i <= range_end; ++i) { + var txt; + if (i < 10 && range_end >= 10) txt = '0' + i; + else txt = '' + i; + part._range[part._range.length] = txt; + } + } + Calendar._add_evs(part); + return part; + }; + var hrs = cal.date.getHours(); + var mins = cal.date.getMinutes(); + var t12 = !cal.time24; + var pm = (hrs > 12); + if (t12 && pm) hrs -= 12; + var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); + var span = Calendar.createElement("span", cell); + span.innerHTML = ":"; + span.className = "colon"; + var M = makeTimePart("minute", mins, 0, 59); + var AP = null; + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + if (t12) + AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); + else + cell.innerHTML = " "; + + cal.onSetTime = function() { + var pm, hrs = this.date.getHours(), + mins = this.date.getMinutes(); + if (t12) { + pm = (hrs >= 12); + if (pm) hrs -= 12; + if (hrs == 0) hrs = 12; + AP.innerHTML = pm ? "pm" : "am"; + } + H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; + M.innerHTML = (mins < 10) ? ("0" + mins) : mins; + }; + + cal.onUpdateTime = function() { + var date = this.date; + var h = parseInt(H.innerHTML, 10); + if (t12) { + if (/pm/i.test(AP.innerHTML) && h < 12) + h += 12; + else if (/am/i.test(AP.innerHTML) && h == 12) + h = 0; + } + var d = date.getDate(); + var m = date.getMonth(); + var y = date.getFullYear(); + date.setHours(h); + date.setMinutes(parseInt(M.innerHTML, 10)); + date.setFullYear(y); + date.setMonth(m); + date.setDate(d); + this.dateClicked = false; + this.callHandler(); + }; + })(); + } else { + this.onSetTime = this.onUpdateTime = function() {}; + } + + var tfoot = Calendar.createElement("tfoot", table); + + row = Calendar.createElement("tr", tfoot); + row.className = "footrow"; + + cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); + cell.className = "ttip"; + if (this.isPopup) { + cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; + cell.style.cursor = "move"; + } + this.tooltips = cell; + + div = Calendar.createElement("div", this.element); + this.monthsCombo = div; + div.className = "combo"; + for (i = 0; i < Calendar._MN.length; ++i) { + var mn = Calendar.createElement("div"); + mn.className = Calendar.is_ie ? "label-IEfix" : "label"; + mn.month = i; + mn.innerHTML = Calendar._SMN[i]; + div.appendChild(mn); + } + + div = Calendar.createElement("div", this.element); + this.yearsCombo = div; + div.className = "combo"; + for (i = 12; i > 0; --i) { + var yr = Calendar.createElement("div"); + yr.className = Calendar.is_ie ? "label-IEfix" : "label"; + div.appendChild(yr); + } + + this._init(this.firstDayOfWeek, this.date); + parent.appendChild(this.element); +}; + +/** keyboard navigation, only for popup calendars */ +Calendar._keyEvent = function(ev) { + var cal = window._dynarch_popupCalendar; + if (!cal || cal.multiple) + return false; + (Calendar.is_ie) && (ev = window.event); + var act = (Calendar.is_ie || ev.type == "keypress"), + K = ev.keyCode; + if (ev.ctrlKey) { + switch (K) { + case 37: // KEY left + act && Calendar.cellClick(cal._nav_pm); + break; + case 38: // KEY up + act && Calendar.cellClick(cal._nav_py); + break; + case 39: // KEY right + act && Calendar.cellClick(cal._nav_nm); + break; + case 40: // KEY down + act && Calendar.cellClick(cal._nav_ny); + break; + default: + return false; + } + } else switch (K) { + case 32: // KEY space (now) + Calendar.cellClick(cal._nav_now); + break; + case 27: // KEY esc + act && cal.callCloseHandler(); + break; + case 37: // KEY left + case 38: // KEY up + case 39: // KEY right + case 40: // KEY down + if (act) { + var prev, x, y, ne, el, step; + prev = K == 37 || K == 38; + step = (K == 37 || K == 39) ? 1 : 7; + function setVars() { + el = cal.currentDateEl; + var p = el.pos; + x = p & 15; + y = p >> 4; + ne = cal.ar_days[y][x]; + };setVars(); + function prevMonth() { + var date = new Date(cal.date); + date.setDate(date.getDate() - step); + cal.setDate(date); + }; + function nextMonth() { + var date = new Date(cal.date); + date.setDate(date.getDate() + step); + cal.setDate(date); + }; + while (1) { + switch (K) { + case 37: // KEY left + if (--x >= 0) + ne = cal.ar_days[y][x]; + else { + x = 6; + K = 38; + continue; + } + break; + case 38: // KEY up + if (--y >= 0) + ne = cal.ar_days[y][x]; + else { + prevMonth(); + setVars(); + } + break; + case 39: // KEY right + if (++x < 7) + ne = cal.ar_days[y][x]; + else { + x = 0; + K = 40; + continue; + } + break; + case 40: // KEY down + if (++y < cal.ar_days.length) + ne = cal.ar_days[y][x]; + else { + nextMonth(); + setVars(); + } + break; + } + break; + } + if (ne) { + if (!ne.disabled) + Calendar.cellClick(ne); + else if (prev) + prevMonth(); + else + nextMonth(); + } + } + break; + case 13: // KEY enter + if (act) + Calendar.cellClick(cal.currentDateEl, ev); + break; + default: + return false; + } + return Calendar.stopEvent(ev); +}; + +/** + * (RE)Initializes the calendar to the given date and firstDayOfWeek + */ +Calendar.prototype._init = function (firstDayOfWeek, date) { + var today = new Date(), + TY = today.getFullYear(), + TM = today.getMonth(), + TD = today.getDate(); + this.table.style.visibility = "hidden"; + var year = date.getFullYear(); + if (year < this.minYear) { + year = this.minYear; + date.setFullYear(year); + } else if (year > this.maxYear) { + year = this.maxYear; + date.setFullYear(year); + } + this.firstDayOfWeek = firstDayOfWeek; + this.date = new Date(date); + var month = date.getMonth(); + var mday = date.getDate(); + var no_days = date.getMonthDays(); + + // calendar voodoo for computing the first day that would actually be + // displayed in the calendar, even if it's from the previous month. + // WARNING: this is magic. ;-) + date.setDate(1); + var day1 = (date.getDay() - this.firstDayOfWeek) % 7; + if (day1 < 0) + day1 += 7; + date.setDate(-day1); + date.setDate(date.getDate() + 1); + + var row = this.tbody.firstChild; + var MN = Calendar._SMN[month]; + var ar_days = this.ar_days = new Array(); + var weekend = Calendar._TT["WEEKEND"]; + var dates = this.multiple ? (this.datesCells = {}) : null; + for (var i = 0; i < 6; ++i, row = row.nextSibling) { + var cell = row.firstChild; + if (this.weekNumbers) { + cell.className = "day wn"; + cell.innerHTML = date.getWeekNumber(); + cell = cell.nextSibling; + } + row.className = "daysrow"; + var hasdays = false, iday, dpos = ar_days[i] = []; + for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { + iday = date.getDate(); + var wday = date.getDay(); + cell.className = "day"; + cell.pos = i << 4 | j; + dpos[j] = cell; + var current_month = (date.getMonth() == month); + if (!current_month) { + if (this.showsOtherMonths) { + cell.className += " othermonth"; + cell.otherMonth = true; + } else { + cell.className = "emptycell"; + cell.innerHTML = " "; + cell.disabled = true; + continue; + } + } else { + cell.otherMonth = false; + hasdays = true; + } + cell.disabled = false; + cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; + if (dates) + dates[date.print("%Y%m%d")] = cell; + if (this.getDateStatus) { + var status = this.getDateStatus(date, year, month, iday); + if (this.getDateToolTip) { + var toolTip = this.getDateToolTip(date, year, month, iday); + if (toolTip) + cell.title = toolTip; + } + if (status === true) { + cell.className += " disabled"; + cell.disabled = true; + } else { + if (/disabled/i.test(status)) + cell.disabled = true; + cell.className += " " + status; + } + } + if (!cell.disabled) { + cell.caldate = new Date(date); + cell.ttip = "_"; + if (!this.multiple && current_month + && iday == mday && this.hiliteToday) { + cell.className += " selected"; + this.currentDateEl = cell; + } + if (date.getFullYear() == TY && + date.getMonth() == TM && + iday == TD) { + cell.className += " today"; + cell.ttip += Calendar._TT["PART_TODAY"]; + } + if (weekend.indexOf(wday.toString()) != -1) + cell.className += cell.otherMonth ? " oweekend" : " weekend"; + } + } + if (!(hasdays || this.showsOtherMonths)) + row.className = "emptyrow"; + } + this.title.innerHTML = Calendar._MN[month] + ", " + year; + this.onSetTime(); + this.table.style.visibility = "visible"; + this._initMultipleDates(); + // PROFILE + // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms"; +}; + +Calendar.prototype._initMultipleDates = function() { + if (this.multiple) { + for (var i in this.multiple) { + var cell = this.datesCells[i]; + var d = this.multiple[i]; + if (!d) + continue; + if (cell) + cell.className += " selected"; + } + } +}; + +Calendar.prototype._toggleMultipleDate = function(date) { + if (this.multiple) { + var ds = date.print("%Y%m%d"); + var cell = this.datesCells[ds]; + if (cell) { + var d = this.multiple[ds]; + if (!d) { + Calendar.addClass(cell, "selected"); + this.multiple[ds] = date; + } else { + Calendar.removeClass(cell, "selected"); + delete this.multiple[ds]; + } + } + } +}; + +Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { + this.getDateToolTip = unaryFunction; +}; + +/** + * Calls _init function above for going to a certain date (but only if the + * date is different than the currently selected one). + */ +Calendar.prototype.setDate = function (date) { + if (!date.equalsTo(this.date)) { + this._init(this.firstDayOfWeek, date); + } +}; + +/** + * Refreshes the calendar. Useful if the "disabledHandler" function is + * dynamic, meaning that the list of disabled date can change at runtime. + * Just * call this function if you think that the list of disabled dates + * should * change. + */ +Calendar.prototype.refresh = function () { + this._init(this.firstDayOfWeek, this.date); +}; + +/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */ +Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { + this._init(firstDayOfWeek, this.date); + this._displayWeekdays(); +}; + +/** + * Allows customization of what dates are enabled. The "unaryFunction" + * parameter must be a function object that receives the date (as a JS Date + * object) and returns a boolean value. If the returned value is true then + * the passed date will be marked as disabled. + */ +Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { + this.getDateStatus = unaryFunction; +}; + +/** Customization of allowed year range for the calendar. */ +Calendar.prototype.setRange = function (a, z) { + this.minYear = a; + this.maxYear = z; +}; + +/** Calls the first user handler (selectedHandler). */ +Calendar.prototype.callHandler = function () { + if (this.onSelected) { + this.onSelected(this, this.date.print(this.dateFormat)); + } +}; + +/** Calls the second user handler (closeHandler). */ +Calendar.prototype.callCloseHandler = function () { + if (this.onClose) { + this.onClose(this); + } + this.hideShowCovered(); +}; + +/** Removes the calendar object from the DOM tree and destroys it. */ +Calendar.prototype.destroy = function () { + var el = this.element.parentNode; + el.removeChild(this.element); + Calendar._C = null; + window._dynarch_popupCalendar = null; +}; + +/** + * Moves the calendar element to a different section in the DOM tree (changes + * its parent). + */ +Calendar.prototype.reparent = function (new_parent) { + var el = this.element; + el.parentNode.removeChild(el); + new_parent.appendChild(el); +}; + +// This gets called when the user presses a mouse button anywhere in the +// document, if the calendar is shown. If the click was outside the open +// calendar this function closes it. +Calendar._checkCalendar = function(ev) { + var calendar = window._dynarch_popupCalendar; + if (!calendar) { + return false; + } + var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); + for (; el != null && el != calendar.element; el = el.parentNode); + if (el == null) { + // calls closeHandler which should hide the calendar. + window._dynarch_popupCalendar.callCloseHandler(); + return Calendar.stopEvent(ev); + } +}; + +/** Shows the calendar. */ +Calendar.prototype.show = function () { + var rows = this.table.getElementsByTagName("tr"); + for (var i = rows.length; i > 0;) { + var row = rows[--i]; + Calendar.removeClass(row, "rowhilite"); + var cells = row.getElementsByTagName("td"); + for (var j = cells.length; j > 0;) { + var cell = cells[--j]; + Calendar.removeClass(cell, "hilite"); + Calendar.removeClass(cell, "active"); + } + } + this.element.style.display = "block"; + this.hidden = false; + if (this.isPopup) { + window._dynarch_popupCalendar = this; + Calendar.addEvent(document, "keydown", Calendar._keyEvent); + Calendar.addEvent(document, "keypress", Calendar._keyEvent); + Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); + } + this.hideShowCovered(); +}; + +/** + * Hides the calendar. Also removes any "hilite" from the class of any TD + * element. + */ +Calendar.prototype.hide = function () { + if (this.isPopup) { + Calendar.removeEvent(document, "keydown", Calendar._keyEvent); + Calendar.removeEvent(document, "keypress", Calendar._keyEvent); + Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); + } + this.element.style.display = "none"; + this.hidden = true; + this.hideShowCovered(); +}; + +/** + * Shows the calendar at a given absolute position (beware that, depending on + * the calendar element style -- position property -- this might be relative + * to the parent's containing rectangle). + */ +Calendar.prototype.showAt = function (x, y) { + var s = this.element.style; + s.left = x + "px"; + s.top = y + "px"; + this.show(); +}; + +/** Shows the calendar near a given element. */ +Calendar.prototype.showAtElement = function (el, opts) { + var self = this; + var p = Calendar.getAbsolutePos(el); + if (!opts || typeof opts != "string") { + this.showAt(p.x, p.y + el.offsetHeight); + return true; + } + function fixPosition(box) { + if (box.x < 0) + box.x = 0; + if (box.y < 0) + box.y = 0; + var cp = document.createElement("div"); + var s = cp.style; + s.position = "absolute"; + s.right = s.bottom = s.width = s.height = "0px"; + document.body.appendChild(cp); + var br = Calendar.getAbsolutePos(cp); + document.body.removeChild(cp); + if (Calendar.is_ie) { + br.y += document.body.scrollTop; + br.x += document.body.scrollLeft; + } else { + br.y += window.scrollY; + br.x += window.scrollX; + } + var tmp = box.x + box.width - br.x; + if (tmp > 0) box.x -= tmp; + tmp = box.y + box.height - br.y; + if (tmp > 0) box.y -= tmp; + }; + this.element.style.display = "block"; + Calendar.continuation_for_the_fucking_khtml_browser = function() { + var w = self.element.offsetWidth; + var h = self.element.offsetHeight; + self.element.style.display = "none"; + var valign = opts.substr(0, 1); + var halign = "l"; + if (opts.length > 1) { + halign = opts.substr(1, 1); + } + // vertical alignment + switch (valign) { + case "T": p.y -= h; break; + case "B": p.y += el.offsetHeight; break; + case "C": p.y += (el.offsetHeight - h) / 2; break; + case "t": p.y += el.offsetHeight - h; break; + case "b": break; // already there + } + // horizontal alignment + switch (halign) { + case "L": p.x -= w; break; + case "R": p.x += el.offsetWidth; break; + case "C": p.x += (el.offsetWidth - w) / 2; break; + case "l": p.x += el.offsetWidth - w; break; + case "r": break; // already there + } + p.width = w; + p.height = h + 40; + self.monthsCombo.style.display = "none"; + fixPosition(p); + self.showAt(p.x, p.y); + }; + if (Calendar.is_khtml) + setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); + else + Calendar.continuation_for_the_fucking_khtml_browser(); +}; + +/** Customizes the date format. */ +Calendar.prototype.setDateFormat = function (str) { + this.dateFormat = str; +}; + +/** Customizes the tooltip date format. */ +Calendar.prototype.setTtDateFormat = function (str) { + this.ttDateFormat = str; +}; + +/** + * Tries to identify the date represented in a string. If successful it also + * calls this.setDate which moves the calendar to the given date. + */ +Calendar.prototype.parseDate = function(str, fmt) { + if (!fmt) + fmt = this.dateFormat; + this.setDate(Date.parseDate(str, fmt)); +}; + +Calendar.prototype.hideShowCovered = function () { + if (!Calendar.is_ie && !Calendar.is_opera) + return; + function getVisib(obj){ + var value = obj.style.visibility; + if (!value) { + if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C + if (!Calendar.is_khtml) + value = document.defaultView. + getComputedStyle(obj, "").getPropertyValue("visibility"); + else + value = ''; + } else if (obj.currentStyle) { // IE + value = obj.currentStyle.visibility; + } else + value = ''; + } + return value; + }; + + var tags = new Array("applet", "iframe", "select"); + var el = this.element; + + var p = Calendar.getAbsolutePos(el); + var EX1 = p.x; + var EX2 = el.offsetWidth + EX1; + var EY1 = p.y; + var EY2 = el.offsetHeight + EY1; + + for (var k = tags.length; k > 0; ) { + var ar = document.getElementsByTagName(tags[--k]); + var cc = null; + + for (var i = ar.length; i > 0;) { + cc = ar[--i]; + + p = Calendar.getAbsolutePos(cc); + var CX1 = p.x; + var CX2 = cc.offsetWidth + CX1; + var CY1 = p.y; + var CY2 = cc.offsetHeight + CY1; + + if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { + if (!cc.__msh_save_visibility) { + cc.__msh_save_visibility = getVisib(cc); + } + cc.style.visibility = cc.__msh_save_visibility; + } else { + if (!cc.__msh_save_visibility) { + cc.__msh_save_visibility = getVisib(cc); + } + cc.style.visibility = "hidden"; + } + } + } +}; + +/** Internal function; it displays the bar with the names of the weekday. */ +Calendar.prototype._displayWeekdays = function () { + var fdow = this.firstDayOfWeek; + var cell = this.firstdayname; + var weekend = Calendar._TT["WEEKEND"]; + for (var i = 0; i < 7; ++i) { + cell.className = "day name"; + var realday = (i + fdow) % 7; + if (i) { + cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); + cell.navtype = 100; + cell.calendar = this; + cell.fdow = realday; + Calendar._add_evs(cell); + } + if (weekend.indexOf(realday.toString()) != -1) { + Calendar.addClass(cell, "weekend"); + } + cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; + cell = cell.nextSibling; + } +}; + +/** Internal function. Hides all combo boxes that might be displayed. */ +Calendar.prototype._hideCombos = function () { + this.monthsCombo.style.display = "none"; + this.yearsCombo.style.display = "none"; +}; + +/** Internal function. Starts dragging the element. */ +Calendar.prototype._dragStart = function (ev) { + if (this.dragging) { + return; + } + this.dragging = true; + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posY = ev.clientY + window.scrollY; + posX = ev.clientX + window.scrollX; + } + var st = this.element.style; + this.xOffs = posX - parseInt(st.left); + this.yOffs = posY - parseInt(st.top); + with (Calendar) { + addEvent(document, "mousemove", calDragIt); + addEvent(document, "mouseup", calDragEnd); + } +}; + +// BEGIN: DATE OBJECT PATCHES + +/** Adds the number of days array to the Date object. */ +Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); + +/** Constants used for time computations */ +Date.SECOND = 1000 /* milliseconds */; +Date.MINUTE = 60 * Date.SECOND; +Date.HOUR = 60 * Date.MINUTE; +Date.DAY = 24 * Date.HOUR; +Date.WEEK = 7 * Date.DAY; + +Date.parseDate = function(str, fmt) { + var today = new Date(); + var y = 0; + var m = -1; + var d = 0; + var a = str.split(/\W+/); + var b = fmt.match(/%./g); + var i = 0, j = 0; + var hr = 0; + var min = 0; + for (i = 0; i < a.length; ++i) { + if (!a[i]) + continue; + switch (b[i]) { + case "%d": + case "%e": + d = parseInt(a[i], 10); + break; + + case "%m": + m = parseInt(a[i], 10) - 1; + break; + + case "%Y": + case "%y": + y = parseInt(a[i], 10); + (y < 100) && (y += (y > 29) ? 1900 : 2000); + break; + + case "%b": + case "%B": + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } + } + break; + + case "%H": + case "%I": + case "%k": + case "%l": + hr = parseInt(a[i], 10); + break; + + case "%P": + case "%p": + if (/pm/i.test(a[i]) && hr < 12) + hr += 12; + else if (/am/i.test(a[i]) && hr >= 12) + hr -= 12; + break; + + case "%M": + min = parseInt(a[i], 10); + break; + } + } + if (isNaN(y)) y = today.getFullYear(); + if (isNaN(m)) m = today.getMonth(); + if (isNaN(d)) d = today.getDate(); + if (isNaN(hr)) hr = today.getHours(); + if (isNaN(min)) min = today.getMinutes(); + if (y != 0 && m != -1 && d != 0) + return new Date(y, m, d, hr, min, 0); + y = 0; m = -1; d = 0; + for (i = 0; i < a.length; ++i) { + if (a[i].search(/[a-zA-Z]+/) != -1) { + var t = -1; + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } + } + if (t != -1) { + if (m != -1) { + d = m+1; + } + m = t; + } + } else if (parseInt(a[i], 10) <= 12 && m == -1) { + m = a[i]-1; + } else if (parseInt(a[i], 10) > 31 && y == 0) { + y = parseInt(a[i], 10); + (y < 100) && (y += (y > 29) ? 1900 : 2000); + } else if (d == 0) { + d = a[i]; + } + } + if (y == 0) + y = today.getFullYear(); + if (m != -1 && d != 0) + return new Date(y, m, d, hr, min, 0); + return today; +}; + +/** Returns the number of days in the current month */ +Date.prototype.getMonthDays = function(month) { + var year = this.getFullYear(); + if (typeof month == "undefined") { + month = this.getMonth(); + } + if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { + return 29; + } else { + return Date._MD[month]; + } +}; + +/** Returns the number of day in the year. */ +Date.prototype.getDayOfYear = function() { + var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); + var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); + var time = now - then; + return Math.floor(time / Date.DAY); +}; + +/** Returns the number of the week in year, as defined in ISO 8601. */ +Date.prototype.getWeekNumber = function() { + var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); + var DoW = d.getDay(); + d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu + var ms = d.valueOf(); // GMT + d.setMonth(0); + d.setDate(4); // Thu in Week 1 + return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; +}; + +/** Checks date and time equality */ +Date.prototype.equalsTo = function(date) { + return ((this.getFullYear() == date.getFullYear()) && + (this.getMonth() == date.getMonth()) && + (this.getDate() == date.getDate()) && + (this.getHours() == date.getHours()) && + (this.getMinutes() == date.getMinutes())); +}; + +/** Set only the year, month, date parts (keep existing time) */ +Date.prototype.setDateOnly = function(date) { + var tmp = new Date(date); + this.setDate(1); + this.setFullYear(tmp.getFullYear()); + this.setMonth(tmp.getMonth()); + this.setDate(tmp.getDate()); +}; + +/** Prints the date in a string according to the given format. */ +Date.prototype.print = function (str) { + var m = this.getMonth(); + var d = this.getDate(); + var y = this.getFullYear(); + var wn = this.getWeekNumber(); + var w = this.getDay(); + var s = {}; + var hr = this.getHours(); + var pm = (hr >= 12); + var ir = (pm) ? (hr - 12) : hr; + var dy = this.getDayOfYear(); + if (ir == 0) + ir = 12; + var min = this.getMinutes(); + var sec = this.getSeconds(); + s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] + s["%A"] = Calendar._DN[w]; // full weekday name + s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] + s["%B"] = Calendar._MN[m]; // full month name + // FIXME: %c : preferred date and time representation for the current locale + s["%C"] = 1 + Math.floor(y / 100); // the century number + s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) + s["%e"] = d; // the day of the month (range 1 to 31) + // FIXME: %D : american date style: %m/%d/%y + // FIXME: %E, %F, %G, %g, %h (man strftime) + s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) + s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) + s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) + s["%k"] = hr; // hour, range 0 to 23 (24h format) + s["%l"] = ir; // hour, range 1 to 12 (12h format) + s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 + s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 + s["%n"] = "\n"; // a newline character + s["%p"] = pm ? "PM" : "AM"; + s["%P"] = pm ? "pm" : "am"; + // FIXME: %r : the time in am/pm notation %I:%M:%S %p + // FIXME: %R : the time in 24-hour notation %H:%M + s["%s"] = Math.floor(this.getTime() / 1000); + s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 + s["%t"] = "\t"; // a tab character + // FIXME: %T : the time in 24-hour notation (%H:%M:%S) + s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; + s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) + s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) + // FIXME: %x : preferred date representation for the current locale without the time + // FIXME: %X : preferred time representation for the current locale without the date + s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) + s["%Y"] = y; // year with the century + s["%%"] = "%"; // a literal '%' character + + var re = /%./g; + if (!Calendar.is_ie5 && !Calendar.is_khtml) + return str.replace(re, function (par) { return s[par] || par; }); + + var a = str.match(re); + for (var i = 0; i < a.length; i++) { + var tmp = s[a[i]]; + if (tmp) { + re = new RegExp(a[i], 'g'); + str = str.replace(re, tmp); + } + } + + return str; +}; + +Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; +Date.prototype.setFullYear = function(y) { + var d = new Date(this); + d.__msh_oldSetFullYear(y); + if (d.getMonth() != this.getMonth()) + this.setDate(28); + this.__msh_oldSetFullYear(y); +}; + +// END: DATE OBJECT PATCHES + + +// global object that remembers the calendar +window._dynarch_popupCalendar = null; diff --git a/posterita/posterita/web/javascripts/modalbox.js b/posterita/posterita/web/javascripts/modalbox.js new file mode 100644 index 0000000000..af29091ba4 --- /dev/null +++ b/posterita/posterita/web/javascripts/modalbox.js @@ -0,0 +1,573 @@ +/* +ModalBox - The pop-up window thingie with AJAX, based on prototype and script.aculo.us. + +Copyright Andrey Okonetchnikov (andrej.okonetschnikow@gmail.com), 2006-2007 +All rights reserved. + +VERSION 1.6.0 +Last Modified: 12/13/2007 +*/ + +if (!window.Modalbox) + var Modalbox = new Object(); + +Modalbox.Methods = { + overrideAlert: false, // Override standard browser alert message with ModalBox + focusableElements: new Array, + currFocused: 0, + initialized: false, + active: true, + options: { + title: "ModalBox Window", // Title of the ModalBox window + overlayClose: true, // Close modal box by clicking on overlay + width: 500, // Default width in px + height: 90, // Default height in px + overlayOpacity: .65, // Default overlay opacity + overlayDuration: .25, // Default overlay fade in/out duration in seconds + slideDownDuration: .5, // Default Modalbox appear slide down effect in seconds + slideUpDuration: .5, // Default Modalbox hiding slide up effect in seconds + resizeDuration: .25, // Default resize duration seconds + inactiveFade: true, // Fades MB window on inactive state + transitions: true, // Toggles transition effects. Transitions are enabled by default + loadingString: "Please wait. Loading...", // Default loading string message + closeString: "Close window", // Default title attribute for close window link + closeValue: "×", // Default string for close link in the header + params: {}, + method: 'get', // Default Ajax request method + autoFocusing: true, // Toggles auto-focusing for form elements. Disable for long text pages. + aspnet: false // Should be use then using with ASP.NET costrols. Then true Modalbox window will be injected into the first form element. + }, + _options: new Object, + + setOptions: function(options) { + Object.extend(this.options, options || {}); + }, + + _init: function(options) { + // Setting up original options with default options + Object.extend(this._options, this.options); + this.setOptions(options); + + //Create the overlay + this.MBoverlay = new Element("div", { id: "MB_overlay", opacity: "0" }); + + //Create DOm for the window + this.MBwindow = new Element("div", {id: "MB_window", style: "display: none"}).update( + this.MBframe = new Element("div", {id: "MB_frame"}).update( + this.MBheader = new Element("div", {id: "MB_header"}).update( + this.MBcaption = new Element("div", {id: "MB_caption"}) + ) + ) + ); + this.MBclose = new Element("a", {id: "MB_close", title: this.options.closeString, href: "#"}).update("" + this.options.closeValue + ""); + this.MBheader.insert({'bottom':this.MBclose}); + + this.MBcontent = new Element("div", {id: "MB_content"}).update( + this.MBloading = new Element("div", {id: "MB_loading"}).update(this.options.loadingString) + ); + this.MBframe.insert({'bottom':this.MBcontent}); + + // Inserting into DOM. If parameter set and form element have been found will inject into it. Otherwise will inject into body as topmost element. + // Be sure to set padding and marging to null via CSS for both body and (in case of asp.net) form elements. + var injectToEl = this.options.aspnet ? $(document.body).down('form') : $(document.body); + injectToEl.insert({'top':this.MBwindow}); + injectToEl.insert({'top':this.MBoverlay}); + + // Initial scrolling position of the window. To be used for remove scrolling effect during ModalBox appearing + this.initScrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft; + this.initScrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop; + + //Adding event observers + this.hideObserver = this._hide.bindAsEventListener(this); + this.kbdObserver = this._kbdHandler.bindAsEventListener(this); + this._initObservers(); + + this.initialized = true; // Mark as initialized + }, + + show: function(content, options) { + if(!this.initialized) this._init(options); // Check for is already initialized + + this.content = content; + this.setOptions(options); + + if(this.options.title) // Updating title of the MB + $(this.MBcaption).update(this.options.title); + else { // If title isn't given, the header will not displayed + $(this.MBheader).hide(); + $(this.MBcaption).hide(); + } + + if(this.MBwindow.style.display == "none") { // First modal box appearing + this._appear(); + this.event("onShow"); // Passing onShow callback + } + else { // If MB already on the screen, update it + this._update(); + this.event("onUpdate"); // Passing onUpdate callback + } + }, + + hide: function(options) { // External hide method to use from external HTML and JS + if(this.initialized) { + // Reading for options/callbacks except if event given as a pararmeter + if(options && typeof options.element != 'function') Object.extend(this.options, options); + // Passing beforeHide callback + this.event("beforeHide"); + if(this.options.transitions) + Effect.SlideUp(this.MBwindow, { duration: this.options.slideUpDuration, transition: Effect.Transitions.sinoidal, afterFinish: this._deinit.bind(this) } ); + else { + $(this.MBwindow).hide(); + this._deinit(); + } + } else throw("Modalbox is not initialized."); + }, + + _hide: function(event) { // Internal hide method to use with overlay and close link + event.stop(); // Stop event propaganation for link elements + /* Then clicked on overlay we'll check the option and in case of overlayClose == false we'll break hiding execution [Fix for #139] */ + if(event.element().id == 'MB_overlay' && !this.options.overlayClose) return false; + this.hide(); + }, + + alert: function(message){ + var html = '

    ' + message + '

    '; + Modalbox.show(html, {title: 'Alert: ' + document.title, width: 300}); + }, + + _appear: function() { // First appearing of MB + if(Prototype.Browser.IE && !navigator.appVersion.match(/\b7.0\b/)) { // Preparing IE 6 for showing modalbox + window.scrollTo(0,0); + this._prepareIE("100%", "hidden"); + } + this._setWidth(); + this._setPosition(); + if(this.options.transitions) { + $(this.MBoverlay).setStyle({opacity: 0}); + new Effect.Fade(this.MBoverlay, { + from: 0, + to: this.options.overlayOpacity, + duration: this.options.overlayDuration, + afterFinish: function() { + new Effect.SlideDown(this.MBwindow, { + duration: this.options.slideDownDuration, + transition: Effect.Transitions.sinoidal, + afterFinish: function(){ + this._setPosition(); + this.loadContent(); + }.bind(this) + }); + }.bind(this) + }); + } else { + $(this.MBoverlay).setStyle({opacity: this.options.overlayOpacity}); + $(this.MBwindow).show(); + this._setPosition(); + this.loadContent(); + } + this._setWidthAndPosition = this._setWidthAndPosition.bindAsEventListener(this); + Event.observe(window, "resize", this._setWidthAndPosition); + }, + + resize: function(byWidth, byHeight, options) { // Change size of MB without loading content + var wHeight = $(this.MBwindow).getHeight(); + var wWidth = $(this.MBwindow).getWidth(); + var hHeight = $(this.MBheader).getHeight(); + var cHeight = $(this.MBcontent).getHeight(); + var newHeight = ((wHeight - hHeight + byHeight) < cHeight) ? (cHeight + hHeight - wHeight) : byHeight; + if(options) this.setOptions(options); // Passing callbacks + if(this.options.transitions) { + new Effect.ScaleBy(this.MBwindow, byWidth, newHeight, { + duration: this.options.resizeDuration, + afterFinish: function() { + this.event("_afterResize"); // Passing internal callback + this.event("afterResize"); // Passing callback + }.bind(this) + }); + } else { + this.MBwindow.setStyle({width: wWidth + byWidth + "px", height: wHeight + newHeight + "px"}); + setTimeout(function() { + this.event("_afterResize"); // Passing internal callback + this.event("afterResize"); // Passing callback + }.bind(this), 1); + + } + + }, + + resizeToContent: function(options){ + + // Resizes the modalbox window to the actual content height. + // This might be useful to resize modalbox after some content modifications which were changed ccontent height. + + var byHeight = this.options.height - this.MBwindow.offsetHeight; + if(byHeight != 0) { + if(options) this.setOptions(options); // Passing callbacks + Modalbox.resize(0, byHeight); + } + }, + + resizeToInclude: function(element, options){ + + // Resizes the modalbox window to the camulative height of element. Calculations are using CSS properties for margins and border. + // This method might be useful to resize modalbox before including or updating content. + + var el = $(element); + var elHeight = el.getHeight() + parseInt(el.getStyle('margin-top')) + parseInt(el.getStyle('margin-bottom')) + parseInt(el.getStyle('border-top-width')) + parseInt(el.getStyle('border-bottom-width')); + if(elHeight > 0) { + if(options) this.setOptions(options); // Passing callbacks + Modalbox.resize(0, elHeight); + } + }, + + _update: function() { // Updating MB in case of wizards + $(this.MBcontent).update(""); + this.MBcontent.appendChild(this.MBloading); + $(this.MBloading).update(this.options.loadingString); + this.currentDims = [this.MBwindow.offsetWidth, this.MBwindow.offsetHeight]; + Modalbox.resize((this.options.width - this.currentDims[0]), (this.options.height - this.currentDims[1]), {_afterResize: this._loadAfterResize.bind(this) }); + }, + + loadContent: function () { + if(this.event("beforeLoad") != false) { // If callback passed false, skip loading of the content + if(typeof this.content == 'string') { + var htmlRegExp = new RegExp(/<\/?[^>]+>/gi); + if(htmlRegExp.test(this.content)) { // Plain HTML given as a parameter + this._insertContent(this.content.stripScripts()); + this._putContent(function(){ + this.content.extractScripts().map(function(script) { + return eval(script.replace("", "")); + }.bind(window)); + }.bind(this)); + } else // URL given as a parameter. We'll request it via Ajax + new Ajax.Request( this.content, { method: this.options.method.toLowerCase(), parameters: this.options.params, + onSuccess: function(transport) { + var response = new String(transport.responseText); + this._insertContent(transport.responseText.stripScripts()); + this._putContent(function(){ + response.extractScripts().map(function(script) { + return eval(script.replace("", "")); + }.bind(window)); + }); + }.bind(this), + onException: function(instance, exception){ + Modalbox.hide(); + throw('Modalbox Loading Error: ' + exception); + } + }); + + } else if (typeof this.content == 'object') {// HTML Object is given + this._insertContent(this.content); + this._putContent(); + } else { + Modalbox.hide(); + throw('Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)'); + } + } + }, + + _insertContent: function(content){ + $(this.MBcontent).hide().update(""); + if(typeof content == 'string') { + setTimeout(function() { // Hack to disable content flickering in Firefox + this.MBcontent.update(content); + }.bind(this), 1); + } else if (typeof content == 'object') { // HTML Object is given + var _htmlObj = content.cloneNode(true); // If node already a part of DOM we'll clone it + // If clonable element has ID attribute defined, modifying it to prevent duplicates + if(content.id) content.id = "MB_" + content.id; + /* Add prefix for IDs on all elements inside the DOM node */ + $(content).select('*[id]').each(function(el){ el.id = "MB_" + el.id; }); + this.MBcontent.appendChild(_htmlObj); + this.MBcontent.down().show(); // Toggle visibility for hidden nodes + if(Prototype.Browser.IE) // Toggling back visibility for hidden selects in IE + $$("#MB_content select").invoke('setStyle', {'visibility': ''}); + } + }, + + _putContent: function(callback){ + // Prepare and resize modal box for content + if(this.options.height == this._options.height) { + setTimeout(function() { // MSIE sometimes doesn't display content correctly + Modalbox.resize(0, $(this.MBcontent).getHeight() - $(this.MBwindow).getHeight() + $(this.MBheader).getHeight(), { + afterResize: function(){ + this.MBcontent.show().makePositioned(); + this.focusableElements = this._findFocusableElements(); + this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button) + setTimeout(function(){ // MSIE fix + if(callback != undefined) + callback(); // Executing internal JS from loaded content + this.event("afterLoad"); // Passing callback + }.bind(this),1); + }.bind(this) + }); + }.bind(this), 1); + } else { // Height is defined. Creating a scrollable window + this._setWidth(); + this.MBcontent.setStyle({overflow: 'auto', height: $(this.MBwindow).getHeight() - $(this.MBheader).getHeight() - 13 + 'px'}); + this.MBcontent.show(); + this.focusableElements = this._findFocusableElements(); + this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button) + setTimeout(function(){ // MSIE fix + if(callback != undefined) + callback(); // Executing internal JS from loaded content + this.event("afterLoad"); // Passing callback + }.bind(this),1); + } + }, + + activate: function(options){ + this.setOptions(options); + this.active = true; + $(this.MBclose).observe("click", this.hideObserver); + if(this.options.overlayClose) + $(this.MBoverlay).observe("click", this.hideObserver); + $(this.MBclose).show(); + if(this.options.transitions && this.options.inactiveFade) + new Effect.Appear(this.MBwindow, {duration: this.options.slideUpDuration}); + }, + + deactivate: function(options) { + this.setOptions(options); + this.active = false; + $(this.MBclose).stopObserving("click", this.hideObserver); + if(this.options.overlayClose) + $(this.MBoverlay).stopObserving("click", this.hideObserver); + $(this.MBclose).hide(); + if(this.options.transitions && this.options.inactiveFade) + new Effect.Fade(this.MBwindow, {duration: this.options.slideUpDuration, to: .75}); + }, + + _initObservers: function(){ + $(this.MBclose).observe("click", this.hideObserver); + if(this.options.overlayClose) + $(this.MBoverlay).observe("click", this.hideObserver); + if(Prototype.Browser.IE) + Event.observe(document, "keydown", this.kbdObserver); + else + Event.observe(document, "keypress", this.kbdObserver); + }, + + _removeObservers: function(){ + $(this.MBclose).stopObserving("click", this.hideObserver); + if(this.options.overlayClose) + $(this.MBoverlay).stopObserving("click", this.hideObserver); + if(Prototype.Browser.IE) + Event.stopObserving(document, "keydown", this.kbdObserver); + else + Event.stopObserving(document, "keypress", this.kbdObserver); + }, + + _loadAfterResize: function() { + this._setWidth(); + this._setPosition(); + this.loadContent(); + }, + + _setFocus: function() { + /* Setting focus to the first 'focusable' element which is one with tabindex = 1 or the first in the form loaded. */ + if(this.focusableElements.length > 0 && this.options.autoFocusing == true) { + var firstEl = this.focusableElements.find(function (el){ + return el.tabIndex == 1; + }) || this.focusableElements.first(); + this.currFocused = this.focusableElements.toArray().indexOf(firstEl); + firstEl.focus(); // Focus on first focusable element except close button + } else if($(this.MBclose).visible()) + $(this.MBclose).focus(); // If no focusable elements exist focus on close button + }, + + _findFocusableElements: function(){ // Collect form elements or links from MB content + this.MBcontent.select('input:not([type~=hidden]), select, textarea, button, a[href]').invoke('addClassName', 'MB_focusable'); + return this.MBcontent.select('.MB_focusable'); + }, + + _kbdHandler: function(event) { + var node = event.element(); + switch(event.keyCode) { + case Event.KEY_TAB: + event.stop(); + + /* Switching currFocused to the element which was focused by mouse instead of TAB-key. Fix for #134 */ + if(node != this.focusableElements[this.currFocused]) + this.currFocused = this.focusableElements.toArray().indexOf(node); + + if(!event.shiftKey) { //Focusing in direct order + if(this.currFocused == this.focusableElements.length - 1) { + this.focusableElements.first().focus(); + this.currFocused = 0; + } else { + this.currFocused++; + this.focusableElements[this.currFocused].focus(); + } + } else { // Shift key is pressed. Focusing in reverse order + if(this.currFocused == 0) { + this.focusableElements.last().focus(); + this.currFocused = this.focusableElements.length - 1; + } else { + this.currFocused--; + this.focusableElements[this.currFocused].focus(); + } + } + break; + case Event.KEY_ESC: + if(this.active) this._hide(event); + break; + case 32: + this._preventScroll(event); + break; + case 0: // For Gecko browsers compatibility + if(event.which == 32) this._preventScroll(event); + break; + case Event.KEY_UP: + case Event.KEY_DOWN: + case Event.KEY_PAGEDOWN: + case Event.KEY_PAGEUP: + case Event.KEY_HOME: + case Event.KEY_END: + // Safari operates in slightly different way. This realization is still buggy in Safari. + if(Prototype.Browser.WebKit && !["textarea", "select"].include(node.tagName.toLowerCase())) + event.stop(); + else if( (node.tagName.toLowerCase() == "input" && ["submit", "button"].include(node.type)) || (node.tagName.toLowerCase() == "a") ) + event.stop(); + break; + } + }, + + _preventScroll: function(event) { // Disabling scrolling by "space" key + if(!["input", "textarea", "select", "button"].include(event.element().tagName.toLowerCase())) + event.stop(); + }, + + _deinit: function() + { + this._removeObservers(); + Event.stopObserving(window, "resize", this._setWidthAndPosition ); + if(this.options.transitions) { + Effect.toggle(this.MBoverlay, 'appear', {duration: this.options.overlayDuration, afterFinish: this._removeElements.bind(this) }); + } else { + this.MBoverlay.hide(); + this._removeElements(); + } + $(this.MBcontent).setStyle({overflow: '', height: ''}); + }, + + _removeElements: function () { + $(this.MBoverlay).remove(); + $(this.MBwindow).remove(); + if(Prototype.Browser.IE && !navigator.appVersion.match(/\b7.0\b/)) { + this._prepareIE("", ""); // If set to auto MSIE will show horizontal scrolling + window.scrollTo(this.initScrollX, this.initScrollY); + } + + /* Replacing prefixes 'MB_' in IDs for the original content */ + if(typeof this.content == 'object') { + if(this.content.id && this.content.id.match(/MB_/)) { + this.content.id = this.content.id.replace(/MB_/, ""); + } + this.content.select('*[id]').each(function(el){ el.id = el.id.replace(/MB_/, ""); }); + } + /* Initialized will be set to false */ + this.initialized = false; + this.event("afterHide"); // Passing afterHide callback + this.setOptions(this._options); //Settings options object into intial state + }, + + _setWidth: function () { //Set size + $(this.MBwindow).setStyle({width: this.options.width + "px", height: this.options.height + "px"}); + }, + + _setPosition: function () { + $(this.MBwindow).setStyle({left: Math.round((Element.getWidth(document.body) - Element.getWidth(this.MBwindow)) / 2 ) + "px"}); + }, + + _setWidthAndPosition: function () { + $(this.MBwindow).setStyle({width: this.options.width + "px"}); + this._setPosition(); + }, + + _getScrollTop: function () { //From: http://www.quirksmode.org/js/doctypes.html + var theTop; + if (document.documentElement && document.documentElement.scrollTop) + theTop = document.documentElement.scrollTop; + else if (document.body) + theTop = document.body.scrollTop; + return theTop; + }, + _prepareIE: function(height, overflow){ + $$('html, body').invoke('setStyle', {width: height, height: height, overflow: overflow}); // IE requires width and height set to 100% and overflow hidden + $$("select").invoke('setStyle', {'visibility': overflow}); // Toggle visibility for all selects in the common document + }, + event: function(eventName) { + if(this.options[eventName]) { + var returnValue = this.options[eventName](); // Executing callback + this.options[eventName] = null; // Removing callback after execution + if(returnValue != undefined) + return returnValue; + else + return true; + } + return true; + } +}; + +Object.extend(Modalbox, Modalbox.Methods); + +if(Modalbox.overrideAlert) window.alert = Modalbox.alert; + +Effect.ScaleBy = Class.create(); +Object.extend(Object.extend(Effect.ScaleBy.prototype, Effect.Base.prototype), { + initialize: function(element, byWidth, byHeight, options) { + this.element = $(element) + var options = Object.extend({ + scaleFromTop: true, + scaleMode: 'box', // 'box' or 'contents' or {} with provided values + scaleByWidth: byWidth, + scaleByHeight: byHeight + }, arguments[3] || {}); + this.start(options); + }, + setup: function() { + this.elementPositioning = this.element.getStyle('position'); + + this.originalTop = this.element.offsetTop; + this.originalLeft = this.element.offsetLeft; + + this.dims = null; + if(this.options.scaleMode=='box') + this.dims = [this.element.offsetHeight, this.element.offsetWidth]; + if(/^content/.test(this.options.scaleMode)) + this.dims = [this.element.scrollHeight, this.element.scrollWidth]; + if(!this.dims) + this.dims = [this.options.scaleMode.originalHeight, + this.options.scaleMode.originalWidth]; + + this.deltaY = this.options.scaleByHeight; + this.deltaX = this.options.scaleByWidth; + }, + update: function(position) { + var currentHeight = this.dims[0] + (this.deltaY * position); + var currentWidth = this.dims[1] + (this.deltaX * position); + + currentHeight = (currentHeight > 0) ? currentHeight : 0; + currentWidth = (currentWidth > 0) ? currentWidth : 0; + + this.setDimensions(currentHeight, currentWidth); + }, + + setDimensions: function(height, width) { + var d = {}; + d.width = width + 'px'; + d.height = height + 'px'; + + var topd = Math.round((height - this.dims[0])/2); + var leftd = Math.round((width - this.dims[1])/2); + if(this.elementPositioning == 'absolute' || this.elementPositioning == 'fixed') { + if(!this.options.scaleFromTop) d.top = this.originalTop-topd + 'px'; + d.left = this.originalLeft-leftd + 'px'; + } else { + if(!this.options.scaleFromTop) d.top = -topd + 'px'; + d.left = -leftd + 'px'; + } + this.element.setStyle(d); + } +}); \ No newline at end of file diff --git a/posterita/posterita/web/javascripts/popup.js b/posterita/posterita/web/javascripts/popup.js new file mode 100644 index 0000000000..8a50083090 --- /dev/null +++ b/posterita/posterita/web/javascripts/popup.js @@ -0,0 +1,470 @@ +/* + popup.js + + A lightweight general purpose JavaScript DOM element popup class. + + Webpage: + http;//www.methods.co.nz/popup/popup.html + + Inspired by: + Lightbox2: http://www.huddletogether.com/projects/lightbox2/ + Lightbox Gone Wild: http://particletree.com/features/lightbox-gone-wild/ + Tooltip: http://blog.innerewut.de/pages/tooltip + Prototype library: http://www.prototypejs.org/ + Scriptaculous library: http://script.aculo.us/ + + Attributions: + - Uses the getPageSize() function from Lightbox v2.02 by Lokesh Dhakar + (http://www.huddletogether.com/projects/lightbox2/). + - Adapted the the modal overlay technique used in Lightbox v2.02 by Lokesh + Dhakar (http://www.huddletogether.com/projects/lightbox2/). + + Version: 1.0.1 + + Author: Stuart Rackham + License: This source code is released under the MIT license. + + Copyright (c) Stuart Rackham 2007 + +*/ + +var Popup = Class.create(); +Popup.zIndex = 1000; // z-index of first popup. + +Popup.prototype = { + + /* + Popup creation + */ + initialize: function(popup, link) { + var options = Object.extend({ + modal: false, + effect: 'fade', + hidden: true, + closebox: 'popup_closebox', // CSS class name of click-to-close elements. + draghandle: 'popup_draghandle' // CSS class name of drag handle elements. + }, arguments[2] || {}); + options.position = options.position || (options.modal ? 'center' : 'auto'); + options.trigger = options.trigger || (options.modal ? 'click' : 'mouseover'); + options.duration = this.first_value(options.duration, Popup.duration, 0.5); + options.show_duration = this.first_value(options.show_duration, options.duration); + options.hide_duration = this.first_value(options.hide_duration, options.duration); + options.opacity = this.first_value(options.opacity, Popup.opacity, 0.5); + options.show_delay = this.first_value(options.show_delay, Popup.show_delay, 500); + options.hide_delay = this.first_value(options.hide_delay, Popup.hide_delay, 200); + options.cursor_margin = this.first_value(options.cursor_margin, Popup.cursor_margin, 5); + this.options = options; + if (link) { + this.link = $(link); + } + this.popup = $(popup); + this.popup.popup = this; // Make the popup object a property of the DOM popup element. + if (options.hidden) { + this.popup.hide(); + } + if (options.closebox) { + this.closeboxes = document.getElementsByClassName(options.closebox, this.popup); + if (this.popup.hasClassName(options.closebox)) { + this.closeboxes[this.closeboxes.length] = this.popup; + } + } + else { + this.closeboxes = []; + } + if (options.draghandle) { + var draghandles = document.getElementsByClassName(options.draghandle, this.popup); + for (i = 0; i < draghandles.length; i++) { + new Draggable(this.popup, { handle: draghandles[i] }); + } + if (this.popup.hasClassName(options.draghandle)) { + new Draggable(this.popup, { handle: this.popup }); + } + } + this.register_events(); + }, + + + /* + Event functions + */ + + register_events: function() { + var trigger_function; + if (this.is_auto_open()) { + trigger_function = this.start_show_timer; + if (this.link) { + Event.observe(this.link, 'mouseout', this.stop_show_timer.bindAsEventListener(this)); + } + } + else { + trigger_function = this.show; + } + if (this.link) { + Event.observe(this.link, this.options.trigger, trigger_function.bindAsEventListener(this)); + } + if (!this.options.modal) { + Event.observe(this.popup, 'click', this.bring_to_front.bindAsEventListener(this)); + } + if (this.closeboxes.length > 0) { + for (var i = 0; i < this.closeboxes.length; i++) { + Event.observe(this.closeboxes[i], 'click', this.hide.bindAsEventListener(this)); + } + } + else { + if (this.link) { + Event.observe(this.link, 'mouseout', this.start_hide_timer.bindAsEventListener(this)); + } + Event.observe(this.popup, 'mouseover', this.stop_hide_timer.bindAsEventListener(this)); + Event.observe(this.popup, 'mouseout', this.start_hide_timer.bindAsEventListener(this)); + } + }, + + bring_to_front: function(event) { + // Bring to front if not already there. + if (Number(this.popup.style.zIndex) < Popup.zIndex - 1) { + this.popup.style.zIndex = Popup.zIndex++; + } + }, + + start_show_timer: function(event) { + // NOTE: event is bound to this.show but it's state changes between being + // bound here and arriving at this.show -- specifically, the mouse + // coordinates are reset to zero). I've no idea why. Anyway, this is the + // reason for passing the event mouse coordinates as properties of this. + this.stop_show_timer(event); + this.mouse_x = Event.pointerX(event); + this.mouse_y = Event.pointerY(event); + this.show_timer = setTimeout(this.show.bind(this, event), this.options.show_delay); + }, + + stop_show_timer: function(event) { + if (this.show_timer) { + clearTimeout(this.show_timer); + this.show_timer = null; + } + }, + + start_hide_timer: function(event) { + this.stop_hide_timer(event); + this.hide_timer = setTimeout(this.hide.bind(this, event), this.options.hide_delay); + }, + + stop_hide_timer: function(event) { + if (this.hide_timer) { + clearTimeout(this.hide_timer); + this.hide_timer = null; + } + }, + + show: function(event) { + this.stop_show_timer(event); + this.stop_hide_timer(event); + if (this.is_open) { + return; + } + if (this.options.modal) { + this.show_overlay(); + } + var pos; + if (!event) { + // We only arrive here if this.show has been called externally. + pos = this.get_popup_position(); + } + else if (this.is_auto_open()) { + // Because auto-open popups calls this.show indirectly via start_show_timer. + pos = this.get_popup_position(this.mouse_x, this.mouse_y); + } + else { + pos = this.get_popup_position(Event.pointerX(event), Event.pointerY(event)); + } + Element.setStyle(this.popup, { top: pos.y, left: pos.x, zIndex: Popup.zIndex++ }); + this.is_open = true; + switch (this.options.effect) { + case 'slide': + Effect.SlideDown(this.popup, {duration: this.options.show_duration}); + break; + case 'grow': + Effect.Grow(this.popup, {duration: this.options.show_duration}); + break; + case 'blind': + Effect.BlindDown(this.popup, {duration: this.options.show_duration}); + break; + case 'fade': + default: + Effect.Appear(this.popup, {duration: this.options.show_duration}); + break; + } + }, + + hide: function(event){ + this.is_open = false; + switch (this.options.effect) { + case 'slide': + Effect.SlideUp(this.popup, {duration: this.options.hide_duration}); + break; + case 'grow': + Effect.Shrink(this.popup, {duration: this.options.hide_duration}); + break; + case 'blind': + Effect.BlindUp(this.popup, {duration: this.options.hide_duration}); + break; + case 'fade': + default: + Effect.Fade(this.popup, {duration: this.options.hide_duration}); + break; + } + if (this.options.modal) { + this.hide_overlay(); + } + }, + + + /* + Helper functions + */ + + // Return the first function argument that is not undefined. + // Because when zero numerical value are possible you can't use || chains. + first_value: function() { + for (var i = 0; i < arguments.length; i++) { + if (arguments[i] !== undefined) { + return arguments[i]; + } + } + return undefined; + }, + + is_auto_open: function() { + return this.options.trigger == 'mouseover'; + }, + + show_overlay: function() { + if (!Popup.overlay) { + var overlay = document.createElement('div'); + overlay.setAttribute('id','popup_overlay'); + overlay.style.display = 'none'; + document.body.appendChild(overlay); + Popup.overlay = overlay; + Popup.overlay_levels = []; + } + Popup.overlay.style.height = this.get_page_dimensions().height + 'px'; + var z = Popup.zIndex++; + Popup.overlay.style.zIndex = z; + Popup.overlay_levels.push(z); + if ( Popup.overlay_levels.length == 1) { // Opening the first modal popup. + // Queue the global overlay effect to ensure correct execution order. + new Effect.Appear(Popup.overlay, + { duration: this.options.show_duration, + to: this.options.opacity, + queue: {position: 'end', scope: 'popup_overlay'} + }); + } + else { // There is another modal popup at a lower level so move the overlay forward. + Popup.overlay.style.zIndex = z; + } + }, + + hide_overlay: function() { + Popup.overlay_levels.pop(); + var z = Popup.overlay_levels.pop(); + if (z) { // There is another modal popup at a lower level so move the overlay back. + Popup.overlay_levels.push(z); + Popup.overlay.style.zIndex = z; + } + else { // The last modal popup is being closed so hide the overlay + // Queue the global overlay effect to ensure correct execution order. + new Effect.Fade(Popup.overlay, + { duration: this.options.hide_duration, + queue: {position: 'end', scope: 'popup_overlay'} + }); + } + }, + + + /* + Positioning functions + */ + + // Return the top and left CSS position strings as an {x,y} object that the + // popup should be shown at. mouse_x and mouse_y are the mouse x,y coordinates + // numbers when the popup was triggered. + get_popup_position: function(mouse_x, mouse_y) { + var pos; + switch (this.options.position) { + case 'auto': + pos = this.get_auto_position(mouse_x, mouse_y); + break; + case 'center': + pos = this.get_center_position(); + break; + case 'below': + pos = this.get_below_position(); + break; + default: + // Check for x,y postion format (x and y can be any valid CSS left or + // top property value). + if (mo = this.options.position.match(/^\s*([^\s,]+)\s*,\s*([^\s,]+)\s*$/)) { + pos = {x: mo[1], y: mo[2]}; + // If possible convert to numbers. + pos.x = Number(pos.x) || pos.x; + pos.y = Number(pos.y) || pos.y; + } + else { + pos = {x: 0, y: 0}; + } + break; + } + if (typeof pos.x == 'number') { + pos.x += 'px'; + } + if (typeof pos.y == 'number') { + pos.y += 'px'; + } + return pos; + }, + + get_below_position: function() { + var pos = Position.cumulativeOffset(this.link); + return {x: pos[0], y: pos[1] + Element.getHeight(this.link)}; + }, + + get_center_position: function() { + dim = Element.getDimensions(this.popup); + var popup_width = dim.width; + var popup_height = dim.height; + dim = this.get_viewport_dimensions(); + var viewport_width = dim.width; + var viewport_height = dim.height; + + var x; + if (popup_width >= viewport_width) { + x = 0; + } + else { + x = (viewport_width - popup_width)/2; + } + + var y; + if (popup_height >= viewport_height) { + y = 0; + } + else { + y = (viewport_height - popup_height)/2; + } + + return {x: x, y: y}; + }, + + get_auto_position: function(mouse_x, mouse_y) { + dim = Element.getDimensions(this.popup); + var popup_width = dim.width; + var popup_height = dim.height; + dim = this.get_viewport_dimensions(); + var viewport_width = dim.width; + var viewport_height = dim.height; + + var available_right = viewport_width - (mouse_x + this.options.cursor_margin); + var available_left = mouse_x - this.options.cursor_margin; + var available_top = mouse_y - this.options.cursor_margin; + var available_bottom = viewport_height - (mouse_x + this.options.cursor_margin); + var offset = this.options.cursor_margin; + var x = mouse_x; + var y = mouse_y; + + if (popup_width >= viewport_width) { + x = 0; + } + else if (popup_width <= available_right) { + x += offset; + } + else if (popup_width <= available_left) { + x -= popup_width + offset; + } + else if (available_right >= available_left) { + x = viewport_width - popup_width; + } + else { + x = 0; + } + + if (popup_height >= viewport_height) { + y = 0; + } + else if (popup_height <= available_bottom) { + y += offset; + } + else if (popup_height <= available_top) { + y -= popup_height + offset; + } + else if (available_bottom >= available_top) { + y = viewport_height - popup_height; + } + else { + y = 0; + } + + return {x: x, y: y}; + }, + + get_viewport_dimensions: function() { + var dim = this.getPageSize(); + return {width: dim[2], height: dim[3]}; + }, + + get_page_dimensions: function() { + var dim = this.getPageSize(); + return {width: dim[0], height: dim[1]}; + }, + + // This function from Lightbox v2.02 by Lokesh Dhakar + // (http://www.huddletogether.com/projects/lightbox2/). + // + // Returns array with page width, height and window width, height + // Core code from - quirksmode.org + // Edit for Firefox by pHaez + // + getPageSize: function() { + var xScroll, yScroll; + + if (window.innerHeight && window.scrollMaxY) { + xScroll = document.body.scrollWidth; + yScroll = window.innerHeight + window.scrollMaxY; + } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac + xScroll = document.body.scrollWidth; + yScroll = document.body.scrollHeight; + } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari + xScroll = document.body.offsetWidth; + yScroll = document.body.offsetHeight; + } + + var windowWidth, windowHeight; + if (self.innerHeight) { // all except Explorer + windowWidth = self.innerWidth; + windowHeight = self.innerHeight; + } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode + windowWidth = document.documentElement.clientWidth; + windowHeight = document.documentElement.clientHeight; + } else if (document.body) { // other Explorers + windowWidth = document.body.clientWidth; + windowHeight = document.body.clientHeight; + } + + // for small pages with total height less then height of the viewport + if(yScroll < windowHeight){ + pageHeight = windowHeight; + } else { + pageHeight = yScroll; + } + + // for small pages with total width less then width of the viewport + if(xScroll < windowWidth){ + pageWidth = windowWidth; + } else { + pageWidth = xScroll; + } + + arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); + return arrayPageSize; + } + +} diff --git a/posterita/posterita/web/javascripts/prototype.js b/posterita/posterita/web/javascripts/prototype.js new file mode 100644 index 0000000000..8613914b1a --- /dev/null +++ b/posterita/posterita/web/javascripts/prototype.js @@ -0,0 +1,4170 @@ +/* Prototype JavaScript framework, version 1.6.0.1 + * (c) 2005-2007 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * + *--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.6.0.1', + + Browser: { + IE: !!(window.attachEvent && !window.opera), + Opera: !!window.opera, + WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, + Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1, + MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) + }, + + BrowserFeatures: { + XPath: !!document.evaluate, + ElementExtensions: !!window.HTMLElement, + SpecificElementExtensions: + document.createElement('div').__proto__ && + document.createElement('div').__proto__ !== + document.createElement('form').__proto__ + }, + + ScriptFragment: ']*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, + + emptyFunction: function() { }, + K: function(x) { return x } +}; + +if (Prototype.Browser.MobileSafari) + Prototype.BrowserFeatures.SpecificElementExtensions = false; + + +/* Based on Alex Arnell's inheritance implementation. */ +var Class = { + create: function() { + var parent = null, properties = $A(arguments); + if (Object.isFunction(properties[0])) + parent = properties.shift(); + + function klass() { + this.initialize.apply(this, arguments); + } + + Object.extend(klass, Class.Methods); + klass.superclass = parent; + klass.subclasses = []; + + if (parent) { + var subclass = function() { }; + subclass.prototype = parent.prototype; + klass.prototype = new subclass; + parent.subclasses.push(klass); + } + + for (var i = 0; i < properties.length; i++) + klass.addMethods(properties[i]); + + if (!klass.prototype.initialize) + klass.prototype.initialize = Prototype.emptyFunction; + + klass.prototype.constructor = klass; + + return klass; + } +}; + +Class.Methods = { + addMethods: function(source) { + var ancestor = this.superclass && this.superclass.prototype; + var properties = Object.keys(source); + + if (!Object.keys({ toString: true }).length) + properties.push("toString", "valueOf"); + + for (var i = 0, length = properties.length; i < length; i++) { + var property = properties[i], value = source[property]; + if (ancestor && Object.isFunction(value) && + value.argumentNames().first() == "$super") { + var method = value, value = Object.extend((function(m) { + return function() { return ancestor[m].apply(this, arguments) }; + })(property).wrap(method), { + valueOf: function() { return method }, + toString: function() { return method.toString() } + }); + } + this.prototype[property] = value; + } + + return this; + } +}; + +var Abstract = { }; + +Object.extend = function(destination, source) { + for (var property in source) + destination[property] = source[property]; + return destination; +}; + +Object.extend(Object, { + inspect: function(object) { + try { + if (Object.isUndefined(object)) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : object.toString(); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + toJSON: function(object) { + var type = typeof object; + switch (type) { + case 'undefined': + case 'function': + case 'unknown': return; + case 'boolean': return object.toString(); + } + + if (object === null) return 'null'; + if (object.toJSON) return object.toJSON(); + if (Object.isElement(object)) return; + + var results = []; + for (var property in object) { + var value = Object.toJSON(object[property]); + if (!Object.isUndefined(value)) + results.push(property.toJSON() + ': ' + value); + } + + return '{' + results.join(', ') + '}'; + }, + + toQueryString: function(object) { + return $H(object).toQueryString(); + }, + + toHTML: function(object) { + return object && object.toHTML ? object.toHTML() : String.interpret(object); + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({ }, object); + }, + + isElement: function(object) { + return object && object.nodeType == 1; + }, + + isArray: function(object) { + return object && object.constructor === Array; + }, + + isHash: function(object) { + return object instanceof Hash; + }, + + isFunction: function(object) { + return typeof object == "function"; + }, + + isString: function(object) { + return typeof object == "string"; + }, + + isNumber: function(object) { + return typeof object == "number"; + }, + + isUndefined: function(object) { + return typeof object == "undefined"; + } +}); + +Object.extend(Function.prototype, { + argumentNames: function() { + var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip"); + return names.length == 1 && !names[0] ? [] : names; + }, + + bind: function() { + if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } + }, + + bindAsEventListener: function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [event || window.event].concat(args)); + } + }, + + curry: function() { + if (!arguments.length) return this; + var __method = this, args = $A(arguments); + return function() { + return __method.apply(this, args.concat($A(arguments))); + } + }, + + delay: function() { + var __method = this, args = $A(arguments), timeout = args.shift() * 1000; + return window.setTimeout(function() { + return __method.apply(__method, args); + }, timeout); + }, + + wrap: function(wrapper) { + var __method = this; + return function() { + return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); + } + }, + + methodize: function() { + if (this._methodized) return this._methodized; + var __method = this; + return this._methodized = function() { + return __method.apply(null, [this].concat($A(arguments))); + }; + } +}); + +Function.prototype.defer = Function.prototype.delay.curry(0.01); + +Date.prototype.toJSON = function() { + return '"' + this.getUTCFullYear() + '-' + + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + + this.getUTCDate().toPaddedString(2) + 'T' + + this.getUTCHours().toPaddedString(2) + ':' + + this.getUTCMinutes().toPaddedString(2) + ':' + + this.getUTCSeconds().toPaddedString(2) + 'Z"'; +}; + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) { } + } + + return returnValue; + } +}; + +RegExp.prototype.match = RegExp.prototype.test; + +RegExp.escape = function(str) { + return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); +}; + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create({ + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + execute: function() { + this.callback(this); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.execute(); + } finally { + this.currentlyExecuting = false; + } + } + } +}); +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = Object.isUndefined(count) ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return String(this); + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = Object.isUndefined(truncation) ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : String(this); + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var self = arguments.callee; + self.text.data = this; + return self.div.innerHTML; + }, + + unescapeHTML: function() { + var div = new Element('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return { }; + + return match[1].split(separator || '&').inject({ }, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()); + var value = pair.length > 1 ? pair.join('=') : pair[0]; + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + times: function(count) { + return count < 1 ? '' : new Array(count + 1).join(this); + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { + var character = String.specialChar[match[0]]; + return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + }, + + toJSON: function() { + return this.inspect(true); + }, + + unfilterJSON: function(filter) { + return this.sub(filter || Prototype.JSONFilter, '#{1}'); + }, + + isJSON: function() { + var str = this; + if (str.blank()) return false; + str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); + return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); + }, + + evalJSON: function(sanitize) { + var json = this.unfilterJSON(); + try { + if (!sanitize || json.isJSON()) return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + }, + + include: function(pattern) { + return this.indexOf(pattern) > -1; + }, + + startsWith: function(pattern) { + return this.indexOf(pattern) === 0; + }, + + endsWith: function(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.lastIndexOf(pattern) === d; + }, + + empty: function() { + return this == ''; + }, + + blank: function() { + return /^\s*$/.test(this); + }, + + interpolate: function(object, pattern) { + return new Template(this, pattern).evaluate(object); + } +}); + +if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { + escapeHTML: function() { + return this.replace(/&/g,'&').replace(//g,'>'); + }, + unescapeHTML: function() { + return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (Object.isFunction(replacement)) return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +}; + +String.prototype.parseQuery = String.prototype.toQueryParams; + +Object.extend(String.prototype.escapeHTML, { + div: document.createElement('div'), + text: document.createTextNode('') +}); + +with (String.prototype.escapeHTML) div.appendChild(text); + +var Template = Class.create({ + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + if (Object.isFunction(object.toTemplateReplacements)) + object = object.toTemplateReplacements(); + + return this.template.gsub(this.pattern, function(match) { + if (object == null) return ''; + + var before = match[1] || ''; + if (before == '\\') return match[2]; + + var ctx = object, expr = match[3]; + var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; + match = pattern.exec(expr); + if (match == null) return before; + + while (match != null) { + var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; + ctx = ctx[comp]; + if (null == ctx || '' == match[3]) break; + expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); + match = pattern.exec(expr); + } + + return before + String.interpret(ctx); + }.bind(this)); + } +}); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; + +var $break = { }; + +var Enumerable = { + each: function(iterator, context) { + var index = 0; + iterator = iterator.bind(context); + try { + this._each(function(value) { + iterator(value, index++); + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + }, + + eachSlice: function(number, iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var index = -number, slices = [], array = this.toArray(); + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.collect(iterator, context); + }, + + all: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result = true; + this.each(function(value, index) { + result = result && !!iterator(value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result = false; + this.each(function(value, index) { + if (result = !!iterator(value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var results = []; + this.each(function(value, index) { + results.push(iterator(value, index)); + }); + return results; + }, + + detect: function(iterator, context) { + iterator = iterator.bind(context); + var result; + this.each(function(value, index) { + if (iterator(value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator, context) { + iterator = iterator.bind(context); + var results = []; + this.each(function(value, index) { + if (iterator(value, index)) + results.push(value); + }); + return results; + }, + + grep: function(filter, iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var results = []; + + if (Object.isString(filter)) + filter = new RegExp(filter); + + this.each(function(value, index) { + if (filter.match(value)) + results.push(iterator(value, index)); + }); + return results; + }, + + include: function(object) { + if (Object.isFunction(this.indexOf)) + if (this.indexOf(object) != -1) return true; + + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inGroupsOf: function(number, fillWith) { + fillWith = Object.isUndefined(fillWith) ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + }, + + inject: function(memo, iterator, context) { + iterator = iterator.bind(context); + this.each(function(value, index) { + memo = iterator(memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result; + this.each(function(value, index) { + value = iterator(value, index); + if (result == null || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result; + this.each(function(value, index) { + value = iterator(value, index); + if (result == null || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var trues = [], falses = []; + this.each(function(value, index) { + (iterator(value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator, context) { + iterator = iterator.bind(context); + var results = []; + this.each(function(value, index) { + if (!iterator(value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator, context) { + iterator = iterator.bind(context); + return this.map(function(value, index) { + return {value: value, criteria: iterator(value, index)}; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.map(); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (Object.isFunction(args.last())) + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + size: function() { + return this.toArray().length; + }, + + inspect: function() { + return '#'; + } +}; + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + filter: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray, + every: Enumerable.all, + some: Enumerable.any +}); +function $A(iterable) { + if (!iterable) return []; + if (iterable.toArray) return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; +} + +if (Prototype.Browser.WebKit) { + function $A(iterable) { + if (!iterable) return []; + if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && + iterable.toArray) return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; + } +} + +Array.from = $A; + +Object.extend(Array.prototype, Enumerable); + +if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0, length = this.length; i < length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(Object.isArray(value) ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + reduce: function() { + return this.length > 1 ? this : this[0]; + }, + + uniq: function(sorted) { + return this.inject([], function(array, value, index) { + if (0 == index || (sorted ? array.last() != value : !array.include(value))) + array.push(value); + return array; + }); + }, + + intersect: function(array) { + return this.uniq().findAll(function(item) { + return array.detect(function(value) { return item === value }); + }); + }, + + clone: function() { + return [].concat(this); + }, + + size: function() { + return this.length; + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + }, + + toJSON: function() { + var results = []; + this.each(function(object) { + var value = Object.toJSON(object); + if (!Object.isUndefined(value)) results.push(value); + }); + return '[' + results.join(', ') + ']'; + } +}); + +// use native browser JS 1.6 implementation if available +if (Object.isFunction(Array.prototype.forEach)) + Array.prototype._each = Array.prototype.forEach; + +if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) { + i || (i = 0); + var length = this.length; + if (i < 0) i = length + i; + for (; i < length; i++) + if (this[i] === item) return i; + return -1; +}; + +if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) { + i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; + var n = this.slice(0, i).reverse().indexOf(item); + return (n < 0) ? n : i - n - 1; +}; + +Array.prototype.toArray = Array.prototype.clone; + +function $w(string) { + if (!Object.isString(string)) return []; + string = string.strip(); + return string ? string.split(/\s+/) : []; +} + +if (Prototype.Browser.Opera){ + Array.prototype.concat = function() { + var array = []; + for (var i = 0, length = this.length; i < length; i++) array.push(this[i]); + for (var i = 0, length = arguments.length; i < length; i++) { + if (Object.isArray(arguments[i])) { + for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) + array.push(arguments[i][j]); + } else { + array.push(arguments[i]); + } + } + return array; + }; +} +Object.extend(Number.prototype, { + toColorPart: function() { + return this.toPaddedString(2, 16); + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator) { + $R(0, this, true).each(iterator); + return this; + }, + + toPaddedString: function(length, radix) { + var string = this.toString(radix || 10); + return '0'.times(length - string.length) + string; + }, + + toJSON: function() { + return isFinite(this) ? this.toString() : 'null'; + } +}); + +$w('abs round ceil floor').each(function(method){ + Number.prototype[method] = Math[method].methodize(); +}); +function $H(object) { + return new Hash(object); +}; + +var Hash = Class.create(Enumerable, (function() { + + function toQueryPair(key, value) { + if (Object.isUndefined(value)) return key; + return key + '=' + encodeURIComponent(String.interpret(value)); + } + + return { + initialize: function(object) { + this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); + }, + + _each: function(iterator) { + for (var key in this._object) { + var value = this._object[key], pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + }, + + set: function(key, value) { + return this._object[key] = value; + }, + + get: function(key) { + return this._object[key]; + }, + + unset: function(key) { + var value = this._object[key]; + delete this._object[key]; + return value; + }, + + toObject: function() { + return Object.clone(this._object); + }, + + keys: function() { + return this.pluck('key'); + }, + + values: function() { + return this.pluck('value'); + }, + + index: function(value) { + var match = this.detect(function(pair) { + return pair.value === value; + }); + return match && match.key; + }, + + merge: function(object) { + return this.clone().update(object); + }, + + update: function(object) { + return new Hash(object).inject(this, function(result, pair) { + result.set(pair.key, pair.value); + return result; + }); + }, + + toQueryString: function() { + return this.map(function(pair) { + var key = encodeURIComponent(pair.key), values = pair.value; + + if (values && typeof values == 'object') { + if (Object.isArray(values)) + return values.map(toQueryPair.curry(key)).join('&'); + } + return toQueryPair(key, values); + }).join('&'); + }, + + inspect: function() { + return '#'; + }, + + toJSON: function() { + return Object.toJSON(this.toObject()); + }, + + clone: function() { + return new Hash(this); + } + } +})()); + +Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; +Hash.from = $H; +var ObjectRange = Class.create(Enumerable, { + initialize: function(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + }, + + _each: function(iterator) { + var value = this.start; + while (this.include(value)) { + iterator(value); + value = value.succ(); + } + }, + + include: function(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } +}); + +var $R = function(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +}; + +var Ajax = { + getTransport: function() { + return Try.these( + function() {return new XMLHttpRequest()}, + function() {return new ActiveXObject('Msxml2.XMLHTTP')}, + function() {return new ActiveXObject('Microsoft.XMLHTTP')} + ) || false; + }, + + activeRequestCount: 0 +}; + +Ajax.Responders = { + responders: [], + + _each: function(iterator) { + this.responders._each(iterator); + }, + + register: function(responder) { + if (!this.include(responder)) + this.responders.push(responder); + }, + + unregister: function(responder) { + this.responders = this.responders.without(responder); + }, + + dispatch: function(callback, request, transport, json) { + this.each(function(responder) { + if (Object.isFunction(responder[callback])) { + try { + responder[callback].apply(responder, [request, transport, json]); + } catch (e) { } + } + }); + } +}; + +Object.extend(Ajax.Responders, Enumerable); + +Ajax.Responders.register({ + onCreate: function() { Ajax.activeRequestCount++ }, + onComplete: function() { Ajax.activeRequestCount-- } +}); + +Ajax.Base = Class.create({ + initialize: function(options) { + this.options = { + method: 'post', + asynchronous: true, + contentType: 'application/x-www-form-urlencoded', + encoding: 'UTF-8', + parameters: '', + evalJSON: true, + evalJS: true + }; + Object.extend(this.options, options || { }); + + this.options.method = this.options.method.toLowerCase(); + + if (Object.isString(this.options.parameters)) + this.options.parameters = this.options.parameters.toQueryParams(); + else if (Object.isHash(this.options.parameters)) + this.options.parameters = this.options.parameters.toObject(); + } +}); + +Ajax.Request = Class.create(Ajax.Base, { + _complete: false, + + initialize: function($super, url, options) { + $super(options); + this.transport = Ajax.getTransport(); + this.request(url); + }, + + request: function(url) { + this.url = url; + this.method = this.options.method; + var params = Object.clone(this.options.parameters); + + if (!['get', 'post'].include(this.method)) { + // simulate other verbs over post + params['_method'] = this.method; + this.method = 'post'; + } + + this.parameters = params; + + if (params = Object.toQueryString(params)) { + // when GET, append parameters to URL + if (this.method == 'get') + this.url += (this.url.include('?') ? '&' : '?') + params; + else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) + params += '&_='; + } + + try { + var response = new Ajax.Response(this); + if (this.options.onCreate) this.options.onCreate(response); + Ajax.Responders.dispatch('onCreate', this, response); + + this.transport.open(this.method.toUpperCase(), this.url, + this.options.asynchronous); + + if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); + + this.transport.onreadystatechange = this.onStateChange.bind(this); + this.setRequestHeaders(); + + this.body = this.method == 'post' ? (this.options.postBody || params) : null; + this.transport.send(this.body); + + /* Force Firefox to handle ready state 4 for synchronous requests */ + if (!this.options.asynchronous && this.transport.overrideMimeType) + this.onStateChange(); + + } + catch (e) { + this.dispatchException(e); + } + }, + + onStateChange: function() { + var readyState = this.transport.readyState; + if (readyState > 1 && !((readyState == 4) && this._complete)) + this.respondToReadyState(this.transport.readyState); + }, + + setRequestHeaders: function() { + var headers = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-Prototype-Version': Prototype.Version, + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + }; + + if (this.method == 'post') { + headers['Content-type'] = this.options.contentType + + (this.options.encoding ? '; charset=' + this.options.encoding : ''); + + /* Force "Connection: close" for older Mozilla browsers to work + * around a bug where XMLHttpRequest sends an incorrect + * Content-length header. See Mozilla Bugzilla #246651. + */ + if (this.transport.overrideMimeType && + (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) + headers['Connection'] = 'close'; + } + + // user-defined headers + if (typeof this.options.requestHeaders == 'object') { + var extras = this.options.requestHeaders; + + if (Object.isFunction(extras.push)) + for (var i = 0, length = extras.length; i < length; i += 2) + headers[extras[i]] = extras[i+1]; + else + $H(extras).each(function(pair) { headers[pair.key] = pair.value }); + } + + for (var name in headers) + this.transport.setRequestHeader(name, headers[name]); + }, + + success: function() { + var status = this.getStatus(); + return !status || (status >= 200 && status < 300); + }, + + getStatus: function() { + try { + return this.transport.status || 0; + } catch (e) { return 0 } + }, + + respondToReadyState: function(readyState) { + var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); + + if (state == 'Complete') { + try { + this._complete = true; + (this.options['on' + response.status] + || this.options['on' + (this.success() ? 'Success' : 'Failure')] + || Prototype.emptyFunction)(response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + var contentType = response.getHeader('Content-type'); + if (this.options.evalJS == 'force' + || (this.options.evalJS && contentType + && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) + this.evalResponse(); + } + + try { + (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); + Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + if (state == 'Complete') { + // avoid memory leak in MSIE: clean up + this.transport.onreadystatechange = Prototype.emptyFunction; + } + }, + + getHeader: function(name) { + try { + return this.transport.getResponseHeader(name) || null; + } catch (e) { return null } + }, + + evalResponse: function() { + try { + return eval((this.transport.responseText || '').unfilterJSON()); + } catch (e) { + this.dispatchException(e); + } + }, + + dispatchException: function(exception) { + (this.options.onException || Prototype.emptyFunction)(this, exception); + Ajax.Responders.dispatch('onException', this, exception); + } +}); + +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + +Ajax.Response = Class.create({ + initialize: function(request){ + this.request = request; + var transport = this.transport = request.transport, + readyState = this.readyState = transport.readyState; + + if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { + this.status = this.getStatus(); + this.statusText = this.getStatusText(); + this.responseText = String.interpret(transport.responseText); + this.headerJSON = this._getHeaderJSON(); + } + + if(readyState == 4) { + var xml = transport.responseXML; + this.responseXML = Object.isUndefined(xml) ? null : xml; + this.responseJSON = this._getResponseJSON(); + } + }, + + status: 0, + statusText: '', + + getStatus: Ajax.Request.prototype.getStatus, + + getStatusText: function() { + try { + return this.transport.statusText || ''; + } catch (e) { return '' } + }, + + getHeader: Ajax.Request.prototype.getHeader, + + getAllHeaders: function() { + try { + return this.getAllResponseHeaders(); + } catch (e) { return null } + }, + + getResponseHeader: function(name) { + return this.transport.getResponseHeader(name); + }, + + getAllResponseHeaders: function() { + return this.transport.getAllResponseHeaders(); + }, + + _getHeaderJSON: function() { + var json = this.getHeader('X-JSON'); + if (!json) return null; + json = decodeURIComponent(escape(json)); + try { + return json.evalJSON(this.request.options.sanitizeJSON); + } catch (e) { + this.request.dispatchException(e); + } + }, + + _getResponseJSON: function() { + var options = this.request.options; + if (!options.evalJSON || (options.evalJSON != 'force' && + !(this.getHeader('Content-type') || '').include('application/json')) || + this.responseText.blank()) + return null; + try { + return this.responseText.evalJSON(options.sanitizeJSON); + } catch (e) { + this.request.dispatchException(e); + } + } +}); + +Ajax.Updater = Class.create(Ajax.Request, { + initialize: function($super, container, url, options) { + this.container = { + success: (container.success || container), + failure: (container.failure || (container.success ? null : container)) + }; + + options = Object.clone(options); + var onComplete = options.onComplete; + options.onComplete = (function(response, json) { + this.updateContent(response.responseText); + if (Object.isFunction(onComplete)) onComplete(response, json); + }).bind(this); + + $super(url, options); + }, + + updateContent: function(responseText) { + var receiver = this.container[this.success() ? 'success' : 'failure'], + options = this.options; + + if (!options.evalScripts) responseText = responseText.stripScripts(); + + if (receiver = $(receiver)) { + if (options.insertion) { + if (Object.isString(options.insertion)) { + var insertion = { }; insertion[options.insertion] = responseText; + receiver.insert(insertion); + } + else options.insertion(receiver, responseText); + } + else receiver.update(responseText); + } + } +}); + +Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { + initialize: function($super, container, url, options) { + $super(options); + this.onComplete = this.options.onComplete; + + this.frequency = (this.options.frequency || 2); + this.decay = (this.options.decay || 1); + + this.updater = { }; + this.container = container; + this.url = url; + + this.start(); + }, + + start: function() { + this.options.onComplete = this.updateComplete.bind(this); + this.onTimerEvent(); + }, + + stop: function() { + this.updater.options.onComplete = undefined; + clearTimeout(this.timer); + (this.onComplete || Prototype.emptyFunction).apply(this, arguments); + }, + + updateComplete: function(response) { + if (this.options.decay) { + this.decay = (response.responseText == this.lastText ? + this.decay * this.options.decay : 1); + + this.lastText = response.responseText; + } + this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); + }, + + onTimerEvent: function() { + this.updater = new Ajax.Updater(this.container, this.url, this.options); + } +}); +function $(element) { + if (arguments.length > 1) { + for (var i = 0, elements = [], length = arguments.length; i < length; i++) + elements.push($(arguments[i])); + return elements; + } + if (Object.isString(element)) + element = document.getElementById(element); + return Element.extend(element); +} + +if (Prototype.BrowserFeatures.XPath) { + document._getElementsByXPath = function(expression, parentElement) { + var results = []; + var query = document.evaluate(expression, $(parentElement) || document, + null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0, length = query.snapshotLength; i < length; i++) + results.push(Element.extend(query.snapshotItem(i))); + return results; + }; +} + +/*--------------------------------------------------------------------------*/ + +if (!window.Node) var Node = { }; + +if (!Node.ELEMENT_NODE) { + // DOM level 2 ECMAScript Language Binding + Object.extend(Node, { + ELEMENT_NODE: 1, + ATTRIBUTE_NODE: 2, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + ENTITY_REFERENCE_NODE: 5, + ENTITY_NODE: 6, + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + NOTATION_NODE: 12 + }); +} + +(function() { + var element = this.Element; + this.Element = function(tagName, attributes) { + attributes = attributes || { }; + tagName = tagName.toLowerCase(); + var cache = Element.cache; + if (Prototype.Browser.IE && attributes.name) { + tagName = '<' + tagName + ' name="' + attributes.name + '">'; + delete attributes.name; + return Element.writeAttribute(document.createElement(tagName), attributes); + } + if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); + return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); + }; + Object.extend(this.Element, element || { }); +}).call(window); + +Element.cache = { }; + +Element.Methods = { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function(element) { + element = $(element); + Element[Element.visible(element) ? 'hide' : 'show'](element); + return element; + }, + + hide: function(element) { + $(element).style.display = 'none'; + return element; + }, + + show: function(element) { + $(element).style.display = ''; + return element; + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + return element; + }, + + update: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + content = Object.toHTML(content); + element.innerHTML = content.stripScripts(); + content.evalScripts.bind(content).defer(); + return element; + }, + + replace: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + else if (!Object.isElement(content)) { + content = Object.toHTML(content); + var range = element.ownerDocument.createRange(); + range.selectNode(element); + content.evalScripts.bind(content).defer(); + content = range.createContextualFragment(content.stripScripts()); + } + element.parentNode.replaceChild(content, element); + return element; + }, + + insert: function(element, insertions) { + element = $(element); + + if (Object.isString(insertions) || Object.isNumber(insertions) || + Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) + insertions = {bottom:insertions}; + + var content, insert, tagName, childNodes; + + for (position in insertions) { + content = insertions[position]; + position = position.toLowerCase(); + insert = Element._insertionTranslations[position]; + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + insert(element, content); + continue; + } + + content = Object.toHTML(content); + + tagName = ((position == 'before' || position == 'after') + ? element.parentNode : element).tagName.toUpperCase(); + + childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + + if (position == 'top' || position == 'after') childNodes.reverse(); + childNodes.each(insert.curry(element)); + + content.evalScripts.bind(content).defer(); + } + + return element; + }, + + wrap: function(element, wrapper, attributes) { + element = $(element); + if (Object.isElement(wrapper)) + $(wrapper).writeAttribute(attributes || { }); + else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); + else wrapper = new Element('div', wrapper); + if (element.parentNode) + element.parentNode.replaceChild(wrapper, element); + wrapper.appendChild(element); + return wrapper; + }, + + inspect: function(element) { + element = $(element); + var result = '<' + element.tagName.toLowerCase(); + $H({'id': 'id', 'className': 'class'}).each(function(pair) { + var property = pair.first(), attribute = pair.last(); + var value = (element[property] || '').toString(); + if (value) result += ' ' + attribute + '=' + value.inspect(true); + }); + return result + '>'; + }, + + recursivelyCollect: function(element, property) { + element = $(element); + var elements = []; + while (element = element[property]) + if (element.nodeType == 1) + elements.push(Element.extend(element)); + return elements; + }, + + ancestors: function(element) { + return $(element).recursivelyCollect('parentNode'); + }, + + descendants: function(element) { + return $(element).getElementsBySelector("*"); + }, + + firstDescendant: function(element) { + element = $(element).firstChild; + while (element && element.nodeType != 1) element = element.nextSibling; + return $(element); + }, + + immediateDescendants: function(element) { + if (!(element = $(element).firstChild)) return []; + while (element && element.nodeType != 1) element = element.nextSibling; + if (element) return [element].concat($(element).nextSiblings()); + return []; + }, + + previousSiblings: function(element) { + return $(element).recursivelyCollect('previousSibling'); + }, + + nextSiblings: function(element) { + return $(element).recursivelyCollect('nextSibling'); + }, + + siblings: function(element) { + element = $(element); + return element.previousSiblings().reverse().concat(element.nextSiblings()); + }, + + match: function(element, selector) { + if (Object.isString(selector)) + selector = new Selector(selector); + return selector.match($(element)); + }, + + up: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(element.parentNode); + var ancestors = element.ancestors(); + return Object.isNumber(expression) ? ancestors[expression] : + Selector.findElement(ancestors, expression, index); + }, + + down: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return element.firstDescendant(); + return Object.isNumber(expression) ? element.descendants()[expression] : + element.select(expression)[index || 0]; + }, + + previous: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); + var previousSiblings = element.previousSiblings(); + return Object.isNumber(expression) ? previousSiblings[expression] : + Selector.findElement(previousSiblings, expression, index); + }, + + next: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); + var nextSiblings = element.nextSiblings(); + return Object.isNumber(expression) ? nextSiblings[expression] : + Selector.findElement(nextSiblings, expression, index); + }, + + select: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element, args); + }, + + adjacent: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element.parentNode, args).without(element); + }, + + identify: function(element) { + element = $(element); + var id = element.readAttribute('id'), self = arguments.callee; + if (id) return id; + do { id = 'anonymous_element_' + self.counter++ } while ($(id)); + element.writeAttribute('id', id); + return id; + }, + + readAttribute: function(element, name) { + element = $(element); + if (Prototype.Browser.IE) { + var t = Element._attributeTranslations.read; + if (t.values[name]) return t.values[name](element, name); + if (t.names[name]) name = t.names[name]; + if (name.include(':')) { + return (!element.attributes || !element.attributes[name]) ? null : + element.attributes[name].value; + } + } + return element.getAttribute(name); + }, + + writeAttribute: function(element, name, value) { + element = $(element); + var attributes = { }, t = Element._attributeTranslations.write; + + if (typeof name == 'object') attributes = name; + else attributes[name] = Object.isUndefined(value) ? true : value; + + for (var attr in attributes) { + name = t.names[attr] || attr; + value = attributes[attr]; + if (t.values[attr]) name = t.values[attr](element, value); + if (value === false || value === null) + element.removeAttribute(name); + else if (value === true) + element.setAttribute(name, name); + else element.setAttribute(name, value); + } + return element; + }, + + getHeight: function(element) { + return $(element).getDimensions().height; + }, + + getWidth: function(element) { + return $(element).getDimensions().width; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + var elementClassName = element.className; + return (elementClassName.length > 0 && (elementClassName == className || + new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + if (!element.hasClassName(className)) + element.className += (element.className ? ' ' : '') + className; + return element; + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + element.className = element.className.replace( + new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); + return element; + }, + + toggleClassName: function(element, className) { + if (!(element = $(element))) return; + return element[element.hasClassName(className) ? + 'removeClassName' : 'addClassName'](className); + }, + + // removes whitespace-only text node children + cleanWhitespace: function(element) { + element = $(element); + var node = element.firstChild; + while (node) { + var nextNode = node.nextSibling; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + element.removeChild(node); + node = nextNode; + } + return element; + }, + + empty: function(element) { + return $(element).innerHTML.blank(); + }, + + descendantOf: function(element, ancestor) { + element = $(element), ancestor = $(ancestor); + var originalAncestor = ancestor; + + if (element.compareDocumentPosition) + return (element.compareDocumentPosition(ancestor) & 8) === 8; + + if (element.sourceIndex && !Prototype.Browser.Opera) { + var e = element.sourceIndex, a = ancestor.sourceIndex, + nextAncestor = ancestor.nextSibling; + if (!nextAncestor) { + do { ancestor = ancestor.parentNode; } + while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); + } + if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex); + } + + while (element = element.parentNode) + if (element == originalAncestor) return true; + return false; + }, + + scrollTo: function(element) { + element = $(element); + var pos = element.cumulativeOffset(); + window.scrollTo(pos[0], pos[1]); + return element; + }, + + getStyle: function(element, style) { + element = $(element); + style = style == 'float' ? 'cssFloat' : style.camelize(); + var value = element.style[style]; + if (!value) { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css[style] : null; + } + if (style == 'opacity') return value ? parseFloat(value) : 1.0; + return value == 'auto' ? null : value; + }, + + getOpacity: function(element) { + return $(element).getStyle('opacity'); + }, + + setStyle: function(element, styles) { + element = $(element); + var elementStyle = element.style, match; + if (Object.isString(styles)) { + element.style.cssText += ';' + styles; + return styles.include('opacity') ? + element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; + } + for (var property in styles) + if (property == 'opacity') element.setOpacity(styles[property]); + else + elementStyle[(property == 'float' || property == 'cssFloat') ? + (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : + property] = styles[property]; + + return element; + }, + + setOpacity: function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + return element; + }, + + getDimensions: function(element) { + element = $(element); + var display = $(element).getStyle('display'); + if (display != 'none' && display != null) // Safari bug + return {width: element.offsetWidth, height: element.offsetHeight}; + + // All *Width and *Height properties give 0 on elements with display none, + // so enable the element temporarily + var els = element.style; + var originalVisibility = els.visibility; + var originalPosition = els.position; + var originalDisplay = els.display; + els.visibility = 'hidden'; + els.position = 'absolute'; + els.display = 'block'; + var originalWidth = element.clientWidth; + var originalHeight = element.clientHeight; + els.display = originalDisplay; + els.position = originalPosition; + els.visibility = originalVisibility; + return {width: originalWidth, height: originalHeight}; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + // Opera returns the offset relative to the positioning context, when an + // element is position relative but top and left have not been defined + if (window.opera) { + element.style.top = 0; + element.style.left = 0; + } + } + return element; + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + return element; + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return element; + element._overflow = Element.getStyle(element, 'overflow') || 'auto'; + if (element._overflow !== 'hidden') + element.style.overflow = 'hidden'; + return element; + }, + + undoClipping: function(element) { + element = $(element); + if (!element._overflow) return element; + element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; + element._overflow = null; + return element; + }, + + cumulativeOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + positionedOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + if (element.tagName == 'BODY') break; + var p = Element.getStyle(element, 'position'); + if (p == 'relative' || p == 'absolute') break; + } + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + absolutize: function(element) { + element = $(element); + if (element.getStyle('position') == 'absolute') return; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + var offsets = element.positionedOffset(); + var top = offsets[1]; + var left = offsets[0]; + var width = element.clientWidth; + var height = element.clientHeight; + + element._originalLeft = left - parseFloat(element.style.left || 0); + element._originalTop = top - parseFloat(element.style.top || 0); + element._originalWidth = element.style.width; + element._originalHeight = element.style.height; + + element.style.position = 'absolute'; + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.width = width + 'px'; + element.style.height = height + 'px'; + return element; + }, + + relativize: function(element) { + element = $(element); + if (element.getStyle('position') == 'relative') return; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + element.style.position = 'relative'; + var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); + var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); + + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.height = element._originalHeight; + element.style.width = element._originalWidth; + return element; + }, + + cumulativeScrollOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + getOffsetParent: function(element) { + if (element.offsetParent) return $(element.offsetParent); + if (element == document.body) return $(element); + + while ((element = element.parentNode) && element != document.body) + if (Element.getStyle(element, 'position') != 'static') + return $(element); + + return $(document.body); + }, + + viewportOffset: function(forElement) { + var valueT = 0, valueL = 0; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + + // Safari fix + if (element.offsetParent == document.body && + Element.getStyle(element, 'position') == 'absolute') break; + + } while (element = element.offsetParent); + + element = forElement; + do { + if (!Prototype.Browser.Opera || element.tagName == 'BODY') { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } + } while (element = element.parentNode); + + return Element._returnOffset(valueL, valueT); + }, + + clonePosition: function(element, source) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || { }); + + // find page position of source + source = $(source); + var p = source.viewportOffset(); + + // find coordinate system to use + element = $(element); + var delta = [0, 0]; + var parent = null; + // delta [0,0] will do fine with position: fixed elements, + // position:absolute needs offsetParent deltas + if (Element.getStyle(element, 'position') == 'absolute') { + parent = element.getOffsetParent(); + delta = parent.viewportOffset(); + } + + // correct by body offsets (fixes Safari) + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + // set position + if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if (options.setWidth) element.style.width = source.offsetWidth + 'px'; + if (options.setHeight) element.style.height = source.offsetHeight + 'px'; + return element; + } +}; + +Element.Methods.identify.counter = 1; + +Object.extend(Element.Methods, { + getElementsBySelector: Element.Methods.select, + childElements: Element.Methods.immediateDescendants +}); + +Element._attributeTranslations = { + write: { + names: { + className: 'class', + htmlFor: 'for' + }, + values: { } + } +}; + +if (Prototype.Browser.Opera) { + Element.Methods.getStyle = Element.Methods.getStyle.wrap( + function(proceed, element, style) { + switch (style) { + case 'left': case 'top': case 'right': case 'bottom': + if (proceed(element, 'position') === 'static') return null; + case 'height': case 'width': + // returns '0px' for hidden elements; we want it to return null + if (!Element.visible(element)) return null; + + // returns the border-box dimensions rather than the content-box + // dimensions, so we subtract padding and borders from the value + var dim = parseInt(proceed(element, style), 10); + + if (dim !== element['offset' + style.capitalize()]) + return dim + 'px'; + + var properties; + if (style === 'height') { + properties = ['border-top-width', 'padding-top', + 'padding-bottom', 'border-bottom-width']; + } + else { + properties = ['border-left-width', 'padding-left', + 'padding-right', 'border-right-width']; + } + return properties.inject(dim, function(memo, property) { + var val = proceed(element, property); + return val === null ? memo : memo - parseInt(val, 10); + }) + 'px'; + default: return proceed(element, style); + } + } + ); + + Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( + function(proceed, element, attribute) { + if (attribute === 'title') return element.title; + return proceed(element, attribute); + } + ); +} + +else if (Prototype.Browser.IE) { + $w('positionedOffset getOffsetParent viewportOffset').each(function(method) { + Element.Methods[method] = Element.Methods[method].wrap( + function(proceed, element) { + element = $(element); + var position = element.getStyle('position'); + if (position != 'static') return proceed(element); + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + }); + + Element.Methods.getStyle = function(element, style) { + element = $(element); + style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); + var value = element.style[style]; + if (!value && element.currentStyle) value = element.currentStyle[style]; + + if (style == 'opacity') { + if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) + if (value[1]) return parseFloat(value[1]) / 100; + return 1.0; + } + + if (value == 'auto') { + if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) + return element['offset' + style.capitalize()] + 'px'; + return null; + } + return value; + }; + + Element.Methods.setOpacity = function(element, value) { + function stripAlpha(filter){ + return filter.replace(/alpha\([^\)]*\)/gi,''); + } + element = $(element); + var currentStyle = element.currentStyle; + if ((currentStyle && !currentStyle.hasLayout) || + (!currentStyle && element.style.zoom == 'normal')) + element.style.zoom = 1; + + var filter = element.getStyle('filter'), style = element.style; + if (value == 1 || value === '') { + (filter = stripAlpha(filter)) ? + style.filter = filter : style.removeAttribute('filter'); + return element; + } else if (value < 0.00001) value = 0; + style.filter = stripAlpha(filter) + + 'alpha(opacity=' + (value * 100) + ')'; + return element; + }; + + Element._attributeTranslations = { + read: { + names: { + 'class': 'className', + 'for': 'htmlFor' + }, + values: { + _getAttr: function(element, attribute) { + return element.getAttribute(attribute, 2); + }, + _getAttrNode: function(element, attribute) { + var node = element.getAttributeNode(attribute); + return node ? node.value : ""; + }, + _getEv: function(element, attribute) { + attribute = element.getAttribute(attribute); + return attribute ? attribute.toString().slice(23, -2) : null; + }, + _flag: function(element, attribute) { + return $(element).hasAttribute(attribute) ? attribute : null; + }, + style: function(element) { + return element.style.cssText.toLowerCase(); + }, + title: function(element) { + return element.title; + } + } + } + }; + + Element._attributeTranslations.write = { + names: Object.clone(Element._attributeTranslations.read.names), + values: { + checked: function(element, value) { + element.checked = !!value; + }, + + style: function(element, value) { + element.style.cssText = value ? value : ''; + } + } + }; + + Element._attributeTranslations.has = {}; + + $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + + 'encType maxLength readOnly longDesc').each(function(attr) { + Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; + Element._attributeTranslations.has[attr.toLowerCase()] = attr; + }); + + (function(v) { + Object.extend(v, { + href: v._getAttr, + src: v._getAttr, + type: v._getAttr, + action: v._getAttrNode, + disabled: v._flag, + checked: v._flag, + readonly: v._flag, + multiple: v._flag, + onload: v._getEv, + onunload: v._getEv, + onclick: v._getEv, + ondblclick: v._getEv, + onmousedown: v._getEv, + onmouseup: v._getEv, + onmouseover: v._getEv, + onmousemove: v._getEv, + onmouseout: v._getEv, + onfocus: v._getEv, + onblur: v._getEv, + onkeypress: v._getEv, + onkeydown: v._getEv, + onkeyup: v._getEv, + onsubmit: v._getEv, + onreset: v._getEv, + onselect: v._getEv, + onchange: v._getEv + }); + })(Element._attributeTranslations.read.values); +} + +else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1) ? 0.999999 : + (value === '') ? '' : (value < 0.00001) ? 0 : value; + return element; + }; +} + +else if (Prototype.Browser.WebKit) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + + if (value == 1) + if(element.tagName == 'IMG' && element.width) { + element.width++; element.width--; + } else try { + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch (e) { } + + return element; + }; + + // Safari returns margins on body which is incorrect if the child is absolutely + // positioned. For performance reasons, redefine Element#cumulativeOffset for + // KHTML/WebKit only. + Element.Methods.cumulativeOffset = function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return Element._returnOffset(valueL, valueT); + }; +} + +if (Prototype.Browser.IE || Prototype.Browser.Opera) { + // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements + Element.Methods.update = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + + content = Object.toHTML(content); + var tagName = element.tagName.toUpperCase(); + + if (tagName in Element._insertionTranslations.tags) { + $A(element.childNodes).each(function(node) { element.removeChild(node) }); + Element._getContentFromAnonymousElement(tagName, content.stripScripts()) + .each(function(node) { element.appendChild(node) }); + } + else element.innerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +if (document.createElement('div').outerHTML) { + Element.Methods.replace = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + element.parentNode.replaceChild(content, element); + return element; + } + + content = Object.toHTML(content); + var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); + + if (Element._insertionTranslations.tags[tagName]) { + var nextSibling = element.next(); + var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + parent.removeChild(element); + if (nextSibling) + fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); + else + fragments.each(function(node) { parent.appendChild(node) }); + } + else element.outerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +Element._returnOffset = function(l, t) { + var result = [l, t]; + result.left = l; + result.top = t; + return result; +}; + +Element._getContentFromAnonymousElement = function(tagName, html) { + var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; + if (t) { + div.innerHTML = t[0] + html + t[1]; + t[2].times(function() { div = div.firstChild }); + } else div.innerHTML = html; + return $A(div.childNodes); +}; + +Element._insertionTranslations = { + before: function(element, node) { + element.parentNode.insertBefore(node, element); + }, + top: function(element, node) { + element.insertBefore(node, element.firstChild); + }, + bottom: function(element, node) { + element.appendChild(node); + }, + after: function(element, node) { + element.parentNode.insertBefore(node, element.nextSibling); + }, + tags: { + TABLE: ['', '
    ', 1], + TBODY: ['', '
    ', 2], + TR: ['', '
    ', 3], + TD: ['
    ', '
    ', 4], + SELECT: ['', 1] + } +}; + +(function() { + Object.extend(this.tags, { + THEAD: this.tags.TBODY, + TFOOT: this.tags.TBODY, + TH: this.tags.TD + }); +}).call(Element._insertionTranslations); + +Element.Methods.Simulated = { + hasAttribute: function(element, attribute) { + attribute = Element._attributeTranslations.has[attribute] || attribute; + var node = $(element).getAttributeNode(attribute); + return node && node.specified; + } +}; + +Element.Methods.ByTag = { }; + +Object.extend(Element, Element.Methods); + +if (!Prototype.BrowserFeatures.ElementExtensions && + document.createElement('div').__proto__) { + window.HTMLElement = { }; + window.HTMLElement.prototype = document.createElement('div').__proto__; + Prototype.BrowserFeatures.ElementExtensions = true; +} + +Element.extend = (function() { + if (Prototype.BrowserFeatures.SpecificElementExtensions) + return Prototype.K; + + var Methods = { }, ByTag = Element.Methods.ByTag; + + var extend = Object.extend(function(element) { + if (!element || element._extendedByPrototype || + element.nodeType != 1 || element == window) return element; + + var methods = Object.clone(Methods), + tagName = element.tagName, property, value; + + // extend methods for specific tags + if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); + + for (property in methods) { + value = methods[property]; + if (Object.isFunction(value) && !(property in element)) + element[property] = value.methodize(); + } + + element._extendedByPrototype = Prototype.emptyFunction; + return element; + + }, { + refresh: function() { + // extend methods for all tags (Safari doesn't need this) + if (!Prototype.BrowserFeatures.ElementExtensions) { + Object.extend(Methods, Element.Methods); + Object.extend(Methods, Element.Methods.Simulated); + } + } + }); + + extend.refresh(); + return extend; +})(); + +Element.hasAttribute = function(element, attribute) { + if (element.hasAttribute) return element.hasAttribute(attribute); + return Element.Methods.Simulated.hasAttribute(element, attribute); +}; + +Element.addMethods = function(methods) { + var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; + + if (!methods) { + Object.extend(Form, Form.Methods); + Object.extend(Form.Element, Form.Element.Methods); + Object.extend(Element.Methods.ByTag, { + "FORM": Object.clone(Form.Methods), + "INPUT": Object.clone(Form.Element.Methods), + "SELECT": Object.clone(Form.Element.Methods), + "TEXTAREA": Object.clone(Form.Element.Methods) + }); + } + + if (arguments.length == 2) { + var tagName = methods; + methods = arguments[1]; + } + + if (!tagName) Object.extend(Element.Methods, methods || { }); + else { + if (Object.isArray(tagName)) tagName.each(extend); + else extend(tagName); + } + + function extend(tagName) { + tagName = tagName.toUpperCase(); + if (!Element.Methods.ByTag[tagName]) + Element.Methods.ByTag[tagName] = { }; + Object.extend(Element.Methods.ByTag[tagName], methods); + } + + function copy(methods, destination, onlyIfAbsent) { + onlyIfAbsent = onlyIfAbsent || false; + for (var property in methods) { + var value = methods[property]; + if (!Object.isFunction(value)) continue; + if (!onlyIfAbsent || !(property in destination)) + destination[property] = value.methodize(); + } + } + + function findDOMClass(tagName) { + var klass; + var trans = { + "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", + "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", + "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", + "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", + "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": + "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": + "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": + "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": + "FrameSet", "IFRAME": "IFrame" + }; + if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName.capitalize() + 'Element'; + if (window[klass]) return window[klass]; + + window[klass] = { }; + window[klass].prototype = document.createElement(tagName).__proto__; + return window[klass]; + } + + if (F.ElementExtensions) { + copy(Element.Methods, HTMLElement.prototype); + copy(Element.Methods.Simulated, HTMLElement.prototype, true); + } + + if (F.SpecificElementExtensions) { + for (var tag in Element.Methods.ByTag) { + var klass = findDOMClass(tag); + if (Object.isUndefined(klass)) continue; + copy(T[tag], klass.prototype); + } + } + + Object.extend(Element, Element.Methods); + delete Element.ByTag; + + if (Element.extend.refresh) Element.extend.refresh(); + Element.cache = { }; +}; + +document.viewport = { + getDimensions: function() { + var dimensions = { }; + var B = Prototype.Browser; + $w('width height').each(function(d) { + var D = d.capitalize(); + dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] : + (B.Opera) ? document.body['client' + D] : document.documentElement['client' + D]; + }); + return dimensions; + }, + + getWidth: function() { + return this.getDimensions().width; + }, + + getHeight: function() { + return this.getDimensions().height; + }, + + getScrollOffsets: function() { + return Element._returnOffset( + window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, + window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); + } +}; +/* Portions of the Selector class are derived from Jack Slocum’s DomQuery, + * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style + * license. Please see http://www.yui-ext.com/ for more information. */ + +var Selector = Class.create({ + initialize: function(expression) { + this.expression = expression.strip(); + this.compileMatcher(); + }, + + shouldUseXPath: function() { + if (!Prototype.BrowserFeatures.XPath) return false; + + var e = this.expression; + + // Safari 3 chokes on :*-of-type and :empty + if (Prototype.Browser.WebKit && + (e.include("-of-type") || e.include(":empty"))) + return false; + + // XPath can't do namespaced attributes, nor can it read + // the "checked" property from DOM nodes + if ((/(\[[\w-]*?:|:checked)/).test(this.expression)) + return false; + + return true; + }, + + compileMatcher: function() { + if (this.shouldUseXPath()) + return this.compileXPathMatcher(); + + var e = this.expression, ps = Selector.patterns, h = Selector.handlers, + c = Selector.criteria, le, p, m; + + if (Selector._cache[e]) { + this.matcher = Selector._cache[e]; + return; + } + + this.matcher = ["this.matcher = function(root) {", + "var r = root, h = Selector.handlers, c = false, n;"]; + + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : + new Template(c[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.matcher.push("return h.unique(n);\n}"); + eval(this.matcher.join('\n')); + Selector._cache[this.expression] = this.matcher; + }, + + compileXPathMatcher: function() { + var e = this.expression, ps = Selector.patterns, + x = Selector.xpath, le, m; + + if (Selector._cache[e]) { + this.xpath = Selector._cache[e]; return; + } + + this.matcher = ['.//*']; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + if (m = e.match(ps[i])) { + this.matcher.push(Object.isFunction(x[i]) ? x[i](m) : + new Template(x[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.xpath = this.matcher.join(''); + Selector._cache[this.expression] = this.xpath; + }, + + findElements: function(root) { + root = root || document; + if (this.xpath) return document._getElementsByXPath(this.xpath, root); + return this.matcher(root); + }, + + match: function(element) { + this.tokens = []; + + var e = this.expression, ps = Selector.patterns, as = Selector.assertions; + var le, p, m; + + while (e && le !== e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + // use the Selector.assertions methods unless the selector + // is too complex. + if (as[i]) { + this.tokens.push([i, Object.clone(m)]); + e = e.replace(m[0], ''); + } else { + // reluctantly do a document-wide search + // and look for a match in the array + return this.findElements(document).include(element); + } + } + } + } + + var match = true, name, matches; + for (var i = 0, token; token = this.tokens[i]; i++) { + name = token[0], matches = token[1]; + if (!Selector.assertions[name](element, matches)) { + match = false; break; + } + } + + return match; + }, + + toString: function() { + return this.expression; + }, + + inspect: function() { + return "#"; + } +}); + +Object.extend(Selector, { + _cache: { }, + + xpath: { + descendant: "//*", + child: "/*", + adjacent: "/following-sibling::*[1]", + laterSibling: '/following-sibling::*', + tagName: function(m) { + if (m[1] == '*') return ''; + return "[local-name()='" + m[1].toLowerCase() + + "' or local-name()='" + m[1].toUpperCase() + "']"; + }, + className: "[contains(concat(' ', @class, ' '), ' #{1} ')]", + id: "[@id='#{1}']", + attrPresence: function(m) { + m[1] = m[1].toLowerCase(); + return new Template("[@#{1}]").evaluate(m); + }, + attr: function(m) { + m[1] = m[1].toLowerCase(); + m[3] = m[5] || m[6]; + return new Template(Selector.xpath.operators[m[2]]).evaluate(m); + }, + pseudo: function(m) { + var h = Selector.xpath.pseudos[m[1]]; + if (!h) return ''; + if (Object.isFunction(h)) return h(m); + return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); + }, + operators: { + '=': "[@#{1}='#{3}']", + '!=': "[@#{1}!='#{3}']", + '^=': "[starts-with(@#{1}, '#{3}')]", + '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']", + '*=': "[contains(@#{1}, '#{3}')]", + '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", + '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" + }, + pseudos: { + 'first-child': '[not(preceding-sibling::*)]', + 'last-child': '[not(following-sibling::*)]', + 'only-child': '[not(preceding-sibling::* or following-sibling::*)]', + 'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]", + 'checked': "[@checked]", + 'disabled': "[@disabled]", + 'enabled': "[not(@disabled)]", + 'not': function(m) { + var e = m[6], p = Selector.patterns, + x = Selector.xpath, le, v; + + var exclusion = []; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in p) { + if (m = e.match(p[i])) { + v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m); + exclusion.push("(" + v.substring(1, v.length - 1) + ")"); + e = e.replace(m[0], ''); + break; + } + } + } + return "[not(" + exclusion.join(" and ") + ")]"; + }, + 'nth-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m); + }, + 'nth-last-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m); + }, + 'nth-of-type': function(m) { + return Selector.xpath.pseudos.nth("position() ", m); + }, + 'nth-last-of-type': function(m) { + return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); + }, + 'first-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m); + }, + 'last-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); + }, + 'only-of-type': function(m) { + var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m); + }, + nth: function(fragment, m) { + var mm, formula = m[6], predicate; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + if (mm = formula.match(/^(\d+)$/)) // digit only + return '[' + fragment + "= " + mm[1] + ']'; + if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (mm[1] == "-") mm[1] = -1; + var a = mm[1] ? Number(mm[1]) : 1; + var b = mm[2] ? Number(mm[2]) : 0; + predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " + + "((#{fragment} - #{b}) div #{a} >= 0)]"; + return new Template(predicate).evaluate({ + fragment: fragment, a: a, b: b }); + } + } + } + }, + + criteria: { + tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', + className: 'n = h.className(n, r, "#{1}", c); c = false;', + id: 'n = h.id(n, r, "#{1}", c); c = false;', + attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;', + attr: function(m) { + m[3] = (m[5] || m[6]); + return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m); + }, + pseudo: function(m) { + if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); + return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m); + }, + descendant: 'c = "descendant";', + child: 'c = "child";', + adjacent: 'c = "adjacent";', + laterSibling: 'c = "laterSibling";' + }, + + patterns: { + // combinators must be listed first + // (and descendant needs to be last combinator) + laterSibling: /^\s*~\s*/, + child: /^\s*>\s*/, + adjacent: /^\s*\+\s*/, + descendant: /^\s/, + + // selectors follow + tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, + id: /^#([\w\-\*]+)(\b|$)/, + className: /^\.([\w\-\*]+)(\b|$)/, + pseudo: +/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/, + attrPresence: /^\[([\w]+)\]/, + attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ + }, + + // for Selector.match and Element#match + assertions: { + tagName: function(element, matches) { + return matches[1].toUpperCase() == element.tagName.toUpperCase(); + }, + + className: function(element, matches) { + return Element.hasClassName(element, matches[1]); + }, + + id: function(element, matches) { + return element.id === matches[1]; + }, + + attrPresence: function(element, matches) { + return Element.hasAttribute(element, matches[1]); + }, + + attr: function(element, matches) { + var nodeValue = Element.readAttribute(element, matches[1]); + return Selector.operators[matches[2]](nodeValue, matches[3]); + } + }, + + handlers: { + // UTILITY FUNCTIONS + // joins two collections + concat: function(a, b) { + for (var i = 0, node; node = b[i]; i++) + a.push(node); + return a; + }, + + // marks an array of nodes for counting + mark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node._counted = true; + return nodes; + }, + + unmark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node._counted = undefined; + return nodes; + }, + + // mark each child node with its position (for nth calls) + // "ofType" flag indicates whether we're indexing for nth-of-type + // rather than nth-child + index: function(parentNode, reverse, ofType) { + parentNode._counted = true; + if (reverse) { + for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { + var node = nodes[i]; + if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; + } + } else { + for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) + if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; + } + }, + + // filters out duplicates and extends all nodes + unique: function(nodes) { + if (nodes.length == 0) return nodes; + var results = [], n; + for (var i = 0, l = nodes.length; i < l; i++) + if (!(n = nodes[i])._counted) { + n._counted = true; + results.push(Element.extend(n)); + } + return Selector.handlers.unmark(results); + }, + + // COMBINATOR FUNCTIONS + descendant: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName('*')); + return results; + }, + + child: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) { + for (var j = 0, child; child = node.childNodes[j]; j++) + if (child.nodeType == 1 && child.tagName != '!') results.push(child); + } + return results; + }, + + adjacent: function(nodes) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + var next = this.nextElementSibling(node); + if (next) results.push(next); + } + return results; + }, + + laterSibling: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, Element.nextSiblings(node)); + return results; + }, + + nextElementSibling: function(node) { + while (node = node.nextSibling) + if (node.nodeType == 1) return node; + return null; + }, + + previousElementSibling: function(node) { + while (node = node.previousSibling) + if (node.nodeType == 1) return node; + return null; + }, + + // TOKEN FUNCTIONS + tagName: function(nodes, root, tagName, combinator) { + var uTagName = tagName.toUpperCase(); + var results = [], h = Selector.handlers; + if (nodes) { + if (combinator) { + // fastlane for ordinary descendant combinators + if (combinator == "descendant") { + for (var i = 0, node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName(tagName)); + return results; + } else nodes = this[combinator](nodes); + if (tagName == "*") return nodes; + } + for (var i = 0, node; node = nodes[i]; i++) + if (node.tagName.toUpperCase() === uTagName) results.push(node); + return results; + } else return root.getElementsByTagName(tagName); + }, + + id: function(nodes, root, id, combinator) { + var targetNode = $(id), h = Selector.handlers; + if (!targetNode) return []; + if (!nodes && root == document) return [targetNode]; + if (nodes) { + if (combinator) { + if (combinator == 'child') { + for (var i = 0, node; node = nodes[i]; i++) + if (targetNode.parentNode == node) return [targetNode]; + } else if (combinator == 'descendant') { + for (var i = 0, node; node = nodes[i]; i++) + if (Element.descendantOf(targetNode, node)) return [targetNode]; + } else if (combinator == 'adjacent') { + for (var i = 0, node; node = nodes[i]; i++) + if (Selector.handlers.previousElementSibling(targetNode) == node) + return [targetNode]; + } else nodes = h[combinator](nodes); + } + for (var i = 0, node; node = nodes[i]; i++) + if (node == targetNode) return [targetNode]; + return []; + } + return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : []; + }, + + className: function(nodes, root, className, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + return Selector.handlers.byClassName(nodes, root, className); + }, + + byClassName: function(nodes, root, className) { + if (!nodes) nodes = Selector.handlers.descendant([root]); + var needle = ' ' + className + ' '; + for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) { + nodeClassName = node.className; + if (nodeClassName.length == 0) continue; + if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle)) + results.push(node); + } + return results; + }, + + attrPresence: function(nodes, root, attr) { + if (!nodes) nodes = root.getElementsByTagName("*"); + var results = []; + for (var i = 0, node; node = nodes[i]; i++) + if (Element.hasAttribute(node, attr)) results.push(node); + return results; + }, + + attr: function(nodes, root, attr, value, operator) { + if (!nodes) nodes = root.getElementsByTagName("*"); + var handler = Selector.operators[operator], results = []; + for (var i = 0, node; node = nodes[i]; i++) { + var nodeValue = Element.readAttribute(node, attr); + if (nodeValue === null) continue; + if (handler(nodeValue, value)) results.push(node); + } + return results; + }, + + pseudo: function(nodes, name, value, root, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + if (!nodes) nodes = root.getElementsByTagName("*"); + return Selector.pseudos[name](nodes, value, root); + } + }, + + pseudos: { + 'first-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.previousElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'last-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.nextElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'only-child': function(nodes, value, root) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) + results.push(node); + return results; + }, + 'nth-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root); + }, + 'nth-last-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true); + }, + 'nth-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, false, true); + }, + 'nth-last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true, true); + }, + 'first-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, false, true); + }, + 'last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, true, true); + }, + 'only-of-type': function(nodes, formula, root) { + var p = Selector.pseudos; + return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root); + }, + + // handles the an+b logic + getIndices: function(a, b, total) { + if (a == 0) return b > 0 ? [b] : []; + return $R(1, total).inject([], function(memo, i) { + if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i); + return memo; + }); + }, + + // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type + nth: function(nodes, formula, root, reverse, ofType) { + if (nodes.length == 0) return []; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + var h = Selector.handlers, results = [], indexed = [], m; + h.mark(nodes); + for (var i = 0, node; node = nodes[i]; i++) { + if (!node.parentNode._counted) { + h.index(node.parentNode, reverse, ofType); + indexed.push(node.parentNode); + } + } + if (formula.match(/^\d+$/)) { // just a number + formula = Number(formula); + for (var i = 0, node; node = nodes[i]; i++) + if (node.nodeIndex == formula) results.push(node); + } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (m[1] == "-") m[1] = -1; + var a = m[1] ? Number(m[1]) : 1; + var b = m[2] ? Number(m[2]) : 0; + var indices = Selector.pseudos.getIndices(a, b, nodes.length); + for (var i = 0, node, l = indices.length; node = nodes[i]; i++) { + for (var j = 0; j < l; j++) + if (node.nodeIndex == indices[j]) results.push(node); + } + } + h.unmark(nodes); + h.unmark(indexed); + return results; + }, + + 'empty': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + // IE treats comments as element nodes + if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue; + results.push(node); + } + return results; + }, + + 'not': function(nodes, selector, root) { + var h = Selector.handlers, selectorType, m; + var exclusions = new Selector(selector).findElements(root); + h.mark(exclusions); + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node._counted) results.push(node); + h.unmark(exclusions); + return results; + }, + + 'enabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node.disabled) results.push(node); + return results; + }, + + 'disabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.disabled) results.push(node); + return results; + }, + + 'checked': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.checked) results.push(node); + return results; + } + }, + + operators: { + '=': function(nv, v) { return nv == v; }, + '!=': function(nv, v) { return nv != v; }, + '^=': function(nv, v) { return nv.startsWith(v); }, + '$=': function(nv, v) { return nv.endsWith(v); }, + '*=': function(nv, v) { return nv.include(v); }, + '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); }, + '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); } + }, + + matchElements: function(elements, expression) { + var matches = new Selector(expression).findElements(), h = Selector.handlers; + h.mark(matches); + for (var i = 0, results = [], element; element = elements[i]; i++) + if (element._counted) results.push(element); + h.unmark(matches); + return results; + }, + + findElement: function(elements, expression, index) { + if (Object.isNumber(expression)) { + index = expression; expression = false; + } + return Selector.matchElements(elements, expression || '*')[index || 0]; + }, + + findChildElements: function(element, expressions) { + var exprs = expressions.join(','); + expressions = []; + exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { + expressions.push(m[1].strip()); + }); + var results = [], h = Selector.handlers; + for (var i = 0, l = expressions.length, selector; i < l; i++) { + selector = new Selector(expressions[i].strip()); + h.concat(results, selector.findElements(element)); + } + return (l > 1) ? h.unique(results) : results; + } +}); + +if (Prototype.Browser.IE) { + // IE returns comment nodes on getElementsByTagName("*"). + // Filter them out. + Selector.handlers.concat = function(a, b) { + for (var i = 0, node; node = b[i]; i++) + if (node.tagName !== "!") a.push(node); + return a; + }; +} + +function $$() { + return Selector.findChildElements(document, $A(arguments)); +} +var Form = { + reset: function(form) { + $(form).reset(); + return form; + }, + + serializeElements: function(elements, options) { + if (typeof options != 'object') options = { hash: !!options }; + else if (Object.isUndefined(options.hash)) options.hash = true; + var key, value, submitted = false, submit = options.submit; + + var data = elements.inject({ }, function(result, element) { + if (!element.disabled && element.name) { + key = element.name; value = $(element).getValue(); + if (value != null && (element.type != 'submit' || (!submitted && + submit !== false && (!submit || key == submit) && (submitted = true)))) { + if (key in result) { + // a key is already present; construct an array of values + if (!Object.isArray(result[key])) result[key] = [result[key]]; + result[key].push(value); + } + else result[key] = value; + } + } + return result; + }); + + return options.hash ? data : Object.toQueryString(data); + } +}; + +Form.Methods = { + serialize: function(form, options) { + return Form.serializeElements(Form.getElements(form), options); + }, + + getElements: function(form) { + return $A($(form).getElementsByTagName('*')).inject([], + function(elements, child) { + if (Form.Element.Serializers[child.tagName.toLowerCase()]) + elements.push(Element.extend(child)); + return elements; + } + ); + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) return $A(inputs).map(Element.extend); + + for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || (name && input.name != name)) + continue; + matchingInputs.push(Element.extend(input)); + } + + return matchingInputs; + }, + + disable: function(form) { + form = $(form); + Form.getElements(form).invoke('disable'); + return form; + }, + + enable: function(form) { + form = $(form); + Form.getElements(form).invoke('enable'); + return form; + }, + + findFirstElement: function(form) { + var elements = $(form).getElements().findAll(function(element) { + return 'hidden' != element.type && !element.disabled; + }); + var firstByIndex = elements.findAll(function(element) { + return element.hasAttribute('tabIndex') && element.tabIndex >= 0; + }).sortBy(function(element) { return element.tabIndex }).first(); + + return firstByIndex ? firstByIndex : elements.find(function(element) { + return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + }); + }, + + focusFirstElement: function(form) { + form = $(form); + form.findFirstElement().activate(); + return form; + }, + + request: function(form, options) { + form = $(form), options = Object.clone(options || { }); + + var params = options.parameters, action = form.readAttribute('action') || ''; + if (action.blank()) action = window.location.href; + options.parameters = form.serialize(true); + + if (params) { + if (Object.isString(params)) params = params.toQueryParams(); + Object.extend(options.parameters, params); + } + + if (form.hasAttribute('method') && !options.method) + options.method = form.method; + + return new Ajax.Request(action, options); + } +}; + +/*--------------------------------------------------------------------------*/ + +Form.Element = { + focus: function(element) { + $(element).focus(); + return element; + }, + + select: function(element) { + $(element).select(); + return element; + } +}; + +Form.Element.Methods = { + serialize: function(element) { + element = $(element); + if (!element.disabled && element.name) { + var value = element.getValue(); + if (value != undefined) { + var pair = { }; + pair[element.name] = value; + return Object.toQueryString(pair); + } + } + return ''; + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + return Form.Element.Serializers[method](element); + }, + + setValue: function(element, value) { + element = $(element); + var method = element.tagName.toLowerCase(); + Form.Element.Serializers[method](element, value); + return element; + }, + + clear: function(element) { + $(element).value = ''; + return element; + }, + + present: function(element) { + return $(element).value != ''; + }, + + activate: function(element) { + element = $(element); + try { + element.focus(); + if (element.select && (element.tagName.toLowerCase() != 'input' || + !['button', 'reset', 'submit'].include(element.type))) + element.select(); + } catch (e) { } + return element; + }, + + disable: function(element) { + element = $(element); + element.blur(); + element.disabled = true; + return element; + }, + + enable: function(element) { + element = $(element); + element.disabled = false; + return element; + } +}; + +/*--------------------------------------------------------------------------*/ + +var Field = Form.Element; +var $F = Form.Element.Methods.getValue; + +/*--------------------------------------------------------------------------*/ + +Form.Element.Serializers = { + input: function(element, value) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + return Form.Element.Serializers.inputSelector(element, value); + default: + return Form.Element.Serializers.textarea(element, value); + } + }, + + inputSelector: function(element, value) { + if (Object.isUndefined(value)) return element.checked ? element.value : null; + else element.checked = !!value; + }, + + textarea: function(element, value) { + if (Object.isUndefined(value)) return element.value; + else element.value = value; + }, + + select: function(element, index) { + if (Object.isUndefined(index)) + return this[element.type == 'select-one' ? + 'selectOne' : 'selectMany'](element); + else { + var opt, value, single = !Object.isArray(index); + for (var i = 0, length = element.length; i < length; i++) { + opt = element.options[i]; + value = this.optionValue(opt); + if (single) { + if (value == index) { + opt.selected = true; + return; + } + } + else opt.selected = index.include(value); + } + } + }, + + selectOne: function(element) { + var index = element.selectedIndex; + return index >= 0 ? this.optionValue(element.options[index]) : null; + }, + + selectMany: function(element) { + var values, length = element.length; + if (!length) return null; + + for (var i = 0, values = []; i < length; i++) { + var opt = element.options[i]; + if (opt.selected) values.push(this.optionValue(opt)); + } + return values; + }, + + optionValue: function(opt) { + // extend element because hasAttribute may not be native + return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; + } +}; + +/*--------------------------------------------------------------------------*/ + +Abstract.TimedObserver = Class.create(PeriodicalExecuter, { + initialize: function($super, element, frequency, callback) { + $super(callback, frequency); + this.element = $(element); + this.lastValue = this.getValue(); + }, + + execute: function() { + var value = this.getValue(); + if (Object.isString(this.lastValue) && Object.isString(value) ? + this.lastValue != value : String(this.lastValue) != String(value)) { + this.callback(this.element, value); + this.lastValue = value; + } + } +}); + +Form.Element.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = Class.create({ + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + Form.getElements(this.element).each(this.registerCallback, this); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + default: + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +}); + +Form.Element.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); +if (!window.Event) var Event = { }; + +Object.extend(Event, { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + KEY_HOME: 36, + KEY_END: 35, + KEY_PAGEUP: 33, + KEY_PAGEDOWN: 34, + KEY_INSERT: 45, + + cache: { }, + + relatedTarget: function(event) { + var element; + switch(event.type) { + case 'mouseover': element = event.fromElement; break; + case 'mouseout': element = event.toElement; break; + default: return null; + } + return Element.extend(element); + } +}); + +Event.Methods = (function() { + var isButton; + + if (Prototype.Browser.IE) { + var buttonMap = { 0: 1, 1: 4, 2: 2 }; + isButton = function(event, code) { + return event.button == buttonMap[code]; + }; + + } else if (Prototype.Browser.WebKit) { + isButton = function(event, code) { + switch (code) { + case 0: return event.which == 1 && !event.metaKey; + case 1: return event.which == 1 && event.metaKey; + default: return false; + } + }; + + } else { + isButton = function(event, code) { + return event.which ? (event.which === code + 1) : (event.button === code); + }; + } + + return { + isLeftClick: function(event) { return isButton(event, 0) }, + isMiddleClick: function(event) { return isButton(event, 1) }, + isRightClick: function(event) { return isButton(event, 2) }, + + element: function(event) { + var node = Event.extend(event).target; + return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node); + }, + + findElement: function(event, expression) { + var element = Event.element(event); + if (!expression) return element; + var elements = [element].concat(element.ancestors()); + return Selector.findElement(elements, expression, 0); + }, + + pointer: function(event) { + return { + x: event.pageX || (event.clientX + + (document.documentElement.scrollLeft || document.body.scrollLeft)), + y: event.pageY || (event.clientY + + (document.documentElement.scrollTop || document.body.scrollTop)) + }; + }, + + pointerX: function(event) { return Event.pointer(event).x }, + pointerY: function(event) { return Event.pointer(event).y }, + + stop: function(event) { + Event.extend(event); + event.preventDefault(); + event.stopPropagation(); + event.stopped = true; + } + }; +})(); + +Event.extend = (function() { + var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { + m[name] = Event.Methods[name].methodize(); + return m; + }); + + if (Prototype.Browser.IE) { + Object.extend(methods, { + stopPropagation: function() { this.cancelBubble = true }, + preventDefault: function() { this.returnValue = false }, + inspect: function() { return "[object Event]" } + }); + + return function(event) { + if (!event) return false; + if (event._extendedByPrototype) return event; + + event._extendedByPrototype = Prototype.emptyFunction; + var pointer = Event.pointer(event); + Object.extend(event, { + target: event.srcElement, + relatedTarget: Event.relatedTarget(event), + pageX: pointer.x, + pageY: pointer.y + }); + return Object.extend(event, methods); + }; + + } else { + Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__; + Object.extend(Event.prototype, methods); + return Prototype.K; + } +})(); + +Object.extend(Event, (function() { + var cache = Event.cache; + + function getEventID(element) { + if (element._eventID) return element._eventID; + arguments.callee.id = arguments.callee.id || 1; + return element._eventID = ++arguments.callee.id; + } + + function getDOMEventName(eventName) { + if (eventName && eventName.include(':')) return "dataavailable"; + return eventName; + } + + function getCacheForID(id) { + return cache[id] = cache[id] || { }; + } + + function getWrappersForEventName(id, eventName) { + var c = getCacheForID(id); + return c[eventName] = c[eventName] || []; + } + + function createWrapper(element, eventName, handler) { + var id = getEventID(element); + var c = getWrappersForEventName(id, eventName); + if (c.pluck("handler").include(handler)) return false; + + var wrapper = function(event) { + if (!Event || !Event.extend || + (event.eventName && event.eventName != eventName)) + return false; + + Event.extend(event); + handler.call(element, event); + }; + + wrapper.handler = handler; + c.push(wrapper); + return wrapper; + } + + function findWrapper(id, eventName, handler) { + var c = getWrappersForEventName(id, eventName); + return c.find(function(wrapper) { return wrapper.handler == handler }); + } + + function destroyWrapper(id, eventName, handler) { + var c = getCacheForID(id); + if (!c[eventName]) return false; + c[eventName] = c[eventName].without(findWrapper(id, eventName, handler)); + } + + function destroyCache() { + for (var id in cache) + for (var eventName in cache[id]) + cache[id][eventName] = null; + } + + if (window.attachEvent) { + window.attachEvent("onunload", destroyCache); + } + + return { + observe: function(element, eventName, handler) { + element = $(element); + var name = getDOMEventName(eventName); + + var wrapper = createWrapper(element, eventName, handler); + if (!wrapper) return element; + + if (element.addEventListener) { + element.addEventListener(name, wrapper, false); + } else { + element.attachEvent("on" + name, wrapper); + } + + return element; + }, + + stopObserving: function(element, eventName, handler) { + element = $(element); + var id = getEventID(element), name = getDOMEventName(eventName); + + if (!handler && eventName) { + getWrappersForEventName(id, eventName).each(function(wrapper) { + element.stopObserving(eventName, wrapper.handler); + }); + return element; + + } else if (!eventName) { + Object.keys(getCacheForID(id)).each(function(eventName) { + element.stopObserving(eventName); + }); + return element; + } + + var wrapper = findWrapper(id, eventName, handler); + if (!wrapper) return element; + + if (element.removeEventListener) { + element.removeEventListener(name, wrapper, false); + } else { + element.detachEvent("on" + name, wrapper); + } + + destroyWrapper(id, eventName, handler); + + return element; + }, + + fire: function(element, eventName, memo) { + element = $(element); + if (element == document && document.createEvent && !element.dispatchEvent) + element = document.documentElement; + + var event; + if (document.createEvent) { + event = document.createEvent("HTMLEvents"); + event.initEvent("dataavailable", true, true); + } else { + event = document.createEventObject(); + event.eventType = "ondataavailable"; + } + + event.eventName = eventName; + event.memo = memo || { }; + + if (document.createEvent) { + element.dispatchEvent(event); + } else { + element.fireEvent(event.eventType, event); + } + + return Event.extend(event); + } + }; +})()); + +Object.extend(Event, Event.Methods); + +Element.addMethods({ + fire: Event.fire, + observe: Event.observe, + stopObserving: Event.stopObserving +}); + +Object.extend(document, { + fire: Element.Methods.fire.methodize(), + observe: Element.Methods.observe.methodize(), + stopObserving: Element.Methods.stopObserving.methodize(), + loaded: false +}); + +(function() { + /* Support for the DOMContentLoaded event is based on work by Dan Webb, + Matthias Miller, Dean Edwards and John Resig. */ + + var timer; + + function fireContentLoadedEvent() { + if (document.loaded) return; + if (timer) window.clearInterval(timer); + document.fire("dom:loaded"); + document.loaded = true; + } + + if (document.addEventListener) { + if (Prototype.Browser.WebKit) { + timer = window.setInterval(function() { + if (/loaded|complete/.test(document.readyState)) + fireContentLoadedEvent(); + }, 0); + + Event.observe(window, "load", fireContentLoadedEvent); + + } else { + document.addEventListener("DOMContentLoaded", + fireContentLoadedEvent, false); + } + + } else { + document.write(" to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backwards compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" diff --git a/posterita/posterita/web/js/creditScreen.js b/posterita/posterita/web/js/creditScreen.js new file mode 100644 index 0000000000..9d28c8b5cd --- /dev/null +++ b/posterita/posterita/web/js/creditScreen.js @@ -0,0 +1,537 @@ +//scripts for Posterita Ordering Screen +var product_id = null; +var qty = null; +var discountLimit = null; +var paymentPanels = null; +var activePanel = null; +var cartLines = null; +var cartIndex = null; +var orderType = null; +var tenderType = null; +var priceList = null; +var oldPriceList = -1; +var searchElement = null; +var isCustomerCompulsory = false; +var defaultPriceList = null; +var defaultPriceListName = null; + +var ORDER_TYPES = { + POS_ORDER : 'POS Order', + POS_GOOD_RECEIVE_NOTE : 'POS Goods Received Note', + CREDIT_ORDER : 'Credit Order' + }; + +var initScreen = function(){ + //set order type + orderType = $('orderType').value; + //set tender type + tenderType = $('tenderType').value; + //set priceList + priceList = $('priceListId').value; + + //set default data for price list + defaultPriceList = priceList; + defaultPriceListName = $('terminal').innerHTML; + + //set search element + var searchProductBy = $('searchProductBy').value; + if(searchProductBy == 'name') + { + searchElement = $('productQuery'); + } + else + { + searchElement = $(searchProductBy); + } + + //set is customer compulsory + if($('isCustomerCompulsory').value == 'true') + { + isCustomerCompulsory = true; + } + + initProductSearch(); + initSearchCustomer(); + initCartBtn(); + initAjaxResponder(); + initShortcuts(); + //initPaymentBtns(); + + //set payment rule + //simulateOnClick($(tenderType + 'Btn')); + + $('total').innerHTML = $('cartTotal').innerHTML; + + + searchElement.focus(); + + var barcode = $('barcode'); + barcode.onkeyup = function(e){ + if(e.keyCode == Event.KEY_RETURN) + { + if(this.value != null && this.value != "") + { + if(!validateBp()) + { + return; + } + + addToCart(this.value); + this.value = ""; + } + + } + }; + + $('qty').onkeyup = function(e){ + if(e.keyCode == Event.KEY_RETURN) + { + //update qty + updateQty(product_id, this.value); + } + }; + + $('checkoutBtn').onclick = function(e){ + if(cartLines == null || cartLines.length == 0) + { + showErrorMessage('Shopping cart is empty!'); + } + else + { + checkout();//shoppingcart.js + } + }; + + + /* + $('openDrawerBtn').onclick = function(e){ + openCashDrawer(); + }; + */ + + $('clearCartBtn').onclick = function(e){ + clearCart(); + }; + + $('discountBtn').showDiscount = $('discountBtn').onclick + $('discountBtn').onclick = function(){ + + if(cartLines == null || cartLines.length == 0) + { + showErrorMessage('Shopping cart is empty!'); + } + else + { + this.showDiscount(); + } + + }; + + + //add behaviour to exixting cart + addBehaviourToCart(); + try + { + showErrors(); + } + catch(e){}; +}; + +var initShortcuts = function(){ + shortcut.add("Ctrl+Space", function(e){simulateOnClick($('checkoutBtn'))}); + + shortcut.add("F1", function(e){$('barcode').select();}); + shortcut.add("F2", function(e){$('productQuery').select();}); + shortcut.add("F3", function(e){$('description').select();}); + shortcut.add("F4", function(e){$('qty').select();}); + + shortcut.add("F5", function(e){$('customerQuery').select();}); + shortcut.add("F6", function(e){simulateOnClick($('discountBtn'))}); + + // Barcode Btn + shortcut.add("Ctrl+B", function(e){simulateOnClick($('barcodeBtn'))}); + + //payment btns + //shortcut.add("F9", function(e){simulateOnClick($('cashBtn'))}); + //shortcut.add("F10", function(e){simulateOnClick($('cardBtn'))}); + //shortcut.add("F11", function(e){simulateOnClick($('chequeBtn'))}); + //shortcut.add("F12", function(e){simulateOnClick($('mixBtn'))}); + + shortcut.add("Ctrl+M", function(){simulateOnClick($('menuBtn'))}); + + shortcut.add("Ctrl+Delete", function(){ + simulateOnClick($('clearCartBtn')); + }); + shortcut.add("Ctrl+S", function(){simulateOnClick($('shortcutBtn'))}); + + //move between cart lines + shortcut.add("Ctrl+Up", function(){ + if(cartIndex > 0) + { + cartIndex = cartIndex -1; + var line = cartLines[cartIndex]; + simulateOnClick(line); + } + }); + + shortcut.add("Ctrl+Down", function(){ + if(cartIndex < cartLines.length - 1) + { + cartIndex = cartIndex + 1; + var line = cartLines[cartIndex]; + simulateOnClick(line); + } + }); + + //incrementing and decrementing qty + shortcut.add("Ctrl+Right", function(){ + simulateOnClick($('plusBtn')); + }); + + shortcut.add("Ctrl+Left", function(){ + simulateOnClick($('minusBtn')); + }); + + shortcut.add("Ctrl+Backspace", function(){ + simulateOnClick($('deleteBtn')); + }); + +}; + +var showResult = function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + Position.clone($('maintop'), update, {setHeight: false, setTop: false, offsetTop: element.offsetHeight}); + } + + update.style.display = 'block'; + update.style.opacity = '1.0'; + + }; + + +var initProductSearch = function(){ + + // autocomplete for search by product name + var productAutocompleter = new Ajax.Autocompleter('productQuery','productSearchResult','SearchProductsAction.do',{ + paramName:'productName', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete, + onShow : showResult + }); + + productAutocompleter.xyz = true; + $('productQuery').Autocompleter = productAutocompleter; + + + // autocomplete for search by product description + var productAutocompleter2 = new Ajax.Autocompleter('description','productSearchByDescriptionResult','SearchProductsAction.do',{ + paramName:'description', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete, + onShow : showResult + }); + + $('description').Autocompleter = productAutocompleter2; +}; + + +var afterAutocomplete = function(e1,e2){ + + if(!validateBp()) + { + return; + } + + var barcode = e2.getAttribute('barcode'); + if(barcode=='null') + { + barcode = ""; + } + var productId = e2.getAttribute('productId'); + //$('barcode').value = barcode; + $('productId').value= productId; + + var description = e2.getAttribute('description'); + //$('description').value = description; + + incrementCart(productId); + + //reset focus to search input + searchElement.focus(); + + //show product details + getProductInfo(productId); + + //set global product + product_id = productId; + + $('description').value = ""; + $('productQuery').value = ""; + +}; + +function getProductInfo(productId) +{ + var url = 'POSProductAction2.do'; + var pars = 'action=getProductDetails&productId='+productId+'&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: showProductInfo, + onFailure: reportError + }); +} + +function showProductInfo(request) +{ + // + try + { + var response = request.responseText; + var product = eval('(' + response + ')'); + + //display product info in right column + $('product.name').innerHTML = product.name; + $('product.barcode').innerHTML = product.barcode; + $('product.taxCategory').innerHTML = product.taxCategory; + $('product.description').innerHTML = product.description; + $('product.stock.qty').innerHTML = product.stockQty; + $('product.price.std').innerHTML = new Number(product.priceStd).toFixed(2); + $('product.price.limit').innerHTML = new Number(product.priceLimit).toFixed(2); + $('product.price.list').innerHTML = new Number(product.priceList).toFixed(2); + + $('product.image').src = 'images/pos/blankimage.png'; + } + catch(e) + { + showErrorMessage(e); + } +} + +function reportError(request) +{ + alert("Ooops some error has occured while communicating with the server"); +} + +function convertString2Unicode(s) +{ + var uniString = "", hexVal, uniChar; + + for(var i = 0; i < s.length; ++i) + { + //Convert char to hex + //hexVal = Number(s.charCodeAt(i)).toString(16); + hexVal = Number(s.charCodeAt(i)).toString(10); + + //Convert to unicode by making sure hex is 4 chars long, padding with 0's if less + //uniChar = "\\u" + ("000" + hexVal).match(/.{4}$/)[0]; + uniChar = "&#" + ("000" + hexVal).match(/.{4}$/)[0] +";"; + + uniString += uniChar; + } + if(hexVal < 255) + return s; + + return uniString; +} + +// returns true if bp is valid +var validateBp = function(){ + if(orderType == ORDER_TYPES.POS_GOOD_RECEIVE_NOTE) + { + var bpartner = $('bpartnerId').value; + if(bpartner == null || bpartner == "") + { + showErrorMessage("Please choose a vendor",'customerQuery'); + return false; + } + } + + if(orderType == ORDER_TYPES.CREDIT_ORDER) + { + var bpartner = $('bpartnerId').value; + if(bpartner == null || bpartner == "") + { + showErrorMessage("Please choose a customer",'customerQuery'); + return false; + } + } + + if(isCustomerCompulsory) + { + var bpartner = $('bpartnerId').value; + if(bpartner == null || bpartner == "") + { + showErrorMessage("Please choose a customer"); + $('bpartnerId').focus(); + + return false; + } + } + + return true; +}; + +var initSearchCustomer = function(){ + + //validateBp(); // validates bp on load + + // auto complete for customer + $('customerQuery').Autocompleter = new Ajax.Autocompleter('customerQuery','customerSearchResult','SearchCustomerAction.do',{ + paramName:'customerQuery', + frequency:TROTTLE_TIME, + parameters : 'orderType=' + orderType, + onShow:function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + } + update.style.display = 'block'; + }, + afterUpdateElement:function(e1,e2){ + var bpartner = $('bpartnerId'); + var bpartnerName = $('customer.name'); + + + if(e2.value != '-1') + { + toConsole('1'); + if(e2.value) + { + toConsole('1.1.1'); + bpartner.value = e2.value; + } + else + { + toConsole('1.1.2'); + bpartner.value = ''; + } + + $('customer.code').innerHTML = bpartner.value; + var creditLimit = e2.getAttribute('creditLimit'); + var name = e2.getAttribute('name'); + setBPartner(bpartner.value, name, creditLimit); + if(bpartnerName) + { + toConsole('1.2'); + $('customer.name').innerHTML = name; + $('credit.available').innerHTML = creditLimit; + + x = e2.getAttribute('priceList'); + if (parseInt(x) > 0) + { + $('terminal').innerHTML = e2.getAttribute('pricelistName'); + $('priceListId').value = x; + priceList = x; + } + else + { + priceList = defaultPriceList; + $('terminal').innerHTML = defaultPriceListName; + } + + //reload shopping cart for partner + if(oldPriceList != priceList) + { + setShoppingCartPriceList(); + oldPriceList = priceList; + } + + $('productQuery').Autocompleter.options.defaultParams='priceListId=' + priceList; + }//if + } + else + { + toConsole('2'); + + bpartner.value = ""; + if(bpartnerName) + { + toConsole('2.1'); + bpartnerName.value = ""; + }//if + }//if + + + $('customerQuery').value = ""; + + searchElement.focus(); + + } + + }); + +} + +function setBPartner(bPartnerValue, name, creditLimit) +{ + try + { + var url = 'CheckoutAction.do'; + var pars = 'action=setBPartner&bPartnerId='+bPartnerValue +'&name='+name+'&creditLimit='+creditLimit; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + }); + + } + catch(e) + { + toConsole(e); + } + return; +} + +var initCartBtn = function(){ + var plus = $('plusBtn'); + var minus = $('minusBtn'); + var del = $('deleteBtn'); + + plus.style.cursor = 'pointer'; + minus.style.cursor = 'pointer'; + del.style.cursor = 'pointer'; + + plus.onclick = function(e){ + if(product_id != null) + incrementCart(product_id); + searchElement.focus(); + }; + + minus.onclick = function(e){ + if(product_id != null) + decrementCart(product_id); + searchElement.focus(); + }; + + del.onclick = function(e){ + if(product_id != null) + deleteItemFromCart(product_id); + searchElement.focus(); + }; +}; + + + +var initAjaxResponder = function(){ + + Ajax.Responders.register({ + onCreate: function() { + $('indicator').style.display = 'block'; + }, + onComplete: function() { + $('indicator').style.display = 'none'; + } + }); +}; + +Event.observe(window,'load',initScreen,false); \ No newline at end of file diff --git a/posterita/posterita/web/js/customer.js b/posterita/posterita/web/js/customer.js new file mode 100644 index 0000000000..3e81a9cfb7 --- /dev/null +++ b/posterita/posterita/web/js/customer.js @@ -0,0 +1,160 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +//----------------------------------FUNCTION DECLARATIONS--------------------------------------------- +//create new customer +function createCustomer() +{ + window.location = "InitCreatePOSCustomer.do?action=initCreatePOSCustomer&creatingFromOrder=true"; +} + +//sets the current customer to default +function defaultCustomer() +{ + try + { + var bpartner = document.getElementsByName('bpartnerId')[0]; + var bpartnerName = document.getElementsByName('partnerName')[0]; + + bpartner.value = ""; + bpartnerName.value = ""; + } + catch(e) + { + toConsole('Unable to set default customer'); + toConsole(e); + } + +} + +//gets the custom name. +function getCustomerName() +{ + var customerID = $FElement('bpartnerId').value; + var url = 'POSCustomerAction.do'; + var pars = 'action=getNameByID&bpartnerId=' + customerID; + + toConsole('Requesting: ' + url + '?' + pars); + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: evaluateResponse, + onFailure: reportError + }); + +} + +//set customer name +function setCustomerName(name) +{ + $FElement('partnerName').value = name; +} + +function evaluateResponse(request) +{ + var script = request.responseText; + eval(script); +} + +function reportError(request) +{ + alert('Some error occured while communicating with the server. Please try again.'); +} +//------------------------------REGISTERING SOME EVENTS OR INITIALISATION----------------------------- + +$FElement('bpartnerId').onkeyup = function(e) +{ + try + { + var event = e||window.event; + + if(event.keyCode == 13) + { + //request client name + getCustomerName(); + this.blur(); + } + } + catch (e) + { + toConsole(e); + } +}; + +$('customerQuery').Autocompleter = new Ajax.Autocompleter('customerQuery','customerSearchResult','SearchCustomerAction.do',{ +paramName:'customerQuery', +frequency:TROTTLE_TIME, +afterUpdateElement:function(e1,e2){ + var bpartner = $FElement('bpartnerId'); + var bpartnerName = $FElement('partnerName'); + + + if(e2.value != '-1') + { + toConsole('1'); + if(e2.value) + { + toConsole('1.1.1'); + bpartner.value = e2.value; + } + else + { + toConsole('1.1.2'); + bpartner.value = ''; + } + + if(bpartnerName) + { + toConsole('1.2'); + bpartnerName.value = e2.getAttribute('name'); + }//if + } + else + { + toConsole('2'); + + bpartner.value = ""; + if(bpartnerName) + { + toConsole('2.1'); + bpartnerName.value = ""; + }//if + }//if + + toConsole('Setting customer-->' + bpartnerName.value); + + $('customerQuery').value = ""; + + //focusBarcode(); + + + } + +}); + +var bpartner = $FElement('bpartnerId'); +bpartner.initialValue = bpartner.value; \ No newline at end of file diff --git a/posterita/posterita/web/js/customer2.js b/posterita/posterita/web/js/customer2.js new file mode 100644 index 0000000000..6216276a8b --- /dev/null +++ b/posterita/posterita/web/js/customer2.js @@ -0,0 +1,161 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +//----------------------------------FUNCTION DECLARATIONS--------------------------------------------- +//create new customer +function createCustomer() +{ + window.location = "InitCreatePOSCustomer.do?action=initCreatePOSCustomer&creatingFromOrder=true"; +} + +//sets the current customer to default +function defaultCustomer() +{ + try + { + var bpartner = document.getElementsByName('bpartnerId')[0]; + var bpartnerName = document.getElementsByName('partnerName')[0]; + + bpartner.value = ""; + bpartnerName.value = ""; + } + catch(e) + { + toConsole('Unable to set default customer'); + toConsole(e); + } + +} + +//gets the custom name. +function getCustomerName() +{ + var customerID = $FElement('bpartnerId').value; + var url = 'POSCustomerAction.do'; + var pars = 'action=getNameByID&bpartnerId=' + customerID; + + toConsole('Requesting: ' + url + '?' + pars); + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: evaluateResponse, + onFailure: reportError + }); + +} + +//set customer name +function setCustomerName(name) +{ + $FElement('partnerName').value = name; + document.forms[0].submit(); +} + +function evaluateResponse(request) +{ + var script = request.responseText; + eval(script); +} + +function reportError(request) +{ + alert('Some error occured while communicating with the server. Please try again.'); +} +//------------------------------REGISTERING SOME EVENTS OR INITIALISATION----------------------------- + +$FElement('bpartnerId').onkeyup = function(e) +{ + try + { + var event = e||window.event; + + if(event.keyCode == 13) + { + //request client name + getCustomerName(); + } + } + catch (e) + { + toConsole(e); + } +}; + +$('customerQuery').Autocompleter = new Ajax.Autocompleter('customerQuery','customerSearchResult','SearchCustomerAction.do',{ +paramName:'customerQuery', +frequency:TROTTLE_TIME, +afterUpdateElement:function(e1,e2){ + var bpartner = $FElement('bpartnerId'); + var bpartnerName = $FElement('partnerName'); + + + if(e2.value != '-1') + { + toConsole('1'); + if(e2.value) + { + toConsole('1.1.1'); + bpartner.value = e2.value; + } + else + { + toConsole('1.1.2'); + bpartner.value = ''; + } + + if(bpartnerName) + { + toConsole('1.2'); + bpartnerName.value = e2.getAttribute('name'); + }//if + } + else + { + toConsole('2'); + + bpartner.value = ""; + if(bpartnerName) + { + toConsole('2.1'); + bpartnerName.value = ""; + }//if + }//if + + toConsole('Setting customer-->' + bpartnerName.value); + document.forms[0].submit(); + + $('customerQuery').value = ""; + + //focusBarcode(); + + + } + +}); + +var bpartner = $FElement('bpartnerId'); +bpartner.initialValue = bpartner.value; \ No newline at end of file diff --git a/posterita/posterita/web/js/dom-drag.js b/posterita/posterita/web/js/dom-drag.js new file mode 100644 index 0000000000..0cd39c3e76 --- /dev/null +++ b/posterita/posterita/web/js/dom-drag.js @@ -0,0 +1,121 @@ +/************************************************** + * dom-drag.js + * 09.25.2001 + * www.youngpup.net + ************************************************** + * 10.28.2001 - fixed minor bug where events + * sometimes fired off the handle, not the root. + **************************************************/ + +var Drag = { + + obj : null, + + init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) + { + o.onmousedown = Drag.start; + + o.hmode = bSwapHorzRef ? false : true ; + o.vmode = bSwapVertRef ? false : true ; + + o.root = oRoot && oRoot != null ? oRoot : o ; + + if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px"; + if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px"; + if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px"; + if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px"; + + o.minX = typeof minX != 'undefined' ? minX : null; + o.minY = typeof minY != 'undefined' ? minY : null; + o.maxX = typeof maxX != 'undefined' ? maxX : null; + o.maxY = typeof maxY != 'undefined' ? maxY : null; + + o.xMapper = fXMapper ? fXMapper : null; + o.yMapper = fYMapper ? fYMapper : null; + + o.root.onDragStart = new Function(); + o.root.onDragEnd = new Function(); + o.root.onDrag = new Function(); + }, + + start : function(e) + { + var o = Drag.obj = this; + e = Drag.fixE(e); + var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); + var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); + o.root.onDragStart(x, y); + + o.lastMouseX = e.clientX; + o.lastMouseY = e.clientY; + + if (o.hmode) { + if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; + if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; + } else { + if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; + if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; + } + + if (o.vmode) { + if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; + if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; + } else { + if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; + if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; + } + + document.onmousemove = Drag.drag; + document.onmouseup = Drag.end; + + return false; + }, + + drag : function(e) + { + e = Drag.fixE(e); + var o = Drag.obj; + + var ey = e.clientY; + var ex = e.clientX; + var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); + var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); + var nx, ny; + + if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); + if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); + if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); + if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); + + nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); + ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); + + if (o.xMapper) nx = o.xMapper(y) + else if (o.yMapper) ny = o.yMapper(x) + + Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px"; + Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px"; + Drag.obj.lastMouseX = ex; + Drag.obj.lastMouseY = ey; + + Drag.obj.root.onDrag(nx, ny); + return false; + }, + + end : function() + { + document.onmousemove = null; + document.onmouseup = null; + Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), + parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"])); + Drag.obj = null; + }, + + fixE : function(e) + { + if (typeof e == 'undefined') e = window.event; + if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; + if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; + return e; + } +}; \ No newline at end of file diff --git a/posterita/posterita/web/js/draftedPOSOrder.js b/posterita/posterita/web/js/draftedPOSOrder.js new file mode 100644 index 0000000000..d9ceb801ef --- /dev/null +++ b/posterita/posterita/web/js/draftedPOSOrder.js @@ -0,0 +1,174 @@ + diff --git a/posterita/posterita/web/js/enableButton.js b/posterita/posterita/web/js/enableButton.js new file mode 100644 index 0000000000..42ab5ee023 --- /dev/null +++ b/posterita/posterita/web/js/enableButton.js @@ -0,0 +1,405 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author tamak + */ + + +window.status=""; +function refreshList(varDoc) +{ + window.location="NatisReleaseAction.do?action=prepareRelease&tradeInDetailMake=" + varDoc.tradeInDetailMake.value + "&assetID=" + varDoc.assetID.value + "&financeOptionId=" + varDoc.financeOptionId.value + "&licensingOptionId=" + varDoc.licensingOptionId.value + "&userSalesRepId=" + varDoc.userSalesRepId.value; +} + +function cancelRelease() +{ + window.location="NatisReleaseAction.do?action=home"; +} + +function updateAttributeList(form,id) +{ + form.updateAttrValueId.value = id; + form.action.value = "updateProductAttributeValue"; + form.submit(); +} + +function setActionMethod(form,action) +{ + toConsole("setting action dynamically"); + toConsole("Form :" + form); + toConsole("action :" + action); + + try + { + document.getElementsByName('action')[0].value = action; + form.submit(); + } + catch(e) + { + toConsole("Unable to set Action " + e); + } + +} + + +/*function setAction(form,action,method) +{ + form.action = action; + form.action.value = method; + //form.bpartnerId.value=100; + //alert("Calling action: " + action + "/n Method="+method); + form.submit(); + +} +*/ +function setAction(form,action,method) +{ + var elements = form.elements; + + var getStr = action + "?action=" + method; + + for(i=0;i 0) + { + cartIndex = cartIndex -1; + var line = cartLines[cartIndex]; + scrollCart(); + simulateOnClick(line); + } + }); + + shortcut.add("Ctrl+Down", function(){ + if(cartIndex < cartLines.length - 1) + { + cartIndex = cartIndex + 1; + var line = cartLines[cartIndex]; + scrollCart(); + simulateOnClick(line); + } + }); + + //incrementing and decrementing qty + shortcut.add("Ctrl+Right", function(){ + simulateOnClick($('plusBtn')); + }); + + shortcut.add("Ctrl+Left", function(){ + simulateOnClick($('minusBtn')); + }); + + shortcut.add("Ctrl+Backspace", function(){ + simulateOnClick($('deleteBtn')); + }); + +}; + +var showResult = function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + Position.clone($('maintop'), update, {setHeight: false, setTop: false, offsetTop: element.offsetHeight}); + } + + update.style.display = 'block'; + update.style.opacity = '1.0'; + + }; + + +var initProductSearch = function(){ + + // autocomplete for search by product name + var productAutocompleter = new Ajax.Autocompleter('productQuery','productSearchResult','SearchProductsAction.do',{ + paramName:'productName', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete, + onShow : showResult + }); + + productAutocompleter.xyz = true; + $('productQuery').Autocompleter = productAutocompleter; + + + // autocomplete for search by product description + var productAutocompleter2 = new Ajax.Autocompleter('description','productSearchByDescriptionResult','SearchProductsAction.do',{ + paramName:'description', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete, + onShow : showResult + }); + + $('description').Autocompleter = productAutocompleter2; +}; + +var afterAutocomplete = function(e1,e2){ + + var barcode = e2.getAttribute('barcode'); + if(barcode=='null') + { + barcode = ""; + } + var productId = e2.getAttribute('productId'); + + if(productId == null) + { + $('description').value = ""; + $('productQuery').value = ""; + + return; + } + + //$('barcode').value = barcode; + $('productId').value= productId; + + var description = e2.getAttribute('description'); + //$('description').value = description; + + incrementCart(productId); + + //reset focus to search input + searchElement.focus(); + + //show product details + getProductInfo(productId); + + //set global product + product_id = productId; + + $('description').value = ""; + $('productQuery').value = ""; + +}; + +function autoSave() +{ + if(cartLines == null || cartLines.length == 0) + { + //Do nothing + return; + } + else + { + Modalbox.show('
    Please Wait...

    ', {title: 'Saving Inventory', width: 800}); + Modalbox.deactivate(); + + var url = 'InventoryCartAction.do'; + var pars = 'action=autoSaveInventoryLines&inventoryId='+inventoryId+'&priceListId='+priceList+'&description='+description; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: showInventoryInfo, + onFailure: reportError + }); + } +} + + + +function showInventoryInfo(request) +{ + // + try + { + if (window.Modalbox) + Modalbox.hide(); + + var response = request.responseText; + var invInfo = eval('(' + response + ')'); + + //display info in right column + $('inventory.docno').innerHTML = invInfo.docNo; + $('inventory.description').innerHTML = invInfo.description; + $('inventory.status').innerHTML = invInfo.docStatus; + $('inventoryId').value = inventoryId = invInfo.inventoryID; + + } + catch(e) + { + showErrorMessage(e); + } +} + + +function getProductInfo(productId) +{ + var url = 'POSProductAction2.do'; + var pars = 'action=getProductDetails&productId='+productId+'&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: showProductInfo, + onFailure: reportError + }); +} + +function showProductInfo(request) +{ + // + try + { + var response = request.responseText; + var product = eval('(' + response + ')'); + + //display product info in right column + $('product.name').innerHTML = product.name; + $('product.barcode').innerHTML = product.barcode; + $('product.taxCategory').innerHTML = product.taxCategory; + $('product.description').innerHTML = product.description; + $('product.stock.qtyBook').innerHTML = product.stockQty; + $('product.price.list').innerHTML = new Number(product.priceList).toFixed(2); + + $('product.total.lines').innerHTML = cartLines.length; + $('product.total.count').innerHTML = $('cartTotalCount').innerHTML; + $('product.total.book').innerHTML = $('cartTotalBook').innerHTML; + $('product.total.csv').innerHTML = $('cartTotalCsv').innerHTML; + $('product.discrepancy').innerHTML = $('cartTotalCount').innerHTML - $('cartTotalBook').innerHTML; + + $('product.image').src = 'images/pos/blankimage.png'; + } + catch(e) + { + showErrorMessage(e); + } +} + +function reportError(request) +{ + alert("Ooops some error has occured while communicating with the server"); +} + +function convertString2Unicode(s) +{ + var uniString = "", hexVal, uniChar; + + for(var i = 0; i < s.length; ++i) + { + //Convert char to hex + //hexVal = Number(s.charCodeAt(i)).toString(16); + hexVal = Number(s.charCodeAt(i)).toString(10); + + //Convert to unicode by making sure hex is 4 chars long, padding with 0's if less + //uniChar = "\\u" + ("000" + hexVal).match(/.{4}$/)[0]; + uniChar = "&#" + ("000" + hexVal).match(/.{4}$/)[0] +";"; + + uniString += uniChar; + } + if(hexVal < 255) + return s; + + return uniString; +} + +var initSearchCustomer = function(){ + + //validateBp(); // validates bp on load + + // auto complete for customer + $('customerQuery').Autocompleter = new Ajax.Autocompleter('customerQuery','customerSearchResult','SearchCustomerAction.do',{ + paramName:'customerQuery', + frequency:TROTTLE_TIME, + parameters : 'orderType=' + orderType, // if credit order, do not validate for standard customer + onShow:function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + } + update.style.display = 'block'; + }, + afterUpdateElement:function(e1,e2){ + var bpartner = $('bpartnerId'); + var bpartnerName = $('customer.name'); + + + if(e2.value != '-1') + { + if(e2.value) + { + bpartner.value = e2.value; + } + else + { + bpartner.value = ''; + } + + $('customer.code').innerHTML = bpartner.value; + var creditLimit = e2.getAttribute('creditLimit'); + var name = e2.getAttribute('name'); + + if(bpartnerName) + { + $('customer.name').innerHTML = name; + $('credit.available').innerHTML = creditLimit==null?0:creditLimit; + + if (e2.getAttribute('priceList') && parseInt(e2.getAttribute('priceList')) > 0) + { + priceList = e2.getAttribute('priceList'); + $('priceListId').value = priceList; + $('terminal').innerHTML = e2.getAttribute('pricelistName'); + } + else + { + priceList = defaultPriceList; + $('terminal').innerHTML = defaultPriceListName; + } + if(cartLines != null && cartLines.length != 0) + { + //reload shopping cart for partner + if(oldPriceList != priceList) + { + setShoppingCartPriceList(); + oldPriceList = priceList; + } + } + $('productQuery').Autocompleter.options.defaultParams='priceListId=' + priceList; + saveBPartnerInfo(bpartner.value, name, creditLimit, priceList); + }//if + } + else + { + bpartner.value = ""; + if(bpartnerName) + { + bpartnerName.value = ""; + }//if + }//if + + + $('customerQuery').value = ""; + + searchElement.focus(); + } + + }); + +} + + +var initCartBtn = function(){ + var plus = $('plusBtn'); + var minus = $('minusBtn'); + var del = $('deleteBtn'); + + plus.style.cursor = 'pointer'; + minus.style.cursor = 'pointer'; + del.style.cursor = 'pointer'; + + plus.onclick = function(e){ + if(product_id != null) + incrementCart(product_id); + searchElement.focus(); + }; + + minus.onclick = function(e){ + if(product_id != null) + decrementCart(product_id); + + if(cartLines == null || cartLines.length == 0) + { + resetInfo(); + } + + searchElement.focus(); + }; + + del.onclick = function(e){ + if(product_id != null) + deleteItemFromCart(product_id); + + if(cartLines == null || cartLines.length == 0) + { + resetInfo(); + } + + searchElement.focus(); + + }; +}; + + + +var initAjaxResponder = function(){ + + Ajax.Responders.register({ + onCreate: function() { + $('indicator').style.display = 'block'; + }, + onComplete: function() { + $('indicator').style.display = 'none'; + } + }); +}; + + + +//---------------------------------------------------------------------------- + + +function getCartTotal() +{ + var amtStr = $('total').innerHTML; + amtStr = amtStr.strip(); + amtStr = amtStr.replace(',', "") + + var amount = parseFloat(amtStr); + while(isNaN(amount)) + { + if(amtStr.length == 0) return 0.0; + + amtStr = amtStr.slice(1); + amount = parseFloat(amtStr); + } + + //amtStr = parseFloat(amtStr); + //var amount = new Number(amtStr); + + return amount; +} + +function displaySortPanel() +{ + $('csvBtn').style.display = 'none'; + $('saveCsvBtn').style.display = 'block'; + $('saveBtn').style.display = 'none'; + $('clearCartBtn').style.display = 'none'; + $('reloatCartBtn').style.display = 'none'; + $('completeBtn').style.display = 'none'; + $('newBtn').style.display = 'none'; + $('cartSearch').style.display = 'none'; + $('editProductContainer').style.display = 'none'; + $('sortPanel').style.display = 'block'; + $('searchBtn').innerHTML = 'SWITCH BACK'; + $('filter').value = ''; + $('filter').focus(); + $('searchBtn').onclick = function() { switchBack(); }; +} + +function switchBack() +{ + $('csvBtn').style.display = 'block'; + $('saveCsvBtn').style.display = 'none'; + $('saveBtn').style.display = 'block'; + $('clearCartBtn').style.display = 'block'; + $('completeBtn').style.display = 'block'; + $('cartSearch').style.display = 'none'; + $('sortPanel').style.display = 'none'; + $('editProductContainer').style.display = 'block'; + $('cartSearch').style.display = 'block'; + $('newBtn').style.display = 'block'; + $('reloatCartBtn').style.display = 'none'; + $('searchBtn').innerHTML = 'SEARCH'; + $('filter').value = ''; + $('barcode').value = ''; + $('barcode').focus(); + $('searchBtn').onclick = function() { displaySortPanel(); }; + reloadCart(); + +} + +function showCsvImport() +{ + $('importBtn').style.display = 'block'; + $('saveCsvBtn').style.display = 'block'; + $('menuBtn').style.display = 'none'; + $('clearCartBtn').style.display = 'none'; + $('printBtn').style.display = 'none'; + $('completeBtn').style.display = 'none'; + $('searchBtn').style.display = 'none'; + $('reloatCartBtn').style.display = 'block'; + $('newBtn').style.display = 'none'; + $('csvBtn').innerHTML = 'BACK'; + $('csvBtn').onclick = function() { goBack(); }; +} + +function diplayCsvOptions() +{ + $('importBtn').style.display = 'block'; + $('saveCsvBtn').style.display = 'block'; + $('menuBtn').style.display = 'none'; + $('clearCartBtn').style.display = 'none'; + $('printBtn').style.display = 'none'; + $('completeBtn').style.display = 'none'; + $('searchBtn').style.display = 'none'; + $('newBtn').style.display = 'none'; + $('reloatCartBtn').style.display = 'block'; + $('csvBtn').innerHTML = 'BACK'; + $('csvBtn').onclick = function() { goBack(); }; + + +} + +function goBack() +{ + $('importBtn').style.display = 'none'; + $('saveCsvBtn').style.display = 'none'; + $('menuBtn').style.display = 'block'; + $('clearCartBtn').style.display = 'block'; + $('printBtn').style.display = 'block'; + $('completeBtn').style.display = 'block'; + $('searchBtn').style.display = 'block'; + $('newBtn').style.display = 'block'; + $('reloatCartBtn').style.display = 'none'; + $('csvBtn').innerHTML = 'CSV'; + $('csvBtn').onclick = function() { diplayCsvOptions(); }; +} +function addPaging() +{ + // +} + +function trim(sString) +{ + while (sString.substring(0,1) == ' ') + { + sString = sString.substring(1, sString.length); + } + while (sString.substring(sString.length-1, sString.length) == ' ') + { + sString = sString.substring(0,sString.length-1); + } + return sString; +} + +function editDescription() +{ + description = $('inventory.description').innerHTML; + var userInput = prompt("Change inventory description", description) + + if(userInput == 'null' || userInput == '' || userInput == null) + { + userInput = description; + $('inventory.description').innerHTML = userInput; + } + else + { + description = userInput; + $('inventory.description').innerHTML = userInput; + } + + return false; + +} + +function addUploadField() +{ + + var tbl = $('upload'); + var lastRow = tbl.rows.length; + // if there's no header row in the table, then iteration = lastRow + 1 + var iteration = lastRow; + var row = tbl.insertRow(1); + row.className = 'upload'; + + // right cell + var cellRight = row.insertCell(0); + cellRight.className = "tdUpload" + var el = document.createElement('input'); + el.type = 'file'; + el.name = 'file' + iteration; + el.id = 'file' + iteration; + el.size = 40; + + cellRight.appendChild(el); + + var div = document.createElement('div') + div.id = 'attachment'+iteration; + + var i = iteration - 1; + + if($('attachment'+i).innerHTML != '') + { + $('attachment'+i).innerHTML = ''; + $('attachment'+i).className = ''; + + } + + + div.className = 'button floatLeft'; + div.innerHTML = 'Add another file' + div.onclick = function() + { + validateRow(); + } + cellRight.appendChild(div); + + var span=document.createElement('span'); + span.id = 'progressfile'+iteration; + + cellRight.appendChild(span); + + cellRight.focus(); + +} + +function validate(obj) +{ + var sfile = obj.value; + + if(sfile == "" || sfile == null || sfile == 'null') + return false; + + var fileType = sfile.substring(sfile.length -3, sfile.length); + if(fileType.toLowerCase() != 'csv') + { + alert('Only csv file is allowed!!!'); + obj.value=''; + obj.focus(); + return false; + } + else + { + obj.disabled = true; + uploadStockSheets(sfile); + } + +} + +function addFileInput() +{ + var d = document.createElement("div"); + var file = document.createElement("input"); + file.setAttribute("type", "file"); + file.setAttribute("name", "attachment"+upload_number); + d.appendChild(file); + document.getElementById("moreUploads").appendChild(d); + upload_number++; +} + + +function uploadStockSheets(form) +{ + $('importStock').request({ + contentType: 'multipart/form-data', + method: 'get', + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + return false; +} + +function generateCsv() +{ + var url = 'InventoryCartAction.do?action=generateInventoryCSV'; + window.location = url; +} + + +function addCSV(file) +{ + $('uploadHeader').style.display="block"; + $('uploadCsv').style.display="block"; + var tbl = $('csv'); + var lastRow = tbl.rows.length; + // if there's no header row in the table, then iteration = lastRow + 1 + var iteration = lastRow; + var row = tbl.insertRow(1); + row.className = 'upload'; + // right cell + var cellRight = row.insertCell(0); + cellRight.className = "tdUpload" + cellRight.innerHTML = "Adempiere.properties"; + +} + +function validateRow() +{ + var tbl = document.getElementById('upload'); + var lastRow = tbl.rows.length - 1; + + if(lastRow == 10) + { + alert('Maximum file to upload reached.'); + return false; + } + + var i; + for (i=1; i<=lastRow; i++) + { + var aRow = document.getElementById('file' + i); + if (aRow.value.length <= 0) + { + alert('Row ' + i + ' is empty'); + return false; + } + else + { + addUploadField(); + addTable(); + } + } +} + +function redirect(url) +{ + window.location = url; +} + +function resetInfo() +{ + $('product.name').innerHTML = ""; + $('product.barcode').innerHTML = ""; + $('product.taxCategory').innerHTML = ""; + $('product.description').innerHTML = ""; + $('product.stock.qtyBook').innerHTML = ""; + $('product.price.list').innerHTML = ""; + + $('product.total.lines').innerHTML = ""; + $('product.total.count').innerHTML = ""; + $('product.total.book').innerHTML = ""; + $('product.total.csv').innerHTML = ""; + $('product.discrepancy').innerHTML = ""; + +} + +function newCart() +{ + var answer = confirm("Click OK if you want to save the inventory cart and start a new one.\nClick CANCEL to only clear the cart.\nNote: Clearing the cart will erase all the data. ") + if (answer) + { + if(cartLines == null || cartLines.length == 0) + { + redirect('InventoryCartAction.do?action=newInventoryCart'); + } + else + { + Modalbox.show('
    Please Wait...

    ', {title: 'Saving Inventory', width: 800}); + Modalbox.deactivate(); + + var url = 'InventoryCartAction.do'; + var pars = 'action=autoSaveInventoryLines&inventoryId='+inventoryId+'&priceListId='+priceList+'&description='+description; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: function(){redirect('InventoryCartAction.do?action=newInventoryCart');}, + onFailure: reportError + }); + + } + + } + else + { + clearCart(); + } +} + +Event.observe(window,'load',initScreen,false); \ No newline at end of file diff --git a/posterita/posterita/web/js/inventoryCart.js b/posterita/posterita/web/js/inventoryCart.js new file mode 100644 index 0000000000..603146c345 --- /dev/null +++ b/posterita/posterita/web/js/inventoryCart.js @@ -0,0 +1,432 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +//----------------------------------FUNCTION DECLARATIONS--------------------------------------------- +//scrolls to the bottom of the cart +function scrollDownCart() +{ + if($('shoppingCart')) + { + $('shoppingCart').scrollTop = $('shoppingCart').scrollHeight; + } +} + + +//adding product to cart +function addToCart(barcode) +{ + cartIndex = null; + if(barcode == null) return; + if(barcode == '') return; + + try + { + + var url = 'InventoryCartAction.do'; + var pars = 'action=addProduct&barCode='+barcode+'&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + + } + catch(e) + { + toConsole(e); + } +} + +//incrementing, decrementing and deleting the shopping cart items using ajax +// 1.Increment the qty for the product +function incrementCart(productId) +{ + if(productId == null) return; + + try + { + + var url = 'InventoryCartAction.do'; + var pars = 'action=incrementQty&productId='+productId+ '&ifAdd=true&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + + } + catch(e) + { + toConsole(e); + } +} + +//2.Decrement the qty for the product +function decrementCart(productId) +{ + if(productId == null) return; + + try + { + + + var url = 'InventoryCartAction.do'; + var pars = 'action=decrementQty&productId='+productId+ '&ifAdd=false&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } +} + +//3.Delete all the products with the ID from the cart +function deleteItemFromCart(productId) +{ + if(productId == null) return; + + cartIndex = null; + updateQty(productId, '0'); +} + +//Refreshs the content of the shopping cart +function refreshShoppingCart(request) +{ + try + { + var response = request.responseText; + $('shoppingCart').innerHTML = response; + $('total').innerHTML = $('cartTotalCount').innerHTML; + $('product.total.lines').innerHTML = cartLines.length; + $('product.total.count').innerHTML = $('cartTotalCount').innerHTML; + $('product.total.book').innerHTML = $('cartTotalBook').innerHTML; + $('product.total.csv').innerHTML = $('cartTotalCsv').innerHTML; + $('product.discrepancy').innerHTML = $('cartTotalCount').innerHTML - $('cartTotalBook').innerHTML; + scrollDownCart(); + response.evalScripts(); //display error messages + } + catch(e) + { + showErrorMessage('Failed to resfresh cart! Cause:' + e); + } + + addBehaviourToCart(); +} + +//Reports an error +function reportShoppingCartError(request) +{ + alert('Some error occured while communicating with the server. Please try again.'); + alert(request.responseText); + var win = window.open(); + win.document.write(request.responseText); + win.document.close(); +} + +//addRequiredLibrary('js/test.js'); +var requestIndicator; + +/* +var ShoppingCart = { + + init : function(){ + //this.indicator = new AJAXIndicator('Please wait...'); + alert('Shopping Cart'); + }, + + indicator : null +}; +*/ + +function completeInventory() +{ + $('inventoryForm').submit(); +} + +//Update the qty for the product +function updateQty(productId, quantity) +{ + if(productId == null) return; + + if (quantity == "") + { + return; + } + + var amount = parseFloat(quantity); + + if (isNaN(amount) || amount < 0) + { + showErrorMessage('Invalid quantity! ' + quantity, 'qty'); + $('qty').value = ""; + return; + } + + try + { + var url = 'InventoryCartAction.do'; + var pars = 'action=updateQty&productId=' + productId + '&ifAdd=false' + '&priceListId='+priceList +'&qtyCount=' + amount; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + return false; + } + catch(e) + { + toConsole(e); + } + + return false; + +} + +//Reload shopping cart +function reloadCart() +{ + try + { + var url = 'InventoryCartAction.do'; + var pars = 'action=reloadCart'; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + + +function clearCart() +{ + maxRows = 0; + excessRows = 0; + + try + { + var url = 'InventoryCartAction.do'; + var pars = 'action=clearCart'; + + $('inventory.docno').innerHTML = 'N/A'; + $('inventory.description').innerHTML = description; + $('inventory.status').innerHTML = 'N/A'; + $('inventoryId').value = inventoryId = 0; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onComplete: resetInfo, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + +function handleCheckout(request) +{ + var response = request.responseText; + var result = eval('(' + response + ')'); + + if(result.error) + { + showErrorMessage(result.error); + } + else + { + printOrder(result.orderID); + reloadCart(); + } +} + + +function addBehaviourToCart() +{ + var rows = new Array(); + var count = 1; + + while(true) + { + var row = $('row' + count); + if(row == null) break; + + rows.push(row); + count ++; + } + + for(var i=0; i 0) + { + var line = cartLines[cartIndex]; + simulateOnClick(line); + + } + + if(cartLines.length > maxRows) + { + var shoppingCart = $('shoppingCart'); + shoppingCart.scrollTop = shoppingCart.scrollHeight; + } + +} + +//Reload the shopping cart. Prices are calculated for the pricelist +function setShoppingCartPriceList() +{ + try + { + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=updatePriceList&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } +} + +function scrollCart() +{ + var shoppingCart = $('shoppingCart'); + + if(cartIndex > maxRows) + { + shoppingCart.scrollTop = shoppingCart.scrollHeight; + } + else + { + shoppingCart.scrollTop = 0; + } +} + + +//Event.observe(window,'load',init,false); +//--------------------------------------------------------------------------------------- +//calling methods \ No newline at end of file diff --git a/posterita/posterita/web/js/inventoryHistory.js b/posterita/posterita/web/js/inventoryHistory.js new file mode 100644 index 0000000000..db744899e5 --- /dev/null +++ b/posterita/posterita/web/js/inventoryHistory.js @@ -0,0 +1,152 @@ +//scripts for Posterita Inventory History +var product_id = null; +var priceList = null; +var searchElement = null; +var defaultPriceList = null; + +var initHistory = function(){ + priceList = $('priceListId').value; + + defaultPriceList = priceList; + + var searchProductBy = $('searchProductBy').value; + if(searchProductBy == 'name') + { + searchElement = $('productQuery'); + } + else + { + searchElement = $(searchProductBy); + } + + + initProductSearch(); + + searchElement.focus(); + + var barcode = $('barcode'); + barcode.onkeyup = function(e){ + if(e.keyCode == Event.KEY_RETURN) + { + if(this.value != null && this.value != "") + { + redirect('ViewInventoryHistoryAction.do?action=searchProductInInventory&barCode=' + this.value); + } + + } + }; +}; + +var showProduct = function(element, update) +{ + update.style.display = 'block'; + update.style.opacity = '1.0'; + + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + Position.clone($('maintop'), update, {setHeight: false, setTop: false, offsetTop: element.offsetHeight}); + } + + }; + + +var initProductSearch = function(){ + + // autocomplete for search by product name + var productAutocompleter = new Ajax.Autocompleter('productQuery','productSearchResult','SearchProductsAction.do',{ + paramName:'productName', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete2, + onShow : showProduct + }); + + productAutocompleter.xyz = true; + $('productQuery').Autocompleter = productAutocompleter; + + + // autocomplete for search by product description + var productAutocompleter2 = new Ajax.Autocompleter('description','productSearchByDescriptionResult','SearchProductsAction.do',{ + paramName:'description', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete2, + onShow : showProduct + }); + + $('description').Autocompleter = productAutocompleter2; +}; + +var afterAutocomplete2 = function(e1,e2){ + + + var barcode = e2.getAttribute('barcode'); + if(barcode=='null') + { + barcode = ""; + } + var productId = e2.getAttribute('productId'); + + if(productId == null) + { + $('description').value = ""; + $('productQuery').value = ""; + + return; + } + + //$('barcode').value = barcode; + $('productId').value= productId; + + var description = e2.getAttribute('description'); + //$('description').value = description; + + redirect('ViewInventoryHistoryAction.do?action=searchProductInInventory&productId=' + productId); + + //reset focus to search input + searchElement.focus(); + + //set global product + product_id = productId; + + $('description').value = ""; + $('productQuery').value = ""; + +}; + +function reportError(request) +{ + alert("Some error has occured while communicating with the server"); +}; + +function convertString2Unicode(s) +{ + var uniString = "", hexVal, uniChar; + + for(var i = 0; i < s.length; ++i) + { + //Convert char to hex + //hexVal = Number(s.charCodeAt(i)).toString(16); + hexVal = Number(s.charCodeAt(i)).toString(10); + + //Convert to unicode by making sure hex is 4 chars long, padding with 0's if less + //uniChar = "\\u" + ("000" + hexVal).match(/.{4}$/)[0]; + uniChar = "&#" + ("000" + hexVal).match(/.{4}$/)[0] +";"; + + uniString += uniChar; + } + if(hexVal < 255) + return s; + + return uniString; +} + +function redirect(url) +{ + window.location = url; +} + +Event.observe(window,'load',initHistory,false); \ No newline at end of file diff --git a/posterita/posterita/web/js/js-calendar.js b/posterita/posterita/web/js/js-calendar.js new file mode 100644 index 0000000000..c2524839db --- /dev/null +++ b/posterita/posterita/web/js/js-calendar.js @@ -0,0 +1,35 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +try +{ + addRequiredLibrary('javascripts/js-calendar/calendar.js'); + addRequiredLibrary('javascripts/js-calendar/calendar-en.js'); + addRequiredLibrary('javascripts/js-calendar/calendar-setup.js'); + addRequiredStyleSheet('css/js-calendar/calendar-win2k-1.css'); + + toConsole('js-calendar initialised'); +} +catch(e){toConsole(e);} \ No newline at end of file diff --git a/posterita/posterita/web/js/js-date.js b/posterita/posterita/web/js/js-date.js new file mode 100644 index 0000000000..cf2687144c --- /dev/null +++ b/posterita/posterita/web/js/js-date.js @@ -0,0 +1,55 @@ +function setStartDate(calendar) + { + var y = calendar.date.getFullYear(); + var m = calendar.date.getMonth(); + var d = calendar.date.getDate(); + + $FElement('startDay').options[d-1].selected = true; + $FElement('startMonth').options[m].selected = true; + + var options = $FElement('startYear').options; + + for(var i = 0; i < options.length; i++) + { + if(options[i].value == y) + { + $FElement('startYear').options[i].selected = true; + break; + } + } + + updateStartDate(); + + } + + function updateStartDate() + { + var d = $FElement('startDay').selectedIndex + 1; + var m = $FElement('startMonth').selectedIndex + 1; + var y = $FElement('startYear').selectedIndex; + y = $FElement('startYear').options[y].value; + + d = (d > 9) ? d : ('0' + d); + m = (m > 9) ? m : ('0' + m); + + $('startDate').value = d + '/' + m + '/' + y; + $FElement('fromDate').value = $('startDate').value; + } + + function initStartCalendar() + { + $FElement('startDay').onchange = updateStartDate; + $FElement('startMonth').onchange = updateStartDate; + $FElement('startYear').onchange = updateStartDate; + + Calendar.setup( + { inputField : "startDate", + ifFormat : "%d/%m/%Y", + showTime : true, + button : "startDateBtn", + onUpdate : setStartDate + } + ); + + $('startDate').value = $FElement('fromDate').value; + } \ No newline at end of file diff --git a/posterita/posterita/web/js/keyboard.js b/posterita/posterita/web/js/keyboard.js new file mode 100644 index 0000000000..9c1ca9910f --- /dev/null +++ b/posterita/posterita/web/js/keyboard.js @@ -0,0 +1,422 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +function insertAtCursor(myField, myValue) +{ + //IE support + if (document.selection) + { + myField.focus(); + sel = document.selection.createRange(); + sel.text = myValue; + } + //MOZILLA/NETSCAPE support + else if (myField.selectionStart || myField.selectionStart == 0) + { + var startPos = myField.selectionStart; + var endPos = myField.selectionEnd; + myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length); + } + else + { + myField.value += myValue; + } +} + +function init() +{ + var textfield = this.output; + var keyboard = document.getElementById('keyboard'); + var keys = keyboard.getElementsByTagName('td'); + + for(var i=0; i' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ' ' + + '' + + '' + + '' + + '' + + '' + + '
    1234567890HIDE
    QWERTYUIOPBACK
    ASDFGHJKLENTER
    CAPSZXCVBNM,.
    SPACE
    ' + + '' + + '
    ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ' ' + + '' + + '' + + '' + + '' + + '' + + '
    1234567890HIDE
    qwertyuiopBACK
    asdfghjklENTER
    CAPSzxcvbnm,.
    SPACE
    ' + + '
    ' + + '
    '; + +} + +Keyboard.prototype.show = function(e){ + + if(this.hidden) + { + this.keypadpanel.style.visibility = 'hidden'; + this.keypadpanel.style.display = 'block'; + //this.keypadpanel.style.top = '10px'; + //this.keypadpanel.style.left = '10px'; + this.hidden = false; + + try + { + //setting keyboard state in cookie + createCookie('pos_keyboard_on',"true",7); + } + catch(e) + { + toConsole(e); + } + + } +}; + +Keyboard.prototype.hide = function(e){ + this.keypadpanel.style.display = 'none'; + this.hidden = true; + + try + {toConsole + //setting keyboard state in cookie + createCookie('pos_keyboard_on',"false",7); + } + catch(e) + { + toConsole(e); + } +}; + +Keyboard.prototype.setCaps = function(e){ + + var uppercasekeyboard = document.getElementById('uppercase'); + var lowercasekeyboard = document.getElementById('lowercase'); + + //toConsole(uppercasekeyboard.style.display); + //toConsole(lowercasekeyboard.style.display); + + if(this.caps) + { + uppercasekeyboard.style.display = 'block'; + lowercasekeyboard.style.display = 'none'; + } + else + { + uppercasekeyboard.style.display = 'none'; + lowercasekeyboard.style.display = 'block'; + } + + +}; + +Keyboard.prototype.init = init; + +function showKeyboard() +{ + keyboard.show(); + keyboard.init(); + keyboard.setCaps(); + + kH = parseInt(keyboard.keypadpanel.scrollHeight); + kW = parseInt(keyboard.keypadpanel.scrollWidth); + + sH = parseInt(getViewportHeight()); + sW = parseInt(getViewportWidth()); + + cH = (sH - kH)/2; + cW = (sW - kW)/2; + + //centering the keyboard + keyboard.keypadpanel.style.top = cH + "px"; + keyboard.keypadpanel.style.left = cW + "px"; + keyboard.keypadpanel.style.visibility = 'visible'; + +} + +function bindKeyboard(output) +{ + keyboard.output = output; + keyboard.init(); + keyboard.setCaps(); +} + +function enableVirtualKeyboard() +{ + keyboard = new Keyboard(); + + var keyboardicon = document.getElementById('keyboardicon'); + + keyboardicon.style.display = 'inline'; + keyboardicon.onclick = function(e){ + showKeyboard(); + }; + + var textfields = document.getElementsByTagName('input'); + + for(var i=0; i 0) return true; + + return false; + } +}; + +var BP_CREDIT_STATUS = SO_CREDIT_STATUS.CreditOK; + +var initScreen = function(){ + DISCOUNT_LIMIT = getDiscountAllowed(); + OVERRIDE_PRICE_LIMIT = overrideLimit; + ISDISCOUNTUPTOLIMITPRICE = isDiscountUptoLimitPrice; + ISDISCOUNTONTOTAL = isDiscountAllowedOnTotal; + + + if(!ISDISCOUNTUPTOLIMITPRICE) + { + $('discountUptoLimitPrice').hide(); + } + + if(!OVERRIDE_PRICE_LIMIT) + { + $('overridePriceLimit').hide(); + } + + if(!ISDISCOUNTONTOTAL) + { + $('discountAllowedOnTotal').hide(); + $('linesTotal').hide(); + } + + if(DISCOUNT_LIMIT == 0) + { + $('userDiscLimit').hide(); + } + + //reset user pin + $('resetPinBtn').hide(); + + //set order type + orderType = $('orderType').value; + //set tender type + tenderType = $('tenderType').value; + //set priceList + priceList = $('priceListId').value; + + //set default data for price list + defaultPriceList = priceList; + defaultPriceListName = $('terminal').innerHTML; + + //set search element + var searchProductBy = $('searchProductBy').value; + if(searchProductBy == 'name') + { + searchElement = $('productQuery'); + } + else + { + searchElement = $(searchProductBy); + } + + //set is customer compulsory + if($('isCustomerCompulsory').value == 'true') + { + isCustomerCompulsory = true; + } + + initProductSearch(); + initSearchCustomer(); + initCartBtn(); + initAjaxResponder(); + initPIN(); + initShortcuts(); + initPaymentBtns(); + initSystemBtns(); + + //set payment rule + if(tenderType == null) + { + tenderType = PAYMENT_RULES.PAYMENT_RULE_CASH; + simulateOnClick($('cashBtn')); + } + else + { + simulateOnClick($(tenderType + 'Btn')); + } + + $('total').innerHTML = $('cartTotal').innerHTML; + + + searchElement.focus(); + + var barcode = $('barcode'); + barcode.focus(); + barcode.onkeyup = function(e){ + if(e.keyCode == Event.KEY_RETURN) + { + if(this.value != null && this.value != "") + { + if(!validateBp()) + { + return; + } + + addToCart(this.value); + this.value = ""; + } + + } + }; + + var incPrice = $('incPrice'); + incPrice.onkeyup = function(e){ + + ERROR_MSG = null; + var DISC_PERC = null; + + var discount = LIST_PRICE - this.value; + DISC_PERC = new Number((discount / LIST_PRICE)*100).toFixed(2); + $('disc').value = DISC_PERC; + + if (isNaN(this.value)) + { + showErrorMessage('Invalid Price Entered: ' + newPrice, this); + this.value = LIST_PRICE; + return; + } + + var newPrice = parseFloat(this.value); + + if(this.value == "") + { + newPrice = 0; + } + + + var totalAmt = $('qty').value * newPrice; + $('totalAmount').value = new Number(totalAmt).toFixed(2); + + $('discountOnTotal').value = $('isDiscOnTotal').value = 'false'; + $('isDiscOnInclUnitPrice').value = 'true'; + $('isDiscOnPerc').value = 'false'; + + validateDiscount(parseFloat(newPrice), parseFloat(DISC_PERC)); + + }; + + var disc = $('disc'); + disc.onkeyup = function(e){ + + ERROR_MSG = null; + var DISC_PERC = null; + + DISC_PERC = this.value; + $('disc').value = DISC_PERC; + + var discAmt = new Number((DISC_PERC / 100) * LIST_PRICE); + var newPrice = new Number(LIST_PRICE - discAmt).toFixed(2); + $('incPrice').value = newPrice; + var newTotal = new Number(((100 - DISC_PERC) / 100) * (LIST_PRICE * $('qty').value)).toFixed(2); + $('totalAmount').value = newTotal; + + $('discountOnTotal').value = $('isDiscOnTotal').value = 'false'; + $('isDiscOnInclUnitPrice').value = 'true'; + $('isDiscOnPerc').value = 'false'; + + validateDiscount(newPrice, DISC_PERC); + }; + + + var totalAmount = $('totalAmount'); + totalAmount.onkeyup = function(e){ + + ERROR_MSG = null; + var DISC_PERC = null; + var qty = $('qty').value; + var total = this.value; + var totalPriceLimit = LIMIT_PRICE * qty; + var newPrice = new Number(total/qty).toFixed(2); + $('incPrice').value = newPrice; + + var disount = LIST_PRICE - newPrice; + DISC_PERC = new Number((discount/LIST_PRICE) * 100).toFixed(2); + $('disc').value = DISC_PERC; + + $('discountOnTotal').value = $('isDiscOnTotal').value = 'false'; + $('isDiscOnInclUnitPrice').value = 'true'; + $('isDiscOnPerc').value = 'false'; + + validateDiscount(newPrice, DISC_PERC); + }; + + var GrandTotal = $('grandTotal'); + GrandTotal.onkeyup = function(e) + { + var totalLines = this.value; + var ERROR_MSG = null; + + if((ISDISCOUNTUPTOLIMITPRICE == true) && (OVERRIDE_PRICE_LIMIT == false)) + { + if((totalLines > TOTAL_LIST_PRICE) && (ORIG_TOTAL_LINES != totalLines)) + { + ERROR_MSG = "DISCOUNTED TOTAL EXCEEDS TOTAL LINES!!!"; + } + if((totalLines < TOTAL_LIMIT_PRICE) && (ORIG_TOTAL_LINES != totalLines)) + { + ERROR_MSG = "TOTAL DISCOUNT EXCEEDED!!!"; + } + + if((totalLines > TOTAL_LIST_PRICE) && (totalLines < TOTAL_LIMIT_PRICE)) + ERROR_MSG = null; + } + + if((ISDISCOUNTUPTOLIMITPRICE == false) && (OVERRIDE_PRICE_LIMIT == true)) + { + if(DISCOUNT_LIMIT > 0) + { + var discount = TOTAL_LIST_PRICE - totalLines; + DISC_PERC = new Number((discount/TOTAL_LIST_PRICE)*100).toFixed(2); + + if(DISC_PERC > DISCOUNT_LIMIT) + { + ERROR_MSG = "DISCOUNT LIMIT EXCEEDED!!!"; + } + + discAmt = totalLines - GRAND_TOTAL; + if(discAmt > 0) + { + ERROR_MSG = "DISCOUNT CANNOT BE NAGATIVE"; + } + + } + + if(DISCOUNT_LIMIT == 0) + { + ERROR_MSG = "CANNOT APPLY DISCOUNT!!!
    NO DISCOUNT PERCENTAGE SET"; + } + } + + if((ISDISCOUNTUPTOLIMITPRICE == false) && (OVERRIDE_PRICE_LIMIT == false)) + { + if(DISCOUNT_LIMIT > 0) + { + if((totalLines < TOTAL_LIMIT_PRICE) && (ORIG_TOTAL_LINES != totalLines)) + { + ERROR_MSG = "CANNOT OVERRIDE LIMIT PRICE!!!"; + } + + if((totalLines > TOTAL_LIST_PRICE) && (ORIG_TOTAL_LINES != totalLines)) + { + ERROR_MSG = "DISCOUNTED TOTAL EXCEEDS TOTAL LINES!!!"; + } + } + + if(DISCOUNT_LIMIT == 0) + { + ERROR_MSG = "CANNOT APPLY DISCOUNT!!!
    NO DISCOUNT PERCENTAGE SET"; + } + } + + if((ISDISCOUNTUPTOLIMITPRICE == true) && (OVERRIDE_PRICE_LIMIT == true)) + { + $('discountUptoLimitPrice').className = "error"; + $('overridePriceLimit').className = "error"; + ERROR_MSG = "DISCOUNT ERROR!! CANNOT PROCESS YOUR REQUEST!!!"; + } + + if(ERROR_MSG == null) + { + if(ORIG_TOTAL_LINES == totalLines) + { + $('applyDiscBtn').disabled = true; + } + else + { + $('applyDiscBtn').disabled = false; + } + } + else + { + $('applyDiscBtn').disabled = true; + } + + $('errorMsg').innerHTML = ERROR_MSG; + + $('discountOnTotal').value = $('isDiscOnTotal').value = 'true'; + $('isDiscOnInclUnitPrice').value = 'false'; + $('isDiscOnPerc').value = 'false'; + + }; + + + $('qty').onkeyup = function(e){ + if(e.keyCode == Event.KEY_RETURN) + { + //update qty + done = true; + updateQty(product_id, this.value); + } + }; + + $('checkoutBtn').onclick = function(e){ + initSystemBtns(); + this.className = 'selected'; + if(cartLines == null || cartLines.length == 0) + { + showErrorMessage('Shopping cart is empty!', 'productQuery'); + } + else + { + if(orderType == ORDER_TYPES.CUSTOMER_RETURNED_ORDER) + { + $('creditPanel').show(); + } + else if(orderType == ORDER_TYPES.POS_GOODS_RETURNED_NOTE) + { + $('creditPanel').show(); + } + else + { + activePanel.show(); + } + + } + }; + + $('openDrawerBtn').onclick = function(e){ + initSystemBtns(); + this.className = 'selected'; + openCashDrawer(); + }; + + $('discountBtn').showDiscount = $('discountBtn').onclick + $('discountBtn').onclick = function(){ + initSystemBtns(); + this.className = 'selected'; + if(cartLines == null || cartLines.length == 0) + { + showErrorMessage('Shopping cart is empty!', 'productQuery'); + } + else + { + this.showDiscount(); + } + + }; + + $('clearCartBtn').onclick = function(e){ + initSystemBtns(); + this.className = 'selected'; + cartIndex = null; + cartLines = null; + clearCart(); + }; + + $('quickDiscountBtn').onclick = function(e){ + initSystemBtns(); + this.className = 'selected'; + var QuickDiscountForm = $('QuickDiscountForm'); + + if(cartLines == null || cartLines.length == 0) + { + isQuickDiscount = false; + QuickDiscountForm.disable(); + showErrorMessage('Shopping cart is empty!', 'barcode'); + } + else + { + if(!OVERRIDE_PRICE_LIMIT && !ISDISCOUNTUPTOLIMITPRICE && !ISDISCOUNTONTOTAL && DISCOUNT_LIMIT == 0) + { + isQuickDiscount = false; + QuickDiscountForm.disable(); + $('errorMsg').innerHTML = "DISCOUNT NOT ALLOWED!!!"; + showErrorMessage('You are not allowed to give discount!', 'barcode'); + } + else + { + isQuickDiscount = true; + QuickDiscountForm.enable(); + + } + + } + + if(isQuickDiscount) + { + if(isDiscountFormOpen) + { + closeDiscount(); + } + else + { + quickDiscount(); + } + } + else + { + closeDiscount(); + } + + }; + + $('applyDiscBtn').onclick = function(e){ + if(cartLines == null || cartLines.length == 0) + { + showErrorMessage('Shopping cart is empty!', 'productQuery'); + } + else + { + applyDiscount(); + } + }; + + $('changePinBtn').onclick = function(e){ + + var isOverlay = $('PINPanel').style.display; + + if(isOverlay == 'none' || isOverlay == '') + { + popUp(); + } + showDisableMask(); + popPanel($('PINPanel')); + $('PIN').focus(); + }; + + //add behaviour to existing cart + addBehaviourToCart(); + + $('barcode').focus(); + showErrors(); +}; + +var initPIN = function(){ + var pinPanel = $('PINPanel'); + var inputs = pinPanel.getElementsByTagName('input'); + + pinPanel.pin = inputs[0]; + pinPanel.ok = inputs[1]; + pinPanel.cancel = inputs[2]; + + var validatePIN = function() + { + if($('PINPanel').pin.value == null || $('PINPanel').pin.value == '') + { + return; + } + + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=validatePIN&pin=' + $('PINPanel').pin.value; + + var refreshDiscountLimit = function(request){ + var response = request.responseText; + var result = eval('(' + response + ')'); + + if(result.error) + { + $('PINPanel').pin.value = ''; + showErrorMessage(result.error, 'PIN'); + } + else + { + roleId = result.roleId; + discountLimit = result.discountLimit; + overrideLimit = result.overrideLimit; + discountOnTotal = result.discountOnTotal; + discountUptoPriceLimit = result.discountUptoPriceLimit; + + DISCOUNT_LIMIT = discountLimit; + OVERRIDE_PRICE_LIMIT = overrideLimit; + ISDISCOUNTONTOTAL = discountOnTotal; + ISDISCOUNTUPTOLIMITPRICE = discountUptoPriceLimit; + + if(!ISDISCOUNTUPTOLIMITPRICE) + { + $('discountUptoLimitPrice').hide(); + } + else + { + $('discountUptoLimitPrice').show(); + } + + if(!OVERRIDE_PRICE_LIMIT) + { + $('overridePriceLimit').hide(); + } + else + { + $('overridePriceLimit').show(); + } + + if(!ISDISCOUNTONTOTAL) + { + $('discountAllowedOnTotal').hide(); + } + else + { + $('discountAllowedOnTotal').show(); + } + + if(DISCOUNT_LIMIT == 0) + { + $('userDiscLimit').hide(); + } + else + { + $('userDiscLimit').show(); + } + + $('isDiscountUptoLimitPrice').innerHTML = discountUptoPriceLimit + ''; + $('overrideLimit').innerHTML = overrideLimit + ''; + $('isDiscountOnTotal').innerHTML = discountOnTotal + ''; + $('discountLimit').innerHTML = discountLimit + '%'; + $('roleId').value = roleId; + $('PINPanel').pin.value = ''; + + $('resetPinBtn').show(); + $('changePinBtn').hide(); + popUp(); + hidePanel($('PINPanel')); + hideDisableMask(); + refreshCart(); + } + }; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshDiscountLimit, + onFailure: reportShoppingCartError + }); + } + + pinPanel.ok.onclick = validatePIN; + + pinPanel.pin.onkeyup = function(e){ + if(e.keyCode == Event.KEY_RETURN) + { + validatePIN(); + } + }; + + pinPanel.cancel.onclick = function(e){ + $('PINPanel').pin.value = ''; + popUp(); + hidePanel($('PINPanel')); + hideDisableMask(); + }; +}; + +function resetUser(roleId) +{ + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=resetUser&roleId=' + roleId; + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshUser, + onFailure: reportShoppingCartError + }); + +} + +function refreshUser(request) +{ + var response = request.responseText; + var result = eval('(' + response + ')'); + + if(result.error) + { + showErrorMessage(result.error, 'barcode'); + } + else + { + roleId = result.roleId; + discountLimit = result.discountLimit; + overrideLimit = result.overrideLimit; + discountOnTotal = result.discountOnTotal; + discountUptoPriceLimit = result.discountUptoPriceLimit; + + DISCOUNT_LIMIT = discountLimit; + OVERRIDE_PRICE_LIMIT = overrideLimit; + ISDISCOUNTONTOTAL = discountOnTotal; + ISDISCOUNTUPTOLIMITPRICE = discountUptoPriceLimit; + + $('isDiscountUptoLimitPrice').innerHTML = discountUptoPriceLimit + ''; + $('overrideLimit').innerHTML = overrideLimit + ''; + $('isDiscountOnTotal').innerHTML = discountOnTotal + ''; + $('discountLimit').innerHTML = discountLimit + '%'; + $('roleId').value = roleId; + $('PINPanel').pin.value = ''; + + $('changePinBtn').show(); + $('resetPinBtn').hide(); + + refreshCart(); + } +} + +var initShortcuts = function() +{ + shortcut.add("Ctrl+Space", function(e){simulateOnClick($('checkoutBtn'))}); + + shortcut.add("F1", function(e){$('barcode').select();}); + shortcut.add("F2", function(e){$('productQuery').select();}); + shortcut.add("F3", function(e){$('description').select();}); + shortcut.add("F4", function(e){$('qty').select();}); + + shortcut.add("F5", function(e){$('customerQuery').select();}); + shortcut.add("F6", function(e){simulateOnClick($('discountBtn'))}); + + // Barcode Btn + shortcut.add("Ctrl+B", function(e){simulateOnClick($('barcodeBtn'))}); + + // Quick Discount + shortcut.add("F8", function(e){simulateOnClick($('quickDiscountBtn'))}); + //payment btns + shortcut.add("F9", function(e){simulateOnClick($('cashBtn'))}); + shortcut.add("F10", function(e){simulateOnClick($('cardBtn'))}); + shortcut.add("F11", function(e){simulateOnClick($('chequeBtn'))}); + shortcut.add("F12", function(e){simulateOnClick($('mixBtn'))}); + + shortcut.add("Ctrl+M", function(){simulateOnClick($('menuBtn'))}); + shortcut.add("Ctrl+D", function(){ + //simulateOnClick($('openDrawerBtn')); + showErrorMessage('Opening Cash Drawer'); + + }); + shortcut.add("Ctrl+Delete", function(){ + simulateOnClick($('clearCartBtn')); + }); + shortcut.add("Ctrl+P", function(){simulateOnClick($('changePinBtn'))}); + shortcut.add("Ctrl+R", function(){simulateOnClick($('resetPinBtn'))}); + shortcut.add("Ctrl+S", function(){simulateOnClick($('shortcutBtn'))}); + + shortcut.add("Ctrl+C", function(){simulateOnClick($('creditBtn'))}); + + //move between cart lines + shortcut.add("Ctrl+Up", function(){ + closeDiscount(); + if(cartIndex > 0) + { + cartIndex = cartIndex -1; + var line = cartLines[cartIndex]; + scrollCart(); + simulateOnClick(line); + } + }); + + shortcut.add("Ctrl+Down", function(){ + closeDiscount(); + if(cartIndex < cartLines.length - 1) + { + cartIndex = cartIndex + 1; + var line = cartLines[cartIndex]; + scrollCart(); + simulateOnClick(line); + } + }); + + //incrementing and decrementing qty + shortcut.add("Ctrl+Right", function(){ + closeDiscount(); + simulateOnClick($('plusBtn')); + }); + + shortcut.add("Ctrl+Left", function(){ + closeDiscount(); + simulateOnClick($('minusBtn')); + }); + + shortcut.add("Ctrl+Backspace", function(){ + closeDiscount(); + simulateOnClick($('deleteBtn')); + }); + + //Enable create product for GRN + if(orderType == ORDER_TYPES.POS_GOODS_RECEIVE_NOTE) + { + shortcut.add("Alt+P", function(){CreateProduct.showPopup(0);}); + shortcut.add("Alt+U", function(){ + if(product_id != null) + CreateProduct.showPopup(product_id); + }); + + shortcut.add("Esc", function(){ + CreateProduct.hidePopup(); + }); + } + +}; + +var showResult = function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + Position.clone($('maintop'), update, {setHeight: false, setTop: false, offsetTop: element.offsetHeight}); + } + + update.style.display = 'block'; + update.style.opacity = '1.0'; + + }; + + +var initProductSearch = function(){ + + // autocomplete for search by product name + var productAutocompleter = new Ajax.Autocompleter('productQuery','productSearchResult','SearchProductsAction.do',{ + paramName:'productName', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete, + onShow : showResult + }); + + productAutocompleter.xyz = true; + $('productQuery').Autocompleter = productAutocompleter; + + + // autocomplete for search by product description + var productAutocompleter2 = new Ajax.Autocompleter('description','productSearchByDescriptionResult','SearchProductsAction.do',{ + paramName:'description', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete, + onShow : showResult + }); + + $('description').Autocompleter = productAutocompleter2; +}; + +var afterAutocomplete = function(e1,e2){ + + if(!validateBp()) + { + return; + } + + var barcode = e2.getAttribute('barcode'); + if(barcode=='null') + { + barcode = ""; + } + var productId = e2.getAttribute('productId'); + + if(productId == null) + { + $('description').value = ""; + $('productQuery').value = ""; + + return; + } + + //$('barcode').value = barcode; + $('productId').value= productId; + + var description = e2.getAttribute('description'); + //$('description').value = description; + + incrementCart(productId); + + //reset focus to search input + searchElement.focus(); + + //show product details + getProductInfo(productId); + + //set global product + product_id = productId; + + $('description').value = ""; + $('productQuery').value = ""; + +}; + +function getProductInfo(productId) +{ + var url = 'POSProductAction2.do'; + var pars = 'action=getProductDetails&productId='+productId+'&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: showProductInfo, + onFailure: reportError + }); +} + +function showProductInfo(request) +{ + // + try + { + var response = request.responseText; + var product = eval('(' + response + ')'); + + //display product info in right column + $('m_productId').value = product.id; + $('product.name').innerHTML = product.name; + $('product.barcode').innerHTML = product.barcode; + $('product.taxCategory').innerHTML = product.taxCategory; + $('product.description').innerHTML = product.description; + $('product.stock.qty').innerHTML = product.stockQty; + TAX_RATE = $('taxRate').value = new Number(product.taxRate).toFixed(2); + var taxPercentage = new Number(1 + (TAX_RATE / 100)); + + ISTAXINCLUDED = product.isTaxIncluded; + + if(ISTAXINCLUDED == "false") + { + LIMIT_PRICE = $('priceLimit').innerHTML = new Number(product.priceLimit * taxPercentage).toFixed(2); + LIST_PRICE = new Number(product.priceList * taxPercentage).toFixed(2); + ORIG_TOTAL = new Number($('qty').value * product.priceList * taxPercentage).toFixed(2); + } + else + { + LIMIT_PRICE = $('priceLimit').innerHTML = new Number(product.priceLimit).toFixed(2); + LIST_PRICE = new Number(product.priceList).toFixed(2); + ORIG_TOTAL = new Number($('qty').value * product.priceList).toFixed(2); + } + + $('product.price.list').innerHTML = LIST_PRICE; + + if(ISDISCOUNTUPTOLIMITPRICE) + { + $('product.price.limit').innerHTML = LIMIT_PRICE; + } + + $('product.image').src = 'images/newUI/productpreview.gif'; + + } + catch(e) + { + showErrorMessage(e); + } +} + +function reportError(request) +{ + alert("Some error has occured while communicating with the server"); + var w = window.open("","Error"); + var d = w.document; + d.write(request.responseText); +} + +function convertString2Unicode(s) +{ + var uniString = "", hexVal, uniChar; + + for(var i = 0; i < s.length; ++i) + { + //Convert char to hex + //hexVal = Number(s.charCodeAt(i)).toString(16); + hexVal = Number(s.charCodeAt(i)).toString(10); + + //Convert to unicode by making sure hex is 4 chars long, padding with 0's if less + //uniChar = "\\u" + ("000" + hexVal).match(/.{4}$/)[0]; + uniChar = "&#" + ("000" + hexVal).match(/.{4}$/)[0] +";"; + + uniString += uniChar; + } + if(hexVal < 255) + return s; + + return uniString; +} + +// returns true if bp is valid +var validateBp = function(){ + if(orderType == ORDER_TYPES.POS_GOODS_RECEIVE_NOTE || + orderType == ORDER_TYPES.POS_GOODS_RETURNED_NOTE) + { + var bpartner = $('bpartnerId').value; + if(bpartner == null || bpartner == "") + { + showErrorMessage("Please choose a vendor", 'customerQuery'); + //$('bpartnerId').focus(); + + return false; + } + } + + if(isCustomerCompulsory) + { + var bpartner = $('bpartnerId').value; + if(bpartner == null || bpartner == "") + { + showErrorMessage("Please choose a customer", 'customerQuery'); + //$('bpartnerId').focus(); + + return false; + } + } + + if(orderType == ORDER_TYPES.CREDIT_ORDER || orderType == ORDER_TYPES.POS_ORDER) + if($('tenderType').value == PAYMENT_RULES.PAYMENT_RULE_CREDIT) + { + var bpartner = $('bpartnerId').value; + if(bpartner == null || bpartner == "") + { + showErrorMessage("Please choose a customer", 'customerQuery'); + //$('bpartnerId').focus(); + + return false; + } + + if(BP.creditStatus == SO_CREDIT_STATUS.NoCreditCheck) + { + showErrorMessage("Please set credit status for customer", 'customerQuery'); + return false; + } + + if(BP.creditLimit == 0) + { + showErrorMessage("Please set credit limit for customer", 'customerQuery'); + return false; + } + + if(BP.openBalance > BP.creditLimit) + { + showErrorMessage("Credit Limit has been exceed!", 'customerQuery'); + return false; + } + + if(BP.creditStatus != SO_CREDIT_STATUS.CreditOK) + { + var errmsg = 'Invalid credit status! '; + + if(BP.creditStatus == SO_CREDIT_STATUS.CreditHold) + { + errmsg += 'Credit Hold'; + } + + if(BP.creditStatus == SO_CREDIT_STATUS.CreditStop) + { + errmsg += 'Credit Stop'; + } + + if(BP.creditStatus == SO_CREDIT_STATUS.CreditWatch) + { + errmsg += 'Credit Watch'; + } + + showErrorMessage(errmsg, 'customerQuery'); + return false; + } + + } + + return true; +}; + +var initSearchCustomer = function(){ + + //validateBp(); // validates bp on load + + // auto complete for customer + $('customerQuery').Autocompleter = new Ajax.Autocompleter('customerQuery','customerSearchResult','SearchCustomerAction.do',{ + paramName:'customerQuery', + frequency:TROTTLE_TIME, + parameters : 'orderType=' + orderType, // if credit order, do not validate for standard customer + onShow:function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + } + update.style.display = 'block'; + }, + afterUpdateElement:function(e1,e2){ + var bpartner = $('bpartnerId'); + var bpartnerName = $('customer.name'); + + + if(e2.value != '-1') + { + if(e2.value) + { + bpartner.value = e2.value; + } + else + { + bpartner.value = ''; + } + + $('customer.code').innerHTML = bpartner.value; + var creditLimit = e2.getAttribute('creditLimit'); + var creditAvailable = e2.getAttribute('creditAvailable'); + var openBalance = e2.getAttribute('openBalance'); + var creditStatus = e2.getAttribute('creditStatus'); + var name = e2.getAttribute('name'); + + if(bpartnerName) + { + BP.id = bpartner.value; + BP.name = name; + BP.priceList = e2.getAttribute('priceList'); + BP.priceListName = e2.getAttribute('pricelistName'); + BP.creditStatus = creditStatus; + BP.creditAvailable = parseFloat(creditAvailable); + BP.creditLimit = parseFloat(creditLimit); + BP.openBalance = parseFloat(openBalance); + + $('customerCode').style.display = 'table-row'; + $('customerName').style.display = 'table-row'; + $('creditAvailable').style.display = 'table-row'; + $('creditLimit').style.display = 'table-row'; + $('openBalance').style.display = 'table-row'; + + $('customer.name').innerHTML = name; + $('credit.available').innerHTML = creditAvailable; + $('credit.limit').innerHTML = creditLimit; + $('open.balance').innerHTML = openBalance; + + BP_CREDIT_STATUS = creditStatus; + + if (e2.getAttribute('priceList') && parseInt(e2.getAttribute('priceList')) > 0) + { + priceList = e2.getAttribute('priceList'); + $('priceListId').value = priceList; + $('terminal').innerHTML = e2.getAttribute('pricelistName'); + } + else + { + priceList = defaultPriceList; + $('terminal').innerHTML = defaultPriceListName; + } + if(cartLines != null && cartLines.length != 0) + { + //reload shopping cart for partner + if(oldPriceList != priceList) + { + setShoppingCartPriceList(); + oldPriceList = priceList; + } + } + $('productQuery').Autocompleter.options.defaultParams='priceListId=' + priceList; + saveBPartnerInfo(bpartner.value, name, creditLimit, priceList); + }//if + } + else + { + bpartner.value = ""; + if(bpartnerName) + { + bpartnerName.value = ""; + }//if + }//if + + + $('customerQuery').value = ""; + + searchElement.focus(); + } + + }); + +} + +function saveBPartnerInfo(bPartnerValue, name, creditLimit, priceListId) +{ + try + { + var url = 'CheckoutAction.do'; + var pars = 'action=saveBPartnerInfo&bPartnerId='+bPartnerValue +'&name='+name+'&creditLimit='+creditLimit+'&priceListId='+priceListId; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars + }); + + } + catch(e) + { + toConsole(e); + } + return; +} + +var initCartBtn = function(){ + var plus = $('plusBtn'); + var minus = $('minusBtn'); + var del = $('deleteBtn'); + + plus.style.cursor = 'pointer'; + minus.style.cursor = 'pointer'; + del.style.cursor = 'pointer'; + + plus.onclick = function(e){ + if(product_id != null) + incrementCart(product_id); + searchElement.focus(); + }; + + minus.onclick = function(e){ + if(product_id != null) + decrementCart(product_id); + searchElement.focus(); + }; + + del.onclick = function(e){ + if(product_id != null) + deleteItemFromCart(product_id); + + if(cartLines == null || cartLines.length == 0) + { + resetDetails(); + } + + searchElement.focus(); + }; +}; + + + +var initAjaxResponder = function(){ + + Ajax.Responders.register({ + onCreate: function() { + $('indicator').style.display = 'block'; + }, + onComplete: function() { + $('indicator').style.display = 'none'; + } + }); +}; + + + +//---------------------------------------------------------------------------- + + +var hidePaymentPanels = function(){ + paymentPanels.each(hidePanel); +}; + +var initOkCancel = function(panel){ + var inputs = panel.getElementsByTagName('input'); + + if(inputs.length > 2) + { + var length = inputs.length; + var ok = inputs[length-2]; + var cancel = inputs[length-1]; + + ok.panel = panel; + cancel.panel = panel; + + ok.onclick = function(){this.panel.validate();}; + cancel.onclick = function() + { + hidePanel(this.panel); + }; + + shortcut.add("Esc", function() + { + simulateOnClick(cancel); + }); + + } + +}; + +// add behaviour to different payment panels +var initCashPanel = function(){ + var cashPanel = $('cashPanel'); + + if(orderType == ORDER_TYPES.POS_GOODS_RECEIVE_NOTE) + { + $('writeOffAmt').style.display = 'none'; + $('actualPaymentAmt').style.display = 'none'; + } + + $('amountTendered').focus(); + + $('amountTendered').onkeypress = function(e){ + + if(e.keyCode == Event.KEY_RETURN) + { + if(this.value == null || this.value == '') + { + showErrorMessage('Enter an amount!', 'amountTendered'); + return; + } + + $('cashPanel').validate(); + } + } + $('amountTendered').onkeyup = function(e){ + + var amount = getCartTotal(); + var amountRefunded = null; + var writeOffAmt = 0; + + var paymentAmt = new Number(amount).toFixed(2); + if(orderType == ORDER_TYPES.POS_ORDER) + { + var roundOffFactor = $('roundOffFactor').value; + var writeOffAmt = 0; + + if (roundOffFactor != null && roundOffFactor != 0) + { + var multiple = amount/roundOffFactor; + var index1 = multiple.toString().indexOf('.'); + if(index1 == -1) + { + writeOffAmt = 0; + } + else + { + multiple = parseInt(multiple); + writeOffAmt = amount - (multiple * roundOffFactor); + writeOffAmt = writeOffAmt.toFixed(2); + } + } + paymentAmt = new Number(amount - writeOffAmt).toFixed(2); + $('writeOffCash').innerHTML = new Number(writeOffAmt).toFixed(2); + $('paymentCash').innerHTML = paymentAmt; + } + + amountRefunded = this.value - paymentAmt; + //Round amountRefunded to two decimal places if its greater than 2 decimal places + var amtstr = new Number(amountRefunded).toString(); + var index = amtstr.indexOf('.'); + + var noOfDecimalPlaces = amountRefunded.toString().length - index; + if(index != -1 && noOfDecimalPlaces > 2) + { + $('amountRefunded').innerHTML = Math.round(amountRefunded * 100) / 100; + } + else + { + $('amountRefunded').innerHTML = amountRefunded; + } + + }; + + cashPanel.validate =function(){ + var amount = getCartTotal(); + var amountTendered = new Number($('amountTendered').value); + var writeOff = $('writeOffCash').innerHTML; + var writeOffAmt = new Number(writeOff); + + if (isNaN(amountTendered)) + { + showErrorMessage('Please enter a numeric value', 'amountTendered'); + return; + } + if (isNaN(writeOffAmt)) + { + writeOffAmt = 0; + } + var total = amountTendered + writeOffAmt; + + if(amount > total) + { + showErrorMessage('Amount tendered is less that total amount', 'amountTendered'); + } + else + { + $FElement('tenderType').value = 'cash'; + $FElement('amountTendered').value = $('amountTendered').value; + $FElement('amountRefunded').value = new Number(amountTendered - amount).toFixed(2); + + hidePanel(this); + + checkout(); + + } + };//cashPanel.validate + + cashPanel.show = function(){ + hidePaymentPanels(); + popPanel(this); + $('cashTotal').innerHTML = $('total').innerHTML; + $('amountTendered').focus(); + }; + + cashPanel.reset = function(){ + $('amountTendered').value = ''; + $('amountRefunded').innerHTML = ''; + }; +}; + +var initCardPanel = function(){ + var cardPanel = $('cardPanel'); + + $('cardNo').onkeypress = function(e){ + + if(e.keyCode == Event.KEY_RETURN) + { + if(this.value == null || this.value == '') + { + showErrorMessage('Enter Credit Card Number!','cardNo'); + return; + } + + $('cardPanel').validate(); + } + }; + + cardPanel.validate = function(){ + //validate credit card no + var cardNo = $('cardNo').value; + + if(cardNo == null || cardNo == '') + { + showErrorMessage('Enter Credit Card Number!','cardNo'); + } + else + { + $FElement('tenderType').value = 'card'; + $FElement('cardNo').value = cardNo; + + hidePanel(this); + + checkout(); + } + }; + + cardPanel.show = function(){ + hidePaymentPanels(); + popPanel(this); + $('cardTotal').innerHTML = $('total').innerHTML; + $('cardList').focus(); + }; + + cardPanel.reset = function(){ + $('cardNo').value = ''; + $('cardList').selectedIndex = 0; + }; +}; + +var initChequePanel = function(){ + var chequePanel = $('chequePanel'); + + $('chequeNo').onkeypress = function(e){ + + if(e.keyCode == Event.KEY_RETURN) + { + if(this.value == null || this.value == '') + { + showErrorMessage('Enter Cheque Number!','chequeNo'); + return; + } + + $('chequePanel').validate(); + } + }; + + chequePanel.validate = function(){ + //validate cheque no + var chequeNo = $('chequeNo').value; + + if(chequeNo == null || chequeNo == '') + { + showErrorMessage('Enter Cheque Number!'); + } + else + { + $FElement('tenderType').value = 'cheque'; + $FElement('chequeNo').value = chequeNo; + + hidePanel(this); + + checkout(); + } + }; + + chequePanel.show = function(){ + hidePaymentPanels(); + popPanel(this); + $('chequeTotal').innerHTML = $('total').innerHTML; + $('chequeNo').focus(); + }; + + chequePanel.reset = function(){ + $('chequeNo').value = ''; + }; +}; + +var initMixPanel = function(){ + var mixPanel = $('mixPanel'); + + var bgColorError = '#FF0000'; + var bgColorNormal = '#FFFFFF'; + var cardAmount; + var cashAmount; + var chequeAmount; + + var inputs = mixPanel.getElementsByTagName('input'); + + $('mix_cashAmt').onkeyup = function(e){ + var total = getCartTotal(); + + if (this.value <= total && this.value >= 0) + { + cashAmount = new Number(this.value); + cardAmount = new Number($('mix_cardAmt').value); + chequeAmount = new Number($('mix_chequeAmt').value); + + var diff = (cashAmount + cardAmount + chequeAmount) - total; + + if (diff < 0) + { + cardAmount = total - (cashAmount + chequeAmount); + } + if (diff > 0) + { + var cardAmountDiff = cardAmount - diff; + + if (cardAmountDiff > 0) + { + cardAmount = cardAmountDiff; + } + else + { + chequeAmount = chequeAmount + cardAmountDiff; + cardAmount = 0; + } + } + $('mix_cardAmt').value = new Number(cardAmount).toFixed(2); + $('mix_chequeAmt').value = new Number(chequeAmount).toFixed(2); + this.style.backgroundColor = bgColorNormal; + inputs[5].disabled = false; + } + else + { + this.style.backgroundColor = bgColorError; + inputs[5].disabled = true; + } + }; + + $('mix_chequeAmt').onkeyup = function(e){ + var total = getCartTotal(); + + if (this.value <= total && this.value >= 0) + { + chequeAmount = new Number(this.value); + cashAmount = new Number($('mix_cashAmt').value); + cardAmount = new Number($('mix_cardAmt').value); + var diff = (chequeAmount + cashAmount + cardAmount) - total; + + if (diff < 0) + { + cardAmount = total - (chequeAmount + cashAmount); + } + if (diff > 0) + { + var cardAmountDiff = cardAmount - diff; + if (cardAmountDiff > 0) + { + cardAmount = cardAmountDiff; + } + else + { + cashAmount = cashAmount + cardAmountDiff; + cardAmount = 0; + } + } + $('mix_cardAmt').value = new Number(cardAmount).toFixed(2); + $('mix_cashAmt').value = new Number(cashAmount).toFixed(2); + this.style.backgroundColor = bgColorNormal; + inputs[5].disabled = false; + } + else + { + this.style.backgroundColor = bgColorError; + inputs[5].disabled = true; + } + }; + + $('mix_cardAmt').onkeyup = function(e){ + var total = getCartTotal(); + + if(this.value <= total && this.value >= 0) + { + chequeAmount = new Number($('mix_chequeAmt').value); + cashAmount = new Number($('mix_cashAmt').value); + cardAmount = new Number(this.value); + + var diff = (cardAmount + cashAmount + chequeAmount) - total; + + if (diff < 0) + { + chequeAmount = total - (cardAmount + cashAmount); + } + if (diff > 0) + { + var chequeAmountDiff = chequeAmount - diff; + + if (chequeAmountDiff > 0) + { + chequeAmount = chequeAmountDiff; + } + else + { + cashAmount = cashAmount + chequeAmountDiff; + chequeAmount = 0; + } + } + $('mix_chequeAmt').value = new Number(chequeAmount).toFixed(2); + $('mix_cashAmt').value = new Number(cashAmount).toFixed(2); + this.style.backgroundColor = bgColorNormal; + inputs[5].disabled = false; + } + else + { + this.style.backgroundColor = bgColorError; + inputs[5].disabled = true; + } + }; + + $('mix_cashAmt').onkeypress = function(e){ + + if(e.keyCode == Event.KEY_RETURN) + { + mixPanel.validate(); + } + }; + + $('mix_chequeAmt').onkeypress = function(e){ + + if(e.keyCode == Event.KEY_RETURN) + { + mixPanel.validate(); + } + }; + + $('mix_cardAmt').onkeypress = function(e){ + + if(e.keyCode == Event.KEY_RETURN) + { + mixPanel.validate(); + } + }; + + $('mix_chequeNo').onkeypress = function(e){ + + if(e.keyCode == Event.KEY_RETURN) + { + mixPanel.validate(); + } + }; + + $('mix_cardNo').onkeypress = function(e){ + + if(e.keyCode == Event.KEY_RETURN) + { + mixPanel.validate(); + } + }; + + mixPanel.validate = function(){ + //validate net amt + if (inputs[5].disabled == true) + { + return; + } + + var total = getCartTotal(); + + var cashAmt = $('mix_cashAmt').value; + var chequeAmt = $('mix_chequeAmt').value; + var chequeNo = $('mix_chequeNo').value; + var cardAmt = $('mix_cardAmt').value; + var cardNo = $('mix_cardNo').value; + + if((cashAmt == null || cashAmt == '') && (chequeAmt == null || chequeAmt == '') && (cardAmt == null || cardAmt == '')) + { + showErrorMessage('Please enter an amount', 'mix_cashAmt'); + } + else if((chequeNo == null || chequeNo == '') && (chequeAmt.length > 0)) + { + showErrorMessage('Enter Cheque Number!', 'mix_chequeNo'); + } + else if(chequeNo.length > 0 && (chequeAmt == null || chequeAmt == '') && (chequeAmt != 0)) + { + showErrorMessage('Enter Cheque Amount!', 'mix_chequeAmt'); + } + else if(cardNo.length > 0 && (cardAmt == null || cardAmt == '')) + { + showErrorMessage('Enter Card Amount!', 'mix_cardAmt'); + } + else if((cardNo == null || cardNo == '') && (cardAmt.length > 0) && (cardAmt != 0)) + { + showErrorMessage('Enter Card Number!', 'mix_cardNo'); + } + else + { + var total1 = new Number(0); + var cashAmt = new Number($('mix_cashAmt').value); + var chequeAmt = new Number($('mix_chequeAmt').value); + var cardAmt = new Number($('mix_cardAmt').value); + + if (!isNaN(cashAmt)) + { + total1 = total1 + cashAmt; + } + if (!isNaN(cardAmt)) + { + total1 = total1 + cardAmt; + } + if (!isNaN(chequeAmt)) + { + total1 = total1 + chequeAmt; + } + + if(total1 < total) + { + showErrorMessage('Amount tendered is less than total amount!', 'mix_cashAmt'); + } + else + { + $FElement('tenderType').value = 'mixed'; + $FElement('chequeNo').value = chequeNo; + $FElement('chequeAmt').value = chequeAmt; + $FElement('cardNo').value = cardNo; + $FElement('cardAmt').value = cardAmt; + $FElement('cashAmt').value = cashAmt; + + hidePanel(this); + + checkout(); + } + + } + }; + + mixPanel.show = function(){ + hidePaymentPanels(); + popPanel(this); + $('mixTotal').innerHTML = $('total').innerHTML; + + $('mix_cashAmt').value = getCartTotal(); + $('mix_cashAmt').select(); + + }; + + mixPanel.reset = function(){ + $('mix_cashAmt').value = ''; + $('mix_chequeAmt').value = ''; + $('mix_chequeNo').value = ''; + $('mix_cardAmt').value = ''; + $('mix_cardNo').value = ''; + }; +}; + +var initCreditPanel = function(){ + var creditPanel = $('creditPanel'); + + creditPanel.show = function(){ + $('isCustomerCompulsory').value = 'true'; + isCustomerCompulsory = 'true'; + + if (!creditPanel.validate()) + { + creditPanel.reset(); + return; + } + checkout(); + }; + + creditPanel.reset = function(){ + if ($('orderType').value == ORDER_TYPES.POS_ORDER) + { + $('isCustomerCompulsory').value = 'false'; + } + }; + + creditPanel.validate = function(){ + return validateBp(); + }; + +}; + + +var initPaymentPanels = function(){ + paymentPanels = [$('cashPanel'), $('cardPanel'), $('chequePanel'), $('mixPanel'), $('creditPanel')]; + paymentPanels = $A(paymentPanels); + paymentPanels.each(initOkCancel); + + initCashPanel(); + initCardPanel(); + initChequePanel(); + initMixPanel(); + initCreditPanel(); +}; + +var initPaymentBtns = function(){ + + initPaymentPanels(); + + paymentbtns = new Array(); + paymentbtns.push($('cashBtn')); + paymentbtns.push($('cardBtn')); + paymentbtns.push($('chequeBtn')); + paymentbtns.push($('mixBtn')); + paymentbtns.push($('creditBtn')); + paymentbtns = $A(paymentbtns); + + for(var i=0; iPlease wait ....."; + div.style.border = 'solid 2px #333'; + div.style.width = '800px'; + div.style.height = '700px'; + div.style.position = 'absolute'; + div.style.zIndex = '1000'; + div.style.backgroundColor = '#FFF'; + div.style.visibility = 'hidden'; + document.body.appendChild(div); + this.popup = div; + popPanel(this.popup); + }, + + showPopup : function(productId){ + if(this.visible) return; + this.updateCart = (productId != 0); + this.createPopup(productId); + this.visible = true; + }, + + hidePopup : function(){ + hidePanel(this.popup); + if(this.updateCart) + { + updateQty(product_id, $('qty').value); + this.updateCart = false; + } + this.visible = false; + } +}; + + +function resetDetails() +{ + $('product.name').innerHTML = ""; + $('product.barcode').innerHTML = ""; + $('product.taxCategory').innerHTML = ""; + $('product.description').innerHTML = ""; + $('product.stock.qty').innerHTML = ""; + $('product.price.list').innerHTML = ""; + $('product.price.limit').innerHTML = ""; + $('product.price.std').innerHTML = ""; + $('priceLimit').innerHTML = ""; + $('qty').value = ""; + $('incPrice').value = ""; + $('disc').value = ""; + $('totalAmount').value = ""; + $('grandTotal').value = ""; + $('customer.code').innerHTML = ""; + $('customer.name').innerHTML = ""; + $('credit.available').innerHTML = ""; + $('credit.limit').innerHTML = ""; + $('open.balance').innerHTML = ""; + $('barcode').value = ""; + $('productQuery').value = ""; + $('description').value = ""; + + $('customerCode').hide(); + $('customerName').hide(); + $('creditAvailable').hide(); + $('creditLimit').hide(); + $('openBalance').hide(); + $('barcode').focus(); + closeDiscount(); + +} + +function quickDiscount() +{ + isQuickDiscount = true; + isDiscountFormOpen = true; + $('customerContainer').hide(); + $('paymentContainer').hide(); + $('editProductContainer').hide(); + $('quickDiscountDetails').show(); + $('quickDiscountDetails').show(); + $('checkoutContainer').hide(); + $('incPrice').activate(); +} + +function closeDiscount() +{ + isQuickDiscount = false; + isDiscountFormOpen = false; + $('customerContainer').show(); + $('paymentContainer').show(); + $('editProductContainer').show(); + $('quickDiscountDetails').hide(); + $('quickDiscountDetails').hide(); + $('checkoutContainer').show(); + $('barcode').focus(); +} + +function validateDiscount(newPrice, DISC_PERC) +{ + ERROR_MSG = null; + + if((ISDISCOUNTUPTOLIMITPRICE == true) && (OVERRIDE_PRICE_LIMIT == false)) + { + if(newPrice < LIMIT_PRICE) + { + ERROR_MSG = "DISCOUNT AMOUNT EXCEEDED!!!"; + } + if(newPrice > LIST_PRICE) + { + ERROR_MSG = "YOU CANNOT EXCEED THE LIST PRICE!!!" + } + } + + if((ISDISCOUNTUPTOLIMITPRICE == false) && (OVERRIDE_PRICE_LIMIT == true)) + { + if(DISCOUNT_LIMIT > 0) + { + if(DISC_PERC > DISCOUNT_LIMIT) + { + ERROR_MSG = "DISCOUNT LIMIT EXCEEDED!!!"; + } + } + + if(DISC_PERC < 0) + { + ERROR_MSG = "DISCOUNT CANNOT BE NEGATIVE!!!"; + } + + if(DISCOUNT_LIMIT == 0) + { + ERROR_MSG = "CANNOT APPLY DISCOUNT!!!
    NO DISCOUNT PERCENTAGE SET"; + } + } + + if((ISDISCOUNTUPTOLIMITPRICE == false) && (OVERRIDE_PRICE_LIMIT == false)) + { + if(DISCOUNT_LIMIT > 0) + { + if(DISC_PERC > DISCOUNT_LIMIT) + { + ERROR_MSG = "DISCOUNT LIMIT EXCEEDED!!!"; + } + + if(DISC_PERC < 0) + { + ERROR_MSG = "DISCOUNT CANNOT BE NEGATIVE!!!"; + } + + if(newPrice < LIMIT_PRICE) + { + ERROR_MSG = "CANNOT OVER RIDE LIMIT PRICE!!!"; + } + } + + if(DISCOUNT_LIMIT == 0) + { + ERROR_MSG = "CANNOT APPLY DISCOUNT!!!
    NO DISCOUNT PERCENTAGE SET"; + } + } + + if((ISDISCOUNTUPTOLIMITPRICE == true) && (OVERRIDE_PRICE_LIMIT == true)) + { + $('discountUptoLimitPrice').className = "error"; + $('overridePriceLimit').className = "error"; + ERROR_MSG = "DISCOUNT ERROR!! CANNOT PROCESS YOUR REQUEST!!!" + } + + if(ERROR_MSG == null) + { + $('applyDiscBtn').disabled = false; + } + else + { + $('applyDiscBtn').disabled = true; + } + + $('errorMsg').innerHTML = ERROR_MSG; +} + +function applyDiscount() +{ + var incPrice = $('incPrice').value; + var discPerc = $('disc').value; + var totalAmount = $('totalAmount').value; + + if(incPrice == null || incPrice == "") + { + showErrorMessage('Inc Price cannot be null!', 'incPrice'); + return ; + } + + if(discPerc == null || discPerc == "") + { + showErrorMessage('Discount % cannot be null!', 'disc'); + return ; + } + + if(totalAmount == null || totalAmount == "") + { + showErrorMessage('Total amount cannot be null!', 'totalAmount'); + return ; + } + + var form = $('QuickDiscountForm'); + form.request({ + onComplete: refreshQuickDiscount + }); + +} + +function refreshQuickDiscount(request) +{ + var response = request.responseText; + var result = eval('(' + response + ')'); + + if(result.error) + { + showErrorMessage(result.error, 'barcode'); + closeDiscount(); + } + + if(result.status == "OK") + { + reloadCart(); + closeDiscount(); + } +} + +function trim(stringToTrim) +{ + return stringToTrim.replace(/^\s+|\s+$/g,""); +} + + +function redirect(url) +{ + window.location = url; +} + +function popUp() +{ + var check = $('pop_overlay').style.display; + if(check == 'none' || check == '') + { + $('pop_overlay').style.display = 'block'; + $('pop_container').style.display = 'block'; + } + else + { + $('pop_overlay').style.display = 'none'; + $('pop_container').style.display = 'none'; + } + +} + +Event.observe(window,'load',initScreen,false); \ No newline at end of file diff --git a/posterita/posterita/web/js/paymentTerm.js b/posterita/posterita/web/js/paymentTerm.js new file mode 100644 index 0000000000..a2bb1426a7 --- /dev/null +++ b/posterita/posterita/web/js/paymentTerm.js @@ -0,0 +1,62 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +//scripts for payment term +var netDays = null; +var fixDate = null; +var fixDay = null; +var fixCutOff = null; +var fixOffset = null; + +function initPaymentScreen(){ + fixDate = $FElement('fixedDueDate'); + + netDays = $FElement('netDays'); + fixDay = $FElement('fixedMonthDay'); + fixCutOff = $FElement('fiedMonthCutoff'); + fixOffset = $FElement('fixedMonthOffset'); + + showHideDates(); + fixDate.onclick = showHideDates; + +} + +function showHideDates(){ + if(fixDate.checked){ + netDays.disabled = true; + fixDay.disabled = false; + fixCutOff.disabled = false; + fixOffset.disabled = false; + } + else{ + netDays.disabled = false; + fixDay.disabled = true; + fixCutOff.disabled = true; + fixOffset.disabled = true; + } +} + +//registering event +Event.observe(window,'load',initPaymentScreen,false); diff --git a/posterita/posterita/web/js/pin.js b/posterita/posterita/web/js/pin.js new file mode 100644 index 0000000000..659c28d8e6 --- /dev/null +++ b/posterita/posterita/web/js/pin.js @@ -0,0 +1,175 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +var PINPanel = $('PINPanel'); +var divBack = $('divBack'); +var PIN = $('PIN'); +var closeBtn = $('closeBtn'); + +function checkout() +{ + showPINPanel(); +} + +function focusBarcode() +{ + document.getElementsByName('barCode')[0].focus(); + //toConsole("Setting focus to barcode"); +} + +function initializeComponents() +{ + PINPanel.style.top = '' + (getViewportHeight()- 60)/2 ; + PINPanel.style.left = '' + (getViewportWidth() - 100)/2; + PINPanel.style.display = 'none'; + PINPanel.style.position = 'absolute'; + divBack.style.zIndex = '1000'; + + + //PIN.focus(); + + closeBtn.onblur = function(){ + try + { + PIN.focus(); + } + catch(e) + { + toConsole(e); + } + }; + + divBack.style.position = 'absolute'; + divBack.style.zIndex = '900'; + divBack.style.display = 'none'; + divBack.style.top = '0'; + divBack.style.left = '0'; + divBack.style.width = getViewportWidth(); + divBack.style.height = getViewportHeight(); + + PINPanel.onblur = function(){ + //PIN.focus(); + }; + + PIN.onkeyup = function(e) + { + try + { + var event = e||window.event; + + if(event.keyCode == 13) + { + validatePIN(); + } + } + catch (e) + { + toConsole(e); + } + }; + + toConsole('PIN Panel initialised'); +} + +function enablePIN() +{ + PIN.disabled = false; + closeBtn.style.visibility = 'visible'; +} + +function disablePIN() +{ + PIN.disabled = true; + closeBtn.style.visibility = 'hidden'; +} + +function reportError(request) +{ + alert('Some error occured while communicating with the server. Please try again.') +} + +function PINError(msg) +{ + alert(msg); + hidePINPanel(); + enablePIN(); + PIN.value=''; +} + +function showPINPanel() +{ + PINPanel.style.display = 'block'; + divBack.style.display = 'block'; + PIN.focus(); +} + +function hidePINPanel() +{ + PINPanel.style.display = 'none'; + divBack.style.display = 'none'; +} + +/* +function validatePIN() +{ + var pin = PIN.value; + var url = 'GetPOSPaymentDetailsAction.do'; + var pars = 'action=validateAdvanceOrderPIN&userPIN=' + pin; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: evaluateResponse, + onFailure: reportError + }); + + disablePIN(); +} +*/ + +function evaluateResponse(request) +{ + var scripts = request.responseText; + eval(scripts); +} + + +function getViewportHeight() { + if (window.innerHeight!=window.undefined) return window.innerHeight; + if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight; + if (document.body) return document.body.clientHeight; + return window.undefined; +} + +function getViewportWidth() { + if (window.innerWidth!=window.undefined) return window.innerWidth; + if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; + if (document.body) return document.body.clientWidth; + return window.undefined; +} + +//initialising +Event.observe(window,'load',initializeComponents,false); \ No newline at end of file diff --git a/posterita/posterita/web/js/pos.js b/posterita/posterita/web/js/pos.js new file mode 100644 index 0000000000..e4b645f5a3 --- /dev/null +++ b/posterita/posterita/web/js/pos.js @@ -0,0 +1,644 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +var MAXIMUM_WAITING_TIME = 10000; +//var TROTTLE_PERIOD = 1000; +var TROTTLE_TIME = 0.5; +var ENABLE_LOGGING = true; +var ENABLE_VIRTUAL_KEYBOARD = true; + + +//The maps stores key-action mappings +var keyMap = new Array(); + +function addKey(key,action) +{ + keyMap[key] = action; +} + +function getAction(key) +{ + if(keyMap[key]) + { + eval(keyMap[key]); + + return false; + } + + return true; +} + +//capture shortcut keys +function captureKey(e) +{ + var evtobj=window.event? event : e; //distinguish between IE's explicit event object (window.event) and Firefox's implicit. + var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode; + + var msg = ""; + + if(evtobj['ctrlKey']) + msg = msg + "CTRL-"; + + if(evtobj['altKey']) + msg = msg + "ALT-"; + + if(evtobj['shiftKey']) + msg = msg + "SHIFT "; + + + var key = unicode; + + key = String.fromCharCode(unicode); + msg = msg + key; + msg = msg.toUpperCase(); + + //perform the action associated with that key + return getAction(msg); + +} + +function hideResult() +{ + displayResult(""); +} + +function printDocument() +{ + var w = window.open("","POS Order","width=800"); + var d = w.document; + + var printDiv = document.getElementById("printDiv"); + + d.write(""); + d.write(" "); + d.write(""); + d.write(printDiv.innerHTML); + d.write(""); + d.close(); +} + +function enableDelete() +{ + var btn = document.getElementsByName("deleteBtn"); + + btn[0].disabled = enableButton(); +} + +function enableButton() +{ + /* + var chk = document.getElementsByName("posOrderLineIds"); + for(i=0;i "+msg); + + //console.appendChild(text); + //document.body.appendChild(console); + } + catch(e) + { + alert(e); + } + +} + +function $focus(element) +{ + var el = document.getElementsByName(element); + + if(el) + { + el[0].focus(); + toConsole('Setting focus to :' + element); + } + else + { + toConsole('Unable to set focus to :' + element); + } + +} + +function $FElement(element) +{ + var el = document.getElementsByName(element)[0]; + return el; + +} + +function focusBarcode() +{ + $FElement('barCode').focus(); + toConsole("Setting focus to barcode"); +} + +function openCashDrawer() +{ + var url = 'CompletePOSOrderAction.do'; + var param = 'action=openCashDrawer'; + + var success = function(request){alert('Opening drawer!');}; + var failure = function(request){alert('Oop some problem occured while communicating with server!');}; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: param, + onSuccess: success, + onFailure: failure + }); +} + +function fullScreen(theURL) +{ + window.open(theURL, '', 'fullscreen=yes, scrollbars=auto'); +} + +function disableButtons() +{ + try + { + var elements = document.getElementsByTagName('input'); + + for(var i = 0; i < elements.length; i++) + { + if(elements[i].name != 'action') + { + elements[i].disabled = true; + elements[i].style.cursor = 'wait'; + } + } + + toConsole('Disable ' + elements.length + ' buttons'); + + return true; + + } + catch(e) + { + toConsole(e); + } +} + + +function initDisableButtons() +{ + toConsole('initDisableButtons'); + + var elements = document.getElementsByTagName('input'); + + for(var i = 0; i < elements.length; i++) + { + var type = elements[i].type; + + if(type == 'button') + { + var button = elements[i]; + var accessKey = button.accessKey; + + if(accessKey == 'c') + { + //button.onclick = disableButtons; + var action = button.onclick; + button.onclick = function(e){ + + }; + + toConsole('Found 1 button with accesskey: C'); + } + } + } +} + +function setNumericInputMask(e) +{ + var evtobj = window.event? event : e; //distinguish between IE's explicit event object (window.event) and Firefox's implicit. + var unicode = evtobj.charCode? evtobj.charCode : evtobj.keyCode; + + var validKeys = [8,9,13,20,27,37,38,39,40,45,46,48,49,50,51,52,53,54,55,56,57]; + + for(var i = 0; i < validKeys.length; i++) + { + if(validKeys[i] == unicode) + { + return true; + } + } + + alert('Accepts numeric values only'); + return false; + +} + +function showDocumentPDF(id) +{ + window.open('ViewDocumentPDFAction.do?action=viewOrderDocumentPDF&documentId=' + id, '_blank', 'width=800, height=600, status=no, toolbar=no, location=no, resizable=yes'); +} + +function showInventoryPDF(id) +{ + window.open('ViewInventoryPDFAction.do?action=viewInventoryDocumentPDF&inventoryId=' + id, '_blank', 'width=800, height=600, status=no, toolbar=no, location=no, resizable=yes'); +} + +function showInvoiceDocumentPDF(id) +{ + window.open('ViewDocumentPDFAction.do?action=viewInvoiceDocumentPDF&documentId=' + id, '_blank', 'width=800, height=600, status=no, toolbar=no, location=no, resizable=yes'); +} + +function showShipmentDocumentPDF(id) +{ + window.open('ViewDocumentPDFAction.do?action=viewShipmentDocumentPDF&documentId=' + id, '_blank', 'width=800, height=600, status=no, toolbar=no, location=no, resizable=yes'); +} + +function showPaymentDocumentPDF(id) +{ + window.open('ViewDocumentPDFAction.do?action=viewPaymentDocumentPDF&documentId=' + id, '_blank', 'width=800, height=600, status=no, toolbar=no, location=no, resizable=yes'); +} + + + +function enableVirtualKeyboard() +{ + if(!ENABLE_VIRTUAL_KEYBOARD) + { + return; + } + + var textfields = document.getElementsByTagName('input'); + + for(var i=0; i= 0) + { + cashInput.value = newValue; + cardInput.previousAmount = newValue; + + } + else + { + var max = cashInput.initialAmount - chequeInput.value; + alert('Card Amount should not exceed ' + max); + + cardInput.value = 0.0; + + newValue = new Number(cashInput.initialAmount - cardInput.value - chequeInput.value).toFixed(2); + cashInput.value = newValue; + } + } + catch(e) + { + toConsole(e); + } + + } + + chequeInput.onkeyup = function() + { + try + { + var newValue = new Number(cashInput.initialAmount - cardInput.value - chequeInput.value).toFixed(2); + + if(newValue >= 0) + { + cashInput.value = newValue; + chequeInput.previousAmount = newValue; + + } + else + { + var max = cashInput.initialAmount - cardInput.value; + alert('Cheque Amount should not exceed ' + max); + + chequeInput.value = 0.0; + + newValue = new Number(cashInput.initialAmount - cardInput.value - chequeInput.value).toFixed(2); + cashInput.value = newValue; + } + } + catch(e) + { + toConsole(e); + } + } + + return false; +} + +function showCheque() +{ + show("chequeNoLabel");show("chequeNoTxt"); + + hide("cashLabel");hide("cashTxt"); + hide("cardLabel");hide("cardTxt"); + hide("cardNoLabel");hide("cardNoTxt"); + hide("chequeLabel");hide("chequeTxt"); + + setTrxType("Cheque"); + + var chequeTf = document.getElementsByName('chequeNo')[0]; + + chequeTf.focus(); + + return false; +} + +function showCard() +{ + show("cardNoLabel");show("cardNoTxt"); + + hide("cashLabel");hide("cashTxt"); + hide("cardLabel");hide("cardTxt"); + hide("chequeLabel");hide("chequeTxt"); + hide("chequeNoLabel");hide("chequeNoTxt"); + + setTrxType("Card"); + + var cardTf = document.getElementsByName('creditCardNumber')[0]; + + cardTf.focus(); + + return false; +} + +function showCash() +{ + hide('cashLabel');hide('cashTxt'); + hide('cardLabel');hide('cardTxt'); + hide('cardNoLabel');hide('cardNoTxt'); + hide('chequeLabel');hide('chequeTxt'); + hide('chequeNoLabel');hide('chequeNoTxt'); + + setTrxType("Cash"); + + return false; +} + +function setTrxType(type) +{ + document.forms[0].trxType.value = type; +} + + + +//adding behaviour to discount&actual price textfields +var price = document.getElementsByName('price'); +var discount = document.getElementsByName('discountPercent'); +var actualPrice = document.getElementsByName('actualPrice'); + +/* +var totalDiscount = $('totalDiscount'); +var totalPrice = $('totalPrice'); + +totalPrice.initialAmount = 0; +for(var i=0;i discountAllowed) + { + var errormsg = 'You are authorised to give ' + discountAllowed + '% discount only!'; + + this.className = 'text medium error'; + this.title = errormsg; + + totalDiscount.className = 'text medium error'; + totalDiscount.title = errormsg; + + //alert(errormsg); + } + else + { + var className = 'text medium'; + + + this.className = className; + this.title = ''; + + totalDiscount.className = className; + totalDiscount.title = ''; + } +}; + +totalDiscount.onkeyup = function() +{ + var newprice = ((100-this.value)*totalPrice.initialAmount)/100; + newprice = new Number(newprice).toFixed(2); //rounding calculate price + totalPrice.value = newprice; + + if(this.value > discountAllowed) + { + var errormsg = 'You are authorised to give ' + discountAllowed + '% discount only!'; + + this.className = 'text medium error'; + this.title = errormsg; + + totalPrice.className = 'text medium error'; + totalPrice.title = errormsg; + + //alert(errormsg); + } + else + { + var className = 'text medium'; + + this.className = className; + this.title = ''; + + totalPrice.className = className; + totalPrice.title = ''; + } +}; +*/ + +for(var i=0;i discountAllowed) + { + var errormsg = 'You are authorised to give ' + discountAllowed + '% discount only!'; + + this.className = 'text medium error'; + this.title = errormsg; + + actualPrice[index].className = 'text medium error'; + actualPrice[index].title = errormsg; + + //alert(errormsg); + } + else if(this.value < 0) + { + var errormsg = 'Discount cannot be negative!'; + + this.className = 'text medium error'; + this.title = errormsg; + + actualPrice[index].className = 'text medium error'; + actualPrice[index].title = errormsg; + + //alert(errormsg); + } + else + { + var className = 'text medium'; + + this.className = className; + this.title = ''; + + actualPrice[index].className = className; + actualPrice[index].title = ''; + } + + } + + element = actualPrice[i]; + element.position = i; //adding attribute position + + element.onkeypress = setNumericInputMask; + element.onkeyup = function(e) + { + var index = this.position; + + var calculateDiscount = 100-((this.value*100)/price[index].value); + calculateDiscount = new Number(calculateDiscount).toFixed(2); //rounding calculate discount + + discount[index].value = calculateDiscount; + updateTotal(); + + if(calculateDiscount > discountAllowed) + { + var errormsg = 'You are authorised to give ' + discountAllowed + '% discount only!'; + + this.className = 'text medium error'; + this.title = errormsg; + + discount[index].className = 'text medium error'; + discount[index].title = errormsg; + + //alert(errormsg); + } + else if(calculateDiscount < 0) + { + var errormsg = 'Discount cannot be negative!'; + + this.className = 'text medium error'; + this.title = errormsg; + + discount[index].className = 'text medium error'; + discount[index].title = errormsg; + + //alert(errormsg); + } + else + { + var className = 'text medium'; + + + this.className = className; + this.title = ''; + + discount[index].className = className; + discount[index].title = ''; + } + } + +} + +function updateTotal() +{ + init(); + + var cardInput = document.getElementsByName('paymentByCard')[0].value=""; + var chequeInput = document.getElementsByName('paymentByChq')[0].value=""; +} + +function init() +{ + var total = 0; + + for(var i=0;i discountAllowed) + { + actualPrice[i].className = 'error medium'; + actualPrice[i].title = errormsg; + + discount[i].className = 'error medium'; + discount[i].title = errormsg; + } + else if(discount[i].value < 0) + { + actualPrice[i].className = 'error medium'; + actualPrice[i].title = errormsg2; + + discount[i].className = 'error medium'; + discount[i].title = errormsg2; + } + else + { + actualPrice[i].className = 'text medium'; + actualPrice[i].title = ""; + + discount[i].className = 'text medium'; + discount[i].title = ""; + } + } + + if(discountTotal.value > discountAllowed) + { + grandTotal.className = 'error medium'; + grandTotal.title = errormsg; + + discountTotal.className = 'error medium'; + discountTotal.title = errormsg; + } + else if(discountTotal.value < 0) + { + grandTotal.className = 'error medium'; + grandTotal.title = errormsg2; + + discountTotal.className = 'error medium'; + discountTotal.title = errormsg2; + } + else + { + grandTotal.className = 'text medium'; + grandTotal.title = ""; + + discountTotal.className = 'text medium'; + discountTotal.title = ""; + } + + +} + + +var discountTotal = null; +var grandTotal = null; +var priceTotal = null; + +var discountAllowed = ; +var errorCount = 0; + + + + + diff --git a/posterita/posterita/web/js/product.js b/posterita/posterita/web/js/product.js new file mode 100644 index 0000000000..f12752d2de --- /dev/null +++ b/posterita/posterita/web/js/product.js @@ -0,0 +1,316 @@ +//autocomplete for revenue recognition +copyValueInto('revenueRecognition','revenue_recognition'); +new Ajax.Autocompleter('revenue_recognition','revenue_recognitionDiv','SearchPOSGarmentAttributes.do',{ + paramName:'revenue_recognition', + frequency:TROTTLE_TIME, + afterUpdateElement:function(e1,e2){ + $('revenue_recognition').value = e1.value; + } + }); + + +function $FF(elementName) +{ + return document.getElementsByName(elementName)[0]; +} + +function copyValueInto(e1,e2) +{ + toConsole("Copying " + e1 + " into " + e2); + + try + { + $FF(e2).value = $FF(e1).value; + } + catch(e) + { + toConsole("Copying failed!"); + toConsole(e); + } + + +} + +function setValues(form) +{ + try + { + toConsole('Going to submit form'); + copyValueInto('revenue_recognition','revenueRecognition'); + + form.submit(); + } + catch(e) + { + toConsole("Submit failed!"); + toConsole(e); + + toConsole(form); + } +} + +//------------------------------------------------------ +// Validation of barcode & product name using AJAX +//------------------------------------------------------ +function validateBarcode() +{ + if($FF('barCode').initialValue == $FF('barCode').value) return; + + var barcode = $FF('barCode').value; + + var url = 'ValidatePOSProductAction.do'; + var pars = 'action=validateProductBarcode&barCode=' + barcode; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: doesBarcodeExists, + onFailure: reportError + }); +} + +function validateProductName() +{ + if($FF('productName').initialValue == $FF('productName').value) return; + + var productName = $FF('productName').value; + var url = 'ValidatePOSProductAction.do'; + var pars = 'action=validateProductName&productName=' + productName; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: doesProductExists, + onFailure: reportError + }); +} + +function doesBarcodeExists(request) +{ + try + { + var response = request.responseText; + + if(response == 'true') + { + Element.show('barcodeError'); + $FF('barCode').className = 'error'; + } + else + { + Element.hide('barcodeError'); + $FF('barCode').className = 'text'; + } + + } + catch(e) + { + toConsole(e); + } +} + +function doesProductExists(request) +{ + try + { + var response = request.responseText; + + if(response == 'true') + { + Element.show('productError'); + $FF('productName').className = 'error'; + } + else + { + Element.hide('productError'); + $FF('productName').className = 'text'; + } + + } + catch(e) + { + toConsole(e); + } +} + +function reportError(request) +{ + alert('Some error occured while communicating with the server. Please try again.'); +} + +//------------------------------------------------------ +var barcode = $FF('barCode'); +var productName = $FF('productName'); +var taxCategory = $FF('taxCategoryId'); + +var purchasePriceStandard = $FF('purchasePriceStandard'); +var salesPriceStandard = $FF('salesPriceStandard'); +var salesPriceList = $FF('salesPriceList'); +var salesPriceLimit = $FF('salesPriceLimit'); + +var purchasePriceStandardTax = $FF('purchasePriceStandardTax'); +var salesPriceStandardTax = $FF('salesPriceStandardTax'); +var salesPriceListTax = $FF('salesPriceListTax'); +var salesPriceLimitTax = $FF('salesPriceLimitTax'); + +/** + * Calculates price including tax + * @param price without tax + * @return price with tax + */ +function getPriceIncludingTax(price) +{ + var tax = getTax(); + var priceWithoutTax = price || 0; + var priceWithTax = ((100+tax)/100)*priceWithoutTax; + + priceWithTax = new Number(priceWithTax).toFixed(2); + + return priceWithTax; + +}//getPriceIncludingTax(price) + +/** + * Calculates price excluding tax + * @param price with tax + * @return price without tax + */ +function getPriceExcludingTax(price) +{ + var tax = getTax(); + var priceWithTax = price || 0; + var priceWithoutTax = (100*priceWithTax)/(100+tax); + + priceWithoutTax = new Number(priceWithoutTax).toFixed(2); + + return priceWithoutTax; + +}//getPriceExcludingTax(price) + +/** + * Gets the current tax + */ +function getTax() +{ + var select = taxCategory; + var index = select.selectedIndex; + + if(index == -1) index = 0; + + var option = select.options[select.selectedIndex]; + var v = option.label || option.text; + + var s = v.split('%'); + + if(s.length < 2) return 0; + + var tax = parseFloat(s[1]); + + return tax; + +}//getTax() + +/* +function setPriceIncludingTax() +{ + purchasePriceStandardTax.value = getPriceIncludingTax(purchasePriceStandard.value); + salesPriceLimitTax.value = getPriceIncludingTax(salesPriceLimit.value); + salesPriceListTax.value = getPriceIncludingTax(salesPriceList.value); + salesPriceStandardTax.value = getPriceIncludingTax(salesPriceStandard.value); + +}//setPriceIncludingTax() + +//-------------------------------------------------------------------------- +// Initialising components & adding behaviour +//-------------------------------------------------------------------------- + +//update all prices +taxCategory.onchange = setPriceIncludingTax; + + +purchasePriceStandard.onkeyup = function(e){ + purchasePriceStandardTax.value = getPriceIncludingTax(this.value); +}; +purchasePriceStandardTax.onkeyup = function(e){ + purchasePriceStandard.value = getPriceExcludingTax(this.value); +}; + +salesPriceLimit.onkeyup = function(e){ + salesPriceLimitTax.value = getPriceIncludingTax(this.value); +}; +salesPriceLimitTax.onkeyup = function(e){ + salesPriceLimit.value = getPriceExcludingTax(this.value); +}; + +salesPriceStandard.onkeyup = function(e){ + salesPriceStandardTax.value = getPriceIncludingTax(this.value); +}; +salesPriceStandardTax.onkeyup = function(e){ + salesPriceStandard.value = getPriceExcludingTax(this.value); +}; + +salesPriceList.onkeyup = function(e){ + salesPriceListTax.value = getPriceIncludingTax(this.value); + + //overwrite the other prices + salesPriceLimit.value = this.value; + salesPriceStandard.value = this.value; + salesPriceLimitTax.value = getPriceIncludingTax(this.value); + salesPriceStandardTax.value = getPriceIncludingTax(this.value); +}; + +salesPriceListTax.onkeyup = function(e){ + salesPriceList.value = getPriceExcludingTax(this.value) ; +}; + +barcode.onblur = validateBarcode; +barcode.initialValue = barcode.value; +barcode.onkeyup = function(e) +{ + try + { + if(this.initialValue == this.value) return; + + var event = e || window.event; + + if(event.keyCode == 13) + { + toConsole('validating barcode'); + validateBarcode(); + } + } + catch (e) + { + toConsole(e); + } +}; + +productName.onblur = validateProductName; +productName.initialValue = productName.value; +productName.onkeyup = function(e) +{ + try + { + if(this.initialValue == this.value) return; + + var event = e || window.event; + + if(event.keyCode == 13) + { + toConsole('validating product name'); + validateProductName(); + } + } + catch (e) + { + toConsole(e); + } +}; + +$('barcodeError').style.display = 'none'; +$('productError').style.display = 'none'; + +setPriceIncludingTax(); +*/ \ No newline at end of file diff --git a/posterita/posterita/web/js/product2.js b/posterita/posterita/web/js/product2.js new file mode 100644 index 0000000000..5eeff0b148 --- /dev/null +++ b/posterita/posterita/web/js/product2.js @@ -0,0 +1,147 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +//------------------------------------------------------ +var taxCategory = $FF('taxCategoryId'); + +var purchasePriceStandard = $FF('purchasePriceStandard'); +var salesPriceStandard = $FF('salesPriceStandard'); +var salesPriceList = $FF('salesPriceList'); +var salesPriceLimit = $FF('salesPriceLimit'); + +var purchasePriceStandardTax = $FF('purchasePriceStandardTax'); +var salesPriceStandardTax = $FF('salesPriceStandardTax'); +var salesPriceListTax = $FF('salesPriceListTax'); +var salesPriceLimitTax = $FF('salesPriceLimitTax'); + +/** + * Calculates price including tax + * @param price without tax + * @return price with tax + */ +function getPriceIncludingTax(price) +{ + var tax = getTax(); + var priceWithoutTax = price || 0; + var priceWithTax = ((100+tax)/100)*priceWithoutTax; + + priceWithTax = new Number(priceWithTax).toFixed(2); + + return priceWithTax; + +}//getPriceIncludingTax(price) + +/** + * Calculates price excluding tax + * @param price with tax + * @return price without tax + */ +function getPriceExcludingTax(price) +{ + var tax = getTax(); + var priceWithTax = price || 0; + var priceWithoutTax = (100*priceWithTax)/(100+tax); + + priceWithoutTax = new Number(priceWithoutTax).toFixed(2); + + return priceWithoutTax; + +}//getPriceExcludingTax(price) + +/** + * Gets the current tax + */ +function getTax() +{ + var select = taxCategory; + var index = select.selectedIndex; + + if(index == -1) index = 0; + + var option = select.options[select.selectedIndex]; + var v = option.label || option.text; + + var s = v.split('%'); + + if(s.length < 2) return 0; + + var tax = parseFloat(s[1]); + + return tax; + +}//getTax() + +function setPriceIncludingTax() +{ + purchasePriceStandardTax.value = getPriceIncludingTax(purchasePriceStandard.value); + salesPriceLimitTax.value = getPriceIncludingTax(salesPriceLimit.value); + salesPriceListTax.value = getPriceIncludingTax(salesPriceList.value); + salesPriceStandardTax.value = getPriceIncludingTax(salesPriceStandard.value); + +}//setPriceIncludingTax() + +//-------------------------------------------------------------------------- +// Initialising components & adding behaviour +//-------------------------------------------------------------------------- + +//update all prices +taxCategory.onchange = setPriceIncludingTax; + +purchasePriceStandard.onkeyup = function(e){ + purchasePriceStandardTax.value = getPriceIncludingTax(this.value); +}; +purchasePriceStandardTax.onkeyup = function(e){ + purchasePriceStandard.value = getPriceExcludingTax(this.value); +}; + +salesPriceLimit.onkeyup = function(e){ + salesPriceLimitTax.value = getPriceIncludingTax(this.value); +}; +salesPriceLimitTax.onkeyup = function(e){ + salesPriceLimit.value = getPriceExcludingTax(this.value); +}; + +salesPriceStandard.onkeyup = function(e){ + salesPriceStandardTax.value = getPriceIncludingTax(this.value); +}; +salesPriceStandardTax.onkeyup = function(e){ + salesPriceStandard.value = getPriceExcludingTax(this.value); +}; + +salesPriceList.onkeyup = function(e){ + salesPriceListTax.value = getPriceIncludingTax(this.value); + + //overwrite the other prices + salesPriceLimit.value = this.value; + salesPriceStandard.value = this.value; + salesPriceLimitTax.value = getPriceIncludingTax(this.value); + salesPriceStandardTax.value = getPriceIncludingTax(this.value); +}; + +salesPriceListTax.onkeyup = function(e){ + salesPriceList.value = getPriceExcludingTax(this.value) ; +}; + +setPriceIncludingTax(); \ No newline at end of file diff --git a/posterita/posterita/web/js/productTax.js b/posterita/posterita/web/js/productTax.js new file mode 100644 index 0000000000..7f1c4a90a3 --- /dev/null +++ b/posterita/posterita/web/js/productTax.js @@ -0,0 +1,131 @@ +// script for calculating excl and incl prices for Posterita products + +var taxRateFactor = 1.0; + +var updateTax = function(e) +{ + var taxCategoryId = document.forms[0].taxCategoryId.value; + var url = "TaxAction.do"; + var pars = "action=getTaxRate&taxCategoryId="+ taxCategoryId; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: setTaxRate, + onFailure: reportError + }); +}; + +var setTaxRate = function(request) +{ + try + { + var response = request.responseText; + var taxRate = parseFloat(response); + taxRateFactor = new Number((taxRate/100)+1).toFixed(2); + loadPriceListBehaviour(); + } + catch(e) + {} +}; + +function reportError(request) +{ + alert("Some error has occured while communicating with the server"); +} + +var loadPriceListBehaviour = function(){ + + var rows = new Array(); + var count = 1; + + while(true) + { + var row = $('row' + count); + if(row == null) break; + + rows.push(row); + count ++; + } + + for(var i=0; i 2 && inputs.length <= 6) + { + listPrice = inputs[2]; + listPriceIncl = inputs[3]; + limitPrice = inputs[4]; + limitPriceIncl = inputs[5]; + + listPrice.tr = tr; + listPriceIncl.tr = tr; + limitPrice.tr = tr; + limitPriceIncl.tr = tr; + + tr.listPrice = listPrice; + tr.listPriceIncl = listPriceIncl; + tr.limitPrice = limitPrice; + tr.limitPriceIncl = limitPriceIncl; + + tr.listPriceIncl.value = calculatePrice(listPrice.value, false); + tr.limitPriceIncl.value = calculatePrice(limitPrice.value, false); + + listPrice.onkeyup = function(){ + this.tr.listPriceIncl.value = calculatePrice(this.value, false); + }; + + listPriceIncl.onkeyup = function(){ + this.tr.listPrice.value = calculatePrice(this.value, true); + }; + + limitPrice.onkeyup = function(){ + this.tr.limitPriceIncl.value = calculatePrice(this.value, false); + }; + + limitPriceIncl.onkeyup = function(){ + this.tr.limitPrice.value = calculatePrice(this.value, true); + }; + } + } +}; + +var calculatePrice = function(value, isTaxIncluded) +{ + if (isTaxIncluded) + { + return new Number(value / taxRateFactor).toFixed(2); + } + else + { + return new Number(value * taxRateFactor).toFixed(2); + } +}; + +Event.observe(window, 'load', updateTax, false); \ No newline at end of file diff --git a/posterita/posterita/web/js/shoppingCart.js b/posterita/posterita/web/js/shoppingCart.js new file mode 100644 index 0000000000..c0bdac0b9f --- /dev/null +++ b/posterita/posterita/web/js/shoppingCart.js @@ -0,0 +1,505 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + +//----------------------------------FUNCTION DECLARATIONS--------------------------------------------- +//scrolls to the bottom of the cart +function scrollDownCart() +{ + if($('shoppingCart')) + { + $('shoppingCart').scrollTop = $('shoppingCart').scrollHeight; + } +} + + +//adding product to cart +function addToCart(barcode) +{ + cartIndex = null; + done = false; + if(barcode == null) return; + if(barcode == '') return; + + try + { + + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=addProduct&barCode='+barcode+ '&orderType=' + orderType + '&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + + } + catch(e) + { + toConsole(e); + } +} + +//incrementing, decrementing and deleting the shopping cart items using ajax +// 1.Increment the qty for the product +function incrementCart(productId) +{ + if(productId == null) return; + + try + { + + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=incrementQty&productId='+productId+ '&ifAdd=true'+ '&orderType=' + orderType + '&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + +//2.Decrement the qty for the product +function decrementCart(productId) +{ + if(productId == null) return; + + try + { + + + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=decrementQty&productId='+productId+ '&ifAdd=false'+ '&orderType=' + orderType + '&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } +} + +//3.Delete all the products with the ID from the cart +function deleteItemFromCart(productId) +{ + if(productId == null) return; + + cartIndex = null; + updateQty(productId, '0'); +} + +//Refreshs the content of the shopping cart +function refreshShoppingCart(request) +{ + try + { + //var top = $('items').scrollTop; + var response = request.responseText; + $('shoppingCart').innerHTML = response; + $('total').innerHTML = $('cartTotal').innerHTML; + closeDiscount(); + scrollDownCart(); + response.evalScripts(); //display error messages + } + catch(e) + { + showErrorMessage('Failed to resfresh cart! Cause:' + e); + } + + addBehaviourToCart(); +} + +//Reports an error +function reportShoppingCartError(request) +{ + alert('Some error occured while communicating with the server. Please try again.'); + alert(request.responseText); + var win = window.open(); + win.document.write(request.responseText); + win.document.close(); +} + +//addRequiredLibrary('js/test.js'); +var requestIndicator; + +/* +var ShoppingCart = { + + init : function(){ + //this.indicator = new AJAXIndicator('Please wait...'); + alert('Shopping Cart'); + }, + + indicator : null +}; +*/ + +function checkout() +{ + //do normal submit + $('checkoutForm').submit(); +/* + var pars = Form.serialize('checkoutForm'); + var url = 'CheckoutAction.do'; + + try + { + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: handleCheckout, + onFailure: reportShoppingCartError + }); + } + catch(e) + { + toConsole(e); + } +*/ +} + +//Update the qty for the product +function updateQty(productId, quantity) +{ + if(productId == null) return; + + if (quantity == "") + { + return; + } + + if(quantity < 0) + { + showErrorMessage('Quantity cannot be negative!', 'qty'); + $('qty').value = ""; + return; + } + + var amount = parseFloat(quantity); + + if (isNaN(amount)) + { + showErrorMessage('Invalid quantity! ' + quantity, 'qty'); + $('qty').value = ""; + return; + } + + try + { + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=updateQty&productId=' + productId + '&ifAdd=false'+ '&orderType=' + orderType + '&priceListId='+priceList +'&quantity=' + quantity; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + +//Reload shopping cart +function reloadCart() +{ + try + { + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=reloadCart&orderType=posOrder'; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + + +function clearCart() +{ + maxRows = 0; + excessRows = 0; + resetDetails(); + + try + { + var url = 'CheckoutAction.do'; + var pars = 'action=clearCart' + '&orderType=' + orderType; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + } + catch(e) + { + toConsole(e); + } + +} + +function handleCheckout(request) +{ + var response = request.responseText; + var result = eval('(' + response + ')'); + + if(result.error) + { + showErrorMessage(result.error); + } + else + { + printOrder(result.orderID); + reloadCart(); + } +} + + +function addBehaviourToCart() +{ + var rows = new Array(); + var count = 1; + var grandTotal = 0; + var totalPriceLimit = 0; + var totalPriceList = 0; + + while(true) + { + var row = $('row' + count); + if(row == null) break; + + rows.push(row); + count ++; + } + + for(var i=0; i 0) + { + var line = cartLines[cartIndex]; + simulateOnClick(line); + + } + + if(cartLines.length > maxRows) + { + var shoppingCart = $('shoppingCart'); + shoppingCart.scrollTop = shoppingCart.scrollHeight; + } + +} + +//Reload the shopping cart. Prices are calculated for the pricelist +function setShoppingCartPriceList() +{ + try + { + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=updatePriceList&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } +} + +function scrollCart() +{ + var shoppingCart = $('shoppingCart'); + + if(cartIndex > maxRows) + { + shoppingCart.scrollTop = shoppingCart.scrollHeight; + } + else + { + shoppingCart.scrollTop = 0; + } +} + + +//Event.observe(window,'load',init,false); +//--------------------------------------------------------------------------------------- +//calling methods \ No newline at end of file diff --git a/posterita/posterita/web/js/shortcut.js b/posterita/posterita/web/js/shortcut.js new file mode 100644 index 0000000000..460a17b96b --- /dev/null +++ b/posterita/posterita/web/js/shortcut.js @@ -0,0 +1,223 @@ +/** + * http://www.openjs.com/scripts/events/keyboard_shortcuts/ + * Version : 2.01.A + * By Binny V A + * License : BSD + */ +shortcut = { + 'all_shortcuts':{},//All the shortcuts are stored in this array + 'add': function(shortcut_combination,callback,opt) { + //Provide a set of default options + var default_options = { + 'type':'keydown', + 'propagate':false, + 'disable_in_input':false, + 'target':document, + 'keycode':false + } + if(!opt) opt = default_options; + else { + for(var dfo in default_options) { + if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo]; + } + } + + var ele = opt.target + if(typeof opt.target == 'string') ele = document.getElementById(opt.target); + var ths = this; + shortcut_combination = shortcut_combination.toLowerCase(); + + //The function to be called at keypress + var func = function(e) { + e = e || window.event; + + if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields + var element; + if(e.target) element=e.target; + else if(e.srcElement) element=e.srcElement; + if(element.nodeType==3) element=element.parentNode; + + if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return; + } + + //Find Which key is pressed + if (e.keyCode) code = e.keyCode; + else if (e.which) code = e.which; + var character = String.fromCharCode(code).toLowerCase(); + + if(code == 188) character=","; //If the user presses , when the type is onkeydown + if(code == 190) character="."; //If the user presses , when the type is onkeydown + + var keys = shortcut_combination.split("+"); + //Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked + var kp = 0; + + //Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken + var shift_nums = { + "`":"~", + "1":"!", + "2":"@", + "3":"#", + "4":"$", + "5":"%", + "6":"^", + "7":"&", + "8":"*", + "9":"(", + "0":")", + "-":"_", + "=":"+", + ";":":", + "'":"\"", + ",":"<", + ".":">", + "/":"?", + "\\":"|" + } + //Special Keys - and their codes + var special_keys = { + 'esc':27, + 'escape':27, + 'tab':9, + 'space':32, + 'return':13, + 'enter':13, + 'backspace':8, + + 'scrolllock':145, + 'scroll_lock':145, + 'scroll':145, + 'capslock':20, + 'caps_lock':20, + 'caps':20, + 'numlock':144, + 'num_lock':144, + 'num':144, + + 'pause':19, + 'break':19, + + 'insert':45, + 'home':36, + 'delete':46, + 'end':35, + + 'pageup':33, + 'page_up':33, + 'pu':33, + + 'pagedown':34, + 'page_down':34, + 'pd':34, + + 'left':37, + 'up':38, + 'right':39, + 'down':40, + + 'f1':112, + 'f2':113, + 'f3':114, + 'f4':115, + 'f5':116, + 'f6':117, + 'f7':118, + 'f8':119, + 'f9':120, + 'f10':121, + 'f11':122, + 'f12':123 + } + + var modifiers = { + shift: { wanted:false, pressed:false}, + ctrl : { wanted:false, pressed:false}, + alt : { wanted:false, pressed:false}, + meta : { wanted:false, pressed:false} //Meta is Mac specific + }; + + if(e.ctrlKey) modifiers.ctrl.pressed = true; + if(e.shiftKey) modifiers.shift.pressed = true; + if(e.altKey) modifiers.alt.pressed = true; + if(e.metaKey) modifiers.meta.pressed = true; + + for(var i=0; k=keys[i],i 1) { //If it is a special key + if(special_keys[k] == code) kp++; + + } else if(opt['keycode']) { + if(opt['keycode'] == code) kp++; + + } else { //The special keys did not match + if(character == k) kp++; + else { + if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase + character = shift_nums[character]; + if(character == k) kp++; + } + } + } + } + + if(kp == keys.length && + modifiers.ctrl.pressed == modifiers.ctrl.wanted && + modifiers.shift.pressed == modifiers.shift.wanted && + modifiers.alt.pressed == modifiers.alt.wanted && + modifiers.meta.pressed == modifiers.meta.wanted) { + callback(e); + + if(!opt['propagate']) { //Stop the event + //e.cancelBubble is supported by IE - this will kill the bubbling process. + e.cancelBubble = true; + e.returnValue = false; + + //e.stopPropagation works in Firefox. + if (e.stopPropagation) { + e.stopPropagation(); + e.preventDefault(); + } + return false; + } + } + } + this.all_shortcuts[shortcut_combination] = { + 'callback':func, + 'target':ele, + 'event': opt['type'] + }; + //Attach the function with the event + if(ele.addEventListener) ele.addEventListener(opt['type'], func, false); + else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func); + else ele['on'+opt['type']] = func; + }, + + //Remove the shortcut - just specify the shortcut and I will remove the binding + 'remove':function(shortcut_combination) { + shortcut_combination = shortcut_combination.toLowerCase(); + var binding = this.all_shortcuts[shortcut_combination]; + delete(this.all_shortcuts[shortcut_combination]) + if(!binding) return; + var type = binding['event']; + var ele = binding['target']; + var callback = binding['callback']; + + if(ele.detachEvent) ele.detachEvent('on'+type, callback); + else if(ele.removeEventListener) ele.removeEventListener(type, callback, false); + else ele['on'+type] = false; + } +} \ No newline at end of file diff --git a/posterita/posterita/web/js/stockCart.js b/posterita/posterita/web/js/stockCart.js new file mode 100644 index 0000000000..8a5481fc49 --- /dev/null +++ b/posterita/posterita/web/js/stockCart.js @@ -0,0 +1,518 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author shameem + */ + +//----------------------------------FUNCTION DECLARATIONS--------------------------------------------- +//scrolls to the bottom of the cart +function scrollDownCart() +{ + if($('shoppingCart')) + { + $('shoppingCart').scrollTop = $('shoppingCart').scrollHeight; + } +} + + +//adding product to cart +function addToCart(barcode) +{ + cartIndex = null; + done = false; + if(barcode == null) return; + if(barcode == '') return; + + try + { + var url = 'StockMovementAction.do'; + var pars = 'action=addProduct&barCode='+ barcode + '&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + + } + catch(e) + { + toConsole(e); + } +} + +//incrementing, decrementing and deleting the shopping cart items using ajax +// 1.Increment the qty for the product +function incrementCart(productId) +{ + if(productId == null) return; + + try + { + + var url = 'StockMovementAction.do'; + var pars = 'action=incrementQty&productId='+productId+ '&ifAdd=true' + '&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + +//2.Decrement the qty for the product +function decrementCart(productId) +{ + if(productId == null) return; + + try + { + + + var url = 'StockMovementAction.do'; + var pars = 'action=decrementQty&productId='+productId+ '&ifAdd=false&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } +} + +//3.Delete all the products with the ID from the cart +function deleteItemFromCart(productId) +{ + if(productId == null) return; + + cartIndex = null; + updateQty(productId, '0'); +} + +//Refreshs the content of the shopping cart +function refreshShoppingCart(request) +{ + try + { + //var top = $('items').scrollTop; + var response = request.responseText; + $('shoppingCart').innerHTML = response; + //$('items').scrollTop = top; + scrollDownCart(); + response.evalScripts(); //display error messages + } + catch(e) + { + showErrorMessage('Failed to resfresh cart! Cause:' + e); + } + + addBehaviourToCart(); +} + +//Reports an error +function reportShoppingCartError(request) +{ + alert('Some error occured while communicating with the server. Please try again.'); + alert(request.responseText); + var win = window.open(); + win.document.write(request.responseText); + win.document.close(); +} + +//addRequiredLibrary('js/test.js'); +var requestIndicator; + +/* +var ShoppingCart = { + + init : function(){ + //this.indicator = new AJAXIndicator('Please wait...'); + alert('Shopping Cart'); + }, + + indicator : null +}; +*/ + +function checkout() +{ + //do normal submit + $('checkoutForm').submit(); +/* + var pars = Form.serialize('checkoutForm'); + var url = 'CheckoutAction.do'; + + try + { + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: handleCheckout, + onFailure: reportShoppingCartError + }); + } + catch(e) + { + toConsole(e); + } +*/ +} + +//Update the qty for the product +function updateQty(productId, quantity) +{ + if(productId == null) return; + + if (quantity == "") + { + return; + } + + if(quantity < 0) + { + showErrorMessage('Quantity cannot be negative!', 'qty'); + $('qty').value = ""; + return; + } + + var amount = parseFloat(quantity); + + if (isNaN(amount)) + { + showErrorMessage('Invalid quantity! ' + quantity, 'qty'); + $('qty').value = ""; + return; + } + + try + { + var url = 'StockMovementAction.do'; + var pars = 'action=updateQty&productId=' + productId + '&ifAdd=false&qtyToMove=' + quantity + '&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + +function updateNoOfPack(productId, noOfPack) +{ + if(productId == null) return; + + if (noOfPack == "") + { + return; + } + + if(noOfPack < 0) + { + showErrorMessage('No of Pack cannot be negative!', 'qty'); + return; + } + + var amount = parseFloat(noOfPack); + + if (isNaN(amount)) + { + showErrorMessage('Invalid No of Pack! ' + quantity, 'qty'); + return; + } + + try + { + var url = 'StockMovementAction.do'; + var pars = 'action=updateNoOfPack&productId=' + productId + '&ifAdd=false&noOfPack=' + noOfPack; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + +//Reload shopping cart +function reloadCart() +{ + try + { + var url = 'StockMovementAction.do'; + var pars = 'action=reloadCart'; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } + +} + + +function clearCart() +{ + maxRows = 0; + excessRows = 0; + resetDetails(); + + try + { + var url = 'StockMovementAction.do'; + var pars = 'action=clearCart'; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + } + catch(e) + { + toConsole(e); + } + +} + +function handleCheckout(request) +{ + var response = request.responseText; + var result = eval('(' + response + ')'); + + if(result.error) + { + showErrorMessage(result.error); + } + else + { + printOrder(result.orderID); + reloadCart(); + } +} + + +function addBehaviourToCart() +{ + var rows = new Array(); + var count = 1; + + while(true) + { + var row = $('row' + count); + if(row == null) break; + + rows.push(row); + count ++; + } + + for(var i=0; i 0) + { + var line = cartLines[cartIndex]; + simulateOnClick(line); + + } + + if(cartLines.length > maxRows) + { + var shoppingCart = $('shoppingCart'); + shoppingCart.scrollTop = shoppingCart.scrollHeight; + } + +} + +//Reload the shopping cart. Prices are calculated for the pricelist +function setShoppingCartPriceList() +{ + try + { + var url = 'AddToPOSShoppingCartAction.do'; + var pars = 'action=updatePriceList&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: refreshShoppingCart, + onFailure: reportShoppingCartError + }); + + } + catch(e) + { + toConsole(e); + } +} + +function scrollCart() +{ + var shoppingCart = $('shoppingCart'); + + if(cartIndex > maxRows) + { + shoppingCart.scrollTop = shoppingCart.scrollHeight; + } + else + { + shoppingCart.scrollTop = 0; + } +} + + +//Event.observe(window,'load',init,false); +//--------------------------------------------------------------------------------------- +//calling methods \ No newline at end of file diff --git a/posterita/posterita/web/js/stockTransfer.js b/posterita/posterita/web/js/stockTransfer.js new file mode 100644 index 0000000000..c9379a962e --- /dev/null +++ b/posterita/posterita/web/js/stockTransfer.js @@ -0,0 +1,537 @@ +//scripts for Posterita Ordering Screen +var product_id = null; +var cartLines = null; +var cartIndex = null; +var priceList = null; +var movementId = null; +var description = null; +var reference = null; +var oldPriceList = -1; +var searchElement = null; +var defaultPriceList = null; +var defaultPriceListName = null; +var ISTAXINCLUDED = null; +var TAX_RATE = null; +var ERROR_MSG = null; +var itemRowHeight = null; +var totalAmount = null; +var maxRows = 15; +var done = false; +var STOCKQTY = null; +var orgFromId = null; +var orgToId = null; + +var initScreen = function(){ + priceList = $('priceListId').value; + movementId = $('movementId').value; + + var orgFrom = $('orgFromId'); + orgFromId = orgFrom[orgFrom.selectedIndex].value; + + var orgTo = $('orgToId'); + orgToId = orgTo[orgTo.selectedIndex].value; + + //set default data for price list + defaultPriceList = priceList; + defaultPriceListName = $('terminal').innerHTML; + + //set search element + var searchProductBy = $('searchProductBy').value; + if(searchProductBy == 'name') + { + searchElement = $('productQuery'); + } + else + { + searchElement = $(searchProductBy); + } + + initProductSearch();; + initCartBtn(); + initAjaxResponder(); + initShortcuts(); + initSystemBtns(); + + searchElement.focus(); + + var barcode = $('barcode'); + barcode.focus(); + barcode.onkeyup = function(e){ + if(e.keyCode == Event.KEY_RETURN) + { + if(this.value != null && this.value != "") + { + done = true; + + addToCart(this.value); + this.value = ""; + } + + } + }; + + $('qty').onkeyup = function(e){ + if(e.keyCode == Event.KEY_RETURN) + { + //update qty + updateQty(product_id, this.value); + return false; + } + }; + + + $('clearCartBtn').onclick = function(e){ + initSystemBtns(); + this.className = 'selected'; + clearCart(); + }; + + $('saveBtn').onclick = function(e){ + initSystemBtns(); + this.className = 'selected'; + + if(cartLines == null || cartLines.length == 0) + { + showErrorMessage('Shopping cart is empty!', 'productQuery'); + return; + } + + if(orgFromId == orgToId) + { + showErrorMessage('You cannot transfer stocks to the same organisation', 'orgFromId'); + return; + } + else + { + saveMMovement(); + } + }; + + $('completeBtn').onclick = function(e){ + initSystemBtns(); + this.className = 'selected'; + + if(cartLines == null || cartLines.length == 0) + { + showErrorMessage('Shopping cart is empty!', 'productQuery'); + return; + } + + if(orgFromId == orgToId) + { + showErrorMessage('You cannot transfer stocks to the same organisation', 'orgFromId'); + return; + } + else + { + $('StockMovementForm').submit(); + } + }; + + $('newStockBtn').onclick = function(e){ + initSystemBtns(); + this.className = 'selected'; + + redirect("StockMovementAction.do?action=createNewStockTransfer"); + }; + + //add behaviour to existing cart + addBehaviourToCart(); +}; + +var initShortcuts = function() +{ + shortcut.add("Ctrl+Space", function(e){simulateOnClick($('checkoutBtn'))}); + + shortcut.add("F1", function(e){$('barcode').select();}); + shortcut.add("F2", function(e){$('productQuery').select();}); + shortcut.add("F3", function(e){$('description').select();}); + shortcut.add("F4", function(e){$('qty').select();}); + + shortcut.add("Ctrl+M", function(){simulateOnClick($('menuBtn'))}); + + shortcut.add("Ctrl+Delete", function(){ + simulateOnClick($('clearCartBtn')); + }); + + shortcut.add("Ctrl+R", function() + { + $('reference').focus(); + }); + + shortcut.add("Ctrl+S", function(){simulateOnClick($('saveBtn'))}); + shortcut.add("Ctrl+C", function(){simulateOnClick($('completeBtn'))}); + + //move between cart lines + shortcut.add("Ctrl+Up", function(){ + if(cartIndex > 0) + { + cartIndex = cartIndex -1; + var line = cartLines[cartIndex]; + scrollCart(); + simulateOnClick(line); + } + }); + + shortcut.add("Ctrl+Down", function(){ + if(cartIndex < cartLines.length - 1) + { + cartIndex = cartIndex + 1; + var line = cartLines[cartIndex]; + scrollCart(); + simulateOnClick(line); + } + }); + + //incrementing and decrementing qty + shortcut.add("Ctrl+Right", function(){ + simulateOnClick($('plusBtn')); + }); + + shortcut.add("Ctrl+Left", function(){ + simulateOnClick($('minusBtn')); + }); + + shortcut.add("Ctrl+Backspace", function(){ + simulateOnClick($('deleteBtn')); + }); + + +}; + +var showResult = function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); + Position.clone($('maintop'), update, {setHeight: false, setTop: false, offsetTop: element.offsetHeight}); + } + + update.style.display = 'block'; + update.style.opacity = '1.0'; + + }; + + +var initProductSearch = function(){ + + // autocomplete for search by product name + var productAutocompleter = new Ajax.Autocompleter('productQuery','productSearchResult','SearchProductsAction.do',{ + paramName:'productName', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete, + onShow : showResult + }); + + productAutocompleter.xyz = true; + $('productQuery').Autocompleter = productAutocompleter; + + + // autocomplete for search by product description + var productAutocompleter2 = new Ajax.Autocompleter('description','productSearchByDescriptionResult','SearchProductsAction.do',{ + paramName:'description', + parameters : 'priceListId=' + priceList, + minChars:1, + frequency:1.0, + afterUpdateElement: afterAutocomplete, + onShow : showResult + }); + + $('description').Autocompleter = productAutocompleter2; +}; + +var afterAutocomplete = function(e1,e2){ + + var barcode = e2.getAttribute('barcode'); + if(barcode=='null') + { + barcode = ""; + } + var productId = e2.getAttribute('productId'); + + if(productId == null) + { + $('description').value = ""; + $('productQuery').value = ""; + + return; + } + + //$('barcode').value = barcode; + $('productId').value= productId; + + var description = e2.getAttribute('description'); + //$('description').value = description; + + incrementCart(productId); + + //reset focus to search input + searchElement.focus(); + + //show product details + getProductInfo(productId); + + //set global product + product_id = productId; + + $('description').value = ""; + $('productQuery').value = ""; + +}; + +function getProductInfo(productId) +{ + var url = 'POSProductAction2.do'; + var pars = 'action=getProductDetails&productId='+productId+'&priceListId='+priceList; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: showProductInfo, + onFailure: reportError + }); +} + +function showProductInfo(request) +{ + // + try + { + var response = request.responseText; + var product = eval('(' + response + ')'); + + //display product info in right column + $('product.name').innerHTML = product.name; + $('product.barcode').innerHTML = product.barcode; + $('product.taxCategory').innerHTML = product.taxCategory; + $('product.description').innerHTML = product.description; + STOCKQTY = $('product.stock.qty').innerHTML = product.stockQty; + TAX_RATE = new Number(product.taxRate).toFixed(2); + var taxPercentage = new Number(1 + (TAX_RATE / 100)); + + ISTAXINCLUDED = product.isTaxIncluded; + + if(ISTAXINCLUDED == "false") + { + $('product.price.list').innerHTML = new Number(product.priceList * taxPercentage).toFixed(2); + } + else + { + $('product.price.list').innerHTML = new Number(product.priceList).toFixed(2); + } + + $('product.units.pack').innerHTML = product.unitsPerPack; + $('product.image').src = 'images/newUI/productpreview.gif'; + + } + catch(e) + { + showErrorMessage(e); + } +} + +function reportError(request) +{ + alert("Some error has occured while communicating with the server"); + var w = window.open("","Error"); + var d = w.document; + d.write(request.responseText); +} + +function convertString2Unicode(s) +{ + var uniString = "", hexVal, uniChar; + + for(var i = 0; i < s.length; ++i) + { + //Convert char to hex + //hexVal = Number(s.charCodeAt(i)).toString(16); + hexVal = Number(s.charCodeAt(i)).toString(10); + + //Convert to unicode by making sure hex is 4 chars long, padding with 0's if less + //uniChar = "\\u" + ("000" + hexVal).match(/.{4}$/)[0]; + uniChar = "&#" + ("000" + hexVal).match(/.{4}$/)[0] +";"; + + uniString += uniChar; + } + if(hexVal < 255) + return s; + + return uniString; +} + +var initCartBtn = function(){ + var plus = $('plusBtn'); + var minus = $('minusBtn'); + var del = $('deleteBtn'); + + plus.style.cursor = 'pointer'; + minus.style.cursor = 'pointer'; + del.style.cursor = 'pointer'; + + plus.onclick = function(e){ + if(product_id != null) + incrementCart(product_id); + searchElement.focus(); + }; + + minus.onclick = function(e){ + if(product_id != null) + decrementCart(product_id); + searchElement.focus(); + }; + + del.onclick = function(e){ + if(product_id != null) + deleteItemFromCart(product_id); + + if(cartLines == null || cartLines.length == 0) + { + resetDetails(); + } + + searchElement.focus(); + }; +}; + + + +var initAjaxResponder = function(){ + + Ajax.Responders.register({ + onCreate: function() { + $('indicator').style.display = 'block'; + }, + onComplete: function() { + $('indicator').style.display = 'none'; + } + }); +}; + + + +//---------------------------------------------------------------------------- + +function initSystemBtns() +{ + + systemBtns = new Array(); + + systemBtns.push($('completeBtn')); + systemBtns.push($('clearCartBtn')); + systemBtns.push($('saveBtn')); + systemBtns.push($('newStockBtn')); + + systemBtns = $A(systemBtns); + + for(var i=0; iPlease Wait...

    ', {title: 'Saving Inventory Move', width: 800}); + Modalbox.deactivate(); + + reference = $('reference').value; + var url = 'StockMovementAction.do'; + var pars = 'action=createMMovement&movementId='+movementId+'&priceListId='+priceList+'&description='+reference+'&orgFromId='+orgFromId+'&orgToId='+orgToId; + + var myAjax = new Ajax.Request( url, + { + method: 'get', + parameters: pars, + onSuccess: showMovementInfo, + onFailure: reportError + }); + } +} + +function showMovementInfo(request) +{ + // + try + { + if (window.Modalbox) + Modalbox.hide(); + + var response = request.responseText; + var movementInfo = eval('(' + response + ')'); + + //display info in right column + $('docNo').innerHTML = movementInfo.docNo; + + if(movementInfo.description == null || movementInfo.description == 'null' || movementInfo.description == "") + { + $('reference').value = ""; + } + else + { + $('reference').value = movementInfo.description; + } + + $('mainTitle').innerHTML = "STATUS: " + movementInfo.docStatus; + $('movementId').value = movementId = movementInfo.movementId; + + } + catch(e) + { + showErrorMessage(e); + } +} +function setOrgFromTo() +{ + var orgFrom = $('orgFromId'); + orgFromId = orgFrom[orgFrom.selectedIndex].value; + + var orgTo = $('orgToId'); + orgToId = orgTo[orgTo.selectedIndex].value; + + if(orgFromId == orgToId) + { + showErrorMessage('You cannot transfer stocks to the same organisation', 'orgFromId'); + } +} + +Event.observe(window,'load',initScreen,false); \ No newline at end of file diff --git a/posterita/posterita/web/js/timer.js b/posterita/posterita/web/js/timer.js new file mode 100644 index 0000000000..477b1a0696 --- /dev/null +++ b/posterita/posterita/web/js/timer.js @@ -0,0 +1,36 @@ +var rTimer; +var sds ; + +TimeTick(); + +function TimeTick() +{ + var d = new Date(); + + var sds = new Date(); + + var hours = d.getHours(); + var minutes = d.getMinutes(); + var seconds = d.getSeconds(); + var month = d.getMonth()+1; + var date= d.getDate(); + var year = d.getFullYear(); + + + hours = (hours < 10)? '0'+hours : hours; + minutes = (minutes < 10)? '0'+minutes : minutes; + seconds = (seconds < 10)? '0'+seconds : seconds; + date =(date <10) ? '0'+date : date; + month =(month<10) ? '0'+ month : month; + + + $('timer').innerHTML= date+"/"+ month +"/"+year+" "+hours+":"+minutes+":"+seconds; + if(rTimer) + { + clearTimeout(rTimer); + } + + rTimer = setTimeout('TimeTick()', 1000); +} + + diff --git a/posterita/posterita/web/js/tooltip.js b/posterita/posterita/web/js/tooltip.js new file mode 100644 index 0000000000..d707fcc866 --- /dev/null +++ b/posterita/posterita/web/js/tooltip.js @@ -0,0 +1,113 @@ +/** + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + @author praveen + */ + + +//some methods for tooltip +function showTooltip(e) +{ + //Remove previous tooltips + if($('tooltipdiv')) + { + document.body.removeChild($('tooltipdiv')); + } + + var tip = this.getAttribute('tooltip'); + if(!tip) + { + return; + } + + var tooltip = document.createElement('div'); + var newAttr = document.createAttribute('id'); + newAttr.nodeValue = "tooltipdiv" + tooltip.setAttributeNode(newAttr); + + tooltip.onclick = function(){ + document.body.removeChild(this); + }; + + var event = window.event || e; + + var xcoor = Event.pointerX(event); + var ycoor = Event.pointerY(event); + + //tooltip.style.left = 10 + xcoor + "px"; + //tooltip.style.top = 10 + ycoor + "px"; + tooltip.style.visibility = 'hidden'; + tooltip.className = "tooltip"; + tooltip.innerHTML = tip; + document.body.appendChild(tooltip); + + var sWidth = getViewportWidth(); + var sHeigth = getViewportHeight(); + + var ttLeft = 10 + xcoor; + var ttTop = 10 + ycoor; + var ttWidth = tooltip.scrollWidth; + var ttHeight = tooltip.scrollHeight; + + if((ttLeft+ttWidth)>sWidth){ + ttLeft = sWidth - (10 + ttWidth); + } + + if((ttTop+ttHeight)>sHeigth){ + ttTop = sHeigth - (10 + ttHeight); + } + + tooltip.style.left = ttLeft + "px"; + tooltip.style.top = ttTop + "px"; + tooltip.style.visibility = 'visible'; + + //toConsole('Width:' + tooltip.scrollWidth); + //toConsole('Height:' + tooltip.scrollHeight); + +} + +var initTooltip = function() +{ + var help = document.getElementsByName('help'); + for(var i=0; i + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + + + + + + + + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + +
    + +
    + + + + + + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + +
    + +
    + +
    + +
    + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/changePassword.jsp b/posterita/posterita/web/jsp/admin/changePassword.jsp new file mode 100644 index 0000000000..34360a7031 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/changePassword.jsp @@ -0,0 +1,79 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + + + + + + + + +<%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + +
    + +
    + + + + + + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + +
    + +
    + +
    +
    + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/checkDataIntegritySuccess.jsp b/posterita/posterita/web/jsp/admin/checkDataIntegritySuccess.jsp new file mode 100644 index 0000000000..4159b268d2 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/checkDataIntegritySuccess.jsp @@ -0,0 +1,48 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.user.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + + + + + + + + + + + + + +
    +
    + +
    +
    +<%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/checkSequenceSuccess.jsp b/posterita/posterita/web/jsp/admin/checkSequenceSuccess.jsp new file mode 100644 index 0000000000..ca460fc900 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/checkSequenceSuccess.jsp @@ -0,0 +1,55 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + +Update Sequence +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
    + The sequences have been updated successfully +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/createRole.jsp b/posterita/posterita/web/jsp/admin/createRole.jsp new file mode 100644 index 0000000000..92fa36db37 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/createRole.jsp @@ -0,0 +1,179 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author praveen +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.posterita.core.MenuItem" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + + + + + + + + +<%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + + + +
    + +
    + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + +
    + Can Create Order + + +
    + Can Alter Order + + +
    + Can View Order + + +
    +

    + Available Menus +
    +
    + + + + + + + + + + + + + + + + + +
    + +
            + + + +
    +
    +
    + + Clear All + + + Select All + + + + +
    + +
    +
    + + + +<%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/emailChanged.jsp b/posterita/posterita/web/jsp/admin/emailChanged.jsp new file mode 100644 index 0000000000..0a13ee080c --- /dev/null +++ b/posterita/posterita/web/jsp/admin/emailChanged.jsp @@ -0,0 +1,48 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/posterita.tld" prefix="posterita"%> + + + + + + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + +
    + +
    + +<%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/listOrganisations.jsp b/posterita/posterita/web/jsp/admin/listOrganisations.jsp new file mode 100644 index 0000000000..432a5d380c --- /dev/null +++ b/posterita/posterita/web/jsp/admin/listOrganisations.jsp @@ -0,0 +1,91 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@page import="org.posterita.struts.admin.OrganisationAction"%> +<%@page import="org.posterita.Constants"%> +Organisations +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
    + + + + + + "> + Create Organisation + +
    + +

    + + + + + + + + + + + + + + + + + + + + +
    Organisation NameAddressActiveUpdate Details
    + + + + + + + + "> + update organisation + + "> + activate/deactivate organisation + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/listRoles.jsp b/posterita/posterita/web/jsp/admin/listRoles.jsp new file mode 100644 index 0000000000..9dbb4cf645 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/listRoles.jsp @@ -0,0 +1,92 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + + + + + + + + + + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + + + + +
    + +
    + <%@ include file="/jsp/include/errors.jsp" %> + +
    + Add Record +
    + + + + + + + + + + + + + + + + + + +
     
    + + <%-- + ">Edit + --%> + ">View + <%--">Delete--%> +
    +
    + + + +<%@ include file="/jsp/include/footerTableBottom.jsp" %> diff --git a/posterita/posterita/web/jsp/admin/passwordChanged.jsp b/posterita/posterita/web/jsp/admin/passwordChanged.jsp new file mode 100644 index 0000000000..aeffa1b345 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/passwordChanged.jsp @@ -0,0 +1,52 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/posterita.tld" prefix="posterita"%> + + + Change password + + + + + + <%@ include file="/jsp/include/errors.jsp"%> + + + + + +
    + +
    + + +<%@ include file="/jsp/include/tshirtFooter.jsp"%> diff --git a/posterita/posterita/web/jsp/admin/updateOrCreateOrganisation.jsp b/posterita/posterita/web/jsp/admin/updateOrCreateOrganisation.jsp new file mode 100644 index 0000000000..be97acaa7d --- /dev/null +++ b/posterita/posterita/web/jsp/admin/updateOrCreateOrganisation.jsp @@ -0,0 +1,128 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * +--%> +<%@ page import="org.posterita.Constants" %> +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + +
    + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + +
    *
    + + + +
    +
    +
    +
    + Receipt Footer Message + + + + + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + +
    + + + + +
    + +
    +
    +
    +   +
    +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/userDeleted.jsp b/posterita/posterita/web/jsp/admin/userDeleted.jsp new file mode 100644 index 0000000000..19ff9c5030 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/userDeleted.jsp @@ -0,0 +1,49 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + +<%@ page import="org.posterita.user.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + + + + + + + + + + + + + +
    +
    + +
    +
    + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/viewMyDetails.jsp b/posterita/posterita/web/jsp/admin/viewMyDetails.jsp new file mode 100644 index 0000000000..cccf499f12 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/viewMyDetails.jsp @@ -0,0 +1,138 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + + + + + + + + + + + + + + + + +
    + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +

    + +

    +
    +
    + +
    +
    + + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/viewOrganisation.jsp b/posterita/posterita/web/jsp/admin/viewOrganisation.jsp new file mode 100644 index 0000000000..07773623fb --- /dev/null +++ b/posterita/posterita/web/jsp/admin/viewOrganisation.jsp @@ -0,0 +1,67 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
    + + + + + + + + + + + + + + + + + + +
    Organisation NameAddressActiveUpdate Details
    + + + + + + + + + + + + + + + + + + + +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/viewRole.jsp b/posterita/posterita/web/jsp/admin/viewRole.jsp new file mode 100644 index 0000000000..41d613f8a7 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/viewRole.jsp @@ -0,0 +1,96 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + + + + <%@ include file="/jsp/include/tabTop.jsp" %>View Role<%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + +
    + +
    + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + +
    Role Name :

    Menus
    + + + + + + + + + + + + + + + + +
    + +
            + +
    +
    +
    +
    + + + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/viewUserDetails.jsp b/posterita/posterita/web/jsp/admin/viewUserDetails.jsp new file mode 100644 index 0000000000..68d409baf7 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/viewUserDetails.jsp @@ -0,0 +1,120 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + + + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + +
    + +
    + + + + + + + + + + + + <%-- + + + + + --%> + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + + + + + + + + +
    + + + +
    +
    +
    + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/admin/viewUsers.jsp b/posterita/posterita/web/jsp/admin/viewUsers.jsp new file mode 100644 index 0000000000..091f0e7fe4 --- /dev/null +++ b/posterita/posterita/web/jsp/admin/viewUsers.jsp @@ -0,0 +1,110 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + + + + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + +
    + +
    + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + +
    + + + + + Active +   + +
    + + + + + + Yes + + + No + + + "> + + +
    +
    + + + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/attachment/createAttachment.jsp b/posterita/posterita/web/jsp/attachment/createAttachment.jsp new file mode 100644 index 0000000000..9d84925850 --- /dev/null +++ b/posterita/posterita/web/jsp/attachment/createAttachment.jsp @@ -0,0 +1,87 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.struts.attachment.AttachmentAction" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + +Attach Logo + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + <%@ include file="/jsp/include/tabTop.jsp" %>Attach Logo<%@ include file="/jsp/include/tabBottom.jsp" %> + <%@ include file="/jsp/include/errors.jsp" %> +
    + find logo + + +
    Name + +
    + + + +
    +
    +<%@ include file="/jsp/include/footerTableBottom.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/bPartner/bPartnerCreated.jsp b/posterita/posterita/web/jsp/bPartner/bPartnerCreated.jsp new file mode 100644 index 0000000000..e927c3a166 --- /dev/null +++ b/posterita/posterita/web/jsp/bPartner/bPartnerCreated.jsp @@ -0,0 +1,180 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import ="org.posterita.Constants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/posterita.tld" prefix="posterita"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + --%> +
    + + + +   +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + Yes + + + No + +
    + + Yes + + + No + +
    + + Yes + + + No + +
    + + Yes + + + No + +
    + + + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/bPartner/bPartnerDetails.jsp b/posterita/posterita/web/jsp/bPartner/bPartnerDetails.jsp new file mode 100644 index 0000000000..b9715c06b9 --- /dev/null +++ b/posterita/posterita/web/jsp/bPartner/bPartnerDetails.jsp @@ -0,0 +1,184 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import ="org.posterita.Constants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/posterita.tld" prefix="posterita"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +   +
    + + + +
    + + + +
    + + + +
    + + + +
    + : + + +
    + : + + +
    + + Yes + + + No + +
    + + Yes + + + No + +
    + + Yes + + + No + +
    + + Yes + + + No + +
    + + Yes + + + No + +
    + + +
    + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/bPartner/createBPartner.jsp b/posterita/posterita/web/jsp/bPartner/createBPartner.jsp new file mode 100644 index 0000000000..365d62c2a5 --- /dev/null +++ b/posterita/posterita/web/jsp/bPartner/createBPartner.jsp @@ -0,0 +1,218 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.struts.bPartner.BPartnerAction" %> +<%@ page import ="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + + + + + + + + + + + + + + --%> + + + + + + +
    + * + + +
    + * + + +
    + * + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + + + + +
    + + + + + +
    + * + + + + +
    + + + + + +
    + + + + + +
    + + + + + +
    +   + + +   + +
    + +
    +<%@ include file="/jsp/include/posFooter.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/bPartner/editBPartner.jsp b/posterita/posterita/web/jsp/bPartner/editBPartner.jsp new file mode 100644 index 0000000000..11e824f239 --- /dev/null +++ b/posterita/posterita/web/jsp/bPartner/editBPartner.jsp @@ -0,0 +1,220 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.struts.bPartner.BPartnerAction" %> +<%@ page import ="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + + + + + + + + + + + + + + --%> + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + + + + +
    + + + + + +
    + * + + + + +
    + + + + + +
    + + + + + +
    + + + + + +
    +   + + +   + +
    + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/bPartner/viewBPartner.jsp b/posterita/posterita/web/jsp/bPartner/viewBPartner.jsp new file mode 100644 index 0000000000..759b1dfbd1 --- /dev/null +++ b/posterita/posterita/web/jsp/bPartner/viewBPartner.jsp @@ -0,0 +1,185 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import ="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
    + + + + + + + +
    + + + + + +   + + + + + Add Business Partner + +
    +
    + + + + + + + + + + + + + + <% + String url = "BusinessPartners.do"; + String collection = Constants.ALLBUSINESSPARTNERS; + %> + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + +   +
    + +   + + + Yes + + + No + + + + Yes + + + No + + + + Yes + + + No + + + + Yes + + + No + + + + Yes + + + No + + + "> + View Business Partner + +   + "> + Edit Business Partner + +   + + + "> + Deactivate + + + + + "> + Activate + + +
    +<%@ include file="/jsp/include/pager.jsp" %> +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> + + diff --git a/posterita/posterita/web/jsp/cashBook/cashBook.jsp b/posterita/posterita/web/jsp/cashBook/cashBook.jsp new file mode 100644 index 0000000000..1adc189922 --- /dev/null +++ b/posterita/posterita/web/jsp/cashBook/cashBook.jsp @@ -0,0 +1,181 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@page import="org.posterita.struts.pos.CashBookAction"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + <% + boolean readonly = new Boolean((String)strReadOnly).booleanValue(); + + boolean orgReadOnly = true; + + if (cashBookId != null) + { + try + { + orgReadOnly = (Integer.parseInt((String)cashBookId) > 0); + } + catch (Exception ex) + {} + } + %> + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + * + + +
    + * + + + + +
    + + + + +
    + + + + +
    + + + + + +
    + + + +
    +
    + + + Copy As + + + + + Edit + + + + + Save + + + + + Cancel + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/client/createClient.jsp b/posterita/posterita/web/jsp/client/createClient.jsp new file mode 100644 index 0000000000..3bcba630d5 --- /dev/null +++ b/posterita/posterita/web/jsp/client/createClient.jsp @@ -0,0 +1,206 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + + + +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + POSterita:. Create Client + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/footer.jsp b/posterita/posterita/web/jsp/include/footer.jsp new file mode 100644 index 0000000000..3878b621ab --- /dev/null +++ b/posterita/posterita/web/jsp/include/footer.jsp @@ -0,0 +1,50 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + +<%@ page import="org.posterita.Constants" %> +<% +String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); +%> + + + + + + + +
    +
    + +
    + + + + + + + +
    + +
    +
    + + + +
    + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/inOut/viewMinOut.jsp b/posterita/posterita/web/jsp/inOut/viewMinOut.jsp new file mode 100644 index 0000000000..ebffee5bf7 --- /dev/null +++ b/posterita/posterita/web/jsp/inOut/viewMinOut.jsp @@ -0,0 +1,103 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> + + + + + + + + + +<%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + +
    + + + + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + +
    +
    + Client + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Client Name
    Organisation Name
    Currency + + + +
    Address
    Postal Address
    City
    Country + + + +
    +
    +
    +
    + Administrator + + + + + + + + + + + + + + + + + + + + + + + + + + +
    User Name
    Role Name
    Password
    Confirm Password
    User PIN
    Email
    +
    +
    +
    + Accounting + + + + + +
    Load Accounting Values
    +
    +
    + +   + +
    +
    + + + + + + diff --git a/posterita/posterita/web/jsp/customer/createPOSCustomer.jsp b/posterita/posterita/web/jsp/customer/createPOSCustomer.jsp new file mode 100644 index 0000000000..dc00985ba7 --- /dev/null +++ b/posterita/posterita/web/jsp/customer/createPOSCustomer.jsp @@ -0,0 +1,51 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.struts.customer.CustomerAction" %> +<%@ page import="org.compiere.model.MBPartner" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + +<%@ include file="/jsp/pos/customerDetails.jsp" %> + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/customer/existingPOSCustomers.jsp b/posterita/posterita/web/jsp/customer/existingPOSCustomers.jsp new file mode 100644 index 0000000000..47a3d40c90 --- /dev/null +++ b/posterita/posterita/web/jsp/customer/existingPOSCustomers.jsp @@ -0,0 +1,138 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import ="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + + +<%@ include file="/jsp/include/tabTop.jsp" %>Customers<%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + +
    + + <%@ include file="/jsp/include/errors.jsp" %> +
    + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Surname + + Name + + Customer ID No. + + Phone No. + + Cell No. + + AA Card No. + + Address + + City +   + +
    + + + + + + + + + + + + + + + +
    +
    + + + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + + diff --git a/posterita/posterita/web/jsp/customer/savePOSCustomer.jsp b/posterita/posterita/web/jsp/customer/savePOSCustomer.jsp new file mode 100644 index 0000000000..cc5d5b1104 --- /dev/null +++ b/posterita/posterita/web/jsp/customer/savePOSCustomer.jsp @@ -0,0 +1,50 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.struts.customer.CustomerAction" %> +<%@ page import="org.compiere.model.MBPartner" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +<%@ include file="/jsp/pos/customerDetails.jsp" %> + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/error/error.jsp b/posterita/posterita/web/jsp/error/error.jsp new file mode 100644 index 0000000000..c9d0bf1d63 --- /dev/null +++ b/posterita/posterita/web/jsp/error/error.jsp @@ -0,0 +1,78 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Tamak +--%> + + +<%@ page import="org.apache.struts.Globals" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + + + + + + + + + + + + + +
    + + + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + +
    + + + + <%-- + Exception xception = (Exception) request.getAttribute(Globals.EXCEPTION_KEY); + out.println(xception.getMessage()); + + --%> + + <%-- + Exception xception = (Exception) request.getAttribute(Globals.EXCEPTION_KEY); + StackTraceElement[] stackTraceElem = xception.getStackTrace(); + + for(int i = 0;i + + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/help/contactUs.jsp b/posterita/posterita/web/jsp/help/contactUs.jsp new file mode 100644 index 0000000000..b7937c3b04 --- /dev/null +++ b/posterita/posterita/web/jsp/help/contactUs.jsp @@ -0,0 +1,87 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    : + +
    : +
    +
    + +   + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/help/emailSuccess.jsp b/posterita/posterita/web/jsp/help/emailSuccess.jsp new file mode 100644 index 0000000000..191df241ee --- /dev/null +++ b/posterita/posterita/web/jsp/help/emailSuccess.jsp @@ -0,0 +1,44 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +Your query has been successfully sent to support@posterita.org +
    We will get back to you as soon as possible +
    Thank you +

    Posterita Support Team + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/inOut/minOutDetails.jsp b/posterita/posterita/web/jsp/inOut/minOutDetails.jsp new file mode 100644 index 0000000000..e29a9cf2c7 --- /dev/null +++ b/posterita/posterita/web/jsp/inOut/minOutDetails.jsp @@ -0,0 +1,153 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.Constants" %> + + +
    + + + + + + +
    + + + + + +
    +
    + + + + +
    + Document Type: +
    +
    + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + Invoice Ref No: + + + + + +
    + Shipment Ref No: + + Counter Shipment Ref No: +
    + Doc Status: +
    +   +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Quantity
    + + + + + + + + + + + 1 +
    +
    + <%@ include file="/jsp/include/errors.jsp" %> + + + + + <%@ include file="/jsp/inOut/webStoreMinOutDetails.jsp" %> + + + + + +
    + + + + + + +
    + + + + + +
    +
    + + + + +
    + + + + + + + + + + + + + + + + +
    + + + +
    +
    +
    + +<%@ include file="/jsp/include/footerTableBottom.jsp" %> diff --git a/posterita/posterita/web/jsp/inOut/viewReceiptHistory.jsp b/posterita/posterita/web/jsp/inOut/viewReceiptHistory.jsp new file mode 100644 index 0000000000..51e35d8842 --- /dev/null +++ b/posterita/posterita/web/jsp/inOut/viewReceiptHistory.jsp @@ -0,0 +1,118 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.posterita.struts.InOut.InOutAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + + + + + +
    + +
    + + + + + <%@ include file="/jsp/include/filter.jsp"%> + + +
    +
    + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + +
    + + + + + + + <%-- --%> + + + + +
    +
    + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/inOut/viewShipmentHistory.jsp b/posterita/posterita/web/jsp/inOut/viewShipmentHistory.jsp new file mode 100644 index 0000000000..ada7055e6b --- /dev/null +++ b/posterita/posterita/web/jsp/inOut/viewShipmentHistory.jsp @@ -0,0 +1,118 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.posterita.struts.InOut.InOutAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> + + + + + + + + + + + + +
    + +
    + + + + + <%@ include file="/jsp/include/filter.jsp"%> + + +
    +
    + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + +
    + + + + + + + <%-- --%> + + + + +
    +
    + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/backBt.jsp b/posterita/posterita/web/jsp/include/backBt.jsp new file mode 100644 index 0000000000..6e6cab57d2 --- /dev/null +++ b/posterita/posterita/web/jsp/include/backBt.jsp @@ -0,0 +1,28 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Tamak +--%> + + +
    + +<%-- Go Back--%> + +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/completePOSOrder.jsp b/posterita/posterita/web/jsp/include/completePOSOrder.jsp new file mode 100644 index 0000000000..2575d14638 --- /dev/null +++ b/posterita/posterita/web/jsp/include/completePOSOrder.jsp @@ -0,0 +1,115 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> +<% String orderlines = Constants.POS_ORDER_LINES; %> +<%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + +
     
    + +
    + + +
    +<%@ include file="/jsp/include/printOrderApplet.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/completePOSOrderIncl.jsp b/posterita/posterita/web/jsp/include/completePOSOrderIncl.jsp new file mode 100644 index 0000000000..5c6ff6253a --- /dev/null +++ b/posterita/posterita/web/jsp/include/completePOSOrderIncl.jsp @@ -0,0 +1,115 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> +<% String orderlines = Constants.POS_ORDER_LINES; %> +<%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + +
     
    + +
    + + +
    +<%@ include file="/jsp/include/printOrderApplet.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/creditOrderPart1FocusBarCode.jsp b/posterita/posterita/web/jsp/include/creditOrderPart1FocusBarCode.jsp new file mode 100644 index 0000000000..a8a728f5d8 --- /dev/null +++ b/posterita/posterita/web/jsp/include/creditOrderPart1FocusBarCode.jsp @@ -0,0 +1,121 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/jsp/include/endCalendar.jsp b/posterita/posterita/web/jsp/include/endCalendar.jsp new file mode 100644 index 0000000000..f97c9feb9f --- /dev/null +++ b/posterita/posterita/web/jsp/include/endCalendar.jsp @@ -0,0 +1,121 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +
    + + <%@ include file="/jsp/include/posOrderBarCode.jsp" %> + + <%@ include file="/jsp/include/posOrderSearch.jsp" %> +
    +
    +
    + <%@ include file="/jsp/pos/creditOrderShoppingCart.jsp" %> +
    +
    + + + + + + + + + + + + + + +
    +
    + +
    + + + + + + + + + +
    +
    +
    +
    + <%@ include file="/jsp/include/customerInfoPanel.jsp" %> + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/creditOrderWithAdvanced.jsp b/posterita/posterita/web/jsp/include/creditOrderWithAdvanced.jsp new file mode 100644 index 0000000000..5cc0e0c83e --- /dev/null +++ b/posterita/posterita/web/jsp/include/creditOrderWithAdvanced.jsp @@ -0,0 +1,33 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> +<%@ include file="/jsp/include/creditOrderPart1FocusBarCode.jsp" %> + + + + + +<%@ include file="/jsp/include/posOrderPart2.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/include/customerInfoPanel.jsp b/posterita/posterita/web/jsp/include/customerInfoPanel.jsp new file mode 100644 index 0000000000..1c91d2e943 --- /dev/null +++ b/posterita/posterita/web/jsp/include/customerInfoPanel.jsp @@ -0,0 +1,42 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +
    + +
    +
    + +
    + +
    + +
    + + <%@ include file="/jsp/include/searchCustomerPanel.jsp" %> +
    + +
    + + +
    +
    diff --git a/posterita/posterita/web/jsp/include/customerInfoPanel2.jsp b/posterita/posterita/web/jsp/include/customerInfoPanel2.jsp new file mode 100644 index 0000000000..887aec0174 --- /dev/null +++ b/posterita/posterita/web/jsp/include/customerInfoPanel2.jsp @@ -0,0 +1,40 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +
    +Customer Info +
    +
    + +
    + +
    + +
    + + <%@ include file="/jsp/include/searchCustomerPanel.jsp" %> +
    + +
    + +
    +
    diff --git a/posterita/posterita/web/jsp/include/dateFilter.jsp b/posterita/posterita/web/jsp/include/dateFilter.jsp new file mode 100644 index 0000000000..04ee1f067f --- /dev/null +++ b/posterita/posterita/web/jsp/include/dateFilter.jsp @@ -0,0 +1,34 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author vishee +--%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +
    +   +
    +   +
    + + + + + + +
    + <%@ include file="/jsp/include/startCalendar.jsp" %> +
    + <%@ include file="/jsp/include/endCalendar.jsp" %> +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/dayList.jsp b/posterita/posterita/web/jsp/include/dayList.jsp new file mode 100644 index 0000000000..e904b5ed18 --- /dev/null +++ b/posterita/posterita/web/jsp/include/dayList.jsp @@ -0,0 +1,54 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 diff --git a/posterita/posterita/web/jsp/include/documentStatusFilter.jsp b/posterita/posterita/web/jsp/include/documentStatusFilter.jsp new file mode 100644 index 0000000000..75ddb27da9 --- /dev/null +++ b/posterita/posterita/web/jsp/include/documentStatusFilter.jsp @@ -0,0 +1,29 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@ page import="org.compiere.process.DocAction" %> + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/draftedCreditOrder.jsp b/posterita/posterita/web/jsp/include/draftedCreditOrder.jsp new file mode 100644 index 0000000000..4e59f97668 --- /dev/null +++ b/posterita/posterita/web/jsp/include/draftedCreditOrder.jsp @@ -0,0 +1,82 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + +
     
    + <% String orderlines = Constants.POS_ORDER_LINES; %> + <%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + + > +
    +
    +
    +   +
    +
    +
    + +   + +   +
    +
    + + + + + + + +
    + + + + + + + +
    +
    +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/draftedPOSOrder.jsp b/posterita/posterita/web/jsp/include/draftedPOSOrder.jsp new file mode 100644 index 0000000000..3699ff99de --- /dev/null +++ b/posterita/posterita/web/jsp/include/draftedPOSOrder.jsp @@ -0,0 +1,115 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + +
     
    +
    + + + + + + + +
    + + + + + + + + +
    +
    +
    + <% String orderlines = Constants.POS_ORDER_LINES; %> + <%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + + > +
    +
    + +
    +   +
    +
    +
    +
    + + + + +   + + + + + + +   +
    +
    + + + + + + + +
    + + + + + + + +
    +
    +
    + + + + + + + + + +
    + + + + <%@ include file="/jsp/include/dayList.jsp" %> + + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + + <%@ include file="/jsp/include/yearList.jsp" %> + + + + + + + + <%@ include file="/jsp/include/hourList.jsp" %> + + + + <%@ include file="/jsp/include/minuteList.jsp" %> + + +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/errorMsg.jsp b/posterita/posterita/web/jsp/include/errorMsg.jsp new file mode 100644 index 0000000000..244a0bc597 --- /dev/null +++ b/posterita/posterita/web/jsp/include/errorMsg.jsp @@ -0,0 +1,65 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> +
    + + + + + + +
    +
    + +
    + +
    +
    +
    +
    +
    + ERROR! +
    +
    +
    + + + + + + + +
    +
    + +
    + +
    +
    +
    +
    +
    + ERROR! +
    +
    +
    +
    + diff --git a/posterita/posterita/web/jsp/include/errors.jsp b/posterita/posterita/web/jsp/include/errors.jsp new file mode 100644 index 0000000000..f3abb3ae91 --- /dev/null +++ b/posterita/posterita/web/jsp/include/errors.jsp @@ -0,0 +1,45 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> +
    + +
    +
    + +
    + +
    +
    +
    +
    +
    + + +
    +
    + +
    +
    +
    +
    +
    +
    + diff --git a/posterita/posterita/web/jsp/include/filter.jsp b/posterita/posterita/web/jsp/include/filter.jsp new file mode 100644 index 0000000000..1708fa5495 --- /dev/null +++ b/posterita/posterita/web/jsp/include/filter.jsp @@ -0,0 +1,91 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +
    + :   + + + + + + + + +
    +   + + + + <%@include file="/jsp/include/month.jsp"%> + + + + + <% + int currentYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR); + %> + <%= currentYear %> + <%= currentYear - 1 %> + + + + + + + + + + + + + + + +
    +   +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/footerTableBottom1.jsp b/posterita/posterita/web/jsp/include/footerTableBottom1.jsp new file mode 100644 index 0000000000..e502929fe0 --- /dev/null +++ b/posterita/posterita/web/jsp/include/footerTableBottom1.jsp @@ -0,0 +1,77 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + + + +<%-- start tablebottom.jsp --%> + +   + + + + + +<%-- end tablebottom.jsp --%> + + + + + + + + + + + + + + + +<%-- start footer.jsp --%> + + + + + + + + + + + + + + + +
    +   + +
    + + + + + +<%-- end footer.jsp --%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/historyMonthYearFilter.jsp b/posterita/posterita/web/jsp/include/historyMonthYearFilter.jsp new file mode 100644 index 0000000000..1bb10bf671 --- /dev/null +++ b/posterita/posterita/web/jsp/include/historyMonthYearFilter.jsp @@ -0,0 +1,41 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + <%@include file="/jsp/include/month.jsp"%> + + + + + + + <% + int currentYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR); + %> + <%= currentYear %> + <%= currentYear - 1 %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/historyfilter.jsp b/posterita/posterita/web/jsp/include/historyfilter.jsp new file mode 100644 index 0000000000..2173b2a87e --- /dev/null +++ b/posterita/posterita/web/jsp/include/historyfilter.jsp @@ -0,0 +1,62 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + +
    + :   + + + + +
    +   + + + + <%@include file="/jsp/include/month.jsp"%> + + + + + <% + int currentYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR); + %> + <%= currentYear %> + <%= currentYear - 1 %> + +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/hourList.jsp b/posterita/posterita/web/jsp/include/hourList.jsp new file mode 100644 index 0000000000..bf722aef1d --- /dev/null +++ b/posterita/posterita/web/jsp/include/hourList.jsp @@ -0,0 +1,47 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + 00 + 01 + 02 + 03 + 04 + 05 + 06 + 07 + 08 + 09 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/minuteList.jsp b/posterita/posterita/web/jsp/include/minuteList.jsp new file mode 100644 index 0000000000..b275b57463 --- /dev/null +++ b/posterita/posterita/web/jsp/include/minuteList.jsp @@ -0,0 +1,82 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + 00 + 01 + 02 + 03 + 04 + 05 + 06 + 07 + 08 + 09 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/month.jsp b/posterita/posterita/web/jsp/include/month.jsp new file mode 100644 index 0000000000..ab3bb9c990 --- /dev/null +++ b/posterita/posterita/web/jsp/include/month.jsp @@ -0,0 +1,34 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/monthList.jsp b/posterita/posterita/web/jsp/include/monthList.jsp new file mode 100644 index 0000000000..f4f1b28c35 --- /dev/null +++ b/posterita/posterita/web/jsp/include/monthList.jsp @@ -0,0 +1,23 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ include file="/jsp/include/month.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/pager.jsp b/posterita/posterita/web/jsp/include/pager.jsp new file mode 100644 index 0000000000..7e5cb59cd5 --- /dev/null +++ b/posterita/posterita/web/jsp/include/pager.jsp @@ -0,0 +1,142 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.core.businesslogic.ElementManager" %> +<%@ page import="org.posterita.core.bean.ElementBean" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<% +int firstOffset = 0; +int lastOffset = 0; +int currentOffset = Integer.parseInt(offset); +int previousOffset = currentOffset - Integer.parseInt(length); +int nextOffset = currentOffset + Integer.parseInt(length); + +boolean isFirst = (currentOffset == 0); +boolean isLast = ((currentOffset + Integer.parseInt(length)) >= recordSize.intValue()); + +ElementBean elementBean = null; + +if(url.indexOf("?") != -1) +{ + url = url + "&"; +} +else +{ + url = url + "?"; +} +%> +
    +
    + + + + + +
    +<% +if(!isFirst){ + out.print("
    "); + out.print(ElementManager.getMsg(ctx, "prev").getName()); + out.print(""); +} +int len = Integer.parseInt(length); + +lastOffset = recordSize.intValue() - (recordSize.intValue() % len); +int b = currentOffset/len + 1; +int d = lastOffset/len; + +if((recordSize.intValue() % len) != 0) +{ + d = d + 1; +} + +b = (b < 1) ? 1 : b; + +int a = b - 2; +int c = b + 2; + +a = (a < 1) ? 1 : a; +c = (c < d) ? c : d; + + + +if(Integer.parseInt(length) != recordSize.intValue()) +{ + if(recordSize.intValue() > len) + { + + for(int i= a ; i < b ; i++) + { + out.print("" + i + " "); + } + + out.print(b + " "); + + for(int j= b+1 ; j < c+1 ; j++) + { + out.print("" + j + " "); + } + } + + out.print("
    "); + + if(recordSize.intValue() > len){ + out.print(""); + } + + + if(!isLast){ + out.print(""); + } + + +} +else +{ + out.print(""); + out.print(ElementManager.getMsg(ctx, "switch.to.paging").getName()); + out.print(""); +} + +%> +
    +
    +
    + diff --git a/posterita/posterita/web/jsp/include/paymentRuleFilter.jsp b/posterita/posterita/web/jsp/include/paymentRuleFilter.jsp new file mode 100644 index 0000000000..d87b5efa0a --- /dev/null +++ b/posterita/posterita/web/jsp/include/paymentRuleFilter.jsp @@ -0,0 +1,29 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/paymentTermsDetails.jsp b/posterita/posterita/web/jsp/include/paymentTermsDetails.jsp new file mode 100644 index 0000000000..73c7fb3038 --- /dev/null +++ b/posterita/posterita/web/jsp/include/paymentTermsDetails.jsp @@ -0,0 +1,135 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + * + + + + + + + + + + + + * + + + + + + + + + + + + + + + + + + * + + + + + + + + + * + + + + + + + + * + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/pinPanel.jsp b/posterita/posterita/web/jsp/include/pinPanel.jsp new file mode 100644 index 0000000000..82bac39197 --- /dev/null +++ b/posterita/posterita/web/jsp/include/pinPanel.jsp @@ -0,0 +1,49 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +
    +
    + + + + + + + + + + +
    + +
    +
    + +
    +
    +
    + + +
    +
    +
    +
    diff --git a/posterita/posterita/web/jsp/include/posFooter.jsp b/posterita/posterita/web/jsp/include/posFooter.jsp new file mode 100644 index 0000000000..fd418278bb --- /dev/null +++ b/posterita/posterita/web/jsp/include/posFooter.jsp @@ -0,0 +1,66 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + +
    + + + +
    + + + +
    +
    + + + diff --git a/posterita/posterita/web/jsp/include/posHeader.jsp b/posterita/posterita/web/jsp/include/posHeader.jsp new file mode 100644 index 0000000000..91e96b77ff --- /dev/null +++ b/posterita/posterita/web/jsp/include/posHeader.jsp @@ -0,0 +1,255 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.compiere.model.MRole" %> +<%@ page import="java.util.Properties" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> +<%@ page import="org.compiere.util.Env" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + + + + + + + + + + + + + + + + + + +<% +response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 +response.setHeader("Cache-Control","no-store"); //HTTP 1.1 +response.setHeader("Pragma","no-cache"); //HTTP 1.0 +response.setDateHeader ("Expires", 0); //prevents caching at the proxy server + +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +Properties ctx = TmkJSPEnv.getCtx(request); +String posName = POSTerminalManager.getTerminalName(ctx); +String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); +String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); +Integer userId = new Integer(Env.getAD_User_ID(ctx)); +String version = UdiConstants.POS_VERSION; +String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); +boolean isTerminalLocked = POSTerminalManager.isTerminalLocked(ctx); + +if (isTerminalLocked) +{ + posName += " (Locked)"; +} +%> + +<%-- + + + +--%> + + + + + <% + if (displayCookie != null && displayCookie.getValue() != null) + { + displayPageSize = displayCookie.getValue().toString(); + } + %> + +<% + Integer pageSize = new Integer(displayPageSize); +%> + + +<%@page import="org.posterita.struts.login.GoToHomePageAction"%> +<%@page import="org.compiere.model.MStore"%> +<%@page import="org.posterita.businesslogic.StoreManager"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + +
    +
    +
    + +
    + +
    +
    +
    + : + <%=orgName%> +
    +
    + : + <%=posName%> +
    +
    +
    +
    + : + +
    +
    + : + <%=roleName%> +
    +
    +
    +
    +
    +
    +
    +
    + + + + + "> + + +
    +
    +
    +
    + + + + +
    + + + +
    +
    + + + + + +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posHeader2.jsp b/posterita/posterita/web/jsp/include/posHeader2.jsp new file mode 100644 index 0000000000..57d1c059be --- /dev/null +++ b/posterita/posterita/web/jsp/include/posHeader2.jsp @@ -0,0 +1,255 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.compiere.model.MRole" %> +<%@ page import="java.util.Properties" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> +<%@ page import="org.compiere.util.Env" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + + + + + + + + + + + + + + + + + + +<% +response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 +response.setHeader("Cache-Control","no-store"); //HTTP 1.1 +response.setHeader("Pragma","no-cache"); //HTTP 1.0 +response.setDateHeader ("Expires", 0); //prevents caching at the proxy server + +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +Properties ctx = TmkJSPEnv.getCtx(request); +String posName = POSTerminalManager.getTerminalName(ctx); +String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); +String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); +Integer userId = new Integer(Env.getAD_User_ID(ctx)); +String version = UdiConstants.POS_VERSION; +String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); +boolean isTerminalLocked = POSTerminalManager.isTerminalLocked(ctx); + +if (isTerminalLocked) +{ + posName += " (Locked)"; +} +%> + +<%-- + + + +--%> + + + + + <% + if (displayCookie != null && displayCookie.getValue() != null) + { + displayPageSize = displayCookie.getValue().toString(); + } + %> + +<% + Integer pageSize = new Integer(displayPageSize); +%> + + +<%@page import="org.posterita.struts.login.GoToHomePageAction"%> +<%@page import="org.compiere.model.MStore"%> +<%@page import="org.posterita.businesslogic.StoreManager"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + + + +
    + + + + + +
    +
    + + + + + +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posHeaderAdministration.jsp b/posterita/posterita/web/jsp/include/posHeaderAdministration.jsp new file mode 100644 index 0000000000..00861d8ef5 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posHeaderAdministration.jsp @@ -0,0 +1,278 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.compiere.model.MRole" %> +<%@ page import="java.util.Properties" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> +<%@ page import="org.compiere.util.Env" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + + + + + + + + + + + + + + + + + + + + +<% +response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 +response.setHeader("Cache-Control","no-store"); //HTTP 1.1 +response.setHeader("Pragma","no-cache"); //HTTP 1.0 +response.setDateHeader ("Expires", 0); //prevents caching at the proxy server + +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +Properties ctx = TmkJSPEnv.getCtx(request); +String posName = POSTerminalManager.getTerminalName(ctx); +String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); +String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); +Integer userId = new Integer(Env.getAD_User_ID(ctx)); +String version = UdiConstants.POS_VERSION; +String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); +boolean isTerminalLocked = POSTerminalManager.isTerminalLocked(ctx); + +if (isTerminalLocked) +{ + posName += " (Locked)"; +} +%> + +<%-- + + + +--%> + + + + + <% + if (displayCookie != null && displayCookie.getValue() != null) + { + displayPageSize = displayCookie.getValue().toString(); + } + %> + +<% + Integer pageSize = new Integer(displayPageSize); +%> + + +<%@page import="org.posterita.struts.login.GoToHomePageAction"%> +<%@page import="org.compiere.model.MStore"%> +<%@page import="org.posterita.businesslogic.StoreManager"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + +
    +
    +
    + +
    + +
    +
    +
    + + + + + "> + + +
    +
    +
    +
    + : + <%=orgName%> +
    +
    + : + <%=posName%> +
    +
    +
    +
    + : + +
    +
    + : + <%=roleName%> +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + +
    + + + +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posHistoryFilter.jsp b/posterita/posterita/web/jsp/include/posHistoryFilter.jsp new file mode 100644 index 0000000000..8b60e5c20d --- /dev/null +++ b/posterita/posterita/web/jsp/include/posHistoryFilter.jsp @@ -0,0 +1,92 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + <%@include file="/jsp/include/documentStatusFilter.jsp"%> + + + + <%@ include file="/jsp/include/historyMonthYearFilter.jsp"%> + + + + + + + + + + + + + + + + + + <%@include file="/jsp/include/paymentRuleFilter.jsp"%> + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posHistoryFilter2.jsp b/posterita/posterita/web/jsp/include/posHistoryFilter2.jsp new file mode 100644 index 0000000000..af6feccf5e --- /dev/null +++ b/posterita/posterita/web/jsp/include/posHistoryFilter2.jsp @@ -0,0 +1,75 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + <%@include file="/jsp/include/documentStatusFilter.jsp"%> + + + + <%@ include file="/jsp/include/historyMonthYearFilter.jsp"%> + + + + + + + <%@include file="/jsp/include/paymentRuleFilter.jsp"%> + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posOrder.jsp b/posterita/posterita/web/jsp/include/posOrder.jsp new file mode 100644 index 0000000000..f1f8103c13 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrder.jsp @@ -0,0 +1,27 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> +<%@ include file="/jsp/include/posOrderPart1FocusBarCode.jsp" %> + +<%@ include file="/jsp/include/posOrderPart2.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/include/posOrderBarCode.jsp b/posterita/posterita/web/jsp/include/posOrderBarCode.jsp new file mode 100644 index 0000000000..49e69c8584 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderBarCode.jsp @@ -0,0 +1,43 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + <%-- +   + + --%> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posOrderFocusBarCode.jsp b/posterita/posterita/web/jsp/include/posOrderFocusBarCode.jsp new file mode 100644 index 0000000000..6a61f1d2d4 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderFocusBarCode.jsp @@ -0,0 +1,29 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ include file="/jsp/include/posOrderPart1.jsp" %> + +<%@ include file="/jsp/include/posOrderPart2.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/include/posOrderFocusSearch.jsp b/posterita/posterita/web/jsp/include/posOrderFocusSearch.jsp new file mode 100644 index 0000000000..6a61f1d2d4 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderFocusSearch.jsp @@ -0,0 +1,29 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ include file="/jsp/include/posOrderPart1.jsp" %> + +<%@ include file="/jsp/include/posOrderPart2.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/include/posOrderPart1.jsp b/posterita/posterita/web/jsp/include/posOrderPart1.jsp new file mode 100644 index 0000000000..d4469468d9 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderPart1.jsp @@ -0,0 +1,101 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + + + + + + + + + <%@ include file="/jsp/include/tablebottom.jsp" %> + + + +
    + + + + + + + + + + + + + + + + + +
    + + + + + + + + + +   +
    + + +
    + <%@ include file="/jsp/include/searchProductPanel.jsp" %> +
    +
     
    +
    +
    + <%@ include file="/jsp/pos/posShoppingCartFirstPage.jsp" %> +
    +
    + + + + + + +<%@ include file="/jsp/include/footer.jsp" %> + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/forgot.jsp b/posterita/posterita/web/jsp/login/forgot.jsp new file mode 100644 index 0000000000..9f44eb94c5 --- /dev/null +++ b/posterita/posterita/web/jsp/login/forgot.jsp @@ -0,0 +1,103 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ page import="org.posterita.Constants" %> + + + + +Welcome to Posterita + + + + + + +
    + <%@ include file="/jsp/include/tenderPanel.jsp" %> + + <%@ include file="/jsp/include/customerInfoPanel.jsp" %> + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posOrderPart1FocusBarCode.jsp b/posterita/posterita/web/jsp/include/posOrderPart1FocusBarCode.jsp new file mode 100644 index 0000000000..c0177aaceb --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderPart1FocusBarCode.jsp @@ -0,0 +1,70 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + + + + + + + + + + +
    +   +
    + + + + + + + + + + + +<%@ include file="/jsp/include/footer.jsp" %> + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/chooseUser.jsp b/posterita/posterita/web/jsp/login/chooseUser.jsp new file mode 100644 index 0000000000..ecfaf15005 --- /dev/null +++ b/posterita/posterita/web/jsp/login/chooseUser.jsp @@ -0,0 +1,119 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.OrgUsersBean"%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + + + + + + +<%@ include file="/jsp/include/tablebottom.jsp" %> + + + +
    + + <%@ include file="/jsp/include/posOrderBarCode.jsp" %> + + <%@ include file="/jsp/include/posOrderSearch.jsp" %> +
    +
    +
    + <%@ include file="/jsp/pos/posShoppingCartFirstPage.jsp" %> +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posOrderWithAdvanced.jsp b/posterita/posterita/web/jsp/include/posOrderWithAdvanced.jsp new file mode 100644 index 0000000000..43b61a5dc7 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderWithAdvanced.jsp @@ -0,0 +1,97 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%--<%@ include file="/jsp/include/posOrderPart1FocusBarCode.jsp"%>--%> + + + + + + + + + + + + +
    + <%@ include file="/jsp/include/tenderPanel.jsp" %> + + <%@ include file="/jsp/include/customerInfoPanel.jsp" %> + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posOrderPart1FocusSearch.jsp b/posterita/posterita/web/jsp/include/posOrderPart1FocusSearch.jsp new file mode 100644 index 0000000000..271910ce5e --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderPart1FocusSearch.jsp @@ -0,0 +1,61 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + +
    +   +
    + + + + + + + + + + + + + + + + + + +
    + + <%@ include file="/jsp/include/posOrderSearch.jsp" %> + + <%@ include file="/jsp/include/posOrderBarCode.jsp" %> +
    +
    +
    + <%@ include file="/jsp/pos/posShoppingCartFirstPage.jsp" %> +
    +
    + + + + + + +
    + <%@ include file="/jsp/include/tenderPanel.jsp" %> + + <%@ include file="/jsp/include/customerInfoPanel.jsp" %> + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posOrderPart2.jsp b/posterita/posterita/web/jsp/include/posOrderPart2.jsp new file mode 100644 index 0000000000..8ea0225c14 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderPart2.jsp @@ -0,0 +1,85 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +
    +   +
    +
    +
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/posterita/posterita/web/jsp/include/posOrderSearch.jsp b/posterita/posterita/web/jsp/include/posOrderSearch.jsp new file mode 100644 index 0000000000..54e2ed7da8 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderSearch.jsp @@ -0,0 +1,35 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Preveen +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +
    + + +
    + <%@ include file="/jsp/include/searchProductPanel.jsp" %> +
    +
     
    + + + + + <%@ include file="/jsp/include/tablebottom.jsp" %> + + + +
    + + + + + + + + +
    + + <%@ include file="/jsp/include/posOrderBarCode.jsp" %> + + <%@ include file="/jsp/include/posOrderSearch.jsp" %> +
    +
    +
    + <%@ include file="/jsp/pos/posShoppingCartFirstPage.jsp" %> +
    +
    +
    + + + + + + + + + + + + + + + + + +
    + <%@ include file="/jsp/include/customerInfoPanel.jsp" %> +
    + <%@ include file="/jsp/include/tenderPanel.jsp" %> +
    + + + + + + + + +<%-- + + + +--%> +<%@ include file="/jsp/include/posOrderPart2.jsp"%> + + + diff --git a/posterita/posterita/web/jsp/include/posOrderWithAdvancedFocusSearch.jsp b/posterita/posterita/web/jsp/include/posOrderWithAdvancedFocusSearch.jsp new file mode 100644 index 0000000000..70ef35d89a --- /dev/null +++ b/posterita/posterita/web/jsp/include/posOrderWithAdvancedFocusSearch.jsp @@ -0,0 +1,39 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ include file="/jsp/include/posOrderPart1FocusSearch.jsp" %> + + + + + + + + +<%@ include file="/jsp/include/posOrderPart2.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/include/posPaymentDetails.jsp b/posterita/posterita/web/jsp/include/posPaymentDetails.jsp new file mode 100644 index 0000000000..25f8e8fa42 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posPaymentDetails.jsp @@ -0,0 +1,307 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> +<%@ page import="org.posterita.form.OrderLineForm" %> +<%@ page import="org.posterita.form.OrderLineForm" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@ page import="java.text.DecimalFormat" %> + +
    +   +
    + <%@ include file="/jsp/include/pinPanel.jsp"%> +
    +   +
    + <%@ include file="/jsp/include/pinPanel.jsp" %> +
    +   +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + <% + String defaultDiscount = "0"; + String defaultPrice = element.getPrice().toString(); + + OrderLineForm form = (OrderLineForm)request.getAttribute("OrderLineForm"); + + if(form!=null) + { + String[] discountPercentage = form.getDiscountPercent(); + String[] actualPrice = form.getActualPrice(); + + if(discountPercentage!= null) + if(discountPercentage.length!=0) + defaultDiscount = discountPercentage[count.intValue()].toString(); + + if(actualPrice!=null) + if(actualPrice.length!=0) + defaultPrice = actualPrice[count.intValue()]; + + } + %> + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + "/> + + + + + +
    + + + + + + + +   + +
    + +
    +
     
    +
    +
    +
     
    + + + + + + + + + + +
    + +   + + + +   + + + +   + + + +   + +
    +
     
    + + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
     
    + "> + + +
    + +   + +
     
    + + + + + + + + +
    + + + + + + + + + +
    +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/posPaymentDetails2.jsp b/posterita/posterita/web/jsp/include/posPaymentDetails2.jsp new file mode 100644 index 0000000000..bbb373f776 --- /dev/null +++ b/posterita/posterita/web/jsp/include/posPaymentDetails2.jsp @@ -0,0 +1,307 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> +<%@ page import="org.posterita.form.OrderLineForm" %> +<%@ page import="java.text.DecimalFormat" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + <% + String defaultDiscount = "0"; + String defaultPrice = element.getPrice().toString(); + DecimalFormat df = new DecimalFormat("0.00"); + + OrderLineForm form = (OrderLineForm)request.getAttribute("OrderLineForm"); + + if(form!=null) + { + String[] discountPercentage = form.getDiscountPercent(); + String[] actualPrice = form.getActualPrice(); + + if(discountPercentage!= null) + if(discountPercentage.length!=0) + defaultDiscount = discountPercentage[count.intValue()].toString(); + + if(actualPrice!=null) + if(actualPrice.length!=0) + defaultPrice = actualPrice[count.intValue()]; + + } + %> + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + "/> + + + + + +
    + + + + + + + +   + +
    + +
    +
     
    +
    +
    +
     
    + + + + + + + + + + +
    + +   + + + +   + + + +   + + + +   + +
    +
     
    + + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
     
    + "> + + +
    + +   + +
     
    + + + + + + + + +
    + + + + + + + + + +
    +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/printOrderApplet.jsp b/posterita/posterita/web/jsp/include/printOrderApplet.jsp new file mode 100644 index 0000000000..58d15a10a6 --- /dev/null +++ b/posterita/posterita/web/jsp/include/printOrderApplet.jsp @@ -0,0 +1,45 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + +
    + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> +
    + +
    +
    diff --git a/posterita/posterita/web/jsp/include/printOrderApplet2.jsp b/posterita/posterita/web/jsp/include/printOrderApplet2.jsp new file mode 100644 index 0000000000..cbc67db52d --- /dev/null +++ b/posterita/posterita/web/jsp/include/printOrderApplet2.jsp @@ -0,0 +1,77 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + +
    + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> +
    + +
    +
    + + + + + + + + + + diff --git a/posterita/posterita/web/jsp/include/searchCustomerPanel.jsp b/posterita/posterita/web/jsp/include/searchCustomerPanel.jsp new file mode 100644 index 0000000000..7bf12ce13c --- /dev/null +++ b/posterita/posterita/web/jsp/include/searchCustomerPanel.jsp @@ -0,0 +1,25 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/searchCustomerPanel2.jsp b/posterita/posterita/web/jsp/include/searchCustomerPanel2.jsp new file mode 100644 index 0000000000..10118c73ca --- /dev/null +++ b/posterita/posterita/web/jsp/include/searchCustomerPanel2.jsp @@ -0,0 +1,26 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/searchProductPanel.jsp b/posterita/posterita/web/jsp/include/searchProductPanel.jsp new file mode 100644 index 0000000000..e93c7d5246 --- /dev/null +++ b/posterita/posterita/web/jsp/include/searchProductPanel.jsp @@ -0,0 +1,89 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<% + String minChars = "1"; +%> + + + + + <% + if (minCharsCookie.getValue() != null || !minCharsCookie.getValue().equals("")) + minChars = minCharsCookie.getValue(); + %> + + + + + + + +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/searchProductPanel2.jsp b/posterita/posterita/web/jsp/include/searchProductPanel2.jsp new file mode 100644 index 0000000000..ed37034acc --- /dev/null +++ b/posterita/posterita/web/jsp/include/searchProductPanel2.jsp @@ -0,0 +1,65 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<% + String minChars = "1"; +%> + + + + + <% + if (minCharsCookie.getValue() != null || !minCharsCookie.getValue().equals("")) + minChars = minCharsCookie.getValue(); + %> + + + + +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/searchProductPanel3.jsp b/posterita/posterita/web/jsp/include/searchProductPanel3.jsp new file mode 100644 index 0000000000..fadf0d66c5 --- /dev/null +++ b/posterita/posterita/web/jsp/include/searchProductPanel3.jsp @@ -0,0 +1,89 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Sendy +--%> + +<%@page import="org.posterita.Constants"%> +<% + String minChars = "1"; +%> + + + + + <% + if (minCharsCookie.getValue() != null || !minCharsCookie.getValue().equals("")) + minChars = minCharsCookie.getValue(); + %> + + + + + + + +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/searchVendorPanel.jsp b/posterita/posterita/web/jsp/include/searchVendorPanel.jsp new file mode 100644 index 0000000000..2ca0b561c7 --- /dev/null +++ b/posterita/posterita/web/jsp/include/searchVendorPanel.jsp @@ -0,0 +1,46 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/searchVendorPanel2.jsp b/posterita/posterita/web/jsp/include/searchVendorPanel2.jsp new file mode 100644 index 0000000000..e90289b7e7 --- /dev/null +++ b/posterita/posterita/web/jsp/include/searchVendorPanel2.jsp @@ -0,0 +1,20 @@ + +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/showErrors.jsp b/posterita/posterita/web/jsp/include/showErrors.jsp new file mode 100644 index 0000000000..fa72d6c051 --- /dev/null +++ b/posterita/posterita/web/jsp/include/showErrors.jsp @@ -0,0 +1,34 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + + + + + diff --git a/posterita/posterita/web/jsp/include/startCalendar.jsp b/posterita/posterita/web/jsp/include/startCalendar.jsp new file mode 100644 index 0000000000..1ba7baef55 --- /dev/null +++ b/posterita/posterita/web/jsp/include/startCalendar.jsp @@ -0,0 +1,66 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + + + + + + + + + +
    + + + + <%@ include file="/jsp/include/dayList.jsp" %> + + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + + <%@ include file="/jsp/include/yearList.jsp" %> + + + + + + + + <%@ include file="/jsp/include/hourList.jsp" %> + + + + <%@ include file="/jsp/include/minuteList.jsp" %> + + +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/success.jsp b/posterita/posterita/web/jsp/include/success.jsp new file mode 100644 index 0000000000..8b4a4df7cf --- /dev/null +++ b/posterita/posterita/web/jsp/include/success.jsp @@ -0,0 +1,34 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Servansingh +--%> +
    + +
    + +
    + +
    +
    +
    +
    +
    +
    + diff --git a/posterita/posterita/web/jsp/include/tabBottom.jsp b/posterita/posterita/web/jsp/include/tabBottom.jsp new file mode 100644 index 0000000000..8842fd4508 --- /dev/null +++ b/posterita/posterita/web/jsp/include/tabBottom.jsp @@ -0,0 +1,24 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author tamak +--%> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/tabTop.jsp b/posterita/posterita/web/jsp/include/tabTop.jsp new file mode 100644 index 0000000000..ba2f13906b --- /dev/null +++ b/posterita/posterita/web/jsp/include/tabTop.jsp @@ -0,0 +1,25 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author vishee +--%> + + +
    + diff --git a/posterita/posterita/web/jsp/include/tabTop_big.jsp b/posterita/posterita/web/jsp/include/tabTop_big.jsp new file mode 100644 index 0000000000..89f05a0c11 --- /dev/null +++ b/posterita/posterita/web/jsp/include/tabTop_big.jsp @@ -0,0 +1,27 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author vishee +--%> + + + + + + + + + + + + + + + + +
      \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/tablebottom.jsp b/posterita/posterita/web/jsp/include/tablebottom.jsp new file mode 100644 index 0000000000..6f5a7955c2 --- /dev/null +++ b/posterita/posterita/web/jsp/include/tablebottom.jsp @@ -0,0 +1,37 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author vishee +--%> + + + +  
         
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/taxDetails.jsp b/posterita/posterita/web/jsp/include/taxDetails.jsp new file mode 100644 index 0000000000..a1a1752c70 --- /dev/null +++ b/posterita/posterita/web/jsp/include/taxDetails.jsp @@ -0,0 +1,84 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + * + + +
    + * + + +
    + + + +
    + + + +
    + * + + + + +
      + +   + +  
    diff --git a/posterita/posterita/web/jsp/include/tenderPanel.jsp b/posterita/posterita/web/jsp/include/tenderPanel.jsp new file mode 100644 index 0000000000..4fd5f3472d --- /dev/null +++ b/posterita/posterita/web/jsp/include/tenderPanel.jsp @@ -0,0 +1,126 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +
    + +
    + + + + + + + +
    + + + + + + + + +
    +   + +   + +   +
    +
    + + + + + + + + + + + + + + + + + + + + +
     
    +
    +
    +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/include/tenderPanel2.jsp b/posterita/posterita/web/jsp/include/tenderPanel2.jsp new file mode 100644 index 0000000000..6aa589c32b --- /dev/null +++ b/posterita/posterita/web/jsp/include/tenderPanel2.jsp @@ -0,0 +1,116 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +
    + Tender +
    + + + + + + + +
    + + + + + + +
    +   + +   +
    +
    + + + + + + + + + + + + + + +
    +
    +
    +
    + diff --git a/posterita/posterita/web/jsp/include/vendorInfoPanel.jsp b/posterita/posterita/web/jsp/include/vendorInfoPanel.jsp new file mode 100644 index 0000000000..cad6ceb7d1 --- /dev/null +++ b/posterita/posterita/web/jsp/include/vendorInfoPanel.jsp @@ -0,0 +1,47 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +
    + +
    +
    + +
    + +
    + +
    + + <%@ include file="/jsp/include/searchVendorPanel2.jsp" %> +
    + +
    +
    + diff --git a/posterita/posterita/web/jsp/include/year.jsp b/posterita/posterita/web/jsp/include/year.jsp new file mode 100644 index 0000000000..388537a45f --- /dev/null +++ b/posterita/posterita/web/jsp/include/year.jsp @@ -0,0 +1,39 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<% +java.util.Calendar c = java.util.Calendar.getInstance(); +int curYear = c.get(java.util.Calendar.YEAR); +curYear = curYear - 57; +%> +<% + for(int i=0;i<=57;i++) + { +%> + <%=curYear + i%> +<% + } +%> + + + diff --git a/posterita/posterita/web/jsp/include/yearList.jsp b/posterita/posterita/web/jsp/include/yearList.jsp new file mode 100644 index 0000000000..3c2dcf2ae5 --- /dev/null +++ b/posterita/posterita/web/jsp/include/yearList.jsp @@ -0,0 +1,36 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<% +java.util.Calendar c = java.util.Calendar.getInstance(); +int curYear = c.get(java.util.Calendar.YEAR); +%> + + +<%=curYear-1%> +<%=curYear%> +<%=curYear+1%> +<%=curYear+2%> +<%=curYear+3%> +<%=curYear+4%> +<%=curYear+5%> diff --git a/posterita/posterita/web/jsp/invoice/webstoreInvoice.jsp b/posterita/posterita/web/jsp/invoice/webstoreInvoice.jsp new file mode 100644 index 0000000000..cb0363b33d --- /dev/null +++ b/posterita/posterita/web/jsp/invoice/webstoreInvoice.jsp @@ -0,0 +1,126 @@ + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.stock.StockAction" %> + +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.beans.OrderLineBean" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> + +Invoice + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + +
    + Order Ref No: + "> + + + +
    + Invoice Ref No: +
    + Doc Status: + +
    +
    +
    + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameQtyPriceVATTotal
    + + + + + + + + + + + +
    + + + + + + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/chooseApplication.jsp b/posterita/posterita/web/jsp/login/chooseApplication.jsp new file mode 100644 index 0000000000..2e61c7f045 --- /dev/null +++ b/posterita/posterita/web/jsp/login/chooseApplication.jsp @@ -0,0 +1,246 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@ page import="org.posterita.Constants" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +%> + + + + + Welcome to Posterita + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    Posterita POS
    +
    +
    +
    +
    +
    + Choose your +
    + POS APPLICATION +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +

    Recent News

    +
    + + +
    +
    + +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Help us better Posterita POS

    +
    +
    + We are constantly trying to improve the product, and we are interested to hear from you. There are several ways you can help us. + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Donate

    +
    +
    + If you find this software helpful, kindly donate and help us support it.

    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + +
    +
      + +
    • + + + +
    • +
      +
    +
    +
    +
    +
    + +
    +
    + + + +
    +
    +
    +
    + +
    +
    + + diff --git a/posterita/posterita/web/jsp/login/chooseRole.jsp b/posterita/posterita/web/jsp/login/chooseRole.jsp new file mode 100644 index 0000000000..5e079f61e7 --- /dev/null +++ b/posterita/posterita/web/jsp/login/chooseRole.jsp @@ -0,0 +1,136 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + +
    + + + + + + + + + +
    +

    + +

    +
    +

    + +

    +
    + + + + + +
    + + + + + + + + + + + +
    + + Please choose an Organisation and a Role + +
    + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + +
    +   +
    Organisation + + + +
    Role + + + +
    + + + +
    +
    +
    + + + +
    +
    +
    +
    +

    + +

    + + + + <% + if ((count.intValue()%4) == 0) + { + + %> + + + <% + } + %> + + + + <% + if ((count.intValue()%4-4) == 0) + { + + %> + + + <% + } + %> + + +
    + + + + + + + + + + + + +
    + +
    +
    + + + +     " styleClass="submenu"> + + +
    + +
    + +
     
    +
    +
    +
    +
    + + + + + + + + + + + + +
    + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/forgot1.jsp b/posterita/posterita/web/jsp/login/forgot1.jsp new file mode 100644 index 0000000000..3d04546b1c --- /dev/null +++ b/posterita/posterita/web/jsp/login/forgot1.jsp @@ -0,0 +1,87 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + + + +
    +

    + + + + + +
    + + + + + +
    + + + + +
    +
    + +
      + +
    • +
      +
    +
    +
    +
    + + + + + + + + + + + + + + + +



      + +

    +
    +
    +
    +
    + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/home.jsp b/posterita/posterita/web/jsp/login/home.jsp new file mode 100644 index 0000000000..caa41ed53f --- /dev/null +++ b/posterita/posterita/web/jsp/login/home.jsp @@ -0,0 +1,100 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + +
    + + + + + + + + + +
    +

    + +

    +
    +

    + +

    +
    + + + + + +
    + + + + + + + + +
    + + <%@ include file="/jsp/include/errors.jsp" %> + + + + <%@ include file="/jsp/login/loginForm.jsp" %> + + +
    + + + +
    +
    +
    + + +<%@ include file="/jsp/include/footer.jsp" %> + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/index.jsp b/posterita/posterita/web/jsp/login/index.jsp new file mode 100644 index 0000000000..5f5c4a3a3d --- /dev/null +++ b/posterita/posterita/web/jsp/login/index.jsp @@ -0,0 +1,93 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> + + + + + + + <bean:message key="login.home.title"/> + + + <%@ include file="/js/enableButton.js" %> + + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + + + + + +
    + + + +
    + + + + +
    + All Content © 2007 Posterita Ltd +
    + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/loginForm.jsp b/posterita/posterita/web/jsp/login/loginForm.jsp new file mode 100644 index 0000000000..3cf611275f --- /dev/null +++ b/posterita/posterita/web/jsp/login/loginForm.jsp @@ -0,0 +1,56 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + + +
    +
    +
    + + + + + + + + + + + + + + + + +
    + +
    + + + + +
    + diff --git a/posterita/posterita/web/jsp/login/logout.jsp b/posterita/posterita/web/jsp/login/logout.jsp new file mode 100644 index 0000000000..54328db6dd --- /dev/null +++ b/posterita/posterita/web/jsp/login/logout.jsp @@ -0,0 +1,61 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + + + + + + + + +
    + +
    + + <%@ include file="/jsp/login/loginForm.jsp" %> +
    + + + + <%@ include file="/jsp/include/tshirtFooter.jsp"%> + + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/maintenance.jsp b/posterita/posterita/web/jsp/login/maintenance.jsp new file mode 100644 index 0000000000..2acf6aaccb --- /dev/null +++ b/posterita/posterita/web/jsp/login/maintenance.jsp @@ -0,0 +1,89 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> + + + + + + + <bean:message key="login.home.title"/> + + + <%@ include file="/js/enableButton.js" %> + + + + + +
    + + + + +
    +
    + + + + +
    + + + + + + + + +
    +
    +
    +
    + + + + + +
    + This Server is Down for Maintenance
    + We will be back shortly
    + Thank You! +
    +
    +
    + +

    All Content © 2007 Posterita Ltd

    +
    +
    +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/password.jsp b/posterita/posterita/web/jsp/login/password.jsp new file mode 100644 index 0000000000..3f5d92f02b --- /dev/null +++ b/posterita/posterita/web/jsp/login/password.jsp @@ -0,0 +1,103 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + + + + + + + +

    + + + + + +
    + + + + +
    + + + + +
    +
    + +
      + +
    • +
      +
    +
    +
    +
    + + + + + + + + +
    + + + +
    + +
    +
    + + + <%@ include file="/jsp/include/tablebottom.jsp" %> + + + + + + +<%@ include file="/jsp/include/footer.jsp" %> + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/login/posLogin.html b/posterita/posterita/web/jsp/login/posLogin.html new file mode 100644 index 0000000000..3348c9581e --- /dev/null +++ b/posterita/posterita/web/jsp/login/posLogin.html @@ -0,0 +1,81 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + + +Welcome to Tamak POS + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/jsp/login/success.jsp b/posterita/posterita/web/jsp/login/success.jsp new file mode 100644 index 0000000000..7780af7344 --- /dev/null +++ b/posterita/posterita/web/jsp/login/success.jsp @@ -0,0 +1,121 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    + + + +
    +


    +
    +
    + + + + + + + + + + + +
    + + + + + + + + + + + + + + +
    + " target="_blank"> + + +
    +
    +

    From To

    +
    +
    +
    +
    + +
    + +<%@ include file="/jsp/include/footerTableBottom.jsp" %> diff --git a/posterita/posterita/web/jsp/materialmovement/viewMMovement.jsp b/posterita/posterita/web/jsp/materialmovement/viewMMovement.jsp new file mode 100644 index 0000000000..5504b769ac --- /dev/null +++ b/posterita/posterita/web/jsp/materialmovement/viewMMovement.jsp @@ -0,0 +1,166 @@ +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<% + String path = request.getContextPath(); + String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + +%> + +<%@page import="org.posterita.Constants"%> +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.ShoppingcartManager"%> +<%@page import="org.posterita.util.HtmlOrderPrintFormatter"%> +<%@page import="org.compiere.model.MOrder"%> +<%@page import="org.posterita.businesslogic.POSManager"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@page import="org.compiere.model.MPayment"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.compiere.model.I_M_PriceList"%> +<%@page import="org.posterita.order.UDIOrderTypes"%> +<%@page import="org.posterita.TangoColors"%> +<%@page import="org.posterita.businesslogic.administration.PriceListManager"%> +<%@page import="org.posterita.businesslogic.stock.MMovementManager"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + +<% +int priceListId = PriceListManager.getDefaultPriceListId(ctx, false); +MPriceList priceList = new MPriceList(ctx, priceListId, null); +String priceListName = priceList.getName(); +%> + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    + Stock Transfer +
    +
    +
    +
    + : + <%=orgName%> +
    +
    + : + <%=posName%> +
    +
    +
    +
    + : + +
    +
    + : + <%=roleName%> +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +   + +
    +
    + <%=priceListName%> +
    +
    +
    +
    +
    +
    + <%= MMovementManager.getMMovementCartFromInventoryMove(ctx, Integer.parseInt(movementId), null) %> +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    + <%String newOrderAction = "/StockMovementAction.do?action=createNewStockTransfer"; %> +
    NEW ORDER
    +
    +
    +
    + Ctrl+Space New Order | Ctrl-M Menu
    +
    + <%@ include file="/jsp/include/printOrderApplet2.jsp" %> + + diff --git a/posterita/posterita/web/jsp/materialmovement/viewMMovementHistory.jsp b/posterita/posterita/web/jsp/materialmovement/viewMMovementHistory.jsp new file mode 100644 index 0000000000..ca8647b1ff --- /dev/null +++ b/posterita/posterita/web/jsp/materialmovement/viewMMovementHistory.jsp @@ -0,0 +1,127 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="org.posterita.struts.stock.StockMovementAction" %> +<%@ page import="org.compiere.process.DocAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> + +<%@page import="org.posterita.core.Configuration"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.compiere.model.MPriceListVersion"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.businesslogic.administration.PriceListManager"%> + History +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +<% + +%> + + + + + + + + + + + + + + + + + + + + + + + + + + <%@ include file="/jsp/include/historyMonthYearFilter.jsp"%> + + + + + + +
    + + + + + + + + + +
    +   + + + + + + + + + + + + + + + <%@include file="/jsp/include/paymentRuleFilter.jsp"%> + + +
    +
    + + + + + + + + + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/materialmovement/viewMMovementLines.jsp b/posterita/posterita/web/jsp/materialmovement/viewMMovementLines.jsp new file mode 100644 index 0000000000..401ddbe1f4 --- /dev/null +++ b/posterita/posterita/web/jsp/materialmovement/viewMMovementLines.jsp @@ -0,0 +1,132 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.struts.stock.StockMovementAction"%> +<%@page import="org.posterita.beans.StockMovementBean"%> +Stock Movement +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +
     
    + +
    + + +<% + StockMovementBean movementBean = (StockMovementBean)request.getSession().getAttribute(Constants.MMOVEMENT); + String orgFrom = movementBean.getOrgFromName(); + String orgTo = movementBean.getOrgToName(); + String addressFrom = movementBean.getAddress1(); + String addressTo = movementBean.getAddress2(); + String docStatus = movementBean.getDocStatus(); + String date = movementBean.getMovementDate(); + String movementId = movementBean.getDocumentNo().toString(); +%> + + + + + +
    +
    <%=orgFrom%>
    +
    <%=addressFrom %>
    +
    <%=docStatus %>
    +
    <%=movementId %>
    +
    +
    <%=orgTo %>
    +
    <%=addressTo %>
    +
    +
     
    +
    +
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Product NameDescriptionUom ActiveQuantity
    + + + + + + + + + + +
    + + + + + + +
    + " class="newbutton" onclick="get('ViewMMovement.do?action=viewMMovement')"> + +   +
    + + + + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/materialmovement/viewMoveConfirm.jsp b/posterita/posterita/web/jsp/materialmovement/viewMoveConfirm.jsp new file mode 100644 index 0000000000..5a97c30a95 --- /dev/null +++ b/posterita/posterita/web/jsp/materialmovement/viewMoveConfirm.jsp @@ -0,0 +1,95 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.struts.stock.StockMovementAction"%> +Move Confirmation +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +
    + <% + String collection = Constants.MOVE_CONFIRM; + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    DocNoInventory Move From Organisation Active DocStatusDateAction
    + + + + + + + + + + + + + + <% if (!stock.getDocStatus().equals("CO")) + { + %> + ">Complete + <% + } + %> +
    + +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/materialmovement/viewMoveConfirmLines.jsp b/posterita/posterita/web/jsp/materialmovement/viewMoveConfirmLines.jsp new file mode 100644 index 0000000000..d25dc73e1e --- /dev/null +++ b/posterita/posterita/web/jsp/materialmovement/viewMoveConfirmLines.jsp @@ -0,0 +1,130 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.struts.stock.StockMovementAction"%> +<%@page import="org.posterita.beans.StockMovementBean"%> +Move Confirmation +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +
     
    + +
    + + +<% + StockMovementBean movementBean = (StockMovementBean)request.getSession().getAttribute(Constants.MMOVEMENT); + String orgFrom = movementBean.getOrgFromName(); + String orgTo = movementBean.getOrgToName(); + String addressFrom = movementBean.getAddress1(); + String addressTo = movementBean.getAddress2(); + String docStatus = movementBean.getDocStatus(); + String date = movementBean.getMovementDate(); + String movementId = movementBean.getDocumentNo().toString(); + String moveConfirmId = movementBean.getMoveConfirmId().toString(); +%> + + + + + +
    +
    <%=orgFrom%>
    +
    <%=addressFrom %>
    +
    <%=docStatus %>
    +
    <%=movementId %>
    +
    +
    <%=orgTo %>
    +
    <%=addressTo %>
    +
    +
     
    +
    +
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Product NameDescriptionUom ActiveQuantity
    + + + + + + + + + + +
    + + + + +
    + " class="newbutton" onclick="get('ViewMoveConfirm.do?action=viewMoveConfirm')"> + +   +
    + + + + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/materialmovement/viewMoveLinesHistory.jsp b/posterita/posterita/web/jsp/materialmovement/viewMoveLinesHistory.jsp new file mode 100644 index 0000000000..992cf3badd --- /dev/null +++ b/posterita/posterita/web/jsp/materialmovement/viewMoveLinesHistory.jsp @@ -0,0 +1,120 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.struts.stock.StockMovementAction"%> +<%@page import="org.posterita.beans.StockMovementBean"%> + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +
     
    + +
    + + +<% + StockMovementBean movementBean = (StockMovementBean)request.getSession().getAttribute(Constants.MMOVEMENT); + String orgFrom = movementBean.getOrgFromName(); + String orgTo = movementBean.getOrgToName(); + String addressFrom = movementBean.getAddress1(); + String addressTo = movementBean.getAddress2(); + String docStatus = movementBean.getDocStatus(); + String date = movementBean.getMovementDate(); + String movementId = movementBean.getDocumentNo().toString(); +%> +
     
    + + + + + +
    +
    <%=orgFrom%>
    +
    <%=addressFrom %>
    +
    <%=docStatus %>
    +
    <%=movementId %>
    +
    +
    <%=orgTo %>
    +
    <%=addressTo %>
    +
    +
     
    +
    +
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Product NameDescriptionUom ActiveQuantity
    + + + + + + + + + + +
    + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/materialmovement/viewStock.jsp b/posterita/posterita/web/jsp/materialmovement/viewStock.jsp new file mode 100644 index 0000000000..b6b87b2dab --- /dev/null +++ b/posterita/posterita/web/jsp/materialmovement/viewStock.jsp @@ -0,0 +1,394 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 - 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author shameem +--%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + +<% + String path = request.getContextPath(); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + + Object bPId = request.getSession().getAttribute(Constants.BPARTNER_ID); + Object bPName = request.getSession().getAttribute(Constants.BPARTNER_NAME); + Object bPCredit = request.getSession().getAttribute(Constants.BPARTNER_CREDIT); + String bPartnerId = bPId == null? "":bPId.toString(); + String bPartnerName = bPName == null? "": bPName.toString(); + String bPartnerCredit = bPCredit == null? "": bPCredit.toString(); + + //set configuration + Configuration configuration = Configuration.getConfiguration(request); + String paymentRule = configuration.getPaymentRule(); + String searchProductBy = configuration.getSearchProductBy(); + boolean isCustomerCompulsory = configuration.isCustomerCompulsory(); + boolean isTerminalLocked = POSTerminalManager.isTerminalLocked(ctx); + int movementId = Env.getContextAsInt(ctx, Constants.MMOVEMENT_ID); + + Integer priceListId = PriceListManager.getDefaultPriceListId(ctx, false); + Object plId = request.getSession().getAttribute(Constants.ORDER_PRICE_LIST); + if (plId != null) + { + try + { + priceListId = Integer.valueOf(String.valueOf(plId)); + } + catch (NumberFormatException e){} + } + MPriceList priceList = MPriceList.get(ctx, priceListId.intValue(), null); + String priceListName = priceList.getName(); + MCurrency currency = MCurrency.get(ctx, priceList.getC_Currency_ID()); + BigDecimal roundOffFactor = currency.getRoundOffFactor(); + + if (isTerminalLocked) + { + posName += " (Locked)"; + } + + int roleId = Env.getAD_Role_ID(ctx); + + Object orgFrom = request.getSession().getAttribute(Constants.ORG_FROM_ID); + Integer ctxOrg = Integer.valueOf(Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)); + String org = orgFrom == null? ctxOrg.toString(): orgFrom.toString(); + + int menuId = MenuManager.getMenuId(ctx, "pmenu.stock"); +%> + +<%@page import="org.posterita.struts.stock.StockMovementAction"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.businesslogic.stock.StockList"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@page import="java.util.Properties"%> +<%@page import="org.compiere.model.MProductPrice"%> +<%@page import="org.posterita.businesslogic.administration.PriceListManager"%> +<%@page import="org.posterita.user.WebUserInfo"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.core.Configuration"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MCurrency"%> +<%@page import="org.posterita.order.UDIOrderTypes"%> +<%@page import="org.posterita.businesslogic.administration.RoleManager"%> +<%@page import="org.posterita.businesslogic.MenuManager"%> +<%@page import="org.posterita.businesslogic.stock.MMovementManager"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/showErrors.jsp" %> +
    Please wait...
    + + + + + + + + + + + + + " styleId="movementId"/> + + + + + + + + + + + + +
    +
    + + +
    + STOCK TRANSFER +
    +
    +
    +
    + : + <%=orgName%> +
    +
    + : + <%=posName%> +
    +
    +
    +
    + : + +
    +
    + : + <%=roleName%> +
    +
    +
    +
    +
    +
    +
    +
    +
    STATUS: DRAFTED
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + +
    + BARCODE: + + + NAME: +
    +
    + DESC: +
    +
    +
    +
    +
    +
    +
    +
    + <%=priceListName%> +
    +
    +
    +
    +
    +
    + <%= MMovementManager.getMMovementCartAsHTML(request)%> +
    +
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Barcode + + +
    + Name + + +
    + Description + + +
    + Tax Cat + + +
    + Stock Qty + + +
    + Price List + + +
    + Units Per Pack + + +
    +
    +
    +
    + + Increase item quantity + Decrease item quantity + Remove item +
    +
    +
    +
    + + + + + + + + + +
    + + + +
    + + + +
    +
    +
    + + + + + + + + + +
    DOCUMENT NO:
    REFERENCE:
    + +
    +
    +
    +
    + New Stock Tansfer + Clear all items +
    +
    +
    +
    +
    + Save + Complete +
    +
    +
    +
    +
    + F1 Barcode | F2 Name | F3 Description | F4 Quantity | Ctrl+Up MoveUp | Ctrl+Down MoveDown | Ctrl+Left Decrement | Ctrl-Right Increment | Ctrl-Backspace Remove | Ctrl+M Menu | + Ctrl-S Save | Ctrl-Delete Clear | Ctrl+Space Checkout | Ctrl+C Complete +
    +
    +
    +
    + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> +
    + +
    +
    +
    +
    + + diff --git a/posterita/posterita/web/jsp/materialmovement/viewStockList.jsp b/posterita/posterita/web/jsp/materialmovement/viewStockList.jsp new file mode 100644 index 0000000000..d2b8f2f1ba --- /dev/null +++ b/posterita/posterita/web/jsp/materialmovement/viewStockList.jsp @@ -0,0 +1,173 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> +<%@page import="org.posterita.struts.stock.StockMovementAction"%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +
    +
    +
    + +
    +
    + + +
    + + + + + + + + + + + + + +
    +
    +
    + + + + + + + + + + + + <% + String url = "ViewStockList.do"; + String collection = Constants.MATERIAL_MOVEMENT_DETAILS; + %> + + + <% + String styleClass = "label"; + if ((index.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + +
     
    + + + + + + + + + + + + + + + + + + ">Remove +
    + + + +
    +   +
    + + +
    +
    + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/payment/paymentDetails.jsp b/posterita/posterita/web/jsp/payment/paymentDetails.jsp new file mode 100644 index 0000000000..5ea34a198d --- /dev/null +++ b/posterita/posterita/web/jsp/payment/paymentDetails.jsp @@ -0,0 +1,127 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + + + + + + +
    + + + + + +
    + + + + + + + + + +
    + Document Type: +
    + + + + + + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + +
    + + + + + + + Invoice Ref No: + + + + + +
    + Payment Ref No: + + Counter Payment Ref No: +
    + Status: +
    +   +
    + + + + + + + + + + + + + + + + + + + + + + +
    Date PaidPay Amount
    + + + + + +
    + + diff --git a/posterita/posterita/web/jsp/payment/viewPayment.jsp b/posterita/posterita/web/jsp/payment/viewPayment.jsp new file mode 100644 index 0000000000..b32ba1f2b8 --- /dev/null +++ b/posterita/posterita/web/jsp/payment/viewPayment.jsp @@ -0,0 +1,96 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok Pathak +--%> + + +<%@ page import="com.posterita.Constants" %> +<%@ page import="com.posterita.user.WebUserInfo" %> +<%@ page import="com.posterita.order.UDIOrderTypes" %> +<%@ page import="org.compiere.model.MPayment" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> + + +Payment + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +<%-- +@TODO by Alok + +--%> + + + <%@ include file="/jsp/webstore/webDocumentHeader.jsp" %> + + + + + + + + + + +
    + + Payment By: +
    +
    + Ref Payment No: +
    + Status: +
    +
    + + + + + + + + + + + +
    Payment DateAmount
    + + + + +
    +
    + + + + <%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/payment/viewPaymentHistory.jsp b/posterita/posterita/web/jsp/payment/viewPaymentHistory.jsp new file mode 100644 index 0000000000..eef993358b --- /dev/null +++ b/posterita/posterita/web/jsp/payment/viewPaymentHistory.jsp @@ -0,0 +1,124 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.posterita.struts.payment.PaymentAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + + + + + + + + + + + + + +
    + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +
    + + + + + <%@ include file="/jsp/include/filter.jsp"%> + + +
    +
    + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    +
    + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/AllPOSCustomer.jsp b/posterita/posterita/web/jsp/pos/AllPOSCustomer.jsp new file mode 100644 index 0000000000..5849356121 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/AllPOSCustomer.jsp @@ -0,0 +1,442 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +
    + + + + + + + + + + + + +
    + + + + +   + + + + + <%@include file="/jsp/include/dayList.jsp"%> + + + + <%@include file="/jsp/include/month.jsp"%> + + + + + <% + int currentYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR); + %> + <%= currentYear %> + <%= currentYear - 1 %> + + + + All + Active + Not Active + + + + + <pos:message textOnly="true" key="add"/> + + + "> + Import POS Customers + +
    +
    + + + <% + org.posterita.businesslogic.CustomerCart cart = (org.posterita.businesslogic.CustomerCart)request.getSession().getAttribute(Constants.CUSTOMER_CART); + %> + + +
    + + + + + + + + + + + + + + + + + + + +
    + + +
    + + +
    :
    +
    +
    + + + + + + + + + + + + + + +<% + String url = "ViewAllCustomers.do"; + String collection = Constants.ALL_CUSTOMERS; +%> + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + +
      
    + + + +
    + +
    + + + + + + + + + + Y + + + N + + + + + + "> + <pos:message textOnly="true" key="edit.customer"/> + + + +   + "> + <pos:message textOnly="true" key="view"/> + + + +   + + "> + <pos:message textOnly="true" key="deactivate"/> + + + + "> + <pos:message textOnly="true" key="activate"/> + + + + + + <% + if(((org.posterita.businesslogic.CustomerCart)request.getSession().getAttribute(Constants.CUSTOMER_CART)).hasCustomer(Integer.parseInt(bpartnerId+""))) + { + %> + + + <% + } + else + { + %> + + <% + } + %> + + + + +
    +<%@ include file="/jsp/include/pager.jsp" %> +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/ViewAllPosVendors.jsp b/posterita/posterita/web/jsp/pos/ViewAllPosVendors.jsp new file mode 100644 index 0000000000..883245fa6b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/ViewAllPosVendors.jsp @@ -0,0 +1,173 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + +
    + + + + + + + + + + +
    + + + + + +   + + + + + Add Vendor + +
    +
    + + + +
    :
    +
    +
    +
    + + + + +<% + String url = "ViewAllVendors.do"; + String collection = Constants.VENDOR_LIST; +%> + + + + + + + + + + + + + + + + + + + + + + + + + +<% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + + + + + + + + + +
     
    + + + + + + + + + + + + Y + + + N + + + + "> + <%=editmsg%> + + + "> + <%=viewmsg%> + + + + "> + <%=deactivatemsg%> + + + + + "> + <%=activatemsg%> + + +
    + +<%@ include file="/jsp/include/pager.jsp" %> + +
    + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/adjustCashBook.jsp b/posterita/posterita/web/jsp/pos/adjustCashBook.jsp new file mode 100644 index 0000000000..bc76adafd7 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/adjustCashBook.jsp @@ -0,0 +1,93 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> +<%@ page import="org.compiere.model.MCashLine" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +
    + + + + + + + + + + + + + + + + + +
    + * + + +
    + * + + + + + + +
    + * + + + +
    +   + + +   + +
    +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/adjustInventory.jsp b/posterita/posterita/web/jsp/pos/adjustInventory.jsp new file mode 100644 index 0000000000..0039eaf096 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/adjustInventory.jsp @@ -0,0 +1,102 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.posterita.struts.pos.InventoryAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + +
    +
    + + + + + + + + + + + +
     
    + + + + + + + + + + Save + +
    + + Complete + +
    + +
    +
    + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/adjustStock.jsp b/posterita/posterita/web/jsp/pos/adjustStock.jsp new file mode 100644 index 0000000000..4288fdc0fd --- /dev/null +++ b/posterita/posterita/web/jsp/pos/adjustStock.jsp @@ -0,0 +1,498 @@ + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + +<% + String path = request.getContextPath(); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + + int menu_id = MenuManager.getMenuId(ctx, "pmenu.stock"); + + String orderType = "Stock Adjustment"; + int purchasePriceListVersionId=Env.getContextAsInt(ctx,UdiConstants.POS_PURCHASE_PL_VERSION); + MPriceListVersion priceListVersion = new MPriceListVersion(ctx,purchasePriceListVersionId,null); + int m_pricelist_id = priceListVersion.getM_PriceList_ID(); + MPriceList priceList = new MPriceList(ctx,m_pricelist_id,null); + + int inventoryId = Env.getContextAsInt(ctx, Constants.INVENTORY_ID); + String description = Env.getContext(ctx, Constants.DESCRIPTION); + long currentTimeInMillis = System.currentTimeMillis(); + Date today = new Date( currentTimeInMillis ); + if(description == "") + { + description = "Stock Adjustment - " + today; + } + + String docNo = (String)request.getSession().getAttribute(Constants.DOC_NO); + if(docNo == "" || docNo == null) + { + docNo = "N/A"; + } + + String docStatus = (String)request.getSession().getAttribute(Constants.DOC_STATUS); + if(docStatus == "" || docStatus == null) + { + docStatus = "N/A"; + } + else + { + + if (DocAction.STATUS_Drafted.equals(docStatus)) + docStatus = Constants.DOC_STATUS_DRAFTED; + else + if (DocAction.STATUS_InProgress.equals(docStatus)) + docStatus = Constants.DOC_STATUS_INPROGRESS; + else + if (DocAction.STATUS_Completed.equals(docStatus)) + docStatus = Constants.DOC_STATUS_COMPLETED; + else + if (DocAction.STATUS_Closed.equals(docStatus)) + docStatus = Constants.DOC_STATUS_CLOSED; + else + if (DocAction.STATUS_Invalid.equals(docStatus)) + docStatus = Constants.DOC_STATUS_INVALID; + else + if (DocAction.STATUS_Voided.equals(docStatus)) + docStatus = Constants.DOC_STATUS_VOID; + } + + String priceListName = priceList.getName(); + MCurrency currency = MCurrency.get(ctx, priceList.getC_Currency_ID()); + BigDecimal roundOffFactor = currency.getRoundOffFactor(); + + //set configuration + Configuration configuration = Configuration.getConfiguration(request); + String paymentRule = configuration.getPaymentRule(); + String searchProductBy = configuration.getSearchProductBy(); + boolean isCustomerCompulsory = configuration.isCustomerCompulsory(); + +%> + +<%@page import="org.posterita.Constants"%> +<%@page import="java.util.Properties"%> +<%@page import="java.util.Calendar"%> +<%@page import="java.util.Date"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.model.MPOS"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.stock.InventoryCartManager"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@page import="org.posterita.core.Configuration"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.compiere.model.MCurrency"%> +<%@page import="org.compiere.model.MPriceListVersion"%> +<%@page import="org.compiere.util.WebSessionCtx"%> +<%@page import="org.posterita.user.WebUserInfo"%> + +<%@page import="org.posterita.businesslogic.MenuManager"%> +<%@page import="org.compiere.process.DocAction"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + + + + +
    Please wait...
    + + + + + + + + + + + + + " styleId="priceListId"/> + " styleId="invdescription"/> + " styleId="inventoryId"/> + " styleId = "roundOffFactor" /> + + " id="isCustomerCompulsory"/> + + + + + + + + + + + +
    +
    + + +
    + <%= orderType %> +
    +
    +
    +
    + : + <%=orgName%> +
    +
    + : + <%=posName%> +
    +
    +
    +
    + : + +
    +
    + : + <%=roleName%> +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + +
    + BARCODE: + + + NAME: +
    +
    + DESC: +
    +
    +
    +
    + +
    +
    +
    +
    +
    + <%=priceListName%> +
    +
    +
    +
    +
    +
    + <%= InventoryCartManager.getInventoryCartAsHTML(request)%> +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Barcode + + +
    + Name + + +
    + Description + + +
    + Tax Cat + + +
    + Qty Book + + +
    + Price List + + +
    + +
    +
    + + Increase item quantity + Decrease item quantity + Remove item +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    + Total Products + + +
    + Total Qty CSV + + +
    + Total Qty Book + + +
    + Total Qty Count + + +
    + Discrepancy + + +
    +
    +
    + + + + + + + + + + + + + + +
    + Reference + + <%=description + ""%> +
    + Doc No + + <%=docNo%> +
    + Status + + <%=docStatus%> +
    + +
    +
    +
    +
    +
    +
    PRINT
    +
    CSV
    +
    SAVE AS CSV
    +
    ADD CSV
    +
    CLEAR
    +
    SAVE
    +
    NEW
    +
    SEARCH
    +
    REFRESH CART
    +
    +
    +
    +
    +
    COMPLETE
    +
    +
    +
    + F1 Barcode | F2 Name | F3 Description | F4 Qty | F5 Save | F6 Search | F7 Import CSV | F8 CSV | F9 Save CSV | F10 Refresh Cart | + Ctrl+Up MoveUp | Ctrl+Down MoveDown | Ctrl+Left Decrement | Ctrl-Right Increment | Ctrl-Backspace Remove | Ctrl+M Menu | Ctrl+N New Cart | Ctrl+R Reference | + Ctrl-P Print | Ctrl-C Complete | Ctrl-Delete Clear +
    +
    + +
    + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> +
    + + + + + + + + + + + + + + + + + + +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/adjustedStock.jsp b/posterita/posterita/web/jsp/pos/adjustedStock.jsp new file mode 100644 index 0000000000..c04ee37868 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/adjustedStock.jsp @@ -0,0 +1,97 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.posterita.struts.pos.InventoryAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + +
    +
    + + + +
    +
    +
    +
    + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/advancedOrderScreen.jsp b/posterita/posterita/web/jsp/pos/advancedOrderScreen.jsp new file mode 100644 index 0000000000..9ec42617e5 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/advancedOrderScreen.jsp @@ -0,0 +1,369 @@ +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<% + String path = request.getContextPath(); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + //String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); +%> + +<%@page import="org.posterita.Constants"%> +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.posterita.businesslogic.administration.RoleManager"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@page import="org.posterita.TangoColors"%> +<%@page import="org.compiere.model.MCurrency"%> + + + + + + + + + + + + + + + + + + + + + +<% + MPriceList priceList = MPriceList.get(ctx, Integer.valueOf(priceListId).intValue(), null); + String priceListName = priceList.getName(); + int currencyId = priceList.getC_Currency_ID(); + MCurrency currency = MCurrency.get(ctx, currencyId); + String curSymbole = currency.getCurSymbol(); +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + POS Order +
    +
    +
    +
    + + Organisation : + Posterita +
    +
    + Terminal : + Test teminal +
    +
    +
    + +
    + User : + admin +
    +
    + Role : + admin +
    +
    + +
    +
    +
    +
    +
    +
    +
    + <%=curSymbole%> + + + +
    +
    +
    +
    +
    +   + +
    +
    + <%=priceListName%> +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + String trStyleClass = ""; + + if ((count.intValue()%2) == 0) + { + //use same color for sales and purchase for time being + if(orderType.equals("POS Order")) + { + trStyleClass = "evenRow"; + } + else if(orderType.equals("POS Goods Receive Note")) + { + trStyleClass = "evenRow"; + } + } + else + { + trStyleClass = "oddRow"; + } + %> + " qty="<%=element.getQty()%>" id="<%= "row" + (count.intValue()+1)%>"> + + + + + + + + + + + + + + + "> + + + + + + + +
    + + + + + " name="qtyPerLine"/> + + + + " name="inclPrice" size="10"/> + + + " name="taxRate"/> + + + + + + + + + " name="discount"/> + + " name="discountedPrice"/> + " name="limitPrice"/> + " name="isDiscOnInclUnitPrice"/> + " name="discInclUnitPrice"/> + " name="isDiscOnPerc"/> + " name="isDiscOnTotal"/> + " name="listPrice"/> +
       +
    + +
    +
    + + " name="inclPrice"/> + + + " format="0.00"/>"id="totalDiscount" name="totalDiscount" class="numeric"/> + + + + + + + " format="0.00"/>" id="grandTotal" name="discountedTotal"/> + + + " id="grandTotal" name="discountedTotal"/> + + + + + + +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + +
    + Override Price Limit: + + <%=isAllowedOverridePriceLimit%> +
    + Discount Limit: + + <%=discountAllowed%> +
    + Price Limit: + + +
    + +
    +
    +
    +
    + <% String loadScreen = "CreatePOSOrderScreen.do?orderType="+orderType; + %> + "/>')" value="Cancel"/> + + +
    +
    +
    + +
    +
    +
    + Ctrl+Enter APPLY | Ctrl+Space OVERRIDE | Ctrl+Backspace CANCEL +
    +
    +
    +
    + + + + + + + + + + +
    + +
    +
    + +
    +
    +
    + + +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/allBlackListCheque.jsp b/posterita/posterita/web/jsp/pos/allBlackListCheque.jsp new file mode 100644 index 0000000000..67e9debf03 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/allBlackListCheque.jsp @@ -0,0 +1,114 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.posterita.model.MBlackListCheque" %> +<%@ page import="org.posterita.beans.BlackListedBean" %> +<%@ page import="org.posterita.struts.pos.BlackListedAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + +
    + + + + + + + + + +
    + +
    +
    + +
    + + + + + +   + +
    + + + + +
    +
    +
    + +
    + + + + + + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + +
     
    + + + + + + ">Edit +   + ">Delete + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/cashBookAdjustmentCompleted.jsp b/posterita/posterita/web/jsp/pos/cashBookAdjustmentCompleted.jsp new file mode 100644 index 0000000000..d066f967b3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/cashBookAdjustmentCompleted.jsp @@ -0,0 +1,55 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/cashDetails.jsp b/posterita/posterita/web/jsp/pos/cashDetails.jsp new file mode 100644 index 0000000000..0349158bc6 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/cashDetails.jsp @@ -0,0 +1,137 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.CashAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + +
    + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + <%@ include file="/jsp/include/historyMonthYearFilter.jsp"%> + +
    + + + +
    +
    + + + <% + String url = "CashDetails.do"; + String collection = Constants.CASH_DETAILS; + %> + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + +
    > + "> + + + > + + > + + + > + + + > + + > + +
    + <%@ include file="/jsp/include/pager.jsp" %> +
    +
    + + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/cashLineDetails.jsp b/posterita/posterita/web/jsp/pos/cashLineDetails.jsp new file mode 100644 index 0000000000..b6486028f5 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/cashLineDetails.jsp @@ -0,0 +1,80 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + +
    + + <% + Integer invoiceId = element.getInvoiceId(); + String cashTypeLink = ""; + if(invoiceId.intValue() == 0) + cashTypeLink = element.getCashTypeName(); + else + { + cashTypeLink = ""; + cashTypeLink += element.getCashTypeName(); + cashTypeLink += ""; + } + %> + + <%= cashTypeLink%> + + + + + + + +
    +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/cashSummary.jsp b/posterita/posterita/web/jsp/pos/cashSummary.jsp new file mode 100644 index 0000000000..97a3cdab72 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/cashSummary.jsp @@ -0,0 +1,53 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<% + String requestURI = "CashLineReportAction.do"; +%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +<%@ include file="/jsp/pos/cashSummaryInc.jsp"%> + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/cashSummaryDate.jsp b/posterita/posterita/web/jsp/pos/cashSummaryDate.jsp new file mode 100644 index 0000000000..1ad28edb2f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/cashSummaryDate.jsp @@ -0,0 +1,91 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<% + String requestURI = "CashSummaryReportAction.do"; +%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + +
    + <%@ include file="/jsp/include/dateFilter.jsp" %> +
    +   +
    + <%@ include file="/jsp/pos/cashSummaryInc.jsp"%> +
    +<%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/cashSummaryInc.jsp b/posterita/posterita/web/jsp/pos/cashSummaryInc.jsp new file mode 100644 index 0000000000..669ab4e9e4 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/cashSummaryInc.jsp @@ -0,0 +1,192 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + +
    +
    +
    + +
    +			
    +			
    +
    +
    + + + + + +
    +   + + + + +   + +
    +
    + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/chooseFastMovingItemReport.jsp b/posterita/posterita/web/jsp/pos/chooseFastMovingItemReport.jsp new file mode 100644 index 0000000000..e93ac6bffd --- /dev/null +++ b/posterita/posterita/web/jsp/pos/chooseFastMovingItemReport.jsp @@ -0,0 +1,48 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +
    + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/choosePOS.jsp b/posterita/posterita/web/jsp/pos/choosePOS.jsp new file mode 100644 index 0000000000..41dad2e728 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/choosePOS.jsp @@ -0,0 +1,103 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.login.POSLoginAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<% +String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); +%> + + + + +<%=appName%> + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/choosePOSInfo.jsp b/posterita/posterita/web/jsp/pos/choosePOSInfo.jsp new file mode 100644 index 0000000000..a967dd2d42 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/choosePOSInfo.jsp @@ -0,0 +1,43 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +
    + +
    +
    + + +
    +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/closeCashBook.jsp b/posterita/posterita/web/jsp/pos/closeCashBook.jsp new file mode 100644 index 0000000000..f30027f221 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/closeCashBook.jsp @@ -0,0 +1,145 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen,Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +<% int noOfOpenedCashbook = 0;%> + + + + + + + + + + + + + + + + + + + +<% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + + + + + + + + + + + + + + + + + + +
    + Cash Book Name + + Beginining Balance + + Ending Balance + + Net Transection + + Status + + Amount transfer + + Transfer Full Amount +
    + + + + + "/> + + + + "/> + + + + + + + + + + + <% noOfOpenedCashbook++; %> + + +
    +
    +
    +<% + if (noOfOpenedCashbook > 0) + { +%> + +   + +<% + } +%> +
    + +
    +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/closePOSTill.jsp b/posterita/posterita/web/jsp/pos/closePOSTill.jsp new file mode 100644 index 0000000000..2e01d796b2 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/closePOSTill.jsp @@ -0,0 +1,299 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen, Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> +<%@ page import="org.posterita.businesslogic.POSTerminalManager" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/posterita.tld" prefix="posterita"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + <% + String styleClass = "label"; + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + "> +
    +   +
    + +
    +
    + +   + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/closedPOSTill.jsp b/posterita/posterita/web/jsp/pos/closedPOSTill.jsp new file mode 100644 index 0000000000..72fa54e41a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/closedPOSTill.jsp @@ -0,0 +1,184 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants"%> +<%@ page import="org.posterita.user.*"%> +<%@ page import="org.posterita.beans.*"%> +<%@ page import="org.posterita.struts.pos.CashBookAction"%> +<%@ page import="org.posterita.businesslogic.POSTerminalManager"%> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%> +<%@ taglib uri="/WEB-INF/posterita.tld" prefix="posterita"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp"%> +<%@ include file="/jsp/include/errors.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    :
    :
    : +
    :
    : +
    :
    :
    :
    :
    :
    :
    :
    :
    + + : +
    + +<%@ include file="/jsp/include/printOrderApplet2.jsp"%> + + + + + + +<%@ include file="/jsp/include/posFooter.jsp"%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/completePOSOrder.jsp b/posterita/posterita/web/jsp/pos/completePOSOrder.jsp new file mode 100644 index 0000000000..e2b9eea2bc --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completePOSOrder.jsp @@ -0,0 +1,36 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/completePOSOrderIncl.jsp" %> + + diff --git a/posterita/posterita/web/jsp/pos/completePOSOrder2.jsp b/posterita/posterita/web/jsp/pos/completePOSOrder2.jsp new file mode 100644 index 0000000000..b9db816393 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completePOSOrder2.jsp @@ -0,0 +1,41 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/completePOSOrderIncl.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/pos/completePOSOrder3.jsp b/posterita/posterita/web/jsp/pos/completePOSOrder3.jsp new file mode 100644 index 0000000000..83f171f36e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completePOSOrder3.jsp @@ -0,0 +1,41 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/completePOSOrderIncl.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/pos/completePOSOrderWA.jsp b/posterita/posterita/web/jsp/pos/completePOSOrderWA.jsp new file mode 100644 index 0000000000..5b999b7e0d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completePOSOrderWA.jsp @@ -0,0 +1,34 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/completePOSOrderIncl.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/completePOSShoppingCart.jsp b/posterita/posterita/web/jsp/pos/completePOSShoppingCart.jsp new file mode 100644 index 0000000000..8e8b402414 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completePOSShoppingCart.jsp @@ -0,0 +1,221 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> +<% + boolean isFullDetails = false; + + if(request.getParameter("isFullDetails") != null) + { + isFullDetails = Boolean.parseBoolean(request.getParameter("isFullDetails")); + } +%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + <%@page import="org.posterita.Constants"%> + + + + + + + + + + + + + <% + if(isFullDetails) + { + %> + + + + <% + } + %> + + + + <%String styleClass = "label"; %> + + + + <% + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + <% + if(isFullDetails) + { + %> + + + + <% + } + %> + + + + + + + + + + + + + + + <% + if(isFullDetails) + { + %> + + + + <% + } + %> + + + <% styleClass = styleClass.equals("label")? "contentName":"label"; %> + + + + + + + + + <% + if(isFullDetails) + { + %> + + + + <% + } + %> + + + <% styleClass = styleClass.equals("label")? "contentName":"label"; %> + + + + + + + + + <% + if(isFullDetails) + { + %> + + + + <% + } + %> + + + + + + + + + + <% + if(isFullDetails) + { + %> + + + + <% + } + %> + + + +
    > align="right"> align="right"> align="right"> align="right"> align="right"> align="right"> align="right"> align="right"> align="right"> align="right">
    + + + +   + +   + + + + +   + + + + + + +   + + + +
    > + + align="right"> + +
    > + + align="right"> + +
    + + + +   + +   + + + + +   + + + + + + +    
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/completedCreditOrder.jsp b/posterita/posterita/web/jsp/pos/completedCreditOrder.jsp new file mode 100644 index 0000000000..3dfe1e1e8c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completedCreditOrder.jsp @@ -0,0 +1,88 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
    + + +
    + +<%@ include file="/jsp/pos/orderHeader.jsp" %> +<% String orderlines = Constants.POS_ORDER_LINES; %> +<%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> + +
    + + + + + + + + + + +
     
    + +
    + + +
    + +<%@ include file="/jsp/include/printOrderApplet.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> + + diff --git a/posterita/posterita/web/jsp/pos/completedCustomerReturnOrder.jsp b/posterita/posterita/web/jsp/pos/completedCustomerReturnOrder.jsp new file mode 100644 index 0000000000..2d6e9e476f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completedCustomerReturnOrder.jsp @@ -0,0 +1,102 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="java.util.ArrayList" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +
    + + + + +
    + + + +
    + +
    + <%@ include file="/jsp/pos/orderHeader.jsp" %> + <% String orderlines = Constants.CUSTOMER_RETURN_ORDER_LINES; %> + <%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> +
    + + +
    + + +<%@ include file="/jsp/include/printOrderApplet.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/completedGoodsReceiveNote.jsp b/posterita/posterita/web/jsp/pos/completedGoodsReceiveNote.jsp new file mode 100644 index 0000000000..46d7dd7dd2 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completedGoodsReceiveNote.jsp @@ -0,0 +1,88 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="java.util.ArrayList" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +
    + <%@ include file="/jsp/pos/orderHeader.jsp" %> + <% String orderlines = Constants.GOODS_RECEIVE_NOTE_LINES; %> + <%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> +
    +
    + + + + + + + +
    +   +
    + + + + + + +
    + +<%@ include file="/jsp/include/printOrderApplet.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/completedGoodsReturnNote.jsp b/posterita/posterita/web/jsp/pos/completedGoodsReturnNote.jsp new file mode 100644 index 0000000000..dfc20a75a7 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/completedGoodsReturnNote.jsp @@ -0,0 +1,89 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="java.util.ArrayList" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> +<% String orderlines = Constants.GOODS_RETURN_NOTE_LINES; %> +<%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> + + + + + + + + +
    +

    +
    + +
    +
    + + + + + + +
    + + +<%@ include file="/jsp/include/printOrderApplet.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/createAPPayment.jsp b/posterita/posterita/web/jsp/pos/createAPPayment.jsp new file mode 100644 index 0000000000..c9c8f4b6e3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createAPPayment.jsp @@ -0,0 +1,82 @@ + +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.PaymentAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + +
    +
    + + +
    +
    + <%@ include file="/jsp/include/vendorInfoPanel.jsp" %> + + <%@ include file="/jsp/include/tenderPanel.jsp" %> +
    + +   + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/createBlackListCheque.jsp b/posterita/posterita/web/jsp/pos/createBlackListCheque.jsp new file mode 100644 index 0000000000..010738d848 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createBlackListCheque.jsp @@ -0,0 +1,81 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + * + + +
    + * + + +
    + +   + +
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/createCreditOrder.jsp b/posterita/posterita/web/jsp/pos/createCreditOrder.jsp new file mode 100644 index 0000000000..6b2f4ad22a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createCreditOrder.jsp @@ -0,0 +1,114 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + +
    + "> + Create New + +
    +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + <%@ include file="/jsp/include/creditOrderWithAdvanced.jsp" %> + <%@ include file="/jsp/include/pinPanel.jsp" %> + + +<%@ include file="/js/createPOSOrder.js" %> + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createCreditOrder2.jsp b/posterita/posterita/web/jsp/pos/createCreditOrder2.jsp new file mode 100644 index 0000000000..5e22c8f362 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createCreditOrder2.jsp @@ -0,0 +1,347 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + + + + + + + + + + +   + +
    + + + <%@ include file="/jsp/include/searchProductPanel.jsp" %> +  
    +
    +
    + <%@ include file="/jsp/pos/customerReturnShoppingCart.jsp" %> +
    +
    + + + + + +
    +
    + : +
    +
    + +
    + + +
    +
    +
    +   +
    +
    + + + + + + + + + + + + + + + + + + + - + + + + + + + +
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createMultipleAPInvoicePayment.jsp b/posterita/posterita/web/jsp/pos/createMultipleAPInvoicePayment.jsp new file mode 100644 index 0000000000..01b5d1849e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createMultipleAPInvoicePayment.jsp @@ -0,0 +1,218 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.PaymentAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.form.PaymentForm" %> +<%@ page import="java.math.BigDecimal" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + <% + double openAmtTotal = 0.0d; + double paidAmtTotal = 0.0d; + double discountAmtTotal = 0.0d; + double invoiceGrandTotal = 0.0d; + %> + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + <% + String defaultAllocateAmount = "0"; + + + PaymentForm form = (PaymentForm)request.getAttribute("PaymentForm"); + + if(form!=null) + { + String[] allocateAmount = form.getAllocateAmount(); + + + if(allocateAmount!= null) + if(allocateAmount.length!=0) + defaultAllocateAmount = allocateAmount[count.intValue()]; + } + %> + + + + + + <% + openAmtTotal += element.getOpenAmt().doubleValue(); + paidAmtTotal += element.getPaidAmt().doubleValue(); + discountAmtTotal += element.getDiscountAmt().doubleValue(); + invoiceGrandTotal += element.getInvoiceGrandTotal().doubleValue(); + %> + + + + + + + + + + + + + + +
    +
    + + +
    +
    + + + + + + + + + + + + + + + +
    > + + + + > + + > + + > + + > + + > + + > + + + > + +
    Total<%=invoiceGrandTotal%><%=discountAmtTotal%><%=paidAmtTotal%><%=openAmtTotal%> 
    + <%@ include file="/jsp/include/tenderPanel2.jsp" %> +
    + +   + +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createMultipleIAPnvoicePayment.jsp b/posterita/posterita/web/jsp/pos/createMultipleIAPnvoicePayment.jsp new file mode 100644 index 0000000000..91da6ca9c8 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createMultipleIAPnvoicePayment.jsp @@ -0,0 +1,218 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.PaymentAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.form.PaymentForm" %> +<%@ page import="java.math.BigDecimal" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + <% + double openAmtTotal = 0.0d; + double paidAmtTotal = 0.0d; + double discountAmtTotal = 0.0d; + double invoiceGrandTotal = 0.0d; + %> + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + <% + String defaultAllocateAmount = "0"; + + + PaymentForm form = (PaymentForm)request.getAttribute("PaymentForm"); + + if(form!=null) + { + String[] allocateAmount = form.getAllocateAmount(); + + + if(allocateAmount!= null) + if(allocateAmount.length!=0) + defaultAllocateAmount = allocateAmount[count.intValue()]; + } + %> + + + + + + <% + openAmtTotal += element.getOpenAmt().doubleValue(); + paidAmtTotal += element.getPaidAmt().doubleValue(); + discountAmtTotal += element.getDiscountAmt().doubleValue(); + invoiceGrandTotal += element.getInvoiceGrandTotal().doubleValue(); + %> + + + + + + + + + + + + + + +
    +
    + + +
    +
    + + + + + + + + + + + + + + + +
    > + + + + > + + > + + > + + > + + > + + > + + + > + +
    Total<%=invoiceGrandTotal%><%=discountAmtTotal%><%=paidAmtTotal%><%=openAmtTotal%> 
    + <%@ include file="/jsp/include/tenderPanel.jsp" %> +
    + +   + +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createMultipleInvoicePayment.jsp b/posterita/posterita/web/jsp/pos/createMultipleInvoicePayment.jsp new file mode 100644 index 0000000000..0a172be1d4 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createMultipleInvoicePayment.jsp @@ -0,0 +1,218 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.PaymentAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.form.PaymentForm" %> +<%@ page import="java.math.BigDecimal" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + <% + double openAmtTotal = 0.0d; + double paidAmtTotal = 0.0d; + double discountAmtTotal = 0.0d; + double invoiceGrandTotal = 0.0d; + %> + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + <% + String defaultAllocateAmount = "0"; + + + PaymentForm form = (PaymentForm)request.getAttribute("PaymentForm"); + + if(form!=null) + { + String[] allocateAmount = form.getAllocateAmount(); + + + if(allocateAmount!= null) + if(allocateAmount.length!=0) + defaultAllocateAmount = allocateAmount[count.intValue()]; + } + %> + + + + + + <% + openAmtTotal += element.getOpenAmt().doubleValue(); + paidAmtTotal += element.getPaidAmt().doubleValue(); + discountAmtTotal += element.getDiscountAmt().doubleValue(); + invoiceGrandTotal += element.getInvoiceGrandTotal().doubleValue(); + %> + + + + + + + + + + + + + + +
    +
    + + +
    +
    + + + + + + + + + + + + + + + +
    > + + + + > + + > + + > + + > + + > + + > + + + > + +
    Total<%=invoiceGrandTotal%><%=discountAmtTotal%><%=paidAmtTotal%><%=openAmtTotal%> 
    + <%@ include file="/jsp/include/tenderPanel.jsp" %> +
    + +   + +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createOrUpdatePriceList.jsp b/posterita/posterita/web/jsp/pos/createOrUpdatePriceList.jsp new file mode 100644 index 0000000000..fe6c49ca2b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createOrUpdatePriceList.jsp @@ -0,0 +1,169 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.struts.pos.PriceListAction"%> +Price List +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + Previous + + "> + Next + + "> + Create PriceList + +
    + + + +
    + + + + + + + +
    + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + +
    + + + + + + + + + + + + + + +
    +   +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/createOrUpdateProduct.jsp b/posterita/posterita/web/jsp/pos/createOrUpdateProduct.jsp new file mode 100644 index 0000000000..9d820ad81f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createOrUpdateProduct.jsp @@ -0,0 +1,586 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.struts.pos.POSProductAction"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.compiere.model.MProduct"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.posterita.beans.ProductBean"%> +Product +<%@ include file="/jsp/include/posHeaderAdministration.jsp" %> +<%@ include file="/jsp/include/errorMsg.jsp" %> + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + +
    + + Image Upload + + + + +
    +
    + + + + * + + + + + +
    + + + + * + + + + +
    + + + + * + + + + + + +
    + + + + * + + + + + + +
    + + + + * + + + + + + +
    + + + + + +
    + + + + * + + + + +
    + + + + + +
    + + + + + + + + +
    + + + + + +
    + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + String styleClass = "oddRow"; + + if(index.intValue()%2 == 0) + { + styleClass = "evenRow"; + } + + %> + + " class="<%=styleClass%>" onMouseOver="this.className='highlight'" onMouseOut="this.className='oddRow'""> + + + + + + + + + + + + + + + + + + +
    + + + + +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
    + +
    +
    + + + + * + + + + + + + + + + + + + + + + + + + + + +     
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + Stock Qty: +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Sales Figures
    + Period + + Sales + + Total Amt +
    + Today + + + + +
    + Current Week + + + + +
    + Current Month + + + + +
    + 6 Months + + + + +
    + Current Year + + + + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + Save Changes +
    +
    +
    +
    + Ctrl-N New Product | Ctrl-I Import Products | Ctrl+M Menu | + Ctrl-D Open Drawer | Ctrl-Left Previous Product | Ctrl-Right Next Product | F4 Save +
    +
    +
    + + diff --git a/posterita/posterita/web/jsp/pos/createOrUpdateProduct2.jsp b/posterita/posterita/web/jsp/pos/createOrUpdateProduct2.jsp new file mode 100644 index 0000000000..7c67705395 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createOrUpdateProduct2.jsp @@ -0,0 +1,270 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.struts.pos.POSProductAction"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.compiere.model.MProduct"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.posterita.beans.ProductBean"%> +Product + +<%@ include file="/jsp/include/posHeader2.jsp" %> + + +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + "> + Create Product + +
    + + + +
    + * + + + +
    + * + + +
    + * + + + + +
    + * + + + + + +
    + * + + + + +
    + * + + +
    +
    + + + +
    + + + + +
    + + +
    + + + +
    + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + "> + + + + + + + + + + + + + + + + + + +
      
    + + * + + + + + + + + + + + + + + + + + + + + +     
    +
    +
    + + + + +
    + Save + Close +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/createPOSGarmentProducts.jsp b/posterita/posterita/web/jsp/pos/createPOSGarmentProducts.jsp new file mode 100644 index 0000000000..75f1f8b116 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPOSGarmentProducts.jsp @@ -0,0 +1,551 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + +<%@ page import="org.posterita.struts.pos.POSProductAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +
    +
    +Garment Details + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    * + +
    * + + +
    +
    * + + +
    +
    * + + +
    +
    * + + +
    +
    * + + +
    +
    + + + + + +
    + + + +
    + + + +
    +
    + + + + + + + + + + + + +
    + * + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + * + + + + + + +
    + * + + + + + + +
    + * + + + + + + +
    +
    +
    +
    + + + + +
    +
    + * + + + + + + + + + +
    +
    + Select: + All + None + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    +
    +
    +
    + Select: + All + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + +
    + + + + + + + +
    + + + + + + + +
    + + + + + + + +
    + + + +
    + + + +
    +
    +
    +
    + Select: + All + None + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    +
    +
    + +
    +
    +
    +
    +   +
    +
    + +
    + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createPOSOrder.jsp b/posterita/posterita/web/jsp/pos/createPOSOrder.jsp new file mode 100644 index 0000000000..4fbb9fc75f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPOSOrder.jsp @@ -0,0 +1,122 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + <%@ include file="/jsp/include/posOrderWithAdvanced.jsp" %> + + +<%@ include file="/js/createPOSOrder.js" %> + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createPOSOrder2.jsp b/posterita/posterita/web/jsp/pos/createPOSOrder2.jsp new file mode 100644 index 0000000000..096c503ff7 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPOSOrder2.jsp @@ -0,0 +1,100 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + <%@ include file="/jsp/include/posOrderWithAdvancedFocusSearch.jsp" %> + + +<%@ include file="/js/createPOSOrder.js" %> + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createPOSOrder3.jsp b/posterita/posterita/web/jsp/pos/createPOSOrder3.jsp new file mode 100644 index 0000000000..09f549b601 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPOSOrder3.jsp @@ -0,0 +1,89 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + <%@ include file="/jsp/include/posOrder.jsp" %> + + +<%@ include file="/js/createPOSOrder.js" %> + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createPOSOrderWithoutAdvance.jsp b/posterita/posterita/web/jsp/pos/createPOSOrderWithoutAdvance.jsp new file mode 100644 index 0000000000..5d203824ef --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPOSOrderWithoutAdvance.jsp @@ -0,0 +1,86 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + <%@ include file="/jsp/include/posOrder.jsp" %> + + +<%@ include file="/js/createPOSOrder.js" %> + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/createPOSProduct.jsp b/posterita/posterita/web/jsp/pos/createPOSProduct.jsp new file mode 100644 index 0000000000..e3354590b0 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPOSProduct.jsp @@ -0,0 +1,310 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok, Preveen +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.compiere.model.MProduct" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + +<%@ page import="org.posterita.struts.pos.POSProductAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +
    +
    Barcode already exists!
    +
    Product name already exists!
    +
    + + + + +
    +
    + + + + + + + + + + + + + + + + +
    + + + +
    + * + + + +
    + * + + +
    +
    +
    + + + + + + +
    +
    + + + + + + + + + + + + +
    + * + + + + + + +
    +
    +
    + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + * + + + + + + +
    + * + + + + + + +
    + * + + + + + + +
    +
    +
    + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + * + + + + +
    + * + + + + +
    + * + + + + +
    + * + + + +
    +
    + + + +
    + + + +
    + + + + +
    + + +
    + + + +
    + + + +
    +
    +
    + + + + + + + +   + + +   + + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/createPOSUser.jsp b/posterita/posterita/web/jsp/pos/createPOSUser.jsp new file mode 100644 index 0000000000..c8a0b6f683 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPOSUser.jsp @@ -0,0 +1,281 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.compiere.model.MCommission" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + +
    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    * + + + +
    + * + + + + +
    *
    + +
    * + + +
    * + +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + +
    + +
    + +
    +
    +
    +
    + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + + Invoice + Order + Payment Receipts + + +
    + + + +
    + + + +
    + + + + Weekly + Monthly + Quarterly + Yearly + + +
    +
    +
    +
    + +   + + +
    + + + + + + + +
    +
    +
    + + + +
    +
    +
    +
    + +
    + + + + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/createPartialPOSOrder.jsp b/posterita/posterita/web/jsp/pos/createPartialPOSOrder.jsp new file mode 100644 index 0000000000..13a8106f9d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPartialPOSOrder.jsp @@ -0,0 +1,467 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    + + + + + + + + + +   +
    + + +
    + <%@ include file="/jsp/include/searchProductPanel.jsp" %> +
    +
     
    +
    +
    + <%@ include file="/jsp/pos/partialPOSOrderShoppingCart.jsp" %> +
    +
    + + + + + + +
    + <%@ include file="/jsp/include/tenderPanel.jsp" %> + + <%@ include file="/jsp/include/customerInfoPanel.jsp" %> + + + + + + + + +
    +   +
    +   +
    +
    +
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/createPayment.jsp b/posterita/posterita/web/jsp/pos/createPayment.jsp new file mode 100644 index 0000000000..3c3d2da6a8 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPayment.jsp @@ -0,0 +1,81 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.PaymentAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + +
    +
    + + +
    +
    + <%@ include file="/jsp/include/customerInfoPanel2.jsp" %> + + <%@ include file="/jsp/include/tenderPanel.jsp" %> +
    + +   + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/createPaymentTerm.jsp b/posterita/posterita/web/jsp/pos/createPaymentTerm.jsp new file mode 100644 index 0000000000..0d5e306386 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createPaymentTerm.jsp @@ -0,0 +1,84 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.PaymentTermAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + <%@ include file="/jsp/include/paymentTermsDetails.jsp" %> + + + + + +
      + +   + +  
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/createProductForm.jsp b/posterita/posterita/web/jsp/pos/createProductForm.jsp new file mode 100644 index 0000000000..05b02add9a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createProductForm.jsp @@ -0,0 +1,272 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.struts.pos.POSProductAction"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.compiere.model.MProduct"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.posterita.beans.ProductBean"%> + + + + + + + Ashish + + + + + + + + + + + + + + + + +
    + + + Create Product + + + Update Product + + +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + "> + Create Product + +
    + + + +
    + * + + + +
    + * + + +
    + * + + + + +
    + * + + + + + +
    + * + + + + +
    + * + + +
    + + + +
    + + + + +
    + + +
    + + + +
    + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + "> + + + + + + + + + + + + + + + + + + +
      
    + + * + + + + + + + + + + + + + + + + + + + + +     
    +
    + + + + + +
    +   +  
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/createRole.jsp b/posterita/posterita/web/jsp/pos/createRole.jsp new file mode 100644 index 0000000000..3da849aa03 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createRole.jsp @@ -0,0 +1,228 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.posterita.core.MenuItem" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + * + + + + +
    + + + +
    + + + +
    + + + +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + <%-- --%> + + + +
    + +
    + + + + +
    +
    + + Clear All + + + Select All + + + + +
    + +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/createTax.jsp b/posterita/posterita/web/jsp/pos/createTax.jsp new file mode 100644 index 0000000000..bedba677c8 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createTax.jsp @@ -0,0 +1,50 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.TaxAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +<%@ include file="/jsp/include/taxDetails.jsp" %> + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/createVendor.jsp b/posterita/posterita/web/jsp/pos/createVendor.jsp new file mode 100644 index 0000000000..1c4664c5b9 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createVendor.jsp @@ -0,0 +1,119 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.posterita.core.MenuItem" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + +
    +
    + + + + + + + + + +
    + * + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + +
     
    +
    +
    + + +   + + + + +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/createdCashPayment.jsp b/posterita/posterita/web/jsp/pos/createdCashPayment.jsp new file mode 100644 index 0000000000..08001d24dc --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createdCashPayment.jsp @@ -0,0 +1,105 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.compiere.model.MInOut" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.compiere.process.DocAction" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + <%@ include file="/jsp/pos/webDocumentHeader.jsp" %> + + + + + + + + + + +
    + + Payment By: +
    +
    + :
    + +
    + +
    +
    + + + + + + + + + + + +
    ::
    + + + + + +
    +
    + +
    +
    +
    + +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/createdProducts.jsp b/posterita/posterita/web/jsp/pos/createdProducts.jsp new file mode 100644 index 0000000000..ef2d252e18 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/createdProducts.jsp @@ -0,0 +1,63 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSStockAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +<% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + +
     
    >
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/creditOrderPayment.jsp b/posterita/posterita/web/jsp/pos/creditOrderPayment.jsp new file mode 100644 index 0000000000..690879dedd --- /dev/null +++ b/posterita/posterita/web/jsp/pos/creditOrderPayment.jsp @@ -0,0 +1,277 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CreditOrderAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.core.UDIPair" %> +<%@ page import="org.compiere.model.MInvoice" %> +<%@ page import="org.compiere.model.MPayment" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +  
    + + + +  
    + + + +  
    + + + +  
    + + + + + + + +
    + + + + + + + + +
    + +
    + +
    + + + + + + + + + + + + <%-- + + + + --%> +
    +   + +   + +   +
    + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + Cash + Card + Cheque + + + +
    + +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    + +   + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/creditOrderShoppingCart.jsp b/posterita/posterita/web/jsp/pos/creditOrderShoppingCart.jsp new file mode 100644 index 0000000000..7f21f6d2ed --- /dev/null +++ b/posterita/posterita/web/jsp/pos/creditOrderShoppingCart.jsp @@ -0,0 +1,24 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<% String items = Constants.CREDIT_ORDER_SHOPPING_CART_ITEMS; %> +<%@ include file="/jsp/pos/posShoppingCart.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/creditScreen.jsp b/posterita/posterita/web/jsp/pos/creditScreen.jsp new file mode 100644 index 0000000000..3508735893 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/creditScreen.jsp @@ -0,0 +1,246 @@ +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + +<% + String path = request.getContextPath(); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + //String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + int m_pricelist_id = POSTerminalManager.getSOPriceListId(ctx); + MPriceList priceList = MPriceList.get(ctx, m_pricelist_id, null); + String priceListName = priceList.getName(); + String orderType = UDIOrderTypes.CREDIT_ORDER.getOrderType(); + request.getSession().setAttribute(Constants.ORDER_TYPE, orderType); + + Object bPId = request.getSession().getAttribute(Constants.BPARTNER_ID); + Object bPName = request.getSession().getAttribute(Constants.BPARTNER_NAME); + Object bPCredit = request.getSession().getAttribute(Constants.BPARTNER_CREDIT); + String bPartnerId = bPId == null? "":bPId.toString(); + String bPartnerName = bPName == null? "": bPName.toString(); + String bPartnerCredit = bPCredit == null? "": bPCredit.toString(); + //set configuration + Configuration configuration = Configuration.getConfiguration(request); + String paymentRule = configuration.getPaymentRule(); + String searchProductBy = configuration.getSearchProductBy(); + boolean isCustomerCompulsory = configuration.isCustomerCompulsory(); +%> + +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.ShoppingcartManager"%> +<%@page import="org.posterita.core.Configuration"%> +<%@page import="org.posterita.user.WebUserInfo"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@page import="org.posterita.order.UDIOrderTypes.CreditOrder"%> +<%@page import="org.posterita.order.UDIOrderTypes"%> +<%@page import="org.posterita.Constants"%> + + + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/showErrors.jsp" %> +
    Please wait...
    + + + + +
    + +
    + +
    + + + + + + +
    + + + + +
    +
    + +
    +
    +
    + + + + + " styleId="priceListId"/> + + + + + + + + + + + + +
    +
    + <%= ShoppingcartManager.getShoppingcartAsHTML(request)%> +
    + +
    + +
    + +
    CLEAR
    +
    SHORTCUTS
    + +
    CHECKOUT
    +
    DISCOUNT
    +
    +
    +
    +
    + F1 Barcode | F2 Name | F3 Description | F4 Qty | F5 Customer | + Ctrl+Up MoveUp | Ctrl+Down MoveDown | Ctrl+Left Increment | Ctrl-Right Decrement | Ctrl-Backspace Remove | Ctrl-Esc Menu | + Ctrl-Delete Clear | Ctrl-Space Checkout | Ctrl-Esc Menu
    + + + + + + +
    +
    $0.00
    +
    + +
    + <%=priceListName%> +
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + +
    + +    
    +
    + +
    + +
    +
    + <%=bPartnerId%>
    + <%=bPartnerName%>
    +
    + <%=bPartnerCredit%>
    +
    +
    + +

    + + + +
    + + diff --git a/posterita/posterita/web/jsp/pos/creditorHistory.jsp b/posterita/posterita/web/jsp/pos/creditorHistory.jsp new file mode 100644 index 0000000000..a6c386192f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/creditorHistory.jsp @@ -0,0 +1,89 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.compiere.model.MBPartner"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="java.util.Properties"%> + +<%@ include file="/jsp/include/posHeader.jsp" %> + + +<%@page import="org.posterita.businesslogic.administration.BPartnerManager"%> +<%@page import="java.util.ArrayList"%> +<%@page import="java.util.Iterator"%> +<%@page import="org.posterita.Constants"%> +<% +BPartnerBean bean = (BPartnerBean)request.getSession().getAttribute(Constants.BPARTNER); +int c_bpartner_id = bean.getBpartnerId().intValue(); +MBPartner partner = MBPartner.get(ctx, c_bpartner_id); +String bpName = partner.getName(); + +if(partner.getName2() != null) +{ + bpName = bpName + " " + partner.getName2(); + bpName = bpName.trim(); +} +%> + +<%@page import="org.posterita.beans.BPartnerBean"%> +
    +

    + : <%=bpName.toUpperCase()%> +

    + + + + + + + + + + + + + + + + + + + + + +
    + + "> + + + + "> + + + + "> + +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/custRetShoppingCart.jsp b/posterita/posterita/web/jsp/pos/custRetShoppingCart.jsp new file mode 100644 index 0000000000..ae97a73831 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/custRetShoppingCart.jsp @@ -0,0 +1,120 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*"%> +<%@ page import="org.posterita.Constants"%> +<%@ page import="org.posterita.struts.stock.StockAction"%> + +<%@ page import="org.posterita.struts.pos.POSOrderAction"%> +<%@ page import="org.posterita.beans.ProductBean"%> +<%@ page import="org.posterita.user.WebUserInfo"%> +<%@ page import="org.posterita.lib.UdiConstants"%> +<%@ page import="org.posterita.struts.pos.POSGoodsAction"%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + + + + + + + + + + + +<% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    DescriptionQuantityPriceVATTotal   +   +
    + + + + + + + + + + + + + + + "> + + "> + + ">X +
    Grand Total + + + + + +    
    diff --git a/posterita/posterita/web/jsp/pos/customFastMovingItemReport.jsp b/posterita/posterita/web/jsp/pos/customFastMovingItemReport.jsp new file mode 100644 index 0000000000..45b6f69232 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customFastMovingItemReport.jsp @@ -0,0 +1,51 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +<%@ include file="/jsp/pos/customReportTable.jsp" %> + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/customPOSInfoReport.jsp b/posterita/posterita/web/jsp/pos/customPOSInfoReport.jsp new file mode 100644 index 0000000000..780e7ea60a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customPOSInfoReport.jsp @@ -0,0 +1,79 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +<% String data = (String) request.getSession().getAttribute(Constants.TABULAR_REPORT_DATA) ;%> + +<%@ include file="/jsp/pos/customReportTable.jsp" %> + + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/customReportTable.jsp b/posterita/posterita/web/jsp/pos/customReportTable.jsp new file mode 100644 index 0000000000..8d75d2e171 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customReportTable.jsp @@ -0,0 +1,173 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + +
    +
    + + + +
    + +   +

    +
    + + + + + + <%=reportData%> +
    +

    + + + + + + +

    + <%-- +

    + + +   + +

    + --%> + <% request.getSession().removeAttribute(Constants.TABULAR_REPORT_DATA); %> +
    +
    +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/customSalesByPeriodReport.jsp b/posterita/posterita/web/jsp/pos/customSalesByPeriodReport.jsp new file mode 100644 index 0000000000..969e9fa5a4 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customSalesByPeriodReport.jsp @@ -0,0 +1,55 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +
    + :
    + " styleClass="submenu">
    + " styleClass="submenu">
    + " styleClass="submenu">
    + " styleClass="submenu">
    + " styleClass="submenu">
    + " styleClass="submenu">
    + " styleClass="submenu">
    + " styleClass="submenu">
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/customSalesReport.jsp b/posterita/posterita/web/jsp/pos/customSalesReport.jsp new file mode 100644 index 0000000000..a9c1a3098c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customSalesReport.jsp @@ -0,0 +1,29 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<% +String actionPath = "/POSSalesReportAction"; +String action = "initCustomReport"; +String title = "Sales Report"; +%> + +<%@ include file="/jsp/pos/reportCalendar.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/customSlowMovingItemReport.jsp b/posterita/posterita/web/jsp/pos/customSlowMovingItemReport.jsp new file mode 100644 index 0000000000..e3dd06d074 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customSlowMovingItemReport.jsp @@ -0,0 +1,51 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +<%@ include file="/jsp/pos/customReportTable.jsp" %> + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/customStockMovementReport.jsp b/posterita/posterita/web/jsp/pos/customStockMovementReport.jsp new file mode 100644 index 0000000000..d40e97c72c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customStockMovementReport.jsp @@ -0,0 +1,50 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +<%@ include file="/jsp/pos/customReportTable.jsp" %> + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/customerDetails.jsp b/posterita/posterita/web/jsp/pos/customerDetails.jsp new file mode 100644 index 0000000000..f4c7a90f6d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customerDetails.jsp @@ -0,0 +1,245 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    *
    *
    + + <%@ include file="/jsp/include/dayList.jsp" %> + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + <%@ include file="/jsp/include/year.jsp" %> + + + + + +
    + * + + + + +
    + * + + + + + +
    +
    +
    + +
    + Credit Details + + + + + + + + + + + + + + +
    * + + <%=Constants.NO_CREDIT_CHECK%> + <%=Constants.CREDIT_OK%> + <%=Constants.CREDIT_STOP%> + + +
    + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + +
    *
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + Save + +
    + + + + + + + diff --git a/posterita/posterita/web/jsp/pos/customerReturnOrder.jsp b/posterita/posterita/web/jsp/pos/customerReturnOrder.jsp new file mode 100644 index 0000000000..65656259a5 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customerReturnOrder.jsp @@ -0,0 +1,376 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + +
    + "> + Create New + +
    +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + + + + + + + + + + +   + +
    + + + <%@ include file="/jsp/include/searchProductPanel.jsp" %> +  
    +
    +
    + <%@ include file="/jsp/pos/customerReturnShoppingCart.jsp" %> +
    +
    + + + + + + +
    +
    + +
    +
    + + + + + + + + + + + + +
    +
    +
    + <%@ include file="/jsp/include/customerInfoPanel.jsp" %> + +   +
    +
    + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + +
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/customerReturnOrder3.jsp b/posterita/posterita/web/jsp/pos/customerReturnOrder3.jsp new file mode 100644 index 0000000000..0c6f73dbe3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customerReturnOrder3.jsp @@ -0,0 +1,367 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + +
    + + + + + + + + + + +   + +
    + + + <%@ include file="/jsp/include/searchProductPanel.jsp" %> +  
    +
    +
    + <%@ include file="/jsp/pos/customerReturnShoppingCart.jsp" %> +
    +
    + + + + + + +
    +
    + Reason +
    +
    + + + + + + + + + + + + +
    +
    +
    +
    + : +
    +
    + +
    + + +
    +
    +
    +   +
    +
    + + + + + + + + + + + + + + + + + + + - + + + + + + + +
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/customerReturnShoppingCart.jsp b/posterita/posterita/web/jsp/pos/customerReturnShoppingCart.jsp new file mode 100644 index 0000000000..aa0ed8b8db --- /dev/null +++ b/posterita/posterita/web/jsp/pos/customerReturnShoppingCart.jsp @@ -0,0 +1,26 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + +<%@page import="org.posterita.businesslogic.ShoppingcartManager"%> +
    + <%= ShoppingcartManager.getShoppingcartAsHTML(request, null)%> +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/debtor.jsp b/posterita/posterita/web/jsp/pos/debtor.jsp new file mode 100644 index 0000000000..7afe245e6f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/debtor.jsp @@ -0,0 +1,78 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.compiere.model.MBPartner"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="java.util.Properties"%> + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + + +
    +
    +

    + +
    + +
    +
    +
    +   +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/debtorHistory.jsp b/posterita/posterita/web/jsp/pos/debtorHistory.jsp new file mode 100644 index 0000000000..9527c28e69 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/debtorHistory.jsp @@ -0,0 +1,89 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.compiere.model.MBPartner"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="java.util.Properties"%> + +<%@ include file="/jsp/include/posHeader.jsp" %> + + +<%@page import="org.posterita.businesslogic.administration.BPartnerManager"%> +<%@page import="java.util.ArrayList"%> +<%@page import="java.util.Iterator"%> +<%@page import="org.posterita.Constants"%> +<% +BPartnerBean bean = (BPartnerBean)request.getSession().getAttribute(Constants.BPARTNER); +int c_bpartner_id = bean.getBpartnerId().intValue(); +MBPartner partner = MBPartner.get(ctx, c_bpartner_id); +String bpName = partner.getName(); + +if(partner.getName2() != null) +{ + bpName = bpName + " " + partner.getName2(); + bpName = bpName.trim(); +} +%> + +<%@page import="org.posterita.beans.BPartnerBean"%> +
    +

    + : <%=bpName.toUpperCase()%> +

    + + + + + + + + + + + + + + + + + + + + + +
    + + "> + + + + "> + + + + "> + +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/detailedSalesReport.jsp b/posterita/posterita/web/jsp/pos/detailedSalesReport.jsp new file mode 100644 index 0000000000..fcda28c1f3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/detailedSalesReport.jsp @@ -0,0 +1,237 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +<% + String url = "DetailedSalesReport.do"; + String collection = Constants.DETAILED_SALES_REPORT; + boolean isFullDetails = false; + + if(request.getParameter("isFullDetails") != null) + { + isFullDetails = Boolean.parseBoolean(request.getParameter("isFullDetails")); + } + +%> + + + + + + +
    + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     
    > + + + + + +
    + + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + +
    + + +
    + + + +
    + +
    +
    +
    > + + + > + + <% + String partnerId= element.getBpartnerId() + ""; + %> + + + "> + + + + + + + "> + + + + + > + + + + + + + + + + + + + + + + + + Credit + + > + + + > + + > + + + > + + + + + + + + + "> + + + + + + + "> + + + + +
    +
    + + + +<%@ include file="/jsp/include/pager.jsp" %> +<%@ include file="/jsp/include/printOrderApplet2.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/downloadUploadCSVfile.jsp b/posterita/posterita/web/jsp/pos/downloadUploadCSVfile.jsp new file mode 100644 index 0000000000..eead27b195 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/downloadUploadCSVfile.jsp @@ -0,0 +1,90 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.EditBulkProductFromFileAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +All products +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +
    + + + + + + +
    + +
    + + Import + +
    + + + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedCreditOrder.jsp b/posterita/posterita/web/jsp/pos/draftedCreditOrder.jsp new file mode 100644 index 0000000000..b9ca6eb476 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedCreditOrder.jsp @@ -0,0 +1,65 @@ + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + <%@ include file="/jsp/include/draftedCreditOrder.jsp" %> + + + +<%@ include file="/js/draftedPOSOrder.js" %> + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder.jsp b/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder.jsp new file mode 100644 index 0000000000..b278e6d594 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder.jsp @@ -0,0 +1,107 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + +<% String orderlines = Constants.CUSTOMER_RETURN_ORDER_LINES; %> +<%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + +
    +
      +
    +
    +
    +
    + + + +   + +   +   + +
    +
    +
    + + + + +
    + + + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder2.jsp b/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder2.jsp new file mode 100644 index 0000000000..5d6f67d653 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder2.jsp @@ -0,0 +1,114 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + +<% String orderlines = Constants.CUSTOMER_RETURN_ORDER_LINES; %> +<%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + +
    +
      +
    +
    +
    +
    + + + + + + + +   + + +   +   + +
    +
    + + + + + +
    + + + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder3.jsp b/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder3.jsp new file mode 100644 index 0000000000..571d258124 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedCustomerReturnOrder3.jsp @@ -0,0 +1,114 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + +<% String orderlines = Constants.CUSTOMER_RETURN_ORDER_LINES; %> +<%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + +
    +
      +
    +
    +
    +
    + + + + + + + +   + + +   +   + +
    +
    + + + + + +
    + + + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedGoodsReceiveNote.jsp b/posterita/posterita/web/jsp/pos/draftedGoodsReceiveNote.jsp new file mode 100644 index 0000000000..21792226af --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedGoodsReceiveNote.jsp @@ -0,0 +1,116 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + +<% String orderlines = Constants.GOODS_RECEIVE_NOTE_LINES; %> +<%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + +
    +
    +   +
    +
    +
    + + + +   +   + +   + +
    +
    +
    + + + + + + + + + + + + + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedGoodsReturnNote.jsp b/posterita/posterita/web/jsp/pos/draftedGoodsReturnNote.jsp new file mode 100644 index 0000000000..5f4da1fa54 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedGoodsReturnNote.jsp @@ -0,0 +1,141 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*"%> +<%@ page import="org.posterita.Constants"%> +<%@ page import="org.posterita.struts.stock.StockAction"%> +<%@ page import="org.posterita.struts.pos.POSOrderAction"%> +<%@ page import="org.posterita.struts.pos.POSGoodsAction"%> +<%@ page import="org.posterita.beans.ProductBean"%> +<%@ page import="org.posterita.user.WebUserInfo"%> +<%@ page import="org.posterita.lib.UdiConstants"%> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> +<% String orderlines = Constants.GOODS_RETURN_NOTE_LINES; %> +<%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + + + + + + + + + + + + + + + + + + + + + + +
    + +   + +
    + +   +   + +   +
     
    + + + + + + + + + + + + + + +
    + +<%@ include file="/jsp/include/posFooter.jsp"%> diff --git a/posterita/posterita/web/jsp/pos/draftedPOSOrder.jsp b/posterita/posterita/web/jsp/pos/draftedPOSOrder.jsp new file mode 100644 index 0000000000..61ab5026b3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedPOSOrder.jsp @@ -0,0 +1,98 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + <%@ include file="/jsp/include/draftedPOSOrder.jsp" %> + + + +<%@ include file="/js/draftedPOSOrder.js" %> + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedPOSOrder2.jsp b/posterita/posterita/web/jsp/pos/draftedPOSOrder2.jsp new file mode 100644 index 0000000000..7b5f9fbefe --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedPOSOrder2.jsp @@ -0,0 +1,96 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
    + + + + <%@ include file="/jsp/include/draftedPOSOrder.jsp" %> + + +<%@ include file="/js/draftedPOSOrder.js" %> + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedPOSShoppingCart.jsp b/posterita/posterita/web/jsp/pos/draftedPOSShoppingCart.jsp new file mode 100644 index 0000000000..dd600b84bf --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedPOSShoppingCart.jsp @@ -0,0 +1,95 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + <%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +
    + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    > align="center"> align="center"> align="right"> align="right"> align="right"> align="right"> align="right">
    + + + +   + +   + + + + +   + + + + + + +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/draftedPartialPOSOrder.jsp b/posterita/posterita/web/jsp/pos/draftedPartialPOSOrder.jsp new file mode 100644 index 0000000000..cd9f209308 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedPartialPOSOrder.jsp @@ -0,0 +1,198 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + <%-- + + + +--%> + + + + + + + + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/draftedposOrderWA.jsp b/posterita/posterita/web/jsp/pos/draftedposOrderWA.jsp new file mode 100644 index 0000000000..3e2b66cc3d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/draftedposOrderWA.jsp @@ -0,0 +1,197 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
    + + + +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + + + + + + + + + + + + + + + + + + +<%@ include file="/js/draftedPOSOrder.js" %> + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/dunningLettersPrinted.jsp b/posterita/posterita/web/jsp/pos/dunningLettersPrinted.jsp new file mode 100644 index 0000000000..8ba8111819 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/dunningLettersPrinted.jsp @@ -0,0 +1,56 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
    +
    + +
    + + + + + + + +
    + + + + + + + + +
    +
    +
    +
    + + <% String orderlines = Constants.PARTIAL_POS_ORDER_LINES; %> + <%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + + > +
    +
    +
    +   +
    +
    +
    +   +   +   +
    +
    +
    + + + + + + + +
    + + + + + + + +
    +
    + +
     
    +
    + + + + + + + +
    + + + + + + + + +
    +
    +
    + <% String orderlines = Constants.POS_ORDER_LINES; %> + <%@ include file="/jsp/pos/draftedPOSShoppingCart.jsp" %> + + > +
    +
    +
    +   +
    +
    +
    + + + + +   + + + + + + + + "> +   + + + + + +   +
    +
    + + + + + + + +
    + + + + + + + +
    +
    +
    + + + + + +
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editBlackListCheque.jsp b/posterita/posterita/web/jsp/pos/editBlackListCheque.jsp new file mode 100644 index 0000000000..26368aaf08 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editBlackListCheque.jsp @@ -0,0 +1,79 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + +<%@ page import="org.posterita.struts.customer.CustomerAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + * + + +
    + + +
    + +   + +
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editBulkProductPrice.jsp b/posterita/posterita/web/jsp/pos/editBulkProductPrice.jsp new file mode 100644 index 0000000000..365631086e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editBulkProductPrice.jsp @@ -0,0 +1,199 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.struts.pos.POSProductAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + +
    + * + + +
    + * + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    + * + + + + + + +
    + * + + + + + + +
    + * + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + +
    + * + + + Select a TAX category + + +
    + * + + + +
    +
    + + + +
    + + + +
    + + + +
    +
    +
    + +   + +
    +
    + +<%@include file="/jsp/include/posFooter.jsp"%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editPOSCustomer.jsp b/posterita/posterita/web/jsp/pos/editPOSCustomer.jsp new file mode 100644 index 0000000000..6e7ffa1053 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editPOSCustomer.jsp @@ -0,0 +1,53 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.struts.customer.CustomerAction" %> +<%@ page import="org.compiere.model.MBPartner" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +<%@ include file="/jsp/pos/customerDetails.jsp" %> + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editPOSUser.jsp b/posterita/posterita/web/jsp/pos/editPOSUser.jsp new file mode 100644 index 0000000000..f9583dab3e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editPOSUser.jsp @@ -0,0 +1,284 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.compiere.model.MCommission" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> + +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    * + + + +
    + * + + + + +
    * +           + + +
    * + +
    * + + +
    * + +
    +
    +
    + +
    + Address + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + + +
    + +
    + +
    +
    +
    + + + + + + +
    +
    + User's Details + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + + Invoice + Order + Payment Receipts + + +
    + + + +
    + + + +
    + + + + Weekly + Monthly + Quarterly + Yearly + + +
    +   +
    +
    +
    + + + + + + + + + +   + + + + + + + + + + + + +
    +
    +
    + Information + + +
    +
    +
    + + + + + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editPaymentTerm.jsp b/posterita/posterita/web/jsp/pos/editPaymentTerm.jsp new file mode 100644 index 0000000000..08f4e95fc1 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editPaymentTerm.jsp @@ -0,0 +1,68 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.PaymentTermAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + <%@ include file="/jsp/include/paymentTermsDetails.jsp" %> + + + + + + +
      + +   + +  
    + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/editRole.jsp b/posterita/posterita/web/jsp/pos/editRole.jsp new file mode 100644 index 0000000000..52d852d55a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editRole.jsp @@ -0,0 +1,254 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.posterita.core.MenuItem" %> +<%@ page import="org.posterita.beans.RoleBean" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +<% + RoleBean roleBean = (RoleBean)request.getSession().getAttribute(Constants.ROLE); + String role = roleBean.getName(); + String roleId = String.valueOf(roleBean.getRoleId().intValue()); + + boolean isAccAllOrgs = roleBean.getIsAccessAllOrgs().booleanValue(); + String accAllOrgs = ""; + if(isAccAllOrgs) + accAllOrgs = "checked=\"checked\""; + + boolean isDiscountUptoLimitPrice = roleBean.getIsDiscountUptoLimitPrice().booleanValue(); + String discountUptoLimitPrice = ""; + if(isDiscountUptoLimitPrice) + discountUptoLimitPrice = "checked=\"checked\""; + + boolean isDiscountOnTotal = roleBean.getIsDiscountAllowedOnTotal().booleanValue(); + String discountOnTotal = ""; + if(isDiscountOnTotal) + discountOnTotal = "checked=\"checked\"";; + + +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + * + + + + +
    + + + +
    + + + +
    + + + +
    + + + + + + + + + +
    + + + + + + + + + + <% + String checked = ""; + if(((MenuItem)ele).isAvailable()) + checked = "checked=\"checked\""; + %> + + + + + + + + + + + + + + + + + +
    + +
    + + + /> +
    + +
    + + + + +
    +
    + + Clear All + + + Select All + + + + +
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editRoleOrgAccess.jsp b/posterita/posterita/web/jsp/pos/editRoleOrgAccess.jsp new file mode 100644 index 0000000000..f34bac4e6c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editRoleOrgAccess.jsp @@ -0,0 +1,110 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.posterita.core.MenuItem" %> +<%@ page import="org.posterita.beans.RoleBean" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +<% + RoleBean roleBean = (RoleBean)request.getSession().getAttribute(Constants.ROLE); + String role = roleBean.getName(); +%> + + + + + + + +
    + +
    + + + + + + + + + + +
    + + + + + + + <% + String checked1 = ""; + if(((RoleBean)roleOrgAccessIndexed).getIsChecked().booleanValue()) + checked1 = "checked"; + %> + + + + + + + +
    + + + + + + + + +
    +
    + + Clear All + + + Select All + + + + +
    + +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editTax.jsp b/posterita/posterita/web/jsp/pos/editTax.jsp new file mode 100644 index 0000000000..f361a10f40 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editTax.jsp @@ -0,0 +1,52 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.struts.pos.TaxAction" %> +<%@ page import="org.compiere.model.MProduct" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +<%@ include file="/jsp/include/taxDetails.jsp" %> + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/editVendor.jsp b/posterita/posterita/web/jsp/pos/editVendor.jsp new file mode 100644 index 0000000000..c4c9f9a7f8 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editVendor.jsp @@ -0,0 +1,122 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.posterita.core.MenuItem" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + +
    +
    + + Contact + + + + + + + + +
    + * + + + +
    +
    +
    +
    + Address + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + Phone + + + + + + + + + + + + + + +
     
    +
    +
    +   +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editattribute.jsp b/posterita/posterita/web/jsp/pos/editattribute.jsp new file mode 100644 index 0000000000..87995dd590 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editattribute.jsp @@ -0,0 +1,71 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +
    + + + + + + + + + + + + + + +
    +
    +
    +   +
    +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/editpriceList.jsp b/posterita/posterita/web/jsp/pos/editpriceList.jsp new file mode 100644 index 0000000000..ab05160e68 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/editpriceList.jsp @@ -0,0 +1,57 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + +
    +   +
    +<%@include file="/jsp/include/posFooter.jsp"%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/filter.jsp b/posterita/posterita/web/jsp/pos/filter.jsp new file mode 100644 index 0000000000..df59c401e7 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/filter.jsp @@ -0,0 +1,109 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + <%@include file="/jsp/include/month.jsp"%> + + + + + + + <% + int currentYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR); + %> + <%= currentYear %> + <%= currentYear - 1 %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/jsp/pos/generateCommission.jsp b/posterita/posterita/web/jsp/pos/generateCommission.jsp new file mode 100644 index 0000000000..6e15561a3b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/generateCommission.jsp @@ -0,0 +1,69 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + <%@ include file="/jsp/include/posFooter.jsp" %> +
    + <%@ include file="/jsp/include/startCalendar.jsp" %> +
    +   +
    + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/genericReport.jsp b/posterita/posterita/web/jsp/pos/genericReport.jsp new file mode 100644 index 0000000000..9d663c3aee --- /dev/null +++ b/posterita/posterita/web/jsp/pos/genericReport.jsp @@ -0,0 +1,72 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.struts.pos.POSReportAction"%> +<%@page import="org.posterita.Constants"%> + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
     
    +
    <%=reportName%>
    +
     
    + + + +
    <%=reportComment%>
    +
     
    + + + +
    + + <%=componentList %> +
    + +
     
    + + + + +
    + Report As: + + Generate +
    + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/getCreditOrderDiscDetails.jsp b/posterita/posterita/web/jsp/pos/getCreditOrderDiscDetails.jsp new file mode 100644 index 0000000000..9f0e4e5a4e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getCreditOrderDiscDetails.jsp @@ -0,0 +1,210 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.form.OrderLineForm" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="java.math.BigDecimal" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
    + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + <% + String defaultDiscount = "0"; + String defaultPrice = element.getPrice().toString(); + + OrderLineForm form = (OrderLineForm)request.getAttribute("OrderLineForm"); + + if(form!=null) + { + String[] discountPercentage = form.getDiscountPercent(); + String[] actualPrice = form.getActualPrice(); + + if(discountPercentage!= null) + if(discountPercentage.length!=0) + defaultDiscount = discountPercentage[count.intValue()]; + + if(actualPrice!=null) + if(actualPrice.length!=0) + defaultPrice = actualPrice[count.intValue()]; + } + %> + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + "/> + + + + + +
    + + + + + + + +   + +
    + +
    +
    + + +
    + +   + + + + +   + + +   + + + + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/getCurrentTillAmount.jsp b/posterita/posterita/web/jsp/pos/getCurrentTillAmount.jsp new file mode 100644 index 0000000000..cd52ed37ce --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getCurrentTillAmount.jsp @@ -0,0 +1,117 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/posterita.tld" prefix="posterita"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/getCustomerReturnFormPOSOrder.jsp b/posterita/posterita/web/jsp/pos/getCustomerReturnFormPOSOrder.jsp new file mode 100644 index 0000000000..3fef08bf95 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getCustomerReturnFormPOSOrder.jsp @@ -0,0 +1,96 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +
    + + + + + + + + +
    + + + +
    + +
    +
    +
    + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/getPOSCustomers.jsp b/posterita/posterita/web/jsp/pos/getPOSCustomers.jsp new file mode 100644 index 0000000000..79014d93c2 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getPOSCustomers.jsp @@ -0,0 +1,139 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + +
    + + + + <%@ include file="/jsp/include/searchCustomerPanel.jsp" %> +
    + + + +
    + + + + +   + + + + <%@ include file="/jsp/pos/shoppingCart.jsp" %> + + + + +   + + + + + + + + + + +   + + + + + + + + + + +
    + - Alt-N + + - Alt-S + + - Alt-C +
    + + +
    + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/getPOSPaymentDetails.jsp b/posterita/posterita/web/jsp/pos/getPOSPaymentDetails.jsp new file mode 100644 index 0000000000..a9cdb97bd3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getPOSPaymentDetails.jsp @@ -0,0 +1,66 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.form.OrderLineForm" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="java.math.BigDecimal" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +
    + + + <%@ include file="/jsp/include/posPaymentDetails.jsp" %> + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/getPOSPaymentDetails2.jsp b/posterita/posterita/web/jsp/pos/getPOSPaymentDetails2.jsp new file mode 100644 index 0000000000..bf75c5815f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getPOSPaymentDetails2.jsp @@ -0,0 +1,67 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.form.OrderLineForm" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="java.math.BigDecimal" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + <%@ include file="/jsp/include/posPaymentDetails2.jsp" %> + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/pos/getPOSPaymentDetails_1.jsp b/posterita/posterita/web/jsp/pos/getPOSPaymentDetails_1.jsp new file mode 100644 index 0000000000..cc2908878d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getPOSPaymentDetails_1.jsp @@ -0,0 +1,218 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
    + + + +   + + + + + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + +
    + + + + + + + + + +
    + + + + + + " id="price<%= count%>"/> + + + + " id="actualPrice<%= count%>" onchange="setDiscountValue('discountPercent<%= count%>', 'price<%= count%>','actualPrice<%= count%>')"/> +
    + + + + +   + + + +   + + + + + + + + + + + +
    + + + + + + + +
    +
    + + +
    + +
    + + + + + +
    + + + +
    + + + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/getPOSStock.jsp b/posterita/posterita/web/jsp/pos/getPOSStock.jsp new file mode 100644 index 0000000000..1576e61b9b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getPOSStock.jsp @@ -0,0 +1,172 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSStockAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.core.UDIPair" %> +<%@ page import="java.math.RoundingMode" %> +<%@ page import= "java.math.BigDecimal"%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + <% + String url = "GetPOSStock.do"; + String collection = Constants.PRODUCTS; + %> + + + + +
    + + + + + + + + + +   + + +    + + + + + > 0 + < 0 + = 0 + > 25 + > 50 + > 100 + +
    + + + + + + + +
    + + + + + + + + + + +
    +
    + <% + org.displaytag.decorator.TotalTableDecorator totals = new org.displaytag.decorator.TotalTableDecorator(); + totals.setTotalLabel("Total"); + pageContext.setAttribute("totals", totals); + %> + + + + + + + + + + + + + + + + + +
    +
    + + +   + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/getPartialPOSPaymentDetails.jsp b/posterita/posterita/web/jsp/pos/getPartialPOSPaymentDetails.jsp new file mode 100644 index 0000000000..bd6fc1d259 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/getPartialPOSPaymentDetails.jsp @@ -0,0 +1,816 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.form.OrderLineForm" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="java.math.BigDecimal" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + +
    + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + <% + String defaultDiscount = "0"; + String defaultPrice = element.getPrice().toString(); + + OrderLineForm form = (OrderLineForm)request.getAttribute("OrderLineForm"); + + if(form!=null) + { + String[] discountPercentage = form.getDiscountPercent(); + String[] actualPrice = form.getActualPrice(); + + if(discountPercentage!= null) + if(discountPercentage.length!=0) + defaultDiscount = discountPercentage[count.intValue()]; + + if(actualPrice!=null) + if(actualPrice.length!=0) + defaultPrice = actualPrice[count.intValue()]; + } + %> + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + "/> + + + + + +
    + + + + + +   + +
    + +
    +
     
    + + + + + +   + + + + + + + + + + + + + + +
    + +   + + + +   + + + +   + + + +   + +
    + + + + +   + + + + + + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + +   + + + + +   + + + + +   + + + + + + + + + + + +
    + + + + + + + + + +
    + + +
    + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/goodsReceiveNote.jsp b/posterita/posterita/web/jsp/pos/goodsReceiveNote.jsp new file mode 100644 index 0000000000..bbdaac5408 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/goodsReceiveNote.jsp @@ -0,0 +1,324 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.*"%> +<%@ page import="org.posterita.Constants"%> +<%@ page import="org.posterita.struts.stock.StockAction"%> + +<%@ page import="org.posterita.struts.pos.POSOrderAction"%> +<%@ page import="org.posterita.beans.ProductBean"%> +<%@ page import="org.posterita.user.WebUserInfo"%> +<%@ page import="org.posterita.lib.UdiConstants"%> +<%@ page import="org.posterita.struts.pos.POSGoodsAction"%> +<%@ page import="org.posterita.order.UDIOrderTypes" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + +
    + + + + + + + + + +   +
    + + + <%@ include file="/jsp/include/searchProductPanel.jsp" %> +
    +
    +
    +
    + <%@ include file="/jsp/pos/goodsReceiveShoppingCart.jsp" %> +
    +
     
    +   +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +<%@ include file="/jsp/include/posFooter.jsp"%> diff --git a/posterita/posterita/web/jsp/pos/goodsReceiveShoppingCart.jsp b/posterita/posterita/web/jsp/pos/goodsReceiveShoppingCart.jsp new file mode 100644 index 0000000000..d8e002aa1b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/goodsReceiveShoppingCart.jsp @@ -0,0 +1,25 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<% String items = Constants.GOODS_RECEIVE_NOTE_SHOPPING_CART_ITEMS; %> +<%@ include file="/jsp/pos/posShoppingCart.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/goodsReturnNote.jsp b/posterita/posterita/web/jsp/pos/goodsReturnNote.jsp new file mode 100644 index 0000000000..1a6bd4c787 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/goodsReturnNote.jsp @@ -0,0 +1,321 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.user.*"%> +<%@ page import="org.posterita.Constants"%> +<%@ page import="org.posterita.struts.stock.StockAction"%> + +<%@ page import="org.posterita.struts.pos.POSOrderAction"%> +<%@ page import="org.posterita.beans.ProductBean"%> +<%@ page import="org.posterita.user.WebUserInfo"%> +<%@ page import="org.posterita.lib.UdiConstants"%> +<%@ page import="org.posterita.struts.pos.POSGoodsAction"%> +<%@ page import="org.posterita.order.UDIOrderTypes" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + +
    + "> + Create New + +
    +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + +
    + + + + + + + + + +   +
    + + + <%@ include file="/jsp/include/searchProductPanel.jsp" %> +
    + +
    +
    + <%@ include file="/jsp/pos/posShoppingCart.jsp" %> +
    +
     
    +   +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +<%@ include file="/jsp/include/posFooter.jsp"%> diff --git a/posterita/posterita/web/jsp/pos/goodsReturnShoppingCart.jsp b/posterita/posterita/web/jsp/pos/goodsReturnShoppingCart.jsp new file mode 100644 index 0000000000..f37f6e467b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/goodsReturnShoppingCart.jsp @@ -0,0 +1,25 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<% String items = Constants.GOODS_RETURN_NOTE_SHOPPING_CART_ITEMS; %> +<%@ include file="/jsp/pos/posShoppingCart.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/grnShoppingCart.jsp b/posterita/posterita/web/jsp/pos/grnShoppingCart.jsp new file mode 100644 index 0000000000..c5ba5272ad --- /dev/null +++ b/posterita/posterita/web/jsp/pos/grnShoppingCart.jsp @@ -0,0 +1,25 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<% String items = Constants.SHOPPING_GRN_CART_ITEMS; %> +<%@ include file="/jsp/pos/posShoppingCart.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/importBlackList.jsp b/posterita/posterita/web/jsp/pos/importBlackList.jsp new file mode 100644 index 0000000000..d84cde9908 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/importBlackList.jsp @@ -0,0 +1,97 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.ImportPOSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + +
    + +
    + + + +
    +
    + +
    +<% + String cvsURL = request.getContextPath() + "/jsp/pos/importTemplate.csv"; +%> + + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    MCB6090018000250
    MCB7714739680121
    + +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/importCustomer.jsp b/posterita/posterita/web/jsp/pos/importCustomer.jsp new file mode 100644 index 0000000000..80f0cf118a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/importCustomer.jsp @@ -0,0 +1,248 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.ImportPOSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="org.posterita.struts.pos.ImportCustomerAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + +Import Customer +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + +
    + +
    + + Import + +
    +
    + +
    +<% + String cvsURL = request.getContextPath() + "/jsp/pos/importTemplate.csv"; + String csvURL1=request.getContextPath() + "/jsp/pos/importGarmentTemplate.csv"; +%> +
    + + This utility is to import a list of Customers from a csv file into the system, the csv file should look like the one shown below including the header: + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Account NoNameAddress1Address2Address3Postal CodeStr Address1Str Address2Str Address3ContactPhoneFax
    +   +
    Payment TermCredit LmtBF BalanceTotal OweSales RepPriceListTax NoBankBranchBank Acc NoEmailMobile
    +
    + + + + + +
    +
    View Remaining Details



    + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + + %> + + + + + + + + + + + + + + +
    Account NoNameAddress1Address2Postal CodeStr Address1Str Address2Address3ContactPhoneFax
    +
    View Remaining Details



    + +
    + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/importPOSProducts.jsp b/posterita/posterita/web/jsp/pos/importPOSProducts.jsp new file mode 100644 index 0000000000..afc574048f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/importPOSProducts.jsp @@ -0,0 +1,155 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.ImportPOSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +
    +

    + +   + +

    +
    + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + + + + + +
    + + + +
    +
    + +
    +<% + String cvsURL = request.getContextPath() + "/import/importTemplate.csv"; + String csvURL1=request.getContextPath() + "/import/importGarmentTemplate.csv"; +%> + +: + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Tshirt6090018000250Tshirt Red XLTshirt Red XLOne300400380350025
    Trousers7714739680121black cotton Lblack cotton LEach3504504304101520
    + + + Garment Template +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/importPOSStock.jsp b/posterita/posterita/web/jsp/pos/importPOSStock.jsp new file mode 100644 index 0000000000..c7969ebc0c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/importPOSStock.jsp @@ -0,0 +1,62 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author shameem +--%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + +
    + +
    + + IMPORT + +
    +
    + + + + + + + + + + + + + + +
    609001800025025
    771473968012120
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/index.jsp b/posterita/posterita/web/jsp/pos/index.jsp new file mode 100644 index 0000000000..3c9c1dc11d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/index.jsp @@ -0,0 +1,45 @@ +<% +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +%> + + + + + Tamak POS + + + + + + + + +
    + + + + +
    + + +
    +
    + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/initMaxItem.jsp b/posterita/posterita/web/jsp/pos/initMaxItem.jsp new file mode 100644 index 0000000000..60eec97c2c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/initMaxItem.jsp @@ -0,0 +1,37 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<% +String actionPath = "/CustomFastMovingItemReportAction"; +String action = "getCustomReport"; +String title = "Most Sold Items"; +%> + +<%@ include file="/jsp/pos/reportCalendar.jsp" %> + + + +<%--<%@ include file="/jsp/pos/reportParameters.jsp" %>--%> + + + diff --git a/posterita/posterita/web/jsp/pos/initMinItem.jsp b/posterita/posterita/web/jsp/pos/initMinItem.jsp new file mode 100644 index 0000000000..7faf373c2e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/initMinItem.jsp @@ -0,0 +1,38 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<% +String actionPath = "/CustomSlowMovingItemReportAction"; +String action = "getCustomReport"; +String title = "Least Sold Items"; +%> + +<%@ include file="/jsp/pos/reportCalendar.jsp" %> + + + +<%--<%@ include file="/jsp/pos/reportParameters.jsp" %>--%> + + + diff --git a/posterita/posterita/web/jsp/pos/initViewPOSInfo2.jsp b/posterita/posterita/web/jsp/pos/initViewPOSInfo2.jsp new file mode 100644 index 0000000000..63a0bd6743 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/initViewPOSInfo2.jsp @@ -0,0 +1,31 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<% +String actionPath = "/CustomPOSInfoAction"; +String action = "getCustomReport"; +String title = "POS INFO"; +%> + +<%@ include file="/jsp/pos/reportCalendar.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/initViewSalesAnalysisReport.jsp b/posterita/posterita/web/jsp/pos/initViewSalesAnalysisReport.jsp new file mode 100644 index 0000000000..7c4d430b62 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/initViewSalesAnalysisReport.jsp @@ -0,0 +1,35 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<% +String actionPath = "/CustomSalesAnalysisReportAction"; +String action = "getCustomReport"; +String title = "Sales Analysis Report"; +%> + +<%@ include file="/jsp/pos/reportCalendar.jsp" %> + + + +<%--<%@ include file="/jsp/pos/reportParameters.jsp" %>--%> diff --git a/posterita/posterita/web/jsp/pos/initViewStockMovement.jsp b/posterita/posterita/web/jsp/pos/initViewStockMovement.jsp new file mode 100644 index 0000000000..27253e0f8e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/initViewStockMovement.jsp @@ -0,0 +1,38 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<% +String actionPath = "/CustomStockMovementReportAction"; +String action = "getCustomReport"; +String title = "Stock Movement Report"; +%> + +<%@ include file="/jsp/pos/reportCalendar.jsp" %> + + + +<%--<%@ include file="/jsp/pos/reportParameters.jsp" %>--%> + + + diff --git a/posterita/posterita/web/jsp/pos/inventoryImportErrors.jsp b/posterita/posterita/web/jsp/pos/inventoryImportErrors.jsp new file mode 100644 index 0000000000..eaf8644b19 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/inventoryImportErrors.jsp @@ -0,0 +1,56 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.ImportPOSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +

    + + Back to Inventory Cart + + + + + Save as CSV + +

    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/invokeCreditOrder.jsp b/posterita/posterita/web/jsp/pos/invokeCreditOrder.jsp new file mode 100644 index 0000000000..13ecee3991 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/invokeCreditOrder.jsp @@ -0,0 +1,97 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +
    + + + + + + + + +
    + + + +
    + +
    +
    +
    + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/invokePartialPOSOrder.jsp b/posterita/posterita/web/jsp/pos/invokePartialPOSOrder.jsp new file mode 100644 index 0000000000..75cfc29d1e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/invokePartialPOSOrder.jsp @@ -0,0 +1,97 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +
    + + + + + + + + +
    + + + +
    + +
    +
    +
    + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/listCashBooks.jsp b/posterita/posterita/web/jsp/pos/listCashBooks.jsp new file mode 100644 index 0000000000..1e82c0a2ec --- /dev/null +++ b/posterita/posterita/web/jsp/pos/listCashBooks.jsp @@ -0,0 +1,98 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> + +<%@page import="org.posterita.struts.pos.CashBookAction"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +
    + + + + + + + +
    + + + + +   + + + + <pos:message textOnly="true" key="add"/> + +
    +
    + + + + + + + + + Journals + + + + + Edit + + + + View + + + + + Deactivate + + + + + + Activate + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/listCurrencies.jsp b/posterita/posterita/web/jsp/pos/listCurrencies.jsp new file mode 100644 index 0000000000..8ba6893712 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/listCurrencies.jsp @@ -0,0 +1,93 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Servansingh +--%> + + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.struts.pos.CurrencyAction"%> +<%@page import="org.posterita.Constants"%> +Currency +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + +
    + + + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + "> + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/listPOSUsers.jsp b/posterita/posterita/web/jsp/pos/listPOSUsers.jsp new file mode 100644 index 0000000000..c172f9d48e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/listPOSUsers.jsp @@ -0,0 +1,144 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + +
    + + + + + + + + +
    + + + + + +   + + + + + Add Customer + +
    +
    + +. + + + + + + + + + + + + + + + + <% + String url = "ListPOSUsers.do"; + String collection = Constants.ALL_USERS; + %> + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + +
     
    + + + + + + + + + "> + Edit Customer + + + + "> + View Customer + + + + "> + User Customer + + + + + "> + Activate User + + +
    +<%@ include file="/jsp/include/pager.jsp" %> + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/listPriceLists.jsp b/posterita/posterita/web/jsp/pos/listPriceLists.jsp new file mode 100644 index 0000000000..fb5ffafb1f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/listPriceLists.jsp @@ -0,0 +1,140 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + + + +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.struts.pos.PriceListAction"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.struts.pos.POSProductAction"%> +Price Lists +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +
    + + + + + + + + + + + + "> + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + "> + + + + + + "> + + + + + + + + + "> + + + + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/listRoles.jsp b/posterita/posterita/web/jsp/pos/listRoles.jsp new file mode 100644 index 0000000000..d4330dc5f1 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/listRoles.jsp @@ -0,0 +1,124 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +
    + + + + + + + + +
    + + + + + +   + + + + + Add Customer + +
    +
    + + + + + + + + + + + + + + + +<% + String url = "ListPOSRoles.do"; + String collection = Constants.ALL_ROLES; +%> + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + +
     
    + + + + + "> + Edit Role + + + "> + View Role + + + + Edit Organisation Access + + + <%--">Delete--%> +
    + +<%@ include file="/jsp/include/pager.jsp" %> + +
    +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/listTerminals.jsp b/posterita/posterita/web/jsp/pos/listTerminals.jsp new file mode 100644 index 0000000000..c96de110f7 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/listTerminals.jsp @@ -0,0 +1,120 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> + +<%@page import="org.posterita.struts.pos.TerminalAction"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +
    + + + + + + + + +
    + + + + +   + + + + <pos:message textOnly="true" key="add"/> + + + + <pos:message textOnly="true" key="ResetCurrentPOSTerminal"/> + +
    +
    + + + + + + + + + + + + Edit + + + + View + + + <% + String activateDisplay = "none"; + String deactivateDispay = "none"; + if (((TerminalBean)row).getIsActive().booleanValue()) + { + deactivateDispay = "inline"; + } + else + { + activateDisplay = "inline"; + } + %> + + + + Deactivate + + + + + + Activate + + + + + <pos:message textOnly="true" key="UpdateCurrentPOSTerminal"/> + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/monthlySalesReport.jsp b/posterita/posterita/web/jsp/pos/monthlySalesReport.jsp new file mode 100644 index 0000000000..ae00109316 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/monthlySalesReport.jsp @@ -0,0 +1,36 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.Constants"%> + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + <%=salesReportData%> + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/orderDetailsPerProduct.jsp b/posterita/posterita/web/jsp/pos/orderDetailsPerProduct.jsp new file mode 100644 index 0000000000..9eadde4ae4 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/orderDetailsPerProduct.jsp @@ -0,0 +1,113 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> + +<% + String url = "ViewPOSHistory.do?orderType=" + orderType; + String collection = Constants.POS_HISTORY; +%> + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    +<%@ include file="/jsp/include/printOrderApplet2.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/orderHeader.jsp b/posterita/posterita/web/jsp/pos/orderHeader.jsp new file mode 100644 index 0000000000..52389c3385 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/orderHeader.jsp @@ -0,0 +1,129 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.compiere.model.MBPartner" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.beans.POSHistoryBean" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + +
    +
    + + +
    + + +
    + +
    +
    + +
    + : + + + +
    + +
    + + : + + + ( + + : + + + + , : + + + + , : + + ) +
    + + +
    + +
    +
    + +
    +
    + + + <% + String url = ""; + String partnerId = partner.get_ID() + ""; + %> + + <%url = "POSCustomerAction.do?action=viewPOSCustomer&bpartnerId=" + partnerId; %> + + + <%url = "POSVendorAction.do?action=viewVendorDetails1&bpartnerId=" + partnerId; %> + + + + + +
    + +
    + + + +
    + +
    + + : + +
    + +
    + + +
    + + +
    + : +
    +
    + +
    + +
    + +
    +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/orderScreen.jsp b/posterita/posterita/web/jsp/pos/orderScreen.jsp new file mode 100644 index 0000000000..2c4b194387 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/orderScreen.jsp @@ -0,0 +1,727 @@ + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + +<% + String path = request.getContextPath(); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + + Object bPId = request.getSession().getAttribute(Constants.BPARTNER_ID); + Object bPName = request.getSession().getAttribute(Constants.BPARTNER_NAME); + Object bPCredit = request.getSession().getAttribute(Constants.BPARTNER_CREDIT); + String bPartnerId = bPId == null? "":bPId.toString(); + String bPartnerName = bPName == null? "": bPName.toString(); + String bPartnerCredit = bPCredit == null? "": bPCredit.toString(); + + //set configuration + Configuration configuration = Configuration.getConfiguration(request); + String orderType = configuration.getOrderType(); + boolean isSOTrx = configuration.getIsSOTrx(); + String paymentRule = configuration.getPaymentRule(); + String searchProductBy = configuration.getSearchProductBy(); + boolean isCustomerCompulsory = configuration.isCustomerCompulsory(); + boolean isTerminalLocked = POSTerminalManager.isTerminalLocked(ctx); + + Integer priceListId = PriceListManager.getDefaultPriceListId(ctx, isSOTrx); + Object plId = request.getSession().getAttribute(Constants.ORDER_PRICE_LIST); + if (plId != null) + { + try + { + priceListId = Integer.valueOf(String.valueOf(plId)); + } + catch (NumberFormatException e){} + } + MPriceList priceList = MPriceList.get(ctx, priceListId.intValue(), null); + String priceListName = priceList.getName(); + MCurrency currency = MCurrency.get(ctx, priceList.getC_Currency_ID()); + BigDecimal roundOffFactor = currency.getRoundOffFactor(); + + if (isTerminalLocked) + { + posName += " (Locked)"; + } + + String bpartnerType = "Customer"; + if (!isSOTrx) + { + bpartnerType = "Vendor"; + } + + String showComponent = ""; + + if(orderType.equals(UDIOrderTypes.CUSTOMER_RETURN_ORDER.getOrderType()) || + orderType.equals(UDIOrderTypes.POS_GOODS_RETURN_NOTE.getOrderType()) + ) + { + showComponent = "style='display:none'"; + } + + String advancedAction = "/LoadAdvancedOrderScreen.do?action=loadAdvancedOrderScreen&isSOTrx="+isSOTrx; + + int roleId = Env.getAD_Role_ID(ctx); + float discountAllowed = RoleManager.getDiscountAllowed(ctx, roleId, null).floatValue(); + boolean isAllowedOverridePriceLimit = RoleManager.isOverridePriceLimitAllowed(ctx, roleId, null); + boolean isDiscountUptoLimitPrice = RoleManager.isDiscountUptoPriceLimit(ctx, roleId, null); + boolean isDiscountAllowedOnTotal = RoleManager.isDiscountAllowedOnTotal(ctx, roleId, null); + + int menuId = MenuManager.getMenuId(ctx, "pmenu.cash.sales"); +%> + +<%@page import="org.posterita.Constants"%> +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.ShoppingcartManager"%> +<%@page import="org.posterita.core.Configuration"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.compiere.model.MCurrency"%> +<%@page import="org.compiere.util.WebSessionCtx"%> +<%@page import="org.posterita.user.WebUserInfo"%> +<%@page import="org.posterita.order.UDIOrderTypes.POSOrder"%> +<%@page import="org.posterita.order.UDIOrderTypes"%> +<%@page import="org.posterita.businesslogic.administration.PriceListManager"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> + +<%@page import="org.posterita.businesslogic.administration.RoleManager"%> +<%@page import="org.posterita.businesslogic.MenuManager"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/showErrors.jsp" %> +
    Please wait...
    + + + + + + + + + + + + + + + + + + + + + + + + " styleId="roundOffFactor"/> + + + + + + + + + + + + + + + " id="isCustomerCompulsory"/> + + + + + + + + + + + +
    +
    + + +
    + <%= orderType %> +
    +
    +
    +
    + : + <%=orgName%> +
    +
    + : + <%=posName%> +
    +
    +
    +
    + : + +
    +
    + : + <%=roleName%> +
    +
    +
    +
    +
    +
    +
    +
    +
    0.00
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + +
    + BARCODE: + + + NAME: +
    +
    + DESC: +
    +
    +
    +
    +
    +
    +
    +
    + <%=priceListName%> +
    +
    +
    +
    +
    +
    + <%= ShoppingcartManager.getShoppingcartAsHTML(request, orderType)%> +
    +
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Barcode + + +
    + Name + + +
    + Description + + +
    + Tax Cat + + +
    + Stock Qty + + +
    + Price List + + +
    + Price Std + + +
    + Price Limit + + +
    +
    +
    + + Increase item quantity + Decrease item quantity + Remove item +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    + <%=bpartnerType%> + + +
    +
    + Code + + <%=bPartnerId%> +
    + Name + + <%=bPartnerName%> +
    + Credit Available + + <%=bPartnerCredit%> +
    + Credit Limit + + +
    + Open Balance + + +
    +
    +
    +
    +
    +

    Payment Method

    + Cash Payment + Card Payment + Cheque Payment +
    Mix Payment + On Credit Payment +
    +
    +
    + + +
    +
    +
    +
    + "/>')" src="images/newUI/butn-discount.gif" alt="Discount" width="95px" height="23px" border="0px"/> + Quick Discount + Open Drawer + Clear all items +
    +
    +
    +
    +
    + Change PIN + Reset USER + Proceed to Checkout +
    +
    +
    +
    +
    + F1 Barcode | F2 Name | F3 Description | F4 Qty | F5 Customer | F6 Discount | F8 Toggle Quick Discount | F9 Cash | F10 Card | F11 Check | F12 Mix | + Ctrl+C Credit | Ctrl+Up MoveUp | Ctrl+Down MoveDown | Ctrl+Left Decrement | Ctrl-Right Increment | Ctrl-Backspace Remove | Ctrl+M Menu | + Ctrl-D Open Drawer | Ctrl-Delete Clear | Ctrl+Space Checkout | Ctrl+P Change PIN | Ctrl+R Reset User +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Total:

    Amount Tendered:
    Write Off Amount:
    Payment Amount:
    Amount Refunded:
     
    + + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + +

    Total:

    Card + +
    Card No:
    + + +
    +
    +
    +
    +
    + + + + + + + + + + + + +

    Total:

    Cheque No:
    + + +
    +
    +
    +
    +
    + + + + + + + + + + + + +

    Total:

    Card No:
    + + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Total:

    Cash Amt:
    Cheque Amt:
    Cheque No:
    Card Amt:
    Card No:
    + + +
    +
    +
    + +
    +
    +
    + + + + + + + + + + +
    + +
    +
    + +
    +
    +
    + + +
    +
    +
    +
    + +
    + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> +
    + +
    +
    +
    +
    + + diff --git a/posterita/posterita/web/jsp/pos/partialPOSOrderShoppingCart.jsp b/posterita/posterita/web/jsp/pos/partialPOSOrderShoppingCart.jsp new file mode 100644 index 0000000000..059dc27a9e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/partialPOSOrderShoppingCart.jsp @@ -0,0 +1,27 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<% String items = Constants.PARTIAL_ORDER_SHOPPING_CART_ITEMS; %> +<%@ include file="/jsp/pos/posShoppingCart.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/posLogin.jsp b/posterita/posterita/web/jsp/pos/posLogin.jsp new file mode 100644 index 0000000000..e35255195a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/posLogin.jsp @@ -0,0 +1,308 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + + +<% +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +%> + + +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<% +String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + +if(appName == null) +{ + appName = "POSterita"; +} + +%> + + + + + +Welcome to <%=appName%> + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    POS Login
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + <%@ include file="/jsp/include/errors.jsp"%> +
    +
    +
    + +
    + + + +
    + + + +
    + +
    + + + +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + +
    + +
    + +
    + +
    +
    +
    +
    + 7 +
    +
    +
    +
    + 8 +
    +
    +
    +
    + 9 +
    +
    +
    +
    + 4 +
    +
    +
    +
    + 5 +
    +
    +
    +
    + 6 +
    +
    +
    +
    + 1 +
    +
    +
    +
    + 2 +
    +
    +
    +
    + 3 +
    +
    +
    +
    + C +
    +
    +
    +
    + 0 +
    +
    +
    +
    + OK +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/posPINLogin.jsp b/posterita/posterita/web/jsp/pos/posPINLogin.jsp new file mode 100644 index 0000000000..cb158e42e1 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/posPINLogin.jsp @@ -0,0 +1,141 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + +<title><pos:message textOnly="true" key="posPassowrd.welcome"/> + + + + + + + + + + + + +
    + + + + + + + + + + + +
    +
    + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/posPassword.jsp b/posterita/posterita/web/jsp/pos/posPassword.jsp new file mode 100644 index 0000000000..22c85c444a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/posPassword.jsp @@ -0,0 +1,79 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ page import="org.posterita.Constants" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + +<pos:message textOnly="true" key="posPassowrd.welcome"/> + + + + + + + + + + +
    + + + + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/posReport.jsp b/posterita/posterita/web/jsp/pos/posReport.jsp new file mode 100644 index 0000000000..567f283935 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/posReport.jsp @@ -0,0 +1,312 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +"/> +"/> + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + +
    +
    + + + + + +
    +
    + + + + +
    +
    +
    + + + + +
    +
    +
    +
    + + + + + +
    +
    + + + +
    +   +
    +   +   +   +   +
    +
    + + + + + <% request.getSession().removeAttribute(Constants.REPORT_URL); %> + + + + + + +
    + + <%=reportData%> +
    +

    + +   + +

    +
    + <% request.getSession().removeAttribute(Constants.TABULAR_REPORT_DATA); %> +
    + + + + + + + + + <% request.getSession().removeAttribute(Constants.TABULAR_REPORT_DATA2); %> + +
    +
    + + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/posReport1.jsp b/posterita/posterita/web/jsp/pos/posReport1.jsp new file mode 100644 index 0000000000..be4df44fe7 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/posReport1.jsp @@ -0,0 +1,292 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +"/> +"/> + + + + + + + + + + + + + + +
    + :
    + + + +
    +
    + + + + + +
    +
    +
    +
    + + + + + + + + + + + + +
    +
    + +
    +
    + + + + + + + + + + +
    + + + + + + + + + +
    + + + + <%@ include file="/jsp/include/dayList.jsp" %> + + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + + <%@ include file="/jsp/include/yearList.jsp" %> + + + + + + <%@ include file="/jsp/include/hourList.jsp" %> + + h + + <%@ include file="/jsp/include/minuteList.jsp" %> + +
    +
    + + + + + + + + + + +
    + + + + <%@ include file="/jsp/include/dayList.jsp" %> + + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + + <%@ include file="/jsp/include/yearList.jsp" %> + + + + + + <%@ include file="/jsp/include/hourList.jsp" %> + + h + + <%@ include file="/jsp/include/minuteList.jsp" %> + +
    +
    +
    +
    +
    + :
    + + + +
     
    +
    + + + + + + + + + + + + + +
    +   + +
    +   + +
    +   + +
    +   + +
    +
    + +
    + + + + <% request.getSession().removeAttribute(Constants.REPORT_URL); %> + + + + + + <%=reportData%> +
    +

    + + <% request.getSession().removeAttribute(Constants.TABULAR_REPORT_DATA); %> +

    +
    +
    +
    + +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/posShoppingCart.jsp b/posterita/posterita/web/jsp/pos/posShoppingCart.jsp new file mode 100644 index 0000000000..bfc05c936c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/posShoppingCart.jsp @@ -0,0 +1,101 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + +<% +String styleClass = "label"; +if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + +
       +
    + +
    +
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/posShoppingCartFirstPage.jsp b/posterita/posterita/web/jsp/pos/posShoppingCartFirstPage.jsp new file mode 100644 index 0000000000..a0900ab35b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/posShoppingCartFirstPage.jsp @@ -0,0 +1,27 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> +<% String items = Constants.SHOPPING_ORDER_CART_ITEMS; %> +<%@ include file="/jsp/pos/posShoppingCart.jsp" %> + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/posSubMenu.jsp b/posterita/posterita/web/jsp/pos/posSubMenu.jsp new file mode 100644 index 0000000000..76d680067e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/posSubMenu.jsp @@ -0,0 +1,79 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.core.MenuItem" %> + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="java.util.Properties"%> +<%@ page import="org.posterita.model.MWebMenu" %> +<%@ page import="java.util.HashMap" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.core.MenuItem" %> +<%@ page import="java.util.Map.Entry"%> +<%@ page import="java.util.Iterator"%> +<%@ page import="org.posterita.core.businesslogic.ElementManager" %> +<%@ page import="org.posterita.core.bean.ElementBean" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + +<%@page import="org.posterita.businesslogic.MenuManager"%> + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> + +
    + + + + + + +
    + + + + +
    +
    +

    POS MAIN MENU

    +
    +
    + <%= MenuManager.getMainMenus(ctx, request) %> +
    +
    +
    + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/postingSuccess.jsp b/posterita/posterita/web/jsp/pos/postingSuccess.jsp new file mode 100644 index 0000000000..6416721bae --- /dev/null +++ b/posterita/posterita/web/jsp/pos/postingSuccess.jsp @@ -0,0 +1,55 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author shameem +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CashBookAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + +Resubmit Posting +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
    + All the documents/invoice have heen sucessfully resubmitted. +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/priceCheck.jsp b/posterita/posterita/web/jsp/pos/priceCheck.jsp new file mode 100644 index 0000000000..abdd447f7f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/priceCheck.jsp @@ -0,0 +1,80 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.compiere.model.MOrder" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + +
    + + + +
    + +
    + + + +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/priceList.jsp b/posterita/posterita/web/jsp/pos/priceList.jsp new file mode 100644 index 0000000000..6eba32bc88 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/priceList.jsp @@ -0,0 +1,109 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + +
    + : + +   +
    + + +
    + + + + + + + + + + + + <% + String style = "label"; + if((count.intValue() % 2) == 0) + style = "contentname"; + %> + + + + + + + +
    + + + + +   +
    > + + > + + > + + + + +
    + + + + +
    + +
    +
    +<%@include file="/jsp/include/posFooter.jsp"%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/printPOSOrder.jsp b/posterita/posterita/web/jsp/pos/printPOSOrder.jsp new file mode 100644 index 0000000000..855dca7593 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/printPOSOrder.jsp @@ -0,0 +1,157 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + <pos:message textOnly="true" key="print.order"/> + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +
    + <%-- Caters for previously sold vehicles where sales rep was not available --%> + + Sales Representative: + +
    + + + +
    + + + +
    + + +
    + : +
    + + + + + +
    + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + +
    >>>>>>
    + + + + + + + +
    +
    + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/productBarcodeCart.jsp b/posterita/posterita/web/jsp/pos/productBarcodeCart.jsp new file mode 100644 index 0000000000..7609a04b0a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/productBarcodeCart.jsp @@ -0,0 +1,387 @@ + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<% + String path = request.getContextPath(); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + int menu_id = MenuManager.getMenuId(ctx, "pmenu.administration"); + String orderType = "Barcode Printing"; + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + int m_pricelist_id = Env.getContextAsInt(ctx, UdiConstants.PRICELIST_CTX_PARAM); + MPriceList priceList = MPriceList.get(ctx, m_pricelist_id, null); + String priceListName = priceList.getName(); + String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + + //set configuration + Configuration configuration = Configuration.getConfiguration(request); + String searchProductBy = configuration.getSearchProductBy(); +%> + + +<%@page import="org.posterita.Constants"%> +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.ShoppingcartManager"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@page import="org.posterita.TangoColors"%> +<%@page import="org.posterita.businesslogic.MenuManager"%> +<%@page import="org.posterita.core.Configuration"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + +
    Please wait...
    + + + + + + + + + + + + + + " styleId="priceListId"/> + + + + + + + + + + + + + +
    +
    + + +
    + <%= orderType %> +
    +
    +
    +
    + : + <%=orgName%> +
    +
    + : + <%=posName%> +
    +
    +
    +
    + : + +
    +
    + : + <%=roleName%> +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + +
    + BARCODE: + + + NAME: +
    +
    + DESC: +
    +
    +
    +
    +
    +
    +
    +
    + <%=priceListName%> +
    +
    +
    +
    +
    +
    + <%= ShoppingcartManager.getBarcodecartAsHTML(request)%> +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Barcode + + +
    + Name + + +
    + Description + + +
    + Tax Cat + + +
    + Stock Qty + + +
    + Price List + + +
    + Price Std + + +
    + Price Limit + + +
    + +
    +
    + + Increase item quantity + Decrease item quantity + Remove item +
    +
    +
    + + + + +
    + Do you want to print labels with: +
     Product Name
    +
     Product Description
    +
     Product Prices
    +
    +
    +
    +
    + + + + + +
    + <%=priceListName%> + +
    CHANGE
    +
    +
    +
    +
    +
    +
    +
    + Open Drawer + Clear all items +
    +
    +
    +
    +
    PRINT
    +
    +
    +
    + F1 Barcode | F2 Name | F3 Description | F4 Qty | Ctrl+Up MoveUp | Ctrl+Down MoveDown | Ctrl+Left + Increment | Ctrl-Right Decrement | Ctrl-Backspace Remove | Ctrl-Space Open Drawer | Ctrl-Delete Clear | Ctrl-P + Print Barcode | Ctrl+M Menu +
    +
    +
    + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> +
    + + + + + + + + + + + + + + + + + + + + + diff --git a/posterita/posterita/web/jsp/pos/productDetails.jsp b/posterita/posterita/web/jsp/pos/productDetails.jsp new file mode 100644 index 0000000000..2b6fb1014c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/productDetails.jsp @@ -0,0 +1,74 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductDetailsBean" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/productDetailsError.jsp b/posterita/posterita/web/jsp/pos/productDetailsError.jsp new file mode 100644 index 0000000000..d824f96b9b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/productDetailsError.jsp @@ -0,0 +1,25 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +
    Could not retrieve product details
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/productsUpdated.jsp b/posterita/posterita/web/jsp/pos/productsUpdated.jsp new file mode 100644 index 0000000000..dec301df57 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/productsUpdated.jsp @@ -0,0 +1,71 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.EditBulkProductFromFileAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +
    + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/reportCalendar.jsp b/posterita/posterita/web/jsp/pos/reportCalendar.jsp new file mode 100644 index 0000000000..bb21563622 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/reportCalendar.jsp @@ -0,0 +1,156 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="java.util.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + +
    + + + + + + + + + +
    + : + + + <%@ include file="/jsp/include/dayList.jsp" %> + + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + + <%@ include file="/jsp/include/yearList.jsp" %> + + + + + + <%@ include file="/jsp/include/hourList.jsp" %> + + h + + <%@ include file="/jsp/include/minuteList.jsp" %> + +
    +
    + + + + + + + + + + +
    + : + + + <%@ include file="/jsp/include/dayList.jsp" %> + + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + + <%@ include file="/jsp/include/yearList.jsp" %> + + + + + + <%@ include file="/jsp/include/hourList.jsp" %> + + h + + <%@ include file="/jsp/include/minuteList.jsp" %> + +
    +
    + + + + + +   +
    + + <%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/reportFilter.jsp b/posterita/posterita/web/jsp/pos/reportFilter.jsp new file mode 100644 index 0000000000..282a501a87 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/reportFilter.jsp @@ -0,0 +1,230 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +
    + + + + + + + + + + +
    + +
    +
    + : + +
    +
    + : +
    +
    + + +
    +
    + +
    +
    + Custom + + + + + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + +
    + + + + + + + + + +
    + : + + + <%@ include file="/jsp/include/dayList.jsp" %> + + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + + <%@ include file="/jsp/include/yearList.jsp" %> + + + + + + <%@ include file="/jsp/include/hourList.jsp" %> + + h + + <%@ include file="/jsp/include/minuteList.jsp" %> + +
    +
    + + + + + + + + + + +
    + : + + + <%@ include file="/jsp/include/dayList.jsp" %> + + + + <%@ include file="/jsp/include/monthList.jsp" %> + + + + <%@ include file="/jsp/include/yearList.jsp" %> + + + + + + <%@ include file="/jsp/include/hourList.jsp" %> + + h + + <%@ include file="/jsp/include/minuteList.jsp" %> + +
    +
    +
    +
    +
    +
    + + + + +
    + +
    +
    +
    + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/retShoppingCart.jsp b/posterita/posterita/web/jsp/pos/retShoppingCart.jsp new file mode 100644 index 0000000000..0f40f17a19 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/retShoppingCart.jsp @@ -0,0 +1,150 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + + + + + + + + + + +<% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + +   + +   + +   +
    + + + + + + + + + + + + + + + + + + + + + "/> + + + + + + + + + "/> + + + + + ">X +
    + + + + + +    
    \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/salesReport.jsp b/posterita/posterita/web/jsp/pos/salesReport.jsp new file mode 100644 index 0000000000..e1f6176a5b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/salesReport.jsp @@ -0,0 +1,76 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> +<% + String isSalesReport = request.getParameter("isSalesReport"); + String pageTitle = "smenu.sales.report"; + String reportDetailsStyle = "display: block"; + + boolean isSalesRPT = Boolean.parseBoolean(isSalesReport); + + if(!(isSalesRPT)) + { + pageTitle = "smenu.purchase.report"; + reportDetailsStyle = "display:none"; + } +%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + +
    +
    + + + + + +
    +
    +<%@ include file="/jsp/pos/customReportTable.jsp" %> + +
    +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/saveVendor.jsp b/posterita/posterita/web/jsp/pos/saveVendor.jsp new file mode 100644 index 0000000000..c50d51b632 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/saveVendor.jsp @@ -0,0 +1,144 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.posterita.core.MenuItem" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + + + + +
    + * + + +
    + * + + + + +
    + * + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + +
     
    +
    +
    +
    +   +
    + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/searchCustomer.jsp b/posterita/posterita/web/jsp/pos/searchCustomer.jsp new file mode 100644 index 0000000000..8a7fe6e881 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/searchCustomer.jsp @@ -0,0 +1,98 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.businesslogic.CustomerManager" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.beans.CustomerBean" %> +<%@ page import="java.util.Properties" %> +<%@ page import="org.posterita.core.businesslogic.ElementManager" %> +<%@ page import="org.posterita.core.bean.ElementBean" %> +<% + Properties ctx = TmkJSPEnv.getCtx(request); + + String customerName = request.getParameter("customerQuery"); + ElementBean elementBean = null; + elementBean = ElementManager.getMsg(ctx, "not.found"); + + ArrayList customerList = CustomerManager.searchCustomers(ctx,customerName,false); + + CustomerBean bean = null; + + if (customerList == null || customerList.size() == 0) + { + //out.print("
      "); + //out.print("
    • "); + //out.print("
    "); + out.print("
    "); + } + else + { + int size = 15; + size = (size > customerList.size())? customerList.size() : size; + + out.print("
      "); + + for(int i=0;i"); + out.print(name); + out.print(""); + } + + out.print("
    "); + + elementBean = ElementManager.getMsg(ctx, "search.result.displaying"); + String msg = elementBean.getName(); + + out.print("
    "); + + } +%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/searchPOSGarmentAttributes.jsp b/posterita/posterita/web/jsp/pos/searchPOSGarmentAttributes.jsp new file mode 100644 index 0000000000..542a80aac8 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/searchPOSGarmentAttributes.jsp @@ -0,0 +1,56 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.businesslogic.POSProductManager" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.core.businesslogic.ElementManager" %> +<%@ page import="org.posterita.core.bean.ElementBean" %> +<%@ page import="java.util.Properties" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> +<% + ArrayList results = POSProductManager.searchPOSGarmentAttributes(request); + Properties ctx = TmkJSPEnv.getCtx(request); + int max = 10; + + ElementBean elementBean = null; + elementBean = ElementManager.getMsg(ctx, "not.found"); + + if (results == null || results.size() == 0) + { + out.print(elementBean.getName()); + } + else + { + out.print("
      "); + + max = (max > results.size()) ? results.size() : max; + + for(int i=0;i" + results.get(i) + ""); + } + + out.print("
        "); + } +%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/searchPOSProducts.jsp b/posterita/posterita/web/jsp/pos/searchPOSProducts.jsp new file mode 100644 index 0000000000..7a50df7677 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/searchPOSProducts.jsp @@ -0,0 +1,299 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
        + + + + +   + + +
        +
        + + + + + + + + + + + + + + + + + + + +
        + + +
        + +<% + String url = "SearchPOSProducts.do"; + String collection = Constants.VIEW_POS_PRODUCTS; +%> + +
        + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + +
         
        width="100px"> + + width="400px"> + + > + + > + +   +
        +<%@ include file="/jsp/include/pager.jsp" %> + + +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/searchVendor.jsp b/posterita/posterita/web/jsp/pos/searchVendor.jsp new file mode 100644 index 0000000000..4cc6401b05 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/searchVendor.jsp @@ -0,0 +1,97 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + + +<%@ page import="org.posterita.businesslogic.CustomerManager" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.beans.CustomerBean" %> +<%@ page import="org.posterita.businesslogic.BPartnerManager" %> +<%@ page import="org.posterita.businesslogic.VendorManager" %> +<%@ page import="org.posterita.core.businesslogic.ElementManager" %> +<%@ page import="org.posterita.core.bean.ElementBean" %> +<% + Properties ctx = TmkJSPEnv.getCtx(request); + String customerName = request.getParameter("customerQuery"); + + ArrayList customerList = VendorManager.searchVendors(TmkJSPEnv.getCtx(request),customerName,true); + CustomerBean bean = null; + + ElementBean elementBean = null; + elementBean = ElementManager.getMsg(ctx, "not.found"); + + if (customerList == null || customerList.size() == 0) + { + out.print("
          "); + out.print("
        • "); + out.print("
        "); + out.print("
        "); + } + else + { + int size = 15; + size = (size > customerList.size())? customerList.size() : size; + + out.print("
          "); + + for(int i=0;i"); + out.print(vendorName); + out.print(""); + } + + out.print("
        "); + + elementBean = ElementManager.getMsg(ctx, "search.result.displaying"); + String msg = elementBean.getName(); + + out.print("
        "); + + } +%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/settleAPPayment.jsp b/posterita/posterita/web/jsp/pos/settleAPPayment.jsp new file mode 100644 index 0000000000..183919f9b4 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/settleAPPayment.jsp @@ -0,0 +1,592 @@ + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CreditOrderAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.core.UDIPair" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + + + +
        +
        + +
        +
        + +
        + +
        + +
        + + <%@ include file="/jsp/include/searchVendorPanel.jsp" %> +
        + +
        +
        +
        +
        +
        + + + + + + + + + +
        + UnPaid + + Partially Paid + + Paid + + Over Paid +
        + +<%-- + + + +--%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/errors.jsp" %> + +
        + + + + + +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + String styleClass = ""; + %> + + <% + styleClass = "green"; + %> + + + + <% + styleClass = "red"; + %> + + + + + <% + styleClass = "yellow"; + %> + + + + + + + + <% + styleClass = "blue"; + %> + + + + <% + styleClass = "blue"; + %> + + + + + + + + + + + + + + + + + + + + + + + +
        + Pay + + + + + + + + + + + + + + + + + + + + + + + +   +
        > + + + + + Pay + + + + + > + "> + + + > + "> + + + > + + + > + + + > + + > + + > + + > + + > + + + > + + "> + + + > + + + > + + + + + +
        + + Pay + + + + + + Match + + +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + +   +
        + "> + + + + + + + + + + + + + + + + + + +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + + + +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/settlePayment.jsp b/posterita/posterita/web/jsp/pos/settlePayment.jsp new file mode 100644 index 0000000000..3b347f064b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/settlePayment.jsp @@ -0,0 +1,610 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CreditOrderAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.core.UDIPair" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + + + +
        +
        + +
        +
        + +
        + +
        + +
        + + <%@ include file="/jsp/include/searchCustomerPanel2.jsp" %> +
        + +
        +
        +
        +
        +
        + + + + + + + + + +
        + UnPaid + + Partially Paid + + Paid + + Over Paid +
        + +<%-- + + + +--%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/errors.jsp" %> + +
        + + + + + +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + String styleClass = ""; + %> + + <% + styleClass = "green"; + %> + + + + <% + styleClass = "red"; + %> + + + + + <% + styleClass = "yellow"; + %> + + + + + + + + <% + styleClass = "blue"; + %> + + + + <% + styleClass = "blue"; + %> + + + + + + + + + + + + + + + + + + + + + + + +
        + Pay + + + + + + + + + + + + + + + + + + + + + + + +   +
        > + + + + + Pay + + + + + > + "> + + + > + "> + + + > + + + > + + + > + + > + + > + + > + + > + + + > + + "> + + + > + + + > + + + + + +
        + + Pay + + + + + + Match + + +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + +   +
        + "> + + + + + + + + + + + + + + + + + + +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + + + +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/shoppingCart.jsp b/posterita/posterita/web/jsp/pos/shoppingCart.jsp new file mode 100644 index 0000000000..1f7d1ecc00 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/shoppingCart.jsp @@ -0,0 +1,139 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + +
        + + + + + + + + + + +   + +   + +   +
        + + + + + + + + + + + + + + + + +
          + + + + + +    + +
        +
        + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/stockAdjustments.jsp b/posterita/posterita/web/jsp/pos/stockAdjustments.jsp new file mode 100644 index 0000000000..b3dc1a3ed5 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/stockAdjustments.jsp @@ -0,0 +1,36 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.Constants"%> + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + <%=stockReportData%> + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/terminal.jsp b/posterita/posterita/web/jsp/pos/terminal.jsp new file mode 100644 index 0000000000..1429f361e1 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/terminal.jsp @@ -0,0 +1,421 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + +<%@page import="org.posterita.struts.pos.TerminalAction"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + <% + boolean readonly = new Boolean((String)strReadOnly).booleanValue(); + boolean orgReadOnly = true; + + if (terminalId != null) + { + try + { + orgReadOnly = (Integer.parseInt((String)terminalId) > 0); + } + catch (Exception ex) + {} + } + %> + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + +
        + * + + +
        + * + + + + +
        + + + + + + + + +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + +
        + + + + + + + + + + + +
        + + + + + + + + + + + +
        + + + + + + + + +
        +
        +
        +
        + + + + + + + + + + + + + + + + + +
        + * + + + + + + + + + + + +
        + + + + + + + + + + + + +
        + + + + + + + + + + + + +
        +
        +
        +
        + + + + + + + + + + + +
        + + + + + + + + +   + + + + + + + + + + +
        + + + + + + + + + +   + +
        +
        +
        + + + Copy As + + + + + Edit + + + + + Save + + + + + Cancel + + +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/testShoppingCart.jsp b/posterita/posterita/web/jsp/pos/testShoppingCart.jsp new file mode 100644 index 0000000000..bb34ec5920 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/testShoppingCart.jsp @@ -0,0 +1,152 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + +
        + Description + + Quantity + + Price + + VAT + + Total + +   + +   + +   +
        + + + + + + + + + + + + + + + + + + "> + + "> + + "> +
        Grand Total + + + + + + + + +    + +
        +
        + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/updateCurrency.jsp b/posterita/posterita/web/jsp/pos/updateCurrency.jsp new file mode 100644 index 0000000000..88fb1fafaa --- /dev/null +++ b/posterita/posterita/web/jsp/pos/updateCurrency.jsp @@ -0,0 +1,115 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Servansingh +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.Constants"%> +<%@page import="org.posterita.beans.CurrencyBean"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.struts.pos.CurrencyAction"%> +Currency +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + Previous + + "> + Next + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        +   +
        +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/updatePOSProduct.jsp b/posterita/posterita/web/jsp/pos/updatePOSProduct.jsp new file mode 100644 index 0000000000..d98a1d1c84 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/updatePOSProduct.jsp @@ -0,0 +1,285 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.compiere.model.MProduct" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + +<%@ page import="org.posterita.struts.pos.POSProductAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +
        +
        +
        +
        + + + + + + + + + + + + + + + + +
        +
        + + + + + + +
        + + + + + + + + + + + + + +
        + + + +
        + * + + + +
        + * + + +
        +
        + + + <% + ProductBean bean = (ProductBean)ProductForm.getBean(); + if(bean.getImageInfo() != null) + if(bean.getImageInfo().getHasAttachment() != null) + if(bean.getImageInfo().getHasAttachment().booleanValue()){%> + "> + <%}%> + + +   + +
        +
        +
        +
        + + + + + + + + + + + +
        + * + + + + + + +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + +
        + * + + + + + + +
        + * + + + + + + +
        + * + + + + + + +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + * + + + + +
        + * + + + +
        +
        + + + +
        + + + +
        + + + + + Select Product Type + + + + + + + + +
        + + + +
        + + + +
        +
        +
        + +   + +
        +
        + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/updatedProduct.jsp b/posterita/posterita/web/jsp/pos/updatedProduct.jsp new file mode 100644 index 0000000000..7a4ff5c8f9 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/updatedProduct.jsp @@ -0,0 +1,136 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + + +<%@ page import="org.posterita.struts.pos.POSProductAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewAPPaymentAllocation.jsp b/posterita/posterita/web/jsp/pos/viewAPPaymentAllocation.jsp new file mode 100644 index 0000000000..6448bd409d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewAPPaymentAllocation.jsp @@ -0,0 +1,153 @@ + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.BPartnerInfoBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.CreditOrderAction" %> +<%@ page import="org.posterita.struts.pos.DunningAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + +
        + +
        + : + +   + + : + +   + + +   + +
        + +
        + + + + + +<% + String url = "ViewPaymentAllocation.do"; + String collection = Constants.PAYMENT_ALLOCATIONS; +%> + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + +
        memo
        > + + "> + + + + > + "> + + + > + "> + + + + > + "> + + + + > + "> + + + > + "> + + + > + + > + + > + + > + +
        +<%@ include file="/jsp/include/pager.jsp" %> +
        +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewAllPOSProducts.jsp b/posterita/posterita/web/jsp/pos/viewAllPOSProducts.jsp new file mode 100644 index 0000000000..e2e5cbb743 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewAllPOSProducts.jsp @@ -0,0 +1,503 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + +<%@ include file="/jsp/include/posHeaderAdministration.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        + + + + + + + + + + + +
        + + + + + + + DESC: + + + +   + +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        + + +
        + Are you sure you want to delete the prices for the following products? + + Delete +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + String url = "ViewAllPOSProduct.do"; + String collection = Constants.VIEW_POS_PRODUCTS; + %> + + + + + + <% + String styleClass = "oddRow"; + if ((count.intValue()%2) != 0) + styleClass = "evenRow"; + %> + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + + + + + +
        + "> + + + + + + + + + + + + + + + + + + + + + + +
        +
        + + + <%@ include file="/jsp/include/pager.jsp" %> + + +
        +
        +
        +
        +
        + + +
        + Stock Qty: +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Sales Figures
        + Period + + Sales + + Total Amt +
        + Today + + + + +
        + Current Week + + + + +
        + Current Month + + + + +
        + 6 Months + + + + +
        + Current Year + + + + +
        +
        +
        +
        + +
        +
        +
        +
        + + + + +
        + No products were found for : +
        +
        +
        + + + + + + + +
        +
        +
        +
        +
        +
        + Clear all items +
        +
        +
        +
        +
        +
        +
        + F1 Barcode | F2 Name | F3 Description | Ctrl+Up MoveUp | Ctrl+Down MoveDown + | Ctrl-N New Product | Ctrl-E Edit Product | Ctrl-I Import Products | Ctrl+M Menu | + Ctrl-D Open Drawer | Ctrl-Delete Clear +
        +
        + + diff --git a/posterita/posterita/web/jsp/pos/viewAllPOSProductsForUpdate.jsp b/posterita/posterita/web/jsp/pos/viewAllPOSProductsForUpdate.jsp new file mode 100644 index 0000000000..915ad89f95 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewAllPOSProductsForUpdate.jsp @@ -0,0 +1,281 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.EditBulkProductFromFileAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + +
        + + +   + +
        +
        + + + + + + + + + + + + + + + + +
        + +
        +
        +
        + + + +
        + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + +
         
        width="400px"> + + > + + + > + + + > + +   +
        +
        +
        +
        +<%-- + + + + Create CSV + + +--%> + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewAllPaymentTerm.jsp b/posterita/posterita/web/jsp/pos/viewAllPaymentTerm.jsp new file mode 100644 index 0000000000..56c7ee6161 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewAllPaymentTerm.jsp @@ -0,0 +1,123 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.posterita.struts.pos.PaymentTermAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +
        + + Add Payment Term + +
        + + + + + + + + + + + + + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + +
         
        + + + + + + + + + + + + + + + + + "> + Edit + +   + + + "> + Deactivate + + + + + "> + Activate + + +
        + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewAllTax.jsp b/posterita/posterita/web/jsp/pos/viewAllTax.jsp new file mode 100644 index 0000000000..450b732b1f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewAllTax.jsp @@ -0,0 +1,109 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.posterita.struts.pos.TaxAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +
        + + Add Payment Term + +
        + + + + + + + + + + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + +
         
        + + + + + + + + + + + "> + Edit + +   + + + "> + Deactivate + + + + + "> + Activate + + +
        + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewBPartnerTrxDetails.jsp b/posterita/posterita/web/jsp/pos/viewBPartnerTrxDetails.jsp new file mode 100644 index 0000000000..f91fea8479 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewBPartnerTrxDetails.jsp @@ -0,0 +1,183 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.BPartnerInfoBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.BpartnerInfoAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
        + + "> + + + + + + "> + + + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + : +
        + : +
        + : +
        + : +
        + Revenue: +
        + : +
        + : +
        +
        +
        + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + +
        Product Info
        > + + > + + > + +
        + +
        +
        + + + + + + + + + + + + + + <% + String styleClass1 = "label"; + if ((count.intValue()%2) != 0) + styleClass1 = "contentname"; + %> + + + + + + + + +
        Order Info
        > + "> + + + > + + + > + + > + + > + +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewBarcode.jsp b/posterita/posterita/web/jsp/pos/viewBarcode.jsp new file mode 100644 index 0000000000..fdf5a6c890 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewBarcode.jsp @@ -0,0 +1,65 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + diff --git a/posterita/posterita/web/jsp/pos/viewBestSellingItems.jsp b/posterita/posterita/web/jsp/pos/viewBestSellingItems.jsp new file mode 100644 index 0000000000..1ebe7e8a84 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewBestSellingItems.jsp @@ -0,0 +1,50 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +<%@ include file="/jsp/pos/customReportTable.jsp" %> + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewBlackListCheques.jsp b/posterita/posterita/web/jsp/pos/viewBlackListCheques.jsp new file mode 100644 index 0000000000..7fe61d4a53 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewBlackListCheques.jsp @@ -0,0 +1,59 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + +<%@ page import="org.posterita.struts.customer.CustomerAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
        + test +
        + + + + + + + + + +
        +
        + + + +
        + + + +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> + diff --git a/posterita/posterita/web/jsp/pos/viewCommission.jsp b/posterita/posterita/web/jsp/pos/viewCommission.jsp new file mode 100644 index 0000000000..924b4ff3e1 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCommission.jsp @@ -0,0 +1,128 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.CommissionAction" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + +
        %
        > + + > + + + "> + + + + > + + + > + + + > + + > + + > + + > + +
        +
        +
        +
        + + +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCommissionDetails.jsp b/posterita/posterita/web/jsp/pos/viewCommissionDetails.jsp new file mode 100644 index 0000000000..b89bae9368 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCommissionDetails.jsp @@ -0,0 +1,114 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.CommissionAction" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + +
        + "> + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + +
        > + "> + + + > + "> + + + + + > + + > + +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCompletePOSOrder.jsp b/posterita/posterita/web/jsp/pos/viewCompletePOSOrder.jsp new file mode 100644 index 0000000000..f1d3cb7ac8 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCompletePOSOrder.jsp @@ -0,0 +1,103 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.compiere.model.MInOut" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.compiere.process.DocAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + +<% + String orderlines = Constants.POS_ORDER_LINES; +%> +<%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> + +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCompletedCreditOrder.jsp b/posterita/posterita/web/jsp/pos/viewCompletedCreditOrder.jsp new file mode 100644 index 0000000000..ca8fcf9884 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCompletedCreditOrder.jsp @@ -0,0 +1,64 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.compiere.model.MInOut" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.compiere.process.DocAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + +<% String orderlines = Constants.POS_ORDER_LINES; %> +<%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> + +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCompletedCustomerReturnOrder.jsp b/posterita/posterita/web/jsp/pos/viewCompletedCustomerReturnOrder.jsp new file mode 100644 index 0000000000..30c0800a3d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCompletedCustomerReturnOrder.jsp @@ -0,0 +1,85 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.compiere.process.DocAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + <% + MOrder order = (MOrder) request.getSession().getAttribute(Constants.CUSTOMER_RETURN_ORDER); + %> + + + + +
        + + + + +
        + + + +
        + + <%@ include file="/jsp/pos/orderHeader.jsp" %> + <% String orderlines = Constants.CUSTOMER_RETURN_ORDER_LINES; %> + <%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> + +
        + + + "/> +   + +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCompletedGoodsReceiveNote.jsp b/posterita/posterita/web/jsp/pos/viewCompletedGoodsReceiveNote.jsp new file mode 100644 index 0000000000..7b87a47f16 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCompletedGoodsReceiveNote.jsp @@ -0,0 +1,79 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.compiere.process.DocAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +
        + +<%@ include file="/jsp/pos/orderHeader.jsp" %> +<% String orderlines = Constants.GOODS_RECEIVE_NOTE_LINES; %> +<%@ include file="/jsp/pos/completePOSShoppingCart.jsp" %> + + + +<% + MOrder order = (MOrder) request.getSession().getAttribute(Constants.GOODS_RECEIVE_NOTE); +%> + + + + +
        + + + "/> +   + +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCompletedGoodsReturnNote.jsp b/posterita/posterita/web/jsp/pos/viewCompletedGoodsReturnNote.jsp new file mode 100644 index 0000000000..2bfec57dc4 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCompletedGoodsReturnNote.jsp @@ -0,0 +1,158 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.compiere.process.DocAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + + + + + + + + + + + + + + +<% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + MOrder order = (MOrder) request.getSession().getAttribute(Constants.GOODS_RETURN_NOTE); + %> + + + + + +
        Total
        colspan="2"> + + align="center"> + + align="center"> + + > + + + > + + + > + + + > + + +
        + + +   + +   + + + + + + + + +
        + + + "/> +   + +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCompletedPOSOrder.jsp b/posterita/posterita/web/jsp/pos/viewCompletedPOSOrder.jsp new file mode 100644 index 0000000000..31c9105838 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCompletedPOSOrder.jsp @@ -0,0 +1,145 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> + + + + + +POS Order +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +<%@ include file="/jsp/pos/orderHeader.jsp" %> + + + + + +
        + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + +
        colspan="2"> align="center"> align="center"> align="right"> align="right"> align="right"> align="right">
        + + +   + +   + + + + + + + + +
        +
        +
        +
        + +
        + +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCreditors.jsp b/posterita/posterita/web/jsp/pos/viewCreditors.jsp new file mode 100644 index 0000000000..e645a91410 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCreditors.jsp @@ -0,0 +1,115 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.BPartnerInfoBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.BpartnerInfoAction" %> +<%@ page import="org.posterita.struts.pos.DunningAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +

        + +
        + + + + + + + + + + + +<% + String collection = Constants.CREDITORS; + String url = "/jsp/pos/viewCreditors.jsp"; +%> + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + +
        > + "> + + + > + + > + + > + + > + + > + + > + +
        + +<%@ include file="/jsp/include/pager.jsp" %> + +
        + +
        +
        + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewCurrency.jsp b/posterita/posterita/web/jsp/pos/viewCurrency.jsp new file mode 100644 index 0000000000..5b9e31be48 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewCurrency.jsp @@ -0,0 +1,78 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Servansingh +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.CurrencyBean" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp"%> + + + + + + + + + + + + + + + + + + + +
        + + + + + + +
        + +
        + +
        + +
        + +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewDebtors.jsp b/posterita/posterita/web/jsp/pos/viewDebtors.jsp new file mode 100644 index 0000000000..ea151e869f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewDebtors.jsp @@ -0,0 +1,116 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.BPartnerInfoBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.BpartnerInfoAction" %> +<%@ page import="org.posterita.struts.pos.DunningAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +

        + +
        + + + + + + + + + + + +<% + String collection = Constants.DEBTORS; + String url = "/jsp/pos/viewDebtors.jsp"; +%> + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + +
        > + + "> + + + > + + > + + > + + > + + > + + > + +
        + +<%@ include file="/jsp/include/pager.jsp" %> + +
        + +
        +
        + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewDocumentHistory.jsp b/posterita/posterita/web/jsp/pos/viewDocumentHistory.jsp new file mode 100644 index 0000000000..7fd468ece7 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewDocumentHistory.jsp @@ -0,0 +1,155 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ page import="java.util.Calendar" %> +<%@ page import="org.posterita.beans.OrderHistoryBean" %> +<%@ page import="java.util.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + +<% + String url = "ViewDocumentHistory.do"; + String collection = Constants.DOCUMENT_HISTORY; +%> + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + + + + + + + + + + +
        + + <%@ include file="/jsp/pos/filter.jsp" %> +
        +
        + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + +
        + <% + String partnerId= element.getBpartnerId() + ""; + %> + + + "> + + + + + + + "> + + + + + + + + + + "> + + + + "> + + + + "> + + + + "> + Create Shipment + + + "> + + +
        +
        + <%@ include file="/jsp/include/pager.jsp" %> + <%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewDocumentPDF.jsp b/posterita/posterita/web/jsp/pos/viewDocumentPDF.jsp new file mode 100644 index 0000000000..9f46aac15f --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewDocumentPDF.jsp @@ -0,0 +1,46 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> + + + Document PDF + + +

        Document PDF

        + <%@ include file="/jsp/include/errors.jsp" %> + + <% + String strPath = (String)request.getAttribute(Constants.DOCUMENT_PDF); + strPath = "\"" + strPath + "\""; + %> + + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewDraftedOrder.jsp b/posterita/posterita/web/jsp/pos/viewDraftedOrder.jsp new file mode 100644 index 0000000000..ccb1b95139 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewDraftedOrder.jsp @@ -0,0 +1,153 @@ +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<% + String path = request.getContextPath(); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + //String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + int m_pricelist_id = POSTerminalManager.getSOPriceListId(ctx); + MPriceList priceList = MPriceList.get(ctx, m_pricelist_id, null); + String priceListName = priceList.getName(); +%> + +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.ShoppingcartManager"%> +<%@page import="org.posterita.util.HtmlOrderPrintFormatter"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> + + + + + + + + + + + + + + + + + + + + + + + + +
        + +
        +
        +
        + <%= ShoppingcartManager.getShoppingCartFromOrder(ctx, Integer.parseInt(orderId), null) %> +
        + +
        + +
        + + <%if(orderType.equalsIgnoreCase("POS Order")){%> +
        NEW ORDER
        + <% }else{ %> +
        NEW ORDER
        + <%}%> +
        REPRINT
        +
        +
        +
        + Ctrl+P Reprint | Ctrl+Enter New Order | Ctrl-Esc Menu
        + + + +
        +
        $0.00
        +
        + +
        + <%=priceListName%> +
        + + +
        + <% + String args = "showFooter=true;lineLength=40;priceWithVat=true;showDiscount=true;showLogo=false;showBarcode=false;"; + + HtmlOrderPrintFormatter formatter = new HtmlOrderPrintFormatter(args); + String data = formatter.format(ctx, Integer.parseInt(orderId), null); + out.print("
        ");
        +			out.print(data);
        +			out.print("
        "); + %> +
        + +
        + +
        + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> +
        + + + diff --git a/posterita/posterita/web/jsp/pos/viewInventoryHistory.jsp b/posterita/posterita/web/jsp/pos/viewInventoryHistory.jsp new file mode 100644 index 0000000000..b1f0173f6c --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewInventoryHistory.jsp @@ -0,0 +1,239 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="org.posterita.struts.pos.InventoryAction" %> +<%@ page import="org.compiere.process.DocAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> + +<%@page import="org.posterita.core.Configuration"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.compiere.model.MPriceListVersion"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.businesslogic.administration.PriceListManager"%> + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> +<% + Integer priceListId = PriceListManager.getDefaultPriceListId(ctx, false); + Configuration configuration = Configuration.getConfiguration(request); + String searchProductBy = configuration.getSearchProductBy(); +%> + + + + + + + + + + + + +
        + + + + + + + +
        +
        + +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + <%@ include file="/jsp/include/historyMonthYearFilter.jsp"%> + + + + + + +
        + + + + + + + + + +
        +   + + + + + + + + + + + + + + + <%@include file="/jsp/include/paymentRuleFilter.jsp"%> + + +
        +
        +
        + + + + + + + + + + + + +

        + + Merge + +

        +
        +
        +
        +

         

        + +<%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewMaxSoldItems.jsp b/posterita/posterita/web/jsp/pos/viewMaxSoldItems.jsp new file mode 100644 index 0000000000..99e341c8b3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewMaxSoldItems.jsp @@ -0,0 +1,68 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +<% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + +
        > + + > + +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewMinOut.jsp b/posterita/posterita/web/jsp/pos/viewMinOut.jsp new file mode 100644 index 0000000000..7fdaa21e69 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewMinOut.jsp @@ -0,0 +1,145 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> + + +Shipment + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + + <%@ include file="/jsp/include/errors.jsp" %> + +
        + + + +
        + + <%@ include file="/jsp/pos/webDocumentHeader.jsp" %> + + + + + + + + + + + + + + + +
        + + + + + + + + +
        + Shipment Ref No: +
        + Doc Status: +
        +
        + Tracking No: + + + + + + +
        +
        + + + + + + + + + + + + + + + + +
        NameQty
        + + + +
        +
        + + + + +
        + + + + + + + + + + + + + + + + +
        + + + +
        +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewMinSoldItems.jsp b/posterita/posterita/web/jsp/pos/viewMinSoldItems.jsp new file mode 100644 index 0000000000..975cd998c3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewMinSoldItems.jsp @@ -0,0 +1,70 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +<% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + +
        nowrap="nowrap"> + + > + +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewOrder.jsp b/posterita/posterita/web/jsp/pos/viewOrder.jsp new file mode 100644 index 0000000000..580e40d0c5 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewOrder.jsp @@ -0,0 +1,317 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.compiere.model.MInOut" %> +<%@ page import="org.posterita.businesslogic.CurrencyManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ page import="org.posterita.beans.WebstoreUserBean" %> + + + + <%@page import="org.posterita.businesslogic.CurrencyManager"%> + + + + + + + + + + + + + + +
        +
        Sales Order
        + + + + + + + +<% + MOrder order = (MOrder) request.getSession().getAttribute(Constants.MORDER); + WebstoreUserBean userbean = (WebstoreUserBean) request.getSession().getAttribute(Constants.WEBSTORE_USER_BEAN); + String isPaid = (String) request.getSession().getAttribute(Constants.IS_PAID); + + + String currSymbole = CurrencyManager.getCurrencySymbol(order.getC_Currency_ID()); + + if (isPaid == null) + isPaid = "N"; +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> +
        +

        Sales Order

        + +
        +
        + + + + + + +
        + + + + +
        + To: +
        +
        + + + + +
        + From: +
        +
        +
        + + + + + + +
        + + + + + + + + + + + + + + + + +
        +   + +
        + +
        + +
        + +
        +
        + + + + + + + + + + + + + + + +
        + +
        + +
        + +
        + +
        +
        +
        + Ref SO No: +
        + Date Ordered: +
        + Status: +
        + + Is Paid: + +
        + + + + + + + + + + + + <% + String styleClass = "lightColour"; + if ((count.intValue()%2) != 0) + styleClass = "darkColour"; + %> + + + + + + + + + + + + + + + + + + + +
        DescriptionQtyUnit PriceTotal Price
        + + + + + <%=currSymbole%> + + + <%=currSymbole%> + +
        +   + + + + <%=currSymbole%> + + +
        +
        + <%-- + if ((order.getDeliveryViaRule().equals(MInOut.DELIVERYVIARULE_Shipper)) && (isPaid.equals(Constants.NO_CHAR))) + { + + +
        + + + + + + + + + "> + "> + + + + + + + + + + + + + + <%int counter = ((Integer)count).intValue()+1;%> + + " value=""> + " value=""> + " value="Quantity"> + " value=""> + " value="Unit Price"> + " value=""> + + +
        + + } + --%> +
        + + + + <%@ include file="/jsp/include/tshirtFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPOSBPartnerForDunning.jsp b/posterita/posterita/web/jsp/pos/viewPOSBPartnerForDunning.jsp new file mode 100644 index 0000000000..23994da30a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSBPartnerForDunning.jsp @@ -0,0 +1,168 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.BPartnerInfoBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.BpartnerInfoAction" %> +<%@ page import="org.posterita.struts.pos.DunningAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
        + + + + + + + + + + +<% + String url = "ViewBPartnersForDunning.do"; + String collection = Constants.DEBTORS; +%> + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + +
        > + + "> + + + > + + "/> + > + + > + <% + String styleClass1 = "nomalcolor"; + if(element.getCreditUsed().intValue()> element.getCreditLimit().intValue()) + styleClass1= "negativecolor"; + %> +
        + +
        +
        > + <% + String styleClass2 = "nomalcolor"; + if(element.getOpenAmt().intValue()> 0) + styleClass2= "negativecolor"; + %> +
        + +
        +
        > + + +
        + +<%@ include file="/jsp/include/pager.jsp" %> + +
        + +
        +
        + + + + + +
        +
        + + +
        +
        +
        + + Print + +
        +
        + + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPOSBPartnerInfo.jsp b/posterita/posterita/web/jsp/pos/viewPOSBPartnerInfo.jsp new file mode 100644 index 0000000000..4728d1e836 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSBPartnerInfo.jsp @@ -0,0 +1,135 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.BPartnerInfoBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.BpartnerInfoAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +
        :
        +
        +
        +
        + + + + + + + + +
        + + +   + + + + + + +
        +
        + + +<% + String url = "ViewPOSBPartnerInfo.do"; + String collection = Constants.BUSINESSPARTNER; +%> + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + +
        > + + "> + + + + > + + > + + > + + > + + > + + > + +
        +<%@ include file="/jsp/include/pager.jsp" %> +
        +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPOSCustomer.jsp b/posterita/posterita/web/jsp/pos/viewPOSCustomer.jsp new file mode 100644 index 0000000000..fd2a33ffdf --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSCustomer.jsp @@ -0,0 +1,230 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="org.posterita.struts.customer.CustomerAction" %> +<%@ page import="org.compiere.model.MBPartner" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + +
        +
        + + + + + + + + + + + + + + +
        + +
        + +
        + +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + +
        + + + + + + + + + +
        + +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + +
        + +
        + +
        + +
        + +
        +
        +
        +
        + + + + + + + + + + + + + + + + + +
        + +
        + +
        +
        +
        + + + + + + + +
        + +
        + + + + + + + + +
        + + + + + + + +
        + "> + + +
        +
        + +
        +
        + + ">Edit + Add New + Back +
        + + +<%@ include file="/jsp/include/posFooter.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewPOSCustomerCart.jsp b/posterita/posterita/web/jsp/pos/viewPOSCustomerCart.jsp new file mode 100644 index 0000000000..7f0a50947b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSCustomerCart.jsp @@ -0,0 +1,193 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> +
        +<%@ include file="/jsp/include/errors.jsp" %> + + + +
        +
        +
        + +
        +
        + + +
        + + + + + + + + + + + + + +
        +
        +
        + + +
        + + + + + + + + + + + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + +
         
        + + + + +
        + +
        + + + + + + + + Y + + + N + + + "> +
        +
        +
        +
        +
        PRINT FIDELITY
        +
        +
        +
        +
        + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> +
        + + + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewPOSHistory.jsp b/posterita/posterita/web/jsp/pos/viewPOSHistory.jsp new file mode 100644 index 0000000000..5ff192a40b --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSHistory.jsp @@ -0,0 +1,127 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +<% + String url = "ViewPOSHistory.do?orderType=" + orderType; + String collection = Constants.POS_HISTORY; +%> + + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + <%@ include file="/jsp/include/posHistoryFilter2.jsp" %> +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +<%@ include file="/jsp/include/printOrderApplet2.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPOSHistoryForAll.jsp b/posterita/posterita/web/jsp/pos/viewPOSHistoryForAll.jsp new file mode 100644 index 0000000000..3df5980075 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSHistoryForAll.jsp @@ -0,0 +1,211 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + <% + String url = "ViewPOSHistoryForAll.do"; + String collection = Constants.POS_HISTORY; + %> + + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + <%@ include file="/jsp/include/posHistoryFilter.jsp" %> +
        + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + +
         
        > + "> + + + + +
        + + +
        +
        + + +
        + +
        +
        + + +
        + +
        +
        + +
        + + +
        + + + +
        + +
        +
        +
        > + + + > + + <% + String partnerId= element.getBpartnerId() + ""; + %> + + + "> + + + + + + + "> + + + + + > + + + + + + + + + + + + + + + + + + Credit + + > + + + > + + + + + + + + + "> + + + + + + + "> + + + + +
        +
        +
        +<%@ include file="/jsp/include/pager.jsp" %> +<%@ include file="/jsp/include/printOrderApplet2.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPOSHistory_displaytag.jsp b/posterita/posterita/web/jsp/pos/viewPOSHistory_displaytag.jsp new file mode 100644 index 0000000000..8e96b2697e --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSHistory_displaytag.jsp @@ -0,0 +1,122 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> +<%@ page import="org.compiere.process.DocAction" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> +<%@ page import="org.displaytag.decorator.TableDecorator" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> +<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> + +<%@page import="org.posterita.beans.POSHistoryBean"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +<% + String url = "ViewPOSHistory.do?orderType=" + orderType; + String collection = Constants.POS_HISTORY; + + Integer display = new Integer("10"); + if (displayCookie.getValue() != null || !displayCookie.getValue().equals("")) + display = new Integer(displayCookie.getValue()); +%> + + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + <%@ include file="/jsp/include/posHistoryFilter2.jsp" %> +
        + + + + + + + + + + + + + + +
        +
        + +<%@ include file="/jsp/include/printOrderApplet2.jsp" %> +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPOSInfo.jsp b/posterita/posterita/web/jsp/pos/viewPOSInfo.jsp new file mode 100644 index 0000000000..5b489e4374 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSInfo.jsp @@ -0,0 +1,82 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + +
        + + + + + +
        + + + + + + +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPOSOrder.jsp b/posterita/posterita/web/jsp/pos/viewPOSOrder.jsp new file mode 100644 index 0000000000..06d6b538bb --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSOrder.jsp @@ -0,0 +1,223 @@ +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<% + String path = request.getContextPath(); + String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + +%> + +<%@page import="org.posterita.Constants"%> +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.ShoppingcartManager"%> +<%@page import="org.posterita.util.HtmlOrderPrintFormatter"%> +<%@page import="org.compiere.model.MOrder"%> +<%@page import="org.posterita.businesslogic.POSManager"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@page import="org.compiere.model.MPayment"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.compiere.model.I_M_PriceList"%> +<%@page import="org.posterita.order.UDIOrderTypes"%> +<%@page import="org.posterita.TangoColors"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + +<% +MOrder order = new MOrder(ctx, Integer.valueOf(orderId).intValue(), null); +String orderType = order.getOrderType(); +MPriceList priceList = MPriceList.get(ctx, order.getM_PriceList_ID(), null); +String priceListName = priceList.getName(); +%> + + + + + + + + + + + + + + + + + + + + +
        +
        + + +
        + <%= orderType %> +
        +
        +
        +
        + : + <%=orgName%> +
        +
        + : + <%=posName%> +
        +
        +
        +
        + : + +
        +
        + : + <%=roleName%> +
        +
        +
        +
        +
        +
        +
        +
        +
        + <% String currency = order.getC_Currency().getCurSymbol(); + + String paymentRule = order.getPaymentRule(); + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + out.print("Amt Refunded: " + currency + order.getAmountRefunded()); + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_CreditCard)) + { + out.print("Card: " + currency + order.getGrandTotal()); + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Check)) + { + out.print("Cheque: " + currency + order.getGrandTotal()); + } + + if(paymentRule.equalsIgnoreCase(UdiConstants.PAYMENTRULE_MIXED)) + { + out.print("Total: " + currency + order.getGrandTotal()); + } + %> +
        +
        +
        +
        +
        +   + +
        +
        + <%=priceListName%> +
        +
        +
        +
        +
        +
        + <%= ShoppingcartManager.getShoppingCartFromOrder(ctx, Integer.valueOf(orderId).intValue(), null) %> +
        +
        +
        +
        +
        + <% + String args = "showFooter=true;lineLength=40;priceWithVat=true;showDiscount=false;showLogo=false;showBarcode=false;"; + + HtmlOrderPrintFormatter formatter = new HtmlOrderPrintFormatter(args); + String data = formatter.format(ctx, Integer.valueOf(orderId).intValue(), null); + out.print("
        ");
        +				out.print(data);
        +				out.print("
        "); + %> +
        +
        +
        + +
        +
        +
        + <%String newOrderAction = "/CreatePOSOrderScreen.do?orderType="+orderType; %> +
        NEW ORDER
        +
        +
        +
        + Ctrl+Space New Order | Ctrl-M Menu
        +
        + <%@ include file="/jsp/include/printOrderApplet2.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/pos/viewPOSProduct.jsp b/posterita/posterita/web/jsp/pos/viewPOSProduct.jsp new file mode 100644 index 0000000000..916051a229 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSProduct.jsp @@ -0,0 +1,276 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> + +<%@ page import="org.compiere.model.MProduct" %> + + +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> + +<%@ page import="org.posterita.struts.pos.POSProductAction" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + +
        +
        + + + + + + +
        + + + + + + + + + + + + + + + + + +
        + + + + +   + +   +
        + * + + + +   + +   +
        + * + + +
        +
        + + + <% + ProductBean bean = (ProductBean)POSProductForm.getBean(); + if(bean.getImageInfo() != null) + if(bean.getImageInfo().getHasAttachment() != null) + if(bean.getImageInfo().getHasAttachment().booleanValue()){%> + "> + <%}%> + + +   + +
        +
        +
        +
        + + + + + + + + + + + +
        + * + + + +   + +   +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + +
        + * + + + +   + +   +
        + * + + + +   + +   +
        + * + + + +   + +   +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + * + + + + +
        + * + + +
        + + + +
        + + + +
        + + + +
        + + + +
        +
        +
        +
        + + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPOSProducts.jsp b/posterita/posterita/web/jsp/pos/viewPOSProducts.jsp new file mode 100644 index 0000000000..2a2fb17be3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSProducts.jsp @@ -0,0 +1,71 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + +<%@ page import="java.util.ArrayList" %> +<%@ page import="java.util.Properties" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> +<%@ page import="org.posterita.businesslogic.ProductManager" %> +<%@ page import="org.posterita.beans.ProductStatusBean" %> +<% + +String productName = request.getParameter("productName"); +Properties ctx = TmkJSPEnv.getCtx(request); + +ArrayList productList =ProductManager.searchProductsByName(ctx,productName); +ProductStatusBean bean = null; + +if(productList == null || productList.size() == 0) +{ + + //out.print("
          "); + //out.print("
        • "); + //out.print("
        "); + out.print("
        "); +} +else +{ + int size = 15; + + size = (size > productList.size())? productList.size() : size; + + if(size > 0) + { + out.print("
          "); + + for(int i=0;i< size;i++) + { + bean = (ProductStatusBean)productList.get(i); + + out.print("
        • "); + out.print(bean.getProductName()); + out.print("
        • "); + } + + out.print("
        "); + } + + out.print("
        "); + +} +%> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewPOSUser.jsp b/posterita/posterita/web/jsp/pos/viewPOSUser.jsp new file mode 100644 index 0000000000..fc33b31f02 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPOSUser.jsp @@ -0,0 +1,201 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok Pathak +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + +
        +
        + Contact + + + + + + + + + + + + + + + + + + + + + +
        + + + +
        + + + +
        +   +
        +   +
        +   +
        +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        +
        +
        + + + + + + +
        +
        + + + + + + + + + + +
        + + + +
        + + + +
        +
        +
        + + + + + + + + <%@ include file="/jsp/include/posFooter.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewPartialPOSOrderHistory.jsp b/posterita/posterita/web/jsp/pos/viewPartialPOSOrderHistory.jsp new file mode 100644 index 0000000000..a7b13a8ed1 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPartialPOSOrderHistory.jsp @@ -0,0 +1,108 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> + + + + <%@ include file="/jsp/include/historyfilter.jsp" %> + + <% + String url = "ViewPartialPOSOrderHistory.do"; + String collection = Constants.POS_HISTORY; + %> + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + +
         
        > + "> + + + > + + > + + > + + +
        + <%@ include file="/jsp/include/pager.jsp" %> +
        +
        +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPayment.jsp b/posterita/posterita/web/jsp/pos/viewPayment.jsp new file mode 100644 index 0000000000..7b13dc475d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPayment.jsp @@ -0,0 +1,96 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> +<%@ page import="org.compiere.model.MPayment" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> + + +Payment + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + +<%-- +@TODO by Alok + +--%> + + + <%@ include file="/jsp/pos/webDocumentHeader.jsp" %> + + + + + + + + + + +
        + + Payment By: +
        +
        + Ref Payment No: +
        + Status: +
        +
        + + + + + + + + + + + +
        Payment DateAmount
        + + + + +
        +
        + + + + <%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPaymentAllocation.jsp b/posterita/posterita/web/jsp/pos/viewPaymentAllocation.jsp new file mode 100644 index 0000000000..57ec786ce8 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPaymentAllocation.jsp @@ -0,0 +1,153 @@ + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.BPartnerInfoBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.CreditOrderAction" %> +<%@ page import="org.posterita.struts.pos.DunningAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + +
        + +
        + : + +   + + : + +   + + +   + +
        + +
        + + + + + +<% + String url = "ViewPaymentAllocation.do"; + String collection = Constants.PAYMENT_ALLOCATIONS; +%> + + + + + + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + + + + + + + + + + + +
        memo
        > + + "> + + + + > + "> + + + > + "> + + + + > + "> + + + + > + "> + + + > + "> + + + > + + > + + > + + > + +
        +<%@ include file="/jsp/include/pager.jsp" %> +
        +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPaymentDetails.jsp b/posterita/posterita/web/jsp/pos/viewPaymentDetails.jsp new file mode 100644 index 0000000000..00d7b77da2 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPaymentDetails.jsp @@ -0,0 +1,181 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.CreditOrderAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="org.posterita.core.UDIPair" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + . + + + + + + + + +
        + + + "> + + + + + + + + + + + + + + + + +
        + + + "> + + + + + + + + + + + + + + + +
        + Total: + + +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewPreferences.jsp b/posterita/posterita/web/jsp/pos/viewPreferences.jsp new file mode 100644 index 0000000000..9cc1c948ca --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewPreferences.jsp @@ -0,0 +1,278 @@ +<%@ page import="org.posterita.util.TmkPrinterConstants" %> +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen Beekoo +--%> + + + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + +
        +
        +
        +
        +
        + + + +
        + + + . + +
        +
        + +
        + Minimum characters before searching starts + +
        + +
        +
        + +
        +
        +
        + + : + +
        +
        +
        +
        +
        + + +
        + + + + + + + + + + + + + + +
        +
        + +
        + + + + + + + + + + + + + + + +
        +
        + : + " code="org.posterita.core.PrintOrderApplet.class" width="0" height="0"> + +
        + + +
        +
        +
        +
        + +
        +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewProductCart.jsp b/posterita/posterita/web/jsp/pos/viewProductCart.jsp new file mode 100644 index 0000000000..bfe9795deb --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewProductCart.jsp @@ -0,0 +1,134 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen Beekoo +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + +
        +
        +
        + +
        +
        + + +
        + + + + + + + + + + + + + +
        +
        +
        + + + + + + + + + <% + String url = "ViewProductCart.do"; + String collection = Constants.PRODUCT_DETAILS; + %> + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + +
         
        > + + > + + > + + > + + > + ">Remove +
        +
        +
        +
        + + + + +
        +<%@ include file="/jsp/include/pager.jsp" %> +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewProductCartForUpdate.jsp b/posterita/posterita/web/jsp/pos/viewProductCartForUpdate.jsp new file mode 100644 index 0000000000..45154bd382 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewProductCartForUpdate.jsp @@ -0,0 +1,134 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen Beekoo +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.EditBulkProductFromFileAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +
        +
        +
        + +
        +
        + +
        +
        + + + + + + + + + + + + + +
        +
        +
        + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + +
         
        width="400px"> + + > + + + > + + + align="center"> + "> + + +
        +
        + + + + + + + +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewProductSalesDetails.jsp b/posterita/posterita/web/jsp/pos/viewProductSalesDetails.jsp new file mode 100644 index 0000000000..0ac6695588 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewProductSalesDetails.jsp @@ -0,0 +1,154 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen Beekoo +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.BPartnerInfoBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.BpartnerInfoAction" %> +<%@ page import="org.posterita.struts.pos.POSGoodsAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + +
        + "> + + +
        + + + + + + + + + + + + + + + +
        + + + + + + + + + +
        +
        +
        + + + + + + + + + + + + + + + + + +
        + : + +
        + : + + + +
        +
        +
        + + + + + + + + + + + + + + <% + String styleClass1 = "label"; + if ((count.intValue()%2) != 0) + styleClass1 = "contentname"; + %> + + + + + + + + + +
        > + "> + + + > + + > + + > + + align="right"> + + align="right"> + + + +
        +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewProductsSalesInfo.jsp b/posterita/posterita/web/jsp/pos/viewProductsSalesInfo.jsp new file mode 100644 index 0000000000..6229b1f32a --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewProductsSalesInfo.jsp @@ -0,0 +1,127 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen Beekoo +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSProductAction" %> +<%@ page import="org.compiere.process.DocumentEngine" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +<%@ page import="org.compiere.model.MOrder" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="java.util.ArrayList" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + +
        + + +   + +
        + +
        + + + + + + + + + + + + + <% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + +
        width="400px"> + "> + + + width="100px"> + + width="150px"> + + > + + > + + + > + + + > + +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewRole.jsp b/posterita/posterita/web/jsp/pos/viewRole.jsp new file mode 100644 index 0000000000..4e22652954 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewRole.jsp @@ -0,0 +1,92 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen Beekoo +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + +
        :
        :
        :
        :
        :

        + + + + + + + + + + + + + + + + +
        + +
                + +
        +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> + + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewStockEnquiry.jsp b/posterita/posterita/web/jsp/pos/viewStockEnquiry.jsp new file mode 100644 index 0000000000..0f35ad0749 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewStockEnquiry.jsp @@ -0,0 +1,73 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Praveen +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> +<%@ page import="org.posterita.struts.pos.POSOrderAction" %> +<%@ page import="org.posterita.businesslogic.performanceanalysis.ReportDateManager" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +
         
        + + + + + + + + + +
        + + + +
        + + + +
        + + + + +
        +   +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewStockMovement.jsp b/posterita/posterita/web/jsp/pos/viewStockMovement.jsp new file mode 100644 index 0000000000..3b3bccfbfc --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewStockMovement.jsp @@ -0,0 +1,92 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alok Pathak +--%> + + + +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.beans.ProductBean" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.lib.UdiConstants" %> +<%@ page import="org.posterita.struts.pos.POSReportAction" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + +<% + String styleClass = "label"; + if ((count.intValue()%2) != 0) + styleClass = "contentname"; +%> + + + + + + + + + + +
        > + "> + + + > + + > + + > + + > + + > + + > + +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewStockSalesReport.jsp b/posterita/posterita/web/jsp/pos/viewStockSalesReport.jsp new file mode 100644 index 0000000000..fd34148bea --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewStockSalesReport.jsp @@ -0,0 +1,112 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2008 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author sendy +--%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<%@page import="org.posterita.Constants"%> + +<%@page import="org.posterita.struts.pos.POSReportAction"%> +Stock Sales Report +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +
        + + + + +
        + +
        + + <%@ include file="/jsp/include/searchProductPanel3.jsp" %> + +
        +
         
        +
        + + +
        +
         
        +
        + + +
        +
         
        +
        + + +
        +
         
        + + + + +
        + + + + + + + +
        + <%@ include file="/jsp/include/startCalendar.jsp" %> +
        + <%@ include file="/jsp/include/endCalendar.jsp" %> +
        +
        +
        + + + + + +
        + +   + + + + +
        +
        + + + + + <%=stockReportData%> + +
        +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewStockTransfer.jsp b/posterita/posterita/web/jsp/pos/viewStockTransfer.jsp new file mode 100644 index 0000000000..a172a01c74 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewStockTransfer.jsp @@ -0,0 +1,223 @@ +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> +<% + String path = request.getContextPath(); + String appName = (String) request.getSession().getAttribute(Constants.APP_NAME); + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; + Properties ctx = TmkJSPEnv.getCtx(request); + String posName = POSTerminalManager.getTerminalName(ctx); + String orgName = MOrg.get(ctx, Env.getContextAsInt(ctx, UdiConstants.ORG_ID_CTX_PARAM)).getName(); + String roleName = MRole.get(ctx, Env.getContextAsInt(ctx, UdiConstants.AD_ROLE_ID)).getName(); + +%> + +<%@page import="org.posterita.Constants"%> +<%@page import="java.util.Properties"%> +<%@page import="org.posterita.core.TmkJSPEnv"%> +<%@page import="org.compiere.util.Env"%> +<%@page import="org.posterita.lib.UdiConstants"%> +<%@page import="org.compiere.model.MPriceList"%> +<%@page import="org.compiere.model.MOrg"%> +<%@page import="org.compiere.model.MRole"%> +<%@page import="org.posterita.businesslogic.ShoppingcartManager"%> +<%@page import="org.posterita.util.HtmlOrderPrintFormatter"%> +<%@page import="org.compiere.model.MOrder"%> +<%@page import="org.posterita.businesslogic.POSManager"%> +<%@page import="org.posterita.businesslogic.POSTerminalManager"%> +<%@page import="org.compiere.model.MPayment"%> +<%@page import="java.math.BigDecimal"%> +<%@page import="org.compiere.model.I_M_PriceList"%> +<%@page import="org.posterita.order.UDIOrderTypes"%> +<%@page import="org.posterita.TangoColors"%> + + + + + <%=appName%> + + + + + + + + + + + + + + + + +<% +MOrder order = new MOrder(ctx, Integer.valueOf(orderId).intValue(), null); +String orderType = order.getOrderType(); +MPriceList priceList = MPriceList.get(ctx, order.getM_PriceList_ID(), null); +String priceListName = priceList.getName(); +%> + + + + + + + + + + + + + + + + + + + + +
        +
        + + +
        + <%= orderType %> +
        +
        +
        +
        + : + <%=orgName%> +
        +
        + : + <%=posName%> +
        +
        +
        +
        + : + +
        +
        + : + <%=roleName%> +
        +
        +
        +
        +
        +
        +
        +
        +
        + <% String currency = order.getC_Currency().getCurSymbol(); + + String paymentRule = order.getPaymentRule(); + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Cash)) + { + out.print("Amt Refunded: " + currency + order.getAmountRefunded()); + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_CreditCard)) + { + out.print("Card: " + currency + order.getGrandTotal()); + } + + if(paymentRule.equalsIgnoreCase(MOrder.PAYMENTRULE_Check)) + { + out.print("Cheque: " + currency + order.getGrandTotal()); + } + + if(paymentRule.equalsIgnoreCase(UdiConstants.PAYMENTRULE_MIXED)) + { + out.print("Total: " + currency + order.getGrandTotal()); + } + %> +
        +
        +
        +
        +
        +   + +
        +
        + <%=priceListName%> +
        +
        +
        +
        +
        +
        + <%= ShoppingcartManager.getShoppingCartFromOrder(ctx, Integer.valueOf(orderId).intValue(), null) %> +
        +
        +
        +
        +
        + <% + String args = "showFooter=true;lineLength=40;priceWithVat=true;showDiscount=false;showLogo=false;showBarcode=false;"; + + HtmlOrderPrintFormatter formatter = new HtmlOrderPrintFormatter(args); + String data = formatter.format(ctx, Integer.valueOf(orderId).intValue(), null); + out.print("
        ");
        +				out.print(data);
        +				out.print("
        "); + %> +
        +
        +
        + +
        +
        +
        + <%String newOrderAction = "/CreatePOSOrderScreen.do?orderType="+orderType; %> +
        NEW ORDER
        +
        +
        +
        + Ctrl+Space New Order | Ctrl-M Menu
        +
        + <%@ include file="/jsp/include/printOrderApplet2.jsp" %> + + + diff --git a/posterita/posterita/web/jsp/pos/viewVendorDetails.jsp b/posterita/posterita/web/jsp/pos/viewVendorDetails.jsp new file mode 100644 index 0000000000..a6643142e3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewVendorDetails.jsp @@ -0,0 +1,106 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Martine +--%> + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> +<%@ page import="org.posterita.core.MenuItem" %> + + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos"%> + + +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + + + + + + + +
        +
        + + + + + + +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + +
        +
        +
        +
        + + + + + + + + + + + + + + + + +
         
        +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/viewWebstorePayment.jsp b/posterita/posterita/web/jsp/pos/viewWebstorePayment.jsp new file mode 100644 index 0000000000..691c9d68c2 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewWebstorePayment.jsp @@ -0,0 +1,121 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.WebUserInfo" %> +<%@ page import="org.posterita.order.UDIOrderTypes" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/dcs.tld" prefix="dcs" %> + + + + + + + + + + + + + + + + + <%@ include file="/jsp/webstore/documentHeader.jsp" %> + + + + + + + + + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> +
        + Doc Status: +
        + + + + + + + + + + + + <% + String styleClass = "lightColour"; + if ((count.intValue()%2) != 0) + styleClass = "darkColour"; + %> + + + + + + + + + + + + + + + + + + + + +
        DescriptionQtyUnit PriceTotal Price
        + + + + + + + +
        +   + + +
        +
        + + + + <%@ include file="/jsp/include/tshirtFooter.jsp" %> diff --git a/posterita/posterita/web/jsp/pos/viewattributevalues.jsp b/posterita/posterita/web/jsp/pos/viewattributevalues.jsp new file mode 100644 index 0000000000..dd7013b2a7 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/viewattributevalues.jsp @@ -0,0 +1,87 @@ + +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/pos.tld" prefix="pos" %> + + + + + + +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + +
        + + + + <%=element.getName()%> + + + +
        +
        +
        +
        + + + + <% + String style = "label"; + if((count.intValue() % 2) == 0) + style = "contentname"; + %> + + + + + + + +
        + + + + <% + String editLink = "EditPOSAttributeValueAction.do?action=initEditAttributeValue"; + editLink += "&attributeValueId=" + element.getKey() + "&name=" + element.getName()+ "&attributeId="; + %> + +
        +
        + +
        +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/webDocumentHeader.jsp b/posterita/posterita/web/jsp/pos/webDocumentHeader.jsp new file mode 100644 index 0000000000..e2009fa2d3 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/webDocumentHeader.jsp @@ -0,0 +1,81 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + + + + + + + + + + + +
        + + + + + +
        + + + +
        + +
        + +
        + +
        +
        + + + + + +
        + + + + <% String partnerId = partner.get_ID() + ""; %> + + + + + "> + + + + +
        + +
        + +
        + + +
        + +
        + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/wstoreeditattribute.jsp b/posterita/posterita/web/jsp/pos/wstoreeditattribute.jsp new file mode 100644 index 0000000000..f99418802d --- /dev/null +++ b/posterita/posterita/web/jsp/pos/wstoreeditattribute.jsp @@ -0,0 +1,72 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley G Ramdass +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + +Edit Attributes +<%@ include file="/jsp/include/posHeader.jsp" %> + + + + + + + + + + +
        + <%@ include file="/jsp/include/errors.jsp" %> +
        + + + + + + + + + + + + + + +
        Old Attribute Value: +
        New Attribute Value: +
        + Save +
        +
        +
        + +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/pos/wstoreviewattributevalues.jsp b/posterita/posterita/web/jsp/pos/wstoreviewattributevalues.jsp new file mode 100644 index 0000000000..2da0c656d5 --- /dev/null +++ b/posterita/posterita/web/jsp/pos/wstoreviewattributevalues.jsp @@ -0,0 +1,81 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Ashley G Ramdass +--%> + + + + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.*" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + +View Attributes +<%@ include file="/jsp/include/posHeader.jsp" %> +<%@ include file="/jsp/include/errors.jsp" %> + + + + + +
        + + + + <%=element.getName()%> + + + +
        +
        +
        +
        + + + + <% + String style = "label"; + if((count.intValue() % 2) == 0) + style = "contentname"; + %> + + + + + + +
        + + + + <% + String editLink = "EditPOSAttributeValueAction.do?action=initEditAttributeValue"; + editLink += "&attributeValueId=" + element.getKey() + "&name=" + element.getName()+ "&attributeId="; + %> + Edit +
        +
        +
        +<%@ include file="/jsp/include/posFooter.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/product/viewProductInfo.jsp b/posterita/posterita/web/jsp/product/viewProductInfo.jsp new file mode 100644 index 0000000000..c8f41d94a3 --- /dev/null +++ b/posterita/posterita/web/jsp/product/viewProductInfo.jsp @@ -0,0 +1,18 @@ +<%@ page language="java"%> +<%@ page import="java.util.Properties" %> +<%@ page import="org.posterita.core.TmkJSPEnv" %> +<%@ page import="org.posterita.core.ImageServer" %> +<%@ page import="org.posterita.businesslogic.ProductManager" %> +<% + Properties ctx = TmkJSPEnv.getCtx(request); + + Integer product_id = new Integer(request.getParameter("productId")); + String size = request.getParameter("size"); + + int attachment_id = ProductManager.getAttachment(ctx,product_id.intValue(), null).get_ID(); + + boolean sent = ImageServer.sendImage(ctx,attachment_id,size,response); + + if(!sent) + ImageServer.sendDefaultImage(response); +%> diff --git a/posterita/posterita/web/jsp/user/createUser.jsp b/posterita/posterita/web/jsp/user/createUser.jsp new file mode 100644 index 0000000000..27cad9e918 --- /dev/null +++ b/posterita/posterita/web/jsp/user/createUser.jsp @@ -0,0 +1,173 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + + + + + + + + + + + + + + + + + + + +
        + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +
        + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Role + + + +
        +
        + +
        + +
        + +
        + +
        + +
        + + + +
        + +
        + +
        + + + +
        + + + +
        + + + + + +
        + +
        +
        + + + +<%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/user/editUser.jsp b/posterita/posterita/web/jsp/user/editUser.jsp new file mode 100644 index 0000000000..eea667066f --- /dev/null +++ b/posterita/posterita/web/jsp/user/editUser.jsp @@ -0,0 +1,174 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.posterita.beans.UDIBean" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> + + + + + + + Edit User + + + + + + + + + + + + + +
        + <%@ include file="/jsp/include/tabTop.jsp" %>Edit User<%@ include file="/jsp/include/tabBottom.jsp" %> +
        + <%@ include file="/jsp/include/errors.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Role + + + +
        + +
        + +
        + +
        + +
        + +
        + + +
        + + +
        + +
        + +
        + + + +
        + + + +
        + + + + + +
        + +
        +
        + + + +<%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/user/listUsers.jsp b/posterita/posterita/web/jsp/user/listUsers.jsp new file mode 100644 index 0000000000..5f5c0f8ea0 --- /dev/null +++ b/posterita/posterita/web/jsp/user/listUsers.jsp @@ -0,0 +1,103 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + + + + + + + + + + + +
        + <%@ include file="/jsp/include/tabTop.jsp" %>All Users<%@ include file="/jsp/include/tabBottom.jsp" %> +
        + + + + + + + + + + + + + <% + String styleClass = "label"; + + if ((count.intValue()%2) != 0) + styleClass = "contentname"; + %> + + + + + + + + + + + + + +
        Add Record
        UsernameRoleIs Sale RepresentativeIs Active 
        + + + + + + + + + ">Edit +   + ">View +   + + ">Deactivate + + + ">Activate + +
        +
        + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + + \ No newline at end of file diff --git a/posterita/posterita/web/jsp/user/registerUser.jsp b/posterita/posterita/web/jsp/user/registerUser.jsp new file mode 100644 index 0000000000..4f9f6ac748 --- /dev/null +++ b/posterita/posterita/web/jsp/user/registerUser.jsp @@ -0,0 +1,153 @@ +<%-- + * Product: Posterita Web-Based POS and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Servansingh +--%> + + +<%String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> + +<%@ page import="org.posterita.Constants" %> + +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + POSterita:. User Registration + + + + + + + +
        + + + + + + + +
        + +
        +
        + User Registration Form +
        + + + + + + + + + +
        + + + <%@ include file="/jsp/include/errors.jsp" %> + +
        +
        + +
        +
        + User Details + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        First Name
        Last Name
        Address
        City
        Country + + + +
        Company
        Industry
        Email
        Remarks
        + + + + + + + +
        +
        +
        +
        + + + + + diff --git a/posterita/posterita/web/jsp/user/userCreated.jsp b/posterita/posterita/web/jsp/user/userCreated.jsp new file mode 100644 index 0000000000..221fb4c608 --- /dev/null +++ b/posterita/posterita/web/jsp/user/userCreated.jsp @@ -0,0 +1,143 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/posterita.tld" prefix="posterita"%> + + + + + + + + + + + + + + + +
        + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + Yes + + + No + +
        + + Yes + + + No + +
        +
        + +<%@ include file="/jsp/include/footerTableBottom.jsp" %> \ No newline at end of file diff --git a/posterita/posterita/web/jsp/user/viewUser.jsp b/posterita/posterita/web/jsp/user/viewUser.jsp new file mode 100644 index 0000000000..19e1025218 --- /dev/null +++ b/posterita/posterita/web/jsp/user/viewUser.jsp @@ -0,0 +1,153 @@ +<%-- + * Product: Posterita Web-Based POS (an Adempiere Plugin) + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Vishee +--%> + +<%@ page import="org.posterita.Constants" %> +<%@ page import="org.posterita.user.*" %> +<%@ page import="org.compiere.model.MOrg" %> + +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> + + + + + + + + + + + + + + +
        + <%@ include file="/jsp/include/tabTop.jsp" %><%@ include file="/jsp/include/tabBottom.jsp" %> +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + +
        + + + + Yes + + + No + +
        + + + + Yes + + + No + +
        +
        + + + <%@ include file="/jsp/include/footerTableBottom.jsp" %> + + \ No newline at end of file diff --git a/posterita/properties.xml b/posterita/properties.xml new file mode 100644 index 0000000000..be1e2401c9 --- /dev/null +++ b/posterita/properties.xml @@ -0,0 +1,17 @@ + + + + This project file sets all properties needed during build and + installation. This file is imported in all other build.xml + files. This file provides a central place for managing + properties. + + + + + + + + + + diff --git a/utils_dev/build.xml b/utils_dev/build.xml index d8dd8273fb..8c1cb29154 100644 --- a/utils_dev/build.xml +++ b/utils_dev/build.xml @@ -29,7 +29,7 @@ - + @@ -48,7 +48,7 @@ - +