[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9190] property: invoice handling clean up / check fo
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9190] property: invoice handling clean up / check for valid session |
Date: |
Fri, 20 Apr 2012 10:52:16 +0000 |
Revision: 9190
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9190
Author: sigurdne
Date: 2012-04-20 10:52:15 +0000 (Fri, 20 Apr 2012)
Log Message:
-----------
property: invoice handling clean up / check for valid session
Modified Paths:
--------------
trunk/property/js/portico/ajax_invoice.js
Modified: trunk/property/js/portico/ajax_invoice.js
===================================================================
--- trunk/property/js/portico/ajax_invoice.js 2012-04-20 09:27:08 UTC (rev
9189)
+++ trunk/property/js/portico/ajax_invoice.js 2012-04-20 10:52:15 UTC (rev
9190)
@@ -20,6 +20,12 @@
success: function(data) {
if( data != null)
{
+ if(data.sessionExpired)
+ {
+ alert('Sesjonen er utløpt - du
må logge inn på nytt');
+ return;
+ }
+
htmlString = "<option>" + data.length
+ " bilag funnet</option>"
var obj = data;
@@ -58,6 +64,12 @@
success: function(data) {
if( data != null)
{
+ if(data.sessionExpired)
+ {
+ alert('Sesjonen er utløpt - du
må logge inn på nytt');
+ return;
+ }
+
htmlString = "<option>" + data.length
+ " bilag funnet</option>"
var obj = data;
@@ -95,6 +107,12 @@
success: function(data) {
if( data != null)
{
+ if(data.sessionExpired)
+ {
+ alert('Sesjonen er utløpt - du
må logge inn på nytt');
+ return;
+ }
+
htmlString = "<option>" + data.length
+ " bilag funnet</option>"
var obj = data;
@@ -132,6 +150,12 @@
success: function(data) {
if( data != null)
{
+ if(data.sessionExpired)
+ {
+ alert('Sesjonen er utløpt - du
må logge inn på nytt');
+ return;
+ }
+
htmlString = "<option>" + data.length
+ " bilag funnet</option>"
var obj = data;
@@ -245,7 +269,12 @@
success: function(data) {
if(data)
{
- // var obj = jQuery.parseJSON(data);
+ if(data.sessionExpired)
+ {
+ alert('Sesjonen er utløpt - du
må logge inn på nytt');
+ return;
+ }
+
var obj = data;
var submitBnt =
$(thisForm).find("input[type='submit']");
@@ -302,821 +331,303 @@
}
});
});
+});
-//-------------
+function update_form_values( line_id, voucher_id_orig ){
+ var oArgs = {menuaction:'property.uiinvoice2.get_single_line'};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
- // When control area is selected, controls are fetched from db and
control select list is populated
- $("#control_area").change(function () {
- var control_area_id = $(this).val();
- if(control_area_id == '')
- control_area_id = "all";
-
- var oArgs =
{menuaction:'controller.uicontrol_group.get_control_groups_by_control_area',
phpgw_return_as:'json'};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- //var requestUrl =
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
-
- var htmlString = "";
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl + "&control_area_id=" + control_area_id,
- success: function(data) {
- if( data != null){
- htmlString = "<option>Velg
kontrollgruppe</option>"
- var obj = jQuery.parseJSON(data);
-
- $.each(obj, function(i) {
- htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].group_name + "</option>";
- });
-
- $("#control_group").html( htmlString );
- }else {
- htmlString += "<option>Ingen
kontrollgrupper</option>"
- $("#control_group").html(
htmlString );
- }
- }
- });
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl + "&line_id=" + line_id,
+ success: function(data) {
+ if(data.sessionExpired)
+ {
+ alert('Sesjonen er utløpt - du må logge inn på
nytt');
+ return;
+ }
+ var voucher = data['voucher'];
+ if( voucher != null && voucher.length > 0)
+ {
+ $("#line_id").val( line_id );
- });
+ var update_image = false;
-
- $("#frm_save_control_groups").submit(function(e){
- var thisForm = $(this);
- var num_checked = $(this).find("input:checked").length;
-
- if(num_checked == 0){
- e.preventDefault();
- $(thisForm).before("<div style='margin: 10px
0;text-align: center;width: 200px;' class='input_error_msg'>Du må velge en
eller flere grupper</div>");
- }
- });
-
- $("#frm_control_items").submit(function(e){
- var thisForm = $(this);
- var num_checked = $(this).find("input:checked").length;
-
- if(num_checked == 0){
- e.preventDefault();
- $(thisForm).before("<div style='margin: 10px
0;text-align: center;width: 200px;' class='input_error_msg'>Du må velge en
eller flere punkter</div>");
- }
- });
-
- $("#frm_save_control_details input").focus(function(e){
-
$("#frm_save_control_details").find(".focus").removeClass("focus");
- $(this).addClass("focus");
- });
-
- $("#frm_save_control_details input").focus(function(e){
-
$("#frm_save_control_details").find(".focus").removeClass("focus");
- $(this).addClass("focus");
- });
-
- $("#frm_save_control_details select").focus(function(e){
-
$("#frm_save_control_details").find(".focus").removeClass("focus");
- $(this).addClass("focus");
- });
-
- $("#frm_save_control_details").submit(function(e){
-
- var thisForm = $(this);
-
- var $required_input_fields = $(this).find(".required");
- var status = true;
-
- $required_input_fields.each(function() {
-
- if($(this).val() == ''){
- var nextElem = $(this).next();
-
- if( !$(nextElem).hasClass("input_error_msg") )
- $(this).after("<div class='input_error_msg'>Du
må fylle ut dette feltet</div>");
-
- status = false;
- }else{
- var nextElem = $(this).next();
-
- if( $(nextElem).hasClass("input_error_msg") )
- $(nextElem).remove();
- }
- });
-
- if( status ){
- var saved_control_area_id =
$(thisForm).find("input[name='saved_control_area_id']").val();
- var new_control_area_id = $("#control_area_id").val();
-
- if(saved_control_area_id != '' & saved_control_area_id !=
new_control_area_id)
- {
- var answer = confirm("Du har endret kontrollområde til
kontrollen. " +
- "Hvis du
lagrer vil kontrollgrupper og kontrollpunkter til kontrollen bli slettet.")
- if (!answer){
- e.preventDefault();
- }
- }
- }else{
- e.preventDefault();
- }
-
- });
-
- // file: view_check_lists_for_location.xsl
- // Fetches info about a check list on hover status image icon
- $('a.view_check_list').bind('contextmenu', function(){
- var thisA = $(this);
- var divWrp = $(this).parent();
-
- var add_param = $(thisA).find("span").text();
-
- var oArgs =
{menuaction:'controller.uicheck_list.get_cases_for_check_list'};
- var baseUrl = phpGWLink('index.php', oArgs, true);
- var requestUrl = baseUrl + add_param
-
- //var requestUrl =
"http://portico/pe/index.php?menuaction=controller.uicheck_list.get_cases_for_check_list"
+ add_param;
-
- $.ajax({
- type: 'POST',
- url: requestUrl,
- dataType: 'json',
- success: function(data) {
- if(data){
- var obj = jQuery.parseJSON(data);
-
- // Show info box with info about check list
- var infoBox = $(divWrp).find("#info_box");
- $(infoBox).show();
-
- var htmlStr = "<h5>Åpne saker</h5><ul>";
-
- $.each(obj, function(i) {
- htmlStr += "<li><label>" + (parseInt(i)
+ 1) + ": Tittel</label><span>" + obj[i].control_item.title + "</span>";
- htmlStr += "<ul>";
-
- $(obj[i].cases_array).each(function(j) {
- htmlStr += "<li>" + "Sak " +
(parseInt(j) + 1) + ": " + obj[i].cases_array[j].descr + "</li>";
- });
- htmlStr += "</ul></li>";
- });
-
- htmlStr += "</ul>";
-
- $(infoBox).html( htmlStr );
- }
- }
- });
-
- return false;
- });
-
- $("a.view_check_list").mouseout(function(){
- var infoBox = $(this).parent().find("#info_box");
-
- $(infoBox).hide();
- });
-
- $(".frm_save_check_item").live("submit", function(e){
- e.preventDefault();
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- var requestUrl = $(thisForm).attr("action");
-
- $.ajax({
- type: 'POST',
- url: requestUrl + "&phpgw_return_as=json&" +
$(thisForm).serialize(),
- success: function(data) {
- if(data){
- var obj = jQuery.parseJSON(data);
-
- if(obj.status == "saved"){
- var submitBnt =
$(thisForm).find("input[type='submit']");
- $(submitBnt).val("Lagret");
-
- // Changes text on save button
back to original
- window.setTimeout(function() {
- $(submitBnt).val('Oppdater
måling');
-
$(submitBnt).addClass("not_active");
- }, 1000);
- }
+ if(voucher_id_orig != voucher[0].voucher_id)
+ {
+ update_image = true;
}
+ $("#voucher_id").val( voucher[0].voucher_id );
+ if( voucher[0].voucher_out_id )
+ {
+ $("#voucher_id_text").html(
voucher[0].voucher_out_id );
}
- });
- });
+ else
+ {
+ $("#voucher_id_text").html(
voucher[0].voucher_id );
+ }
- $(".frm_save_control_item").live("click", function(e){
- e.preventDefault();
- var thisForm = $(this);
- var liWrp = $(this).parent();
- var submitBnt = $(thisForm).find("input[type='submit']");
- var requestUrl = $(thisForm).attr("action");
-
- $.ajax({
- type: 'POST',
- url: requestUrl + "&phpgw_return_as=json&" +
$(thisForm).serialize(),
- success: function(data) {
- if(data){
- var obj = jQuery.parseJSON(data);
-
- if(obj.status == "saved"){
- $(liWrp).fadeOut('3000', function() {
- $(liWrp).addClass("hidden");
- });
- }
+ $("#order_id").val( voucher[0].order_id );
+
+ if(voucher[0].order_id)
+ {
+ var oArgs_order =
{menuaction:'property.uiinvoice.view_order', order_id: voucher[0].order_id};
+ var requestUrl_order =
phpGWLink('index.php', oArgs_order);
+ var htmlString_order = " <a target=
\"_blank\" href=\"" + requestUrl_order + "\" title=\"" + voucher[0].status +
"\" > Bestilling</a>";
+ $("#order_text").html( htmlString_order
);
}
+ else
+ {
+ $("#order_text").html( 'Bestilling' );
}
- });
- });
- $("#frm_update_check_list").live("submit", function(e){
- e.preventDefault();
+ $("#project_group").val(
voucher[0].project_group );
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- var requestUrl = $(thisForm).attr("action");
-
- $.ajax({
- type: 'POST',
- url: requestUrl + "&phpgw_return_as=json&" +
$(thisForm).serialize(),
- success: function(data) {
- if(data){
- var obj = jQuery.parseJSON(data);
-
- if(obj.status == "updated"){
- var submitBnt =
$(thisForm).find("input[type='submit']");
- $(submitBnt).val("Lagret");
-
- // Changes text on save button back to
original
- window.setTimeout(function() {
- $(submitBnt).val('Lagre
sjekkpunkt');
-
$(submitBnt).addClass("not_active");
- }, 1000);
+ if(update_image)
+ {
+ if(voucher[0].external_ref)
+ {
+
$("#invoice_id_text").html(voucher[0].external_ref );
+
document.getElementById('image_content').src = voucher[0].image_url;
}
+ else
+ {
+
$("#invoice_id_text").html('FakturaNr');
+
document.getElementById('image_content').src = '';
+ }
}
- }
- });
- });
- $(".frm_register_case").live("submit", function(e){
- e.preventDefault();
+ $("#invoice_id").html( voucher[0].invoice_id );
+ $("#kid_nr").html( voucher[0].kid_nr );
+ $("#vendor").html( voucher[0].vendor );
+ $("#invoice_date").html(
voucher[0].invoice_date );
+ $("#payment_date").html(
voucher[0].payment_date );
+ $("#b_account_id").val( voucher[0].b_account_id
);
+ $("#dim_a").val( voucher[0].dim_a );
+ $("#currency").html( voucher[0].currency );
+ $("#process_log").html(
data['generic'].process_log );
+ $("#my_initials").val(
data['generic'].my_initials );
+ $("#sign_orig").val( data['generic'].sign_orig
);
+ $("#line_text").val( voucher[0].line_text );
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- var requestUrl = $(thisForm).attr("action");
-
- $.ajax({
- type: 'POST',
- url: requestUrl + "&" + $(thisForm).serialize(),
- success: function(data) {
- if(data){
- var jsonObj = jQuery.parseJSON(data);
-
- if(jsonObj.status == "saved"){
- var submitBnt =
$(thisForm).find("input[type='submit']");
- $(submitBnt).val("Lagret");
-
- clear_form( thisForm );
-
- // Changes text on save button back to
original
- window.setTimeout(function() {
-
$(submitBnt).val('Registrer sak');
-
$(submitBnt).addClass("not_active");
- }, 1000);
- }
+ if(voucher[0].merknad)
+ {
+ var oArgs_remark =
{menuaction:'property.uiinvoice.remark', id: voucher[0].id};
+ var requestUrl_remark =
phpGWLink('index.php', oArgs_remark);
+ var htmlString = " <a
href=\"javascript:openwindow('" +requestUrl_remark + "','550','400')\" >
Remark</a>";
+
+ $("#remark").html( htmlString );
}
+//---------
+ var checked_park_invoice = "";
+ var park_invoice_status = "";
+ if(voucher[0].parked)
+ {
+ checked_park_invoice = "checked =
\"checked\"";
+ var park_invoice_status = " X";
}
- });
- });
+ var htmlString_park_invoice = "<input
type=\"checkbox\" name=\"values[park_invoice]\" value=\"1\" title=\"park
invoice\"" + checked_park_invoice + "></input>" + park_invoice_status;
+ $("#park_order").html( htmlString_park_invoice
);
+//---------
+ var checked_close_order = "";
+ var close_order_status = " " +
voucher[0].status;
+ if(voucher[0].closed)
+ {
+ checked_close_order = "checked =
\"checked\"";
+ }
+ var htmlString_close_order = "<input
type=\"checkbox\" name=\"values[close_order]\" value=\"1\" title=\"close
order\"" + checked_close_order + "></input>" + close_order_status;
+ $("#close_order").html( htmlString_close_order
);
+ $("#close_order_orig").val( voucher[0].closed );
+//---------
- $(".frm_update_case").live("submit", function(e){
- e.preventDefault();
+
if(typeof(data['generic']['dimb_list']['options']) != 'undefined')
+ {
+ var htmlString = "";
+ var obj =
data['generic']['dimb_list']['options'];
- var thisForm = $(this);
- var clickRow = $(this).closest("li");
- var checkItemRow = $(this).closest("li.check_item_case");
- var requestUrl = $(thisForm).attr("action");
-
- $.ajax({
- type: 'POST',
- url: requestUrl + "&" + $(thisForm).serialize(),
- success: function(data) {
- if(data){
- var jsonObj = jQuery.parseJSON(data);
-
- if(jsonObj.status == "saved"){
- var type =
$(checkItemRow).find(".control_item_type").text();
-
- if(type == "control_item_type_1"){
-
- }else if(type == "control_item_type_2"){
- var measurement_text =
$(thisForm).find("input[name='measurement']").val();
- $(clickRow).find(".case_info
.measurement").text(measurement_text);
- }
-
- // Text from forms textarea
- var desc_text =
$(thisForm).find("textarea").val();
- // Puts new text into description tag
in case_info
- $(clickRow).find(".case_info
.case_descr").text(desc_text);
-
- $(clickRow).find(".case_info").show();
-
$(clickRow).find(".frm_update_case").hide();
- }
+ $.each(obj, function(i) {
+ var selected = '';
+ if(obj[i].id ==
voucher[0].dim_b)
+ {
+ selected = ' selected';
+ }
+ htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+ });
+
+ $("#dim_b").html( htmlString );
}
- }
- });
- });
+
if(typeof(data['generic']['tax_code_list']['options']) != 'undefined')
+ {
+ var htmlString = "";
- $("a.quick_edit").live("click", function(e){
- var clickElem = $(this);
- var clickRow = $(this).closest("li");
-
- $(clickRow).find(".case_info").hide();
- $(clickRow).find(".frm_update_case").show();
-
- return false;
- });
+ htmlString = "<option>Velg</option>"
- $(".frm_update_case .cancel").live("click", function(e){
- var clickElem = $(this);
- var clickRow = $(this).closest("li");
-
-
- $(clickRow).find(".case_info").show();
- $(clickRow).find(".frm_update_case").hide();
-
- return false;
- });
+ var obj =
data['generic']['tax_code_list']['options'];
- // Delete a case item from list
- $(".delete_case").live("click", function(){
- var clickElem = $(this);
- var clickRow = $(this).closest("li");
- var clickItem = $(this).closest("ul");
- var checkItemRow = $(this).parents("li.check_item_case");
-
- var url = $(clickElem).attr("href");
-
- // Sending request for deleting a control item list
- $.ajax({
- type: 'POST',
- url: url,
- success: function(data) {
- var obj = jQuery.parseJSON(data);
-
- if(obj.status == "deleted"){
- if( $(clickItem).children("li").length
> 1){
- $(clickRow).fadeOut(300,
function(){
- $(clickRow).remove();
- });
-
- var next_row =
$(clickRow).next();
-
- // Updating order numbers for
rows below deleted row
- while( $(next_row).length > 0){
-
update_order_nr_for_row(next_row, "-");
- next_row =
$(next_row).next();
+ $.each(obj, function(i) {
+ var selected = '';
+ if(obj[i].id ==
voucher[0].tax_code)
+ {
+ selected = ' selected';
}
- }else{
- $(checkItemRow).fadeOut(300,
function(){
-
$(checkItemRow).remove();
- });
- }
- }
- }
- });
+ htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+ });
- return false;
- });
+ $("#tax_code").html( htmlString );
+ }
- // Closes a case
- $(".close_case").live("click", function(){
- var clickElem = $(this);
- var clickRow = $(this).closest("li");
- var clickItem = $(this).closest("ul");
- var checkItemRow = $(this).parents("li.check_item_case");
-
- var url = $(clickElem).attr("href");
+
if(typeof(data['generic']['period_list']['options']) != 'undefined')
+ {
+ var htmlString = "";
+ var obj =
data['generic']['period_list']['options'];
- // Sending request for deleting a control item list
- $.ajax({
- type: 'POST',
- url: url,
- success: function(data) {
- var obj = jQuery.parseJSON(data);
-
- if(obj.status == "closed"){
- if( $(clickItem).children("li").length
> 1){
- $(clickRow).fadeOut(300,
function(){
- $(clickRow).remove();
- });
-
- var next_row =
$(clickRow).next();
-
- // Updating order numbers for
rows below deleted row
- while( $(next_row).length > 0){
-
update_order_nr_for_row(next_row, "-");
- next_row =
$(next_row).next();
+ $.each(obj, function(i) {
+ var selected = '';
+ if(obj[i].id ==
voucher[0].period)
+ {
+ selected = ' selected';
}
- }else{
- $(checkItemRow).fadeOut(300,
function(){
-
$(checkItemRow).remove();
- });
- }
- }
- }
- });
+ htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+ });
+ $("#period").html( htmlString );
+ }
+
if(typeof(data['generic']['periodization_list']['options']) != 'undefined')
+ {
+ var htmlString = "";
- return false;
- });
+ var obj =
data['generic']['periodization_list']['options'];
- $("#frm_update_check_list").live("click", function(e){
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- $(submitBnt).removeClass("not_active");
- });
+ $.each(obj, function(i) {
+ var selected = '';
+ if(obj[i].id ==
voucher[0].periodization)
+ {
+ selected = ' selected';
+ }
+ htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+ });
- $("#frm_add_check_list").live("click", function(e){
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- $(submitBnt).removeClass("not_active");
- });
+ $("#periodization").html( htmlString );
+ }
+
if(typeof(data['generic']['periodization_start_list']['options']) !=
'undefined')
+ {
+ var htmlString = "";
- $(".frm_save_check_item").live("click", function(e){
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- $(submitBnt).removeClass("not_active");
- });
+ var obj =
data['generic']['periodization_start_list']['options'];
- $(".frm_register_case").live("click", function(e){
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- $(submitBnt).removeClass("not_active");
- });
+ $.each(obj, function(i) {
+ var selected = '';
+ if(obj[i].id ==
voucher[0].periodization_start)
+ {
+ selected = ' selected';
+ }
+ htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+ });
- $("#control_details input").focus(function(e){
- var wrpElem = $(this).parents("dd");
- $(wrpElem).find(".help_text").fadeIn(300);
- });
+ $("#periodization_start").html(
htmlString );
+ }
- $("#control_details input").focusout(function(e){
- var wrpElem = $(this).parents("dd");
- $(wrpElem).find(".help_text").fadeOut(300);
- });
+
if(typeof(data['generic']['process_code_list']['options']) != 'undefined')
+ {
+ var htmlString = "";
- $("#control_details select").focus(function(e){
- var wrpElem = $(this).parents("dd");
- $(wrpElem).find(".help_text").fadeIn(300);
- });
+ var obj =
data['generic']['process_code_list']['options'];
+ $.each(obj, function(i) {
+ var selected = '';
+ if(obj[i].id ==
voucher[0].process_code)
+ {
+ selected = ' selected';
+ }
+ htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+ });
- $("#control_details select").focusout(function(e){
- var wrpElem = $(this).parents("dd");
- $(wrpElem).find(".help_text").fadeOut(300);
- });
+ $("#process_code").html( htmlString );
+ }
-});
-
-
-function update_form_values( line_id, voucher_id_orig ){
- var oArgs = {menuaction:'property.uiinvoice2.get_single_line'};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl + "&line_id=" + line_id,
- success: function(data) {
- var voucher = data['voucher'];
- if( voucher != null && voucher.length > 0)
+ if(typeof(data['generic']['approved_list']) !=
'undefined')
{
- $("#line_id").val( line_id );
-
- var update_image = false;
-
- if(voucher_id_orig !=
voucher[0].voucher_id)
+ for ( var i = 0; i <
data['generic']['approved_list'].length; ++i )
{
- update_image = true;
- }
- $("#voucher_id").val(
voucher[0].voucher_id );
- if( voucher[0].voucher_out_id )
- {
- $("#voucher_id_text").html(
voucher[0].voucher_out_id );
- }
- else
- {
- $("#voucher_id_text").html(
voucher[0].voucher_id );
- }
+ var role_sign =
data['generic']['approved_list'][i].role_sign;
- $("#order_id").val( voucher[0].order_id
);
+ var role_initials =
data['generic']['approved_list'][i].initials;
- if(voucher[0].order_id)
- {
- var oArgs_order =
{menuaction:'property.uiinvoice.view_order', order_id: voucher[0].order_id};
- var requestUrl_order =
phpGWLink('index.php', oArgs_order);
- var htmlString_order = " <a
target= \"_blank\" href=\"" + requestUrl_order + "\" title=\"" +
voucher[0].status + "\" > Bestilling</a>";
- $("#order_text").html(
htmlString_order );
- }
- else
- {
- $("#order_text").html(
'Bestilling' );
- }
-
- $("#project_group").val(
voucher[0].project_group );
-
- if(update_image)
- {
- if(voucher[0].external_ref)
+ if(
data['generic']['approved_list'][i].date )
{
-
$("#invoice_id_text").html(voucher[0].external_ref );
-
document.getElementById('image_content').src = voucher[0].image_url;
+ var htmlString =
role_initials + ": " + data['generic']['approved_list'][i].date;
}
else
{
-
$("#invoice_id_text").html('FakturaNr');
-
document.getElementById('image_content').src = '';
+ var htmlString =
"<select id=\"_" + role_sign + "\" name=\"values[forward][" + role_sign +
"]\">";
+ var obj =
data['generic']['approved_list'][i]['user_list'].options;
+ $.each(obj, function(i)
{
+ var selected =
'';
+ if(obj[i].id ==
role_initials)
+ {
+
selected = ' selected';
+ }
+ htmlString +=
"<option value='" + obj[i].id + "'" + selected + ">" + obj[i].name +
"</option>";
+ });
+ htmlString +=
"</select>";
}
- }
- $("#invoice_id").html(
voucher[0].invoice_id );
- $("#kid_nr").html( voucher[0].kid_nr );
- $("#vendor").html( voucher[0].vendor );
-// $("#janitor").html( voucher[0].janitor
);
-// $("#supervisor").html(
voucher[0].supervisor );
-// $("#budget_responsible").html(
voucher[0].budget_responsible );
- $("#invoice_date").html(
voucher[0].invoice_date );
- $("#payment_date").html(
voucher[0].payment_date );
- $("#b_account_id").val(
voucher[0].b_account_id );
- $("#dim_a").val( voucher[0].dim_a );
-// $("#amount").html(
data['generic'].amount );
-// $("#approved_amount").html(
data['generic'].approved_amount );
- $("#currency").html(
voucher[0].currency );
- $("#process_log").html(
data['generic'].process_log );
- $("#my_initials").val(
data['generic'].my_initials );
- $("#sign_orig").val(
data['generic'].sign_orig );
- $("#line_text").val(
voucher[0].line_text );
-
- // $("#oppsynsigndato").html(
voucher[0].oppsynsigndato );
- // $("#saksigndato").html(
voucher[0].saksigndato );
- // $("#budsjettsigndato").html(
voucher[0].budsjettsigndato );
- if(voucher[0].merknad)
- {
- var oArgs_remark =
{menuaction:'property.uiinvoice.remark', id: voucher[0].id};
- var requestUrl_remark =
phpGWLink('index.php', oArgs_remark);
-
- var htmlString = " <a
href=\"javascript:openwindow('" +requestUrl_remark + "','550','400')\" >
Remark</a>";
-
- $("#remark").html( htmlString );
+ $("#" + role_sign).html(
htmlString );
}
-//---------
- var checked_park_invoice = "";
- var park_invoice_status = "";
- if(voucher[0].parked)
- {
- checked_park_invoice = "checked
= \"checked\"";
- var park_invoice_status = " X";
- }
- var htmlString_park_invoice = "<input
type=\"checkbox\" name=\"values[park_invoice]\" value=\"1\" title=\"park
invoice\"" + checked_park_invoice + "></input>" + park_invoice_status;
- $("#park_order").html(
htmlString_park_invoice );
-//---------
- var checked_close_order = "";
- var close_order_status = " " +
voucher[0].status;
- if(voucher[0].closed)
- {
- checked_close_order = "checked
= \"checked\"";
- }
- var htmlString_close_order = "<input
type=\"checkbox\" name=\"values[close_order]\" value=\"1\" title=\"close
order\"" + checked_close_order + "></input>" + close_order_status;
- $("#close_order").html(
htmlString_close_order );
- $("#close_order_orig").val(
voucher[0].closed );
-//---------
+ }
-
if(typeof(data['generic']['dimb_list']['options']) != 'undefined')
- {
- var htmlString = "";
+
if(typeof(data['generic']['approve_list']['options']) != 'undefined')
+ {
+ var htmlString = "";
- var obj =
data['generic']['dimb_list']['options'];
+ var obj =
data['generic']['approve_list']['options'];
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].dim_b)
- {
- selected = '
selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#dim_b").html( htmlString );
- }
-
if(typeof(data['generic']['tax_code_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- htmlString =
"<option>Velg</option>"
-
- var obj =
data['generic']['tax_code_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].tax_code)
- {
- selected = '
selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#tax_code").html( htmlString
);
- }
-
-
if(typeof(data['generic']['period_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['period_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].period)
- {
- selected = '
selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#period").html( htmlString );
- }
-
if(typeof(data['generic']['periodization_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['periodization_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].periodization)
- {
- selected = '
selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#periodization").html(
htmlString );
- }
-
if(typeof(data['generic']['periodization_start_list']['options']) !=
'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['periodization_start_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].periodization_start)
- {
- selected = '
selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#periodization_start").html(
htmlString );
- }
-
-
if(typeof(data['generic']['process_code_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['process_code_list']['options'];
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].process_code)
- {
- selected = '
selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#process_code").html(
htmlString );
- }
-
-
if(typeof(data['generic']['approved_list']) != 'undefined')
- {
- for ( var i = 0; i <
data['generic']['approved_list'].length; ++i )
+ $.each(obj, function(i) {
+ var selected = '';
+ if(typeof(obj[i].selected) !=
'undefined' && obj[i].selected == 1)
{
- var role_sign =
data['generic']['approved_list'][i].role_sign;
-
- var role_initials =
data['generic']['approved_list'][i].initials;
-
- if(
data['generic']['approved_list'][i].date )
- {
- var htmlString
= role_initials + ": " + data['generic']['approved_list'][i].date;
- }
- else
- {
- var htmlString
= "<select id=\"_" + role_sign + "\" name=\"values[forward][" + role_sign +
"]\">";
- var obj =
data['generic']['approved_list'][i]['user_list'].options;
- $.each(obj,
function(i) {
- var
selected = '';
-
if(obj[i].id == role_initials)
- {
-
selected = ' selected';
- }
-
htmlString += "<option value='" + obj[i].id + "'" + selected + ">" +
obj[i].name + "</option>";
- });
-
- htmlString +=
"</select>";
- }
- $("#" +
role_sign).html( htmlString );
+ selected = ' selected';
}
- }
+ htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+ });
-
if(typeof(data['generic']['approve_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['approve_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
-
if(typeof(obj[i].selected) != 'undefined' && obj[i].selected == 1)
- {
- selected = '
selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#approve_as").html(
htmlString );
- }
+ $("#approve_as").html( htmlString );
}
- else
- {
- $("#line_text").val( '' );
- $("#voucher_id").val( '' );
- $("#voucher_id_text").html( '' );
- $("#order_id").val( '' );
- $("#project_group").val( '' );
- $("#invoice_id").html( '' );
- $("#kid_nr").html( '' );
- $("#vendor").html('' );
-// $("#janitor").html( '' );
-// $("#supervisor").html( '' );
-// $("#budget_responsible").html( '' );
- $("#close_order_orig").val( '' );
- $("#my_initials").val( '' );
- $("#sign_orig").val( '' );
- $("#invoice_date").html( '' );
- $("#payment_date").html( '' );
- $("#b_account_id").val( '' );
-// $("#amount").html( '' );
-// $("#approved_amount").html( '' );
- $("#currency").html( '' );
- $("#oppsynsmannid").html( '' );
- $("#saksbehandlerid").html( '' );
- $("#budsjettansvarligid").html( '' );
- $("#remark").html( '' );
- $("#process_log").html( '' );
- $("#dim_a").val('' );
- $("#dim_b").html(
"<option>Velg</option>" );
- $("#period").html(
"<option>Velg</option>" );
- $("#periodization").html(
"<option>Velg</option>" );
- $("#periodization_start").html(
"<option>Velg</option>" );
- $("#process_code").html(
"<option>Velg</option>" );
- $("#tax_code").html(
"<option>0</option>" );
- $("#approve_as").html(
"<option>Velg</option>" );
- $("#order_text").html( 'Bestilling' );
- $("#invoice_id_text").html('FakturaNr');
-
document.getElementById('image_content').src = '';
- }
}
- });
-
+ else
+ {
+ $("#line_text").val( '' );
+ $("#voucher_id").val( '' );
+ $("#voucher_id_text").html( '' );
+ $("#order_id").val( '' );
+ $("#project_group").val( '' );
+ $("#invoice_id").html( '' );
+ $("#kid_nr").html( '' );
+ $("#vendor").html('' );
+ $("#close_order_orig").val( '' );
+ $("#my_initials").val( '' );
+ $("#sign_orig").val( '' );
+ $("#invoice_date").html( '' );
+ $("#payment_date").html( '' );
+ $("#b_account_id").val( '' );
+ $("#currency").html( '' );
+ $("#oppsynsmannid").html( '' );
+ $("#saksbehandlerid").html( '' );
+ $("#budsjettansvarligid").html( '' );
+ $("#remark").html( '' );
+ $("#process_log").html( '' );
+ $("#dim_a").val('' );
+ $("#dim_b").html( "<option>Velg</option>" );
+ $("#period").html( "<option>Velg</option>" );
+ $("#periodization").html(
"<option>Velg</option>" );
+ $("#periodization_start").html(
"<option>Velg</option>" );
+ $("#process_code").html(
"<option>Velg</option>" );
+ $("#tax_code").html( "<option>0</option>" );
+ $("#approve_as").html( "<option>Velg</option>"
);
+ $("#order_text").html( 'Bestilling' );
+ $("#invoice_id_text").html('FakturaNr');
+ document.getElementById('image_content').src =
'';
+ }
+ }
+ });
}
-
-
-
-function clear_form( form ){
- // Clear form
- $(form).find(':input').each(function() {
- switch(this.type) {
- case 'select-multiple':
- case 'select-one':
- case 'text':
- $(this).val('');
- break;
- case 'textarea':
- $(this).val('');
- break;
- case 'checkbox':
- case 'radio':
- this.checked = false;
- }
- });
-}
-
-//Updates order number for hidden field and number in front of row
-function update_order_nr_for_row(element, sign){
-
- var span_order_nr = $(element).find("span.order_nr");
- var order_nr = $(span_order_nr).text();
-
- if(sign == "+")
- var updated_order_nr = parseInt(order_nr) + 1;
- else
- var updated_order_nr = parseInt(order_nr) - 1;
-
- // Updating order number in front of row
- $(span_order_nr).text(updated_order_nr);
-}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9190] property: invoice handling clean up / check for valid session,
Sigurd Nes <=