diff --git a/README.rdoc b/README.rdoc index 05abbd695..d30cf6582 100644 --- a/README.rdoc +++ b/README.rdoc @@ -93,24 +93,19 @@ If an apache passenger module is used then make sure the following settings are b) RailsAppSpawnerIdleTime 0 c) PassengerPreStart https://rails-app-url/ -Release Notes for v4.5 +Release Notes for v4.5.1 Features: - - Cash flow report - - Option to create product item when creating new model - - Apply Tax rates for supplier invoice automatically - - Consecutive serial numbers for new receipt page - - Make more relationships of inventory - - Hide used items in inventory items list + - Deletion of all entries after a certain period of time + - Show sub tabs also for subcategories + - Automatically close the order when the invoice is created Bug fixes: - - Allow only one receipt per supplier invoice - - Error creating a new product item - - The purchase order does not load when creating a new supplier invoice - - Automatically calculate tax before saving invoice - - Consecutive serial number does not load for old data - - Product item name error in spend time - - Plot the graphs for the current month + - Created user also listed in hiring drop down + - Show item instead of product in spent time + - No option to enter an order number + - Two problems with the order number when creating a supplier invoice + - Show Fixed cost in billing type invoice Customization: diff --git a/app/controllers/wkaccountproject_controller.rb b/app/controllers/wkaccountproject_controller.rb index 8a5b26f10..c5913e868 100644 --- a/app/controllers/wkaccountproject_controller.rb +++ b/app/controllers/wkaccountproject_controller.rb @@ -213,8 +213,8 @@ def additionalAccountType true end - def set_filter_session + def set_filter_session filters = [:contact_id, :account_id, :polymorphic_filter] super(filters, {:project_id => params[:project_id]}) - end + end end diff --git a/app/controllers/wkbase_controller.rb b/app/controllers/wkbase_controller.rb index a8dd8128e..e1a1c699e 100644 --- a/app/controllers/wkbase_controller.rb +++ b/app/controllers/wkbase_controller.rb @@ -42,7 +42,7 @@ def destroy def updateClockInOut lastAttnEntries = findLastAttnEntry(true) @lastAttnEntry = lastAttnEntries[0] if !lastAttnEntries.blank? - entryTime = Time.now + entryTime = (params.has_key?("end_time".to_sym) && params[:end_time].present?) ? params[:end_time].to_time : (params.has_key?("start_time".to_sym) && params[:start_time].present?) ? params[:start_time].to_time : Time.now entryTime = entryTime - (entryTime.utc_offset.seconds + (params[:offSet].to_i).minutes) @lastAttnEntry = saveAttendance(@lastAttnEntry, entryTime, nil, User.current.id, false) respond_to do |format| @@ -370,4 +370,8 @@ def updateWkuserVal data = WkUser.showEncryptdData(params[:userID], params[:columnName]) render json: {data: data} end + + def loadPurchaseDD + false + end end diff --git a/app/controllers/wkbilling_controller.rb b/app/controllers/wkbilling_controller.rb index 1ded966e7..26bf993df 100644 --- a/app/controllers/wkbilling_controller.rb +++ b/app/controllers/wkbilling_controller.rb @@ -22,82 +22,82 @@ class WkbillingController < WkbaseController include WktimeHelper before_action :check_perm_and_redirect, :only => [:index, :edit, :update, :destroy] - + def check_perm_and_redirect unless check_permission render_403 return false end end - + def check_permission return validateERPPermission("M_BILL") end - + def getOrderAccountType 'A' end - + def getOrderContactType 'C' end - + def getInvoiceType 'I' end - + def needBlankProject false end - + def getAdditionalDD - end - - def getPopulateChkBox end - + + def getPopulateChkBox + end + def isInvGenUnbilledLink false end - + def isInvPaymentLink false end - + def getPaymentController "wkpayment" end - + def addAdditionalTax false end - + def addQuoteFields false end - + def needChangedProject true end - + def editInvNumber false end - + def getOrderNumberPrefix end - + def getAccountDDLbl l(:field_account) end - + def getNewHeaderLbl end - + def additionalContactType true end - + def additionalAccountType true end diff --git a/app/controllers/wkexpense_controller.rb b/app/controllers/wkexpense_controller.rb index 39ea8f20b..cb35d1418 100644 --- a/app/controllers/wkexpense_controller.rb +++ b/app/controllers/wkexpense_controller.rb @@ -175,8 +175,8 @@ def getQuery(teQuery, ids, from, to, status) spField = getSpecificField() dtRangeForUsrSqlStr = "(" + getAllWeekSql(from, to) + ") tmp1" teSqlStr = "(" + teQuery + ") tmp2" - selectStr = "select tmp3.user_id as user_id , tmp3.spent_on as spent_on, tmp3.#{spField} as #{spField}, tmp3.status as status, tmp3.status_updater as status_updater, tmp3.created_on as created_on, tmp3.currency as currency" - query = " from (select tmp1.id as user_id, tmp1.created_on, tmp1.selected_date as spent_on, " + + selectStr = "select tmp3.id, tmp3.user_id as user_id , tmp3.spent_on as spent_on, tmp3.#{spField} as #{spField}, tmp3.status as status, tmp3.status_updater as status_updater, tmp3.created_on as created_on, tmp3.currency as currency" + query = " from (select tmp2.id, tmp1.id as user_id, tmp1.created_on, tmp1.selected_date as spent_on, " + "case when tmp2.#{spField} is null then 0 else tmp2.#{spField} end as #{spField}, " + "case when tmp2.status is null then 'e' else tmp2.status end as status, tmp2.currency, tmp2.status_updater from " query = query + dtRangeForUsrSqlStr + " left join " + teSqlStr diff --git a/app/controllers/wkinventory_controller.rb b/app/controllers/wkinventory_controller.rb index 99105397d..98457b0b3 100644 --- a/app/controllers/wkinventory_controller.rb +++ b/app/controllers/wkinventory_controller.rb @@ -7,18 +7,18 @@ class WkinventoryController < WkbaseController before_action :check_perm_and_redirect, :only => [:index, :edit, :update, :destroy] before_action :check_admin_redirect, :only => [:destroy] - + def check_perm_and_redirect unless check_permission render_403 return false end end - + def check_permission return validateERPPermission("V_INV") end - + def check_admin_redirect allow = false allow = validateERPPermission("D_INV") @@ -27,10 +27,8 @@ def check_admin_redirect return false end end - + def hasDeletePermission validateERPPermission("D_INV") end - - end diff --git a/app/controllers/wkorderentity_controller.rb b/app/controllers/wkorderentity_controller.rb index 379741c4c..21be5e663 100644 --- a/app/controllers/wkorderentity_controller.rb +++ b/app/controllers/wkorderentity_controller.rb @@ -152,7 +152,7 @@ def index LEFT JOIN wk_accounts a on (wk_invoices.parent_type = 'WkAccount' and wk_invoices.parent_id = a.id) LEFT JOIN wk_crm_contacts c on (wk_invoices.parent_type = 'WkCrmContact' and wk_invoices.parent_id = c.id) ").group("wk_invoices.id, CASE WHEN wk_invoices.parent_type = 'WkAccount' THEN a.name ELSE CONCAT(c.first_name, c.last_name) END, - CONCAT(users.firstname, users.lastname), wk_invoices.status, wk_invoices.invoice_number, wk_invoices.start_date, wk_invoices.end_date, wk_invoices.invoice_date, wk_invoices.closed_on, wk_invoices.modifier_id, wk_invoices.gl_transaction_id, wk_invoices.parent_id, wk_invoices.invoice_type, wk_invoices.invoice_num_key, wk_invoices.created_at, wk_invoices.updated_at,wk_invoices.parent_type ") + CONCAT(users.firstname, users.lastname), wk_invoices.status, wk_invoices.invoice_number, wk_invoices.start_date, wk_invoices.end_date, wk_invoices.invoice_date, wk_invoices.closed_on, wk_invoices.modifier_id, wk_invoices.gl_transaction_id, wk_invoices.parent_id, wk_invoices.invoice_type, wk_invoices.invoice_num_key, wk_invoices.created_at, wk_invoices.updated_at,wk_invoices.parent_type, wk_invoices.confirm_num") .select("wk_invoices.*, SUM(wk_invoice_items.quantity) AS quantity, SUM(wk_invoice_items.amount) AS amount, SUM(wk_invoice_items.original_amount) AS original_amt") invEntries = invEntries.reorder(sort_clause) @@ -317,10 +317,9 @@ def update saveOrderInvoice(params[:parent_id], params[:parent_type], params[:project_id_1],params[:inv_date], invoicePeriod, false, getInvoiceType) end - @invoice.status = params[:field_status] unless params[:field_status].blank? - unless params[:inv_number].blank? - @invoice.invoice_number = params[:inv_number] - end + @invoice.status = params[:field_status] if params[:field_status].present? + @invoice.invoice_number = params[:inv_number] if params[:inv_number].present? + @invoice.confirm_num = params[:confirm_num] if params[:confirm_num].present? if @invoice.status_changed? @invoice.closed_on = Time.now end @@ -350,9 +349,9 @@ def update pjtId = params["project_id_#{i}"] if !params["project_id_#{i}"].blank? itemType = params["item_type_#{i}"].blank? ? params["hd_item_type_#{i}"] : params["item_type_#{i}"] - invoice_item_id = (params["invoice_item_id_#{i}"]).split(",").last + invoice_item_id = ((params["invoice_item_id_#{i}"]) || "").split(",").last invoice_item_id = invoice_item_id.present? ? invoice_item_id.to_i : nil - product_id = params["product_id_#{i}"].present? ? params["product_id_#{i}"] : (params["invoice_item_id_#{i}"]).split(",").first + product_id = params["product_id_#{i}"].present? ? params["product_id_#{i}"] : ((params["invoice_item_id_#{i}"]) || "").split(",").first product_id = product_id.present? ? product_id.to_i : nil unless params["item_id_#{i}"].blank? arrId.delete(params["item_id_#{i}"].to_i) @@ -427,13 +426,16 @@ def update end end end + + #Updating Status if the condition is met + update_status() + elsif !isEditable && !status_changed && params["invoice_id"].present? @invoice = WkInvoice.find(params["invoice_id"].to_i) @invoice.invoice_date = params[:inv_date] - unless params[:inv_number].blank? - @invoice.invoice_number = params[:inv_number] - end - @invoice.status = params[:field_status] unless params[:field_status].blank? + @invoice.status = params[:field_status] if params[:field_status].present? + @invoice.invoice_number = params[:inv_number] if params[:inv_number].present? + @invoice.confirm_num = params[:confirm_num] if params[:confirm_num].present? @invoice.save end @@ -706,7 +708,7 @@ def invoiceItemDetail(pdf, invoice, invoice_items, columnWidth) pdf.RDMCell(columnWidth, height, invoice_items.where(:project_id => lastProjectId, :item_type => 'i').sum(:original_amount).round(2).to_s, 1, 0, 'R') pdf.set_fill_color(255, 255, 255) end - + if !lastProjectId.blank? && lastProjectId != entry.project_id pdf.SetFontStyle('B',10) pdf.RDMMultiCell(80, height, '', 1, 'L', 0, 0) @@ -719,8 +721,7 @@ def invoiceItemDetail(pdf, invoice, invoice_items, columnWidth) pdf.set_fill_color(255, 255, 255) end - item_type = (entry.item_type == 'i' && invoice.invoice_type == 'I') && l(:field_hours) || entry.item_type == 'm' && l(:label_material) || - entry.item_type == 'a' && l(:label_rental) || entry.item_type == 'e' && l(:label_expenses) || "" + item_type = getInvoiceItemType(entry) rate = entry.rate.present? ? entry.rate.round(2).to_s + (entry.item_type == 'i' || entry.item_type == 'c' || entry.item_type == 'm' || entry.item_type == 'a' || entry.item_type == 'e' ? '' : ( addAdditionalTax ? '' : "%")) : '' pdf.SetFontStyle('',10) @@ -730,9 +731,9 @@ def invoiceItemDetail(pdf, invoice, invoice_items, columnWidth) pdf.RDMCell(columnWidth, height, rate.to_s, 1, 0, 'R') pdf.RDMCell(columnWidth, height, entry&.quantity.present? ? entry&.quantity.round(2).to_s : '', 1, 0, 'R') pdf.RDMCell(columnWidth, height, entry&.original_currency.to_s, 1, 0, 'R') - pdf.RDMCell(columnWidth, height, entry&.original_amount.present? ? entry&.original_amount.round(2).to_s : '', 1, 0, 'R') + pdf.RDMCell(columnWidth, height, entry&.original_amount.present? ? entry&.original_amount.round(2).to_s : '', 1, 0, 'R') end - + lastItemType = entry.item_type lastProjectId = entry.project_id end @@ -746,7 +747,7 @@ def invoiceItemDetail(pdf, invoice, invoice_items, columnWidth) pdf.RDMCell(columnWidth, 5, invoice_items.where(:project_id => lastProjectId).where.not(:item_type => 'r').sum(:quantity).round(2).to_s, 1, 0, 'R',1) pdf.RDMCell(columnWidth, 5, invoice_items[0].original_currency.to_s, 1, 0, 'R',1) pdf.RDMCell(columnWidth, 5, invoice_items.where(:project_id => lastProjectId).where.not(:item_type => 'r').sum(:original_amount).round(2).to_s, 1, 0, 'R',1) - pdf.set_fill_color(255, 255, 255) + pdf.set_fill_color(255, 255, 255) end def listItem(pdf, entry, columnWidth) @@ -754,7 +755,7 @@ def listItem(pdf, entry, columnWidth) pdf.SetFontStyle('',10) pdf.ln pdf.RDMMultiCell(80, height, entry.name, 1, 'L', 0, 0) - pdf.RDMCell(columnWidth, height, getInvoiceItemType(entry.item_type), 1, 0, 'L') + pdf.RDMCell(columnWidth, height, getInvoiceItemType(entry), 1, 0, 'L') pdf.RDMCell(columnWidth, height, entry.item_type == 't' ? entry.rate.to_s + "%" : entry.rate.to_s, 1, 0, 'R') pdf.RDMCell(columnWidth, height, entry.quantity.to_s, 1, 0, 'R') pdf.RDMCell(columnWidth, height, entry.original_currency.to_s, 1, 0, 'R') @@ -774,26 +775,6 @@ def listTotal(pdf, columnWidth, invoice, label) pdf.set_fill_color(255, 255, 255) end - def getInvoiceItemType(type) - itemtype = '' - case(type) - when 'i' - itemtype = l(:field_hours) - when 'c' - itemtype = l(:label_credit) - when 'm' - itemtype = l(:label_material) - when 't' - itemtype = l(:label_tax) - when 'a' - itemtype = l(:label_rental) - when 'e' - itemtype = l(:label_expenses) - else - itemtype = ''; - end - end - def setUnbilledParams accPjt = WkAccountProject.getAccProj(@invoice.parent_id, @invoice.parent_type) params[:new_invoice] = true @@ -855,7 +836,7 @@ def getInvoices(invoice) end def getInvoiceItems(item) - invoiceItems = [ item.name, getInvoiceItemType(item.item_type), item.item_type == 't' ? (item.rate.to_s + "%") : item.rate.to_s, item.quantity, item.original_currency.to_s + item.original_amount.round(2).to_s, item.currency.to_s + item.amount.round(2).to_s] + invoiceItems = [ item.name, getInvoiceItemType(item), item.item_type == 't' ? (item.rate.to_s + "%") : item.rate.to_s, item.quantity, item.original_currency.to_s + item.original_amount.round(2).to_s, item.currency.to_s + item.amount.round(2).to_s] invoiceItems end @@ -902,4 +883,7 @@ def get_project_tax def storeInvoiceItemTax(totals) end + + def update_status + end end diff --git a/app/controllers/wkshipment_controller.rb b/app/controllers/wkshipment_controller.rb index c179625d4..0b6ea9d45 100644 --- a/app/controllers/wkshipment_controller.rb +++ b/app/controllers/wkshipment_controller.rb @@ -128,6 +128,7 @@ def edit inventory.total_quantity = item.quantity inventory.status = 'o' inventory.supplier_invoice_id = item.invoice_id + inventory.product_item_id = item.invoice_item_id shipment_item << inventory end @shipmentItem = shipment_item diff --git a/app/controllers/wksupplierinvoice_controller.rb b/app/controllers/wksupplierinvoice_controller.rb index cf9b49c4d..7fe1bc86a 100644 --- a/app/controllers/wksupplierinvoice_controller.rb +++ b/app/controllers/wksupplierinvoice_controller.rb @@ -1,7 +1,6 @@ class WksupplierinvoiceController < WksupplierorderentityController unloadable menu_item :wkrfq - @@simutex = Mutex.new def newSupOrderEntity(parentId, parentType) @@ -49,12 +48,12 @@ def saveOrderRelations def getRfqPoIds quoteIds = "" rfqObj = "" - rfqObj = WkInvoice.where(:id => getInvoiceIds(params[:rfq_id].to_i, 'PO', false), :parent_id => params[:parent_id].to_i, :parent_type => params[:parent_type]).order(:id) + rfqObj = WkInvoice.where(id: getInvoiceIds(params[:rfq_id].to_i, 'PO', false), parent_id: params[:parent_id].to_i, parent_type: params[:parent_type], status: 'o').order(:id) if !Setting.plugin_redmine_wktime['label_create_supplier_invoice_without_purchase_order'].blank? && Setting.plugin_redmine_wktime['label_create_supplier_invoice_without_purchase_order'].to_i == 1 quoteIds << "," + "\n" end rfqObj.each do | entry| - quoteIds << entry.id.to_s() + ',' + entry.invoice_number.to_s() + "\n" + quoteIds << entry.id.to_s() + ',' + entry.invoice_number.to_s() + " - " + entry.confirm_num.to_s() + "\n" end respond_to do |format| format.text { render :plain => quoteIds } @@ -137,4 +136,40 @@ def addAdditionalTax def storeInvoiceItemTax(totals) saveInvoiceItemTax(totals) end + + # When Saving SI, update Purchase Order status + def update_status + invoices = @invoice&.sup_inv_po&.purchase_order&.supplier_invoices + po = @invoice&.sup_inv_po&.purchase_order + if po.present? + inv_quantity = {po.id => 0} + po_quantity = 0 + (invoices || {}).each do |invoice| + invoice.invoice_items.each do |inv_item| + if inv_item.invoice_item_id.blank? && ["i", "e"].include?(inv_item.item_type) + inv_quantity[po.id] += (inv_item.quantity || 0) + elsif ["i", "e"].include?(inv_item.item_type) + inv_quantity[inv_item.invoice_item_id] ||= 0 + inv_quantity[inv_item.invoice_item_id] += inv_item.quantity + end + end + end + status = po.status + (po.invoice_items || {}).each do |po_item| + if inv_quantity[po_item.invoice_item_id].present? && ["i", "e"].include?(po_item.item_type) + status = inv_quantity[po_item.invoice_item_id] == po_item.quantity ? "c" : "o" + break if status == "o" + elsif ["i", "e"].include?(po_item.item_type) + po_quantity += po_item.quantity + end + end + status = po_quantity == inv_quantity[po.id] ? "c" : "o" + po.status = status + po.save() + end + end + + def loadPurchaseDD + true + end end diff --git a/app/controllers/wktime_controller.rb b/app/controllers/wktime_controller.rb index e0b74c4ae..c6f39f3b4 100644 --- a/app/controllers/wktime_controller.rb +++ b/app/controllers/wktime_controller.rb @@ -2259,7 +2259,7 @@ def getEntityNames def getTEQuery(from, to, ids) spField = getSpecificField() entityNames = getEntityNames() - teSelectStr = "select v1.user_id, v1.startday as spent_on, v1." + spField + teSelectStr = "select v1.id, v1.user_id, v1.startday as spent_on, v1." + spField wkSelectStr = teSelectStr + ", case when w.status is null then 'n' else w.status end as status " sqlStr = " from " sDay = getDateSqlString('t.spent_on') @@ -2295,8 +2295,8 @@ def getQuery(teQuery, ids, from, to, status) dtRangeForUsrSqlStr = "(" + getAllWeekSql(from, to) + ") tmp1" teSqlStr = "(" + teQuery + ") tmp2" - selectStr = "select tmp3.user_id as user_id , tmp3.spent_on as spent_on, tmp3.#{spField} as #{spField}, tmp3.status as status, tmp3.status_updater as status_updater, tmp3.created_on as created_on" - query = " from (select tmp1.id as user_id, tmp1.created_on, tmp1.selected_date as spent_on, " + + selectStr = "select tmp3.id, tmp3.user_id as user_id , tmp3.spent_on as spent_on, tmp3.#{spField} as #{spField}, tmp3.status as status, tmp3.status_updater as status_updater, tmp3.created_on as created_on" + query = " from (select tmp2.id, tmp1.id as user_id, tmp1.created_on, tmp1.selected_date as spent_on, " + "case when tmp2.#{spField} is null then 0 else tmp2.#{spField} end as #{spField}, " + "case when tmp2.status is null then 'e' else tmp2.status end as status, tmp2.status_updater from " + dtRangeForUsrSqlStr + " left join " + teSqlStr diff --git a/app/helpers/wkorderentity_helper.rb b/app/helpers/wkorderentity_helper.rb index 54e914e3c..bfe786588 100644 --- a/app/helpers/wkorderentity_helper.rb +++ b/app/helpers/wkorderentity_helper.rb @@ -6,35 +6,37 @@ def getRfqArray(needBlank) rfqArr.unshift(["",'']) if needBlank rfqArr end - + def getRfqQuoteArray(needBlank, id) rfqQuoteObj = WkRfqQuote.includes(:quote).where(:rfq_id => id, :is_won => true).order(:id) #getInvoiceIds(id, 'Q', true) rfqQuoteArr = rfqQuoteObj.collect {|i| [i.quote.invoice_number, i.quote.id] } rfqQuoteArr.unshift(["",'']) if needBlank rfqQuoteArr end - - def getRfqPoArray(needBlank, id) + + def getRfqPoArray(needBlank, id, parent_type, parent_id) rfqPoArr = Array.new - rfqObj = WkInvoice.joins(:po_quote).where("wk_po_quotes.quote_id"=> id.blank? ? nil : id) - rfqPoArr = rfqObj.collect{|i|[i.invoice_number,i.id] } + rfqObj = WkInvoice.joins("LEFT JOIN wk_po_quotes ON wk_po_quotes.purchase_order_id = wk_invoices.id ") + .joins("LEFT JOIN wk_rfq_quotes ON wk_rfq_quotes.quote_id=wk_po_quotes.quote_id") + .where("parent_id" => parent_id, "parent_type" => parent_type, "invoice_type" => 'PO', "wk_rfq_quotes.rfq_id" => id.present? ? id : nil, "status" => 'o') + rfqPoArr = rfqObj.collect{|i| [i.invoice_number.to_s + " - " + i.confirm_num.to_s, i.id] } rfqPoArr.unshift(["",'']) if needBlank rfqPoArr end - + def options_for_rfq_select(selectedValue, needBlank) options_for_select(getRfqArray(needBlank), selectedValue.blank? ? '' : selectedValue) end - + def options_for_rfqQuote_select(needBlank, id) options_for_select(getRfqQuoteArray(needBlank, id)) end - - def options_for_rfqPO_select(needBlank, id) - options_for_select(getRfqPoArray(needBlank, id)) + + def options_for_rfqPO_select(needBlank, id, parent_type, parent_id) + options_for_select(getRfqPoArray(needBlank, id, parent_type, parent_id)) end - + def getInvoiceIds(rfqId, invoiceType, requireWonQuote) sqlStr = getRfqOrderSqlStr + " where rfq.id = #{rfqId}" if requireWonQuote @@ -50,14 +52,14 @@ def getInvoiceIds(rfqId, invoiceType, requireWonQuote) end invIdArr end - + def getRfqOrderSqlStr sqlStr = "select rfq.id as rfq_id, rq.quote_id, rp.purchase_order_id, rs.supplier_inv_id from wk_rfqs rfq" + " left join wk_rfq_quotes rq on (rfq.id = rq.rfq_id )" + " left join wk_po_quotes rp on (rp.quote_id = rq.quote_id)"+ " left join wk_po_supplier_invoices rs on (rs.purchase_order_id = rp.purchase_order_id)" end - + def saveRfqQuotes(id, rfqId, quoteId, isWon, winningNote) rfqQuote = nil if id.blank? @@ -68,13 +70,13 @@ def saveRfqQuotes(id, rfqId, quoteId, isWon, winningNote) rfqQuote.rfq_id = rfqId rfqQuote.quote_id = quoteId rfqQuote.is_won = isWon.blank? ? false : isWon - if rfqQuote.is_won.blank? || rfqQuote.is_won_changed? + if rfqQuote.is_won.blank? || rfqQuote.is_won_changed? rfqQuote.won_date = rfqQuote.is_won ? Date.today : nil end rfqQuote.winning_note = winningNote rfqQuote.save() end - + def savePurchaseOrderQuotes(id, poId, quoteId) poQuote = nil if id.blank? @@ -86,7 +88,7 @@ def savePurchaseOrderQuotes(id, poId, quoteId) poQuote.quote_id = quoteId poQuote.save() end - + def savePoSupInv(id, poId, supInvId) poSI = nil if id.blank? @@ -98,5 +100,33 @@ def savePoSupInv(id, poId, supInvId) poSI.supplier_inv_id = supInvId poSI.save() end - + + def getInvoiceItemType(invoice_item) + type = invoice_item.item_type + invoice = invoice_item.invoice + accProj = WkAccountProject.getTax(invoice_item.project_id, invoice.parent_type, invoice.parent_id).first + billing_type = accProj&.billing_type + itemtype = '' + case(type) + when 'i' + itemtype = invoice&.invoice_type == 'I' ? (billing_type == 'FC' ? l(:label_fixed_cost) : l(:field_hours)) : '' + when 'm' + itemtype = l(:label_material) + when 'a' + itemtype = l(:label_rental) + when 'e' + itemtype = l(:label_expenses) + else + itemtype = ''; + end + end + + def getSIStatus + { + l(:label_open) => 'o', + l(:label_closed_issues) => 'c', + l(:label_fullfilled) => 'f', + l(:label_delivered) => 'd' + } + end end diff --git a/app/models/wk_invoice_item.rb b/app/models/wk_invoice_item.rb index fee7a6b3a..a2a9d084b 100644 --- a/app/models/wk_invoice_item.rb +++ b/app/models/wk_invoice_item.rb @@ -48,6 +48,7 @@ def self.getGenerateEntries(toVal, fromVal, parent_id, parent_type, projectID, m entries = entries.where(wk_account_projects: { billing_type: 'TM'}) if table != "wk_expense_entries" entries = getNonZeroEntries(entries, table) entries = getFilteredEntries(entries, projectID, parent_type) + entries = entries.where("(wk_spent_fors.spent_for_id= #{parent_id} AND wk_spent_fors.spent_for_type = '#{parent_type}') OR wk_spent_fors.spent_for_id is NULL") if parent_id.present? entries.order("#{table}.spent_on desc") end diff --git a/app/models/wk_lead.rb b/app/models/wk_lead.rb index 894ec5f12..aabf852f3 100644 --- a/app/models/wk_lead.rb +++ b/app/models/wk_lead.rb @@ -48,7 +48,9 @@ class WkLead < ActiveRecord::Base } scope :hiring_employees, ->{ - joins(:contact).where("wk_crm_contacts.contact_type" => "IC", status: "C") + joins(:contact) + .joins("LEFT JOIN wk_users ON wk_users.source_id = wk_leads.contact_id") + .where("wk_crm_contacts.contact_type" => "IC", "wk_leads.status" => "C", "wk_users.source_id" => nil) } def self.referrals(privilege, id=nil) diff --git a/app/views/wkattendance/_render_hr_tabs.html.erb b/app/views/wkattendance/_render_hr_tabs.html.erb index 5bd16a472..a13d17045 100644 --- a/app/views/wkattendance/_render_hr_tabs.html.erb +++ b/app/views/wkattendance/_render_hr_tabs.html.erb @@ -1,16 +1,18 @@ -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> +<%= javascript_include_tag 'index', plugin:"redmine_wktime" %> +<%= stylesheet_link_tag 'wk-time', plugin:"redmine_wktime" %> -<%= render_tabs time_expense_tabs %> \ No newline at end of file +<%= render_tabs time_expense_tabs %> +<%= hidden_field_tag 'back_url', url_for(controller: params[:controller], action: params[:action]) %> \ No newline at end of file diff --git a/app/views/wkattendance/_sidebar.html.erb b/app/views/wkattendance/_sidebar.html.erb index fea16d803..797a41769 100644 --- a/app/views/wkattendance/_sidebar.html.erb +++ b/app/views/wkattendance/_sidebar.html.erb @@ -1,5 +1,5 @@ <%= actions_dropdown do %> - <%= link_to l(:label_wk_leave), url_for(:controller => "wkattendance", :action => "index")%> - <%= link_to l(:label_leave_setting), url_for(:controller => "wkattendance", :action => "leavesettings")%> - <%= link_to l(:label_public_holiday), url_for(:controller => "wkpublicholiday", :action => "index")%> + <%= link_to l(:label_wk_leave), url_for(controller: "wkattendance", action: "index", tab: "leave")%> + <%= link_to l(:label_leave_setting), url_for(controller: "wkattendance", action: "leavesettings", tab: "leave")%> + <%= link_to l(:label_public_holiday), url_for(controller: "wkpublicholiday", action: "index", tab: "leave")%> <% end %> \ No newline at end of file diff --git a/app/views/wkattendance/clockindex.api.rsb b/app/views/wkattendance/clockindex.api.rsb index 3eee85e65..ddf56b88e 100644 --- a/app/views/wkattendance/clockindex.api.rsb +++ b/app/views/wkattendance/clockindex.api.rsb @@ -1,10 +1,11 @@ api.array :wk_clkinout, api_meta(:total_count => @entry_count, :offset => @offset, :limit => @limit, unseen_count: @unseen_count) do @clk_entries.each do |clk_entry| api.clk_entry do - api.id clk_entry.user.id unless clk_entry.user.nil? - api.name clk_entry.user.name unless clk_entry.user.nil? - api.clock_in clk_entry.start_time.localtime.strftime('%R') unless clk_entry.start_time.nil? - api.clock_out clk_entry.end_time.localtime.strftime('%R') unless clk_entry.end_time.nil? + api.id clk_entry.id + api.user_id clk_entry.user.id if clk_entry.user.present? + api.name clk_entry.user.name if clk_entry.user.present? + api.clock_in clk_entry.start_time.localtime.strftime('%R') if clk_entry.start_time.present? + api.clock_out clk_entry.end_time.localtime.strftime('%R') if clk_entry.end_time.present? api.hours clk_entry.hours api.startdate clk_entry.entry_date.to_date api.s_longitude clk_entry.s_longitude diff --git a/app/views/wkattendance/index.html.erb b/app/views/wkattendance/index.html.erb index 1f41e8f82..016ff18ce 100644 --- a/app/views/wkattendance/index.html.erb +++ b/app/views/wkattendance/index.html.erb @@ -1,3 +1,3 @@ -<%= title l(:report_attendance) %> +<%= title l(:label_wk_leave) %> <%= render partial: "wkattendance/render_hr_tabs" %> <%= render :partial => 'attn_index' %> \ No newline at end of file diff --git a/app/views/wkattendance/leavesettings.html.erb b/app/views/wkattendance/leavesettings.html.erb index ace6ee443..e38fb9b3e 100644 --- a/app/views/wkattendance/leavesettings.html.erb +++ b/app/views/wkattendance/leavesettings.html.erb @@ -1,51 +1,53 @@ <%= javascript_include_tag 'settings', :plugin => "redmine_wktime" %> <%= javascript_include_tag 'payrollsettings', :plugin => "redmine_wktime" %> - + +<%= title l(:label_leave_setting) %>
<%= render :partial => 'sidebar' %>
-<%= title l(:label_leave_setting) %> - <% - leave = [] - issue_list = Issue.order('subject') - unless issue_list.blank? - issueslist = issue_list.collect {|issue| [issue.subject, issue.id] } - issuehash = Hash[issue_list.map { |u| [u.id, u.subject] }] - else - issueslist = Array.new - issueslist << [ "", 0] - end - projects = Project.where("#{Project.table_name}.status not in(#{Project::STATUS_CLOSED},#{Project::STATUS_ARCHIVED})").order('name') - wktime_helper = Object.new.extend(WktimeHelper) - projArr = wktime_helper.options_for_wktime_project(projects,false) +<%= render partial: "wkattendance/render_hr_tabs" %> + +<% + leave = [] + issue_list = Issue.order('subject') + unless issue_list.blank? + issueslist = issue_list.collect {|issue| [issue.subject, issue.id] } + issuehash = Hash[issue_list.map { |u| [u.id, u.subject] }] + else + issueslist = Array.new + issueslist << [ "", 0] + end + projects = Project.where("#{Project.table_name}.status not in(#{Project::STATUS_CLOSED},#{Project::STATUS_ARCHIVED})").order('name') + wktime_helper = Object.new.extend(WktimeHelper) + projArr = wktime_helper.options_for_wktime_project(projects,false) - if @leaveSettings.blank? - leave = '' - else - @leaveSettings.each do |element| - listboxArr = element.split('|') - issueId = listboxArr[0] - issueName = issuehash[issueId.to_i].blank? ? issueId : issuehash[issueId.to_i] - leaveAccrual = listboxArr[1].blank? ? "" : listboxArr[1] - accrualAfter = listboxArr[2].blank? ? "" : listboxArr[2] - optionText = leaveAccrual.blank? ? issueName : issueName + " : " + leaveAccrual + " " + l(:label_hours_per_month) + " " + l(:label_wk_leave_accrual_after) + " " + accrualAfter + " " + l(:label_year) - leave << [optionText,element] - end + if @leaveSettings.blank? + leave = '' + else + @leaveSettings.each do |element| + listboxArr = element.split('|') + issueId = listboxArr[0] + issueName = issuehash[issueId.to_i].blank? ? issueId : issuehash[issueId.to_i] + leaveAccrual = listboxArr[1].blank? ? "" : listboxArr[1] + accrualAfter = listboxArr[2].blank? ? "" : listboxArr[2] + optionText = leaveAccrual.blank? ? issueName : issueName + " : " + leaveAccrual + " " + l(:label_hours_per_month) + " " + l(:label_wk_leave_accrual_after) + " " + accrualAfter + " " + l(:label_year) + leave << [optionText,element] end - %> + end +%> <%= form_tag({:controller => controller_name, :action => 'leavesettings'}, :method => :post) do %>

diff --git a/app/views/wkattributegroup/index.html.erb b/app/views/wkattributegroup/index.html.erb index c3e9cd820..447e8535d 100644 --- a/app/views/wkattributegroup/index.html.erb +++ b/app/views/wkattributegroup/index.html.erb @@ -2,6 +2,7 @@ <%= stylesheet_link_tag 'wk-time', plugin: "redmine_wktime" %>

<%= l(:label_attribute_group) %>

+<%= render partial: "wkproduct/render_inventory_tabs" %> <% name =session[controller_name].try(:[], :name) %> <%= form_tag({:controller => 'wkattributegroup', :action => 'index'}, :method => :post, :id => 'query_form') do %> <%= hidden_field_tag "searchlist", controller_name %> diff --git a/app/views/wkbilling/_index_filters.html.erb b/app/views/wkbilling/_index_filters.html.erb index 5f5c99f1b..ab188b874 100644 --- a/app/views/wkbilling/_index_filters.html.erb +++ b/app/views/wkbilling/_index_filters.html.erb @@ -1,16 +1,16 @@ -<% +<% polymorphic_filter = filter_session - + allSelection = false contactSelection = false accountSelection = false if polymorphic_filter == '1' || polymorphic_filter.blank? - allSelection = true + allSelection = true end %> <% parent_id = 0 %> <% parent_type = 'WkAccount' %> - <% contactArr = relatedValues('WkCrmContact', nil, controller.getOrderContactType, true, controller.additionalContactType, controller.additionalAccountType) %> <% accountArr = options_for_wktime_account(blankForActDD, controller.getOrderAccountType, controller.additionalAccountType) %> -<% projects = Project.where("#{Project.table_name}.status not in(#{Project::STATUS_CLOSED},#{Project::STATUS_ARCHIVED})").order('name') %> +<% projects = Project.where("#{Project.table_name}.status not in(#{Project::STATUS_CLOSED},#{Project::STATUS_ARCHIVED})").order('name') %> <% projArr = options_for_wktime_project(projects,true) isPjtBlank = true - if pjtChanged - accountProjects = getProjArrays(parent_id, parent_type) + if pjtChanged + accountProjects = getProjArrays(parent_id, parent_type) projArr = accountProjects.collect{|m| [ m.project_name, m.project_id ] } if !accountProjects.blank? if !project_id.blank? && polymorphic_filter != '1' projArr.unshift(["", '0']) @@ -50,7 +50,7 @@ $(document).ready(function() projArr[0] = [l(:label_all_projects),'AP'] projArr.unshift(["",'']) end -%> +%> <% if isAll %> @@ -59,31 +59,29 @@ $(document).ready(function() - + + :onchange => " if(#{pjtChanged}) { accProjChanged('', this.id, false, #{blankOptionForPjt}); } if(#{loadSIDD}) { getSupplierInvoice(#{User.current.id}, 'si_id'); } if(#{controller.loadPurchaseDD}) { rfqTOQuoteChanged(#{User.current.id}, 'po_id');} ") %> <% if isproject %> <% end %> - + <% unless controller.getAdditionalDD.blank? %> <%= render partial: controller.getAdditionalDD, locals: { rfq_id: rfq_id, reqQuotePoDD: needQuotePoDD, onchngeMethodName: "", needRfqBlank: isFilter }%> <% end %> - - + + <% if isapply %> - - <% end %> diff --git a/app/views/wkbilling/_render_billing_tabs.html.erb b/app/views/wkbilling/_render_billing_tabs.html.erb new file mode 100644 index 000000000..b65aeaa98 --- /dev/null +++ b/app/views/wkbilling/_render_billing_tabs.html.erb @@ -0,0 +1,12 @@ +<%= javascript_include_tag 'index', plugin: "redmine_wktime" %> +<%= stylesheet_link_tag 'wk-time', plugin: "redmine_wktime" %> + + + +<%= render_tabs time_expense_tabs %> +<%= hidden_field_tag 'back_url', url_for(controller: params[:controller], action: params[:action]) %> diff --git a/app/views/wkbrand/index.html.erb b/app/views/wkbrand/index.html.erb index b2db108b5..fd5be26d2 100644 --- a/app/views/wkbrand/index.html.erb +++ b/app/views/wkbrand/index.html.erb @@ -1,7 +1,6 @@ -<%= javascript_include_tag 'index', plugin: "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', plugin: "redmine_wktime" %> +<%= title l(:label_brand) %> +<%= render partial: "wkproduct/render_inventory_tabs" %> - <%= title l(:label_brand) %> <% name =session[controller_name].try(:[], :name) %> <%= form_tag({:controller => 'wkbrand', :action => 'index'}, :method => :post, :id => 'query_form') do %> <%= hidden_field_tag "searchlist", controller_name %> diff --git a/app/views/wkcontract/index.html.erb b/app/views/wkcontract/index.html.erb index b7ecc0fcd..19f4f9534 100644 --- a/app/views/wkcontract/index.html.erb +++ b/app/views/wkcontract/index.html.erb @@ -1,18 +1,4 @@ <%= title l(:label_contracts) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> - -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkbilling/render_billing_tabs" %> <%= render :partial => 'wkcontract/contract_index'%> \ No newline at end of file diff --git a/app/views/wkcrm/_render_crm_tabs.html.erb b/app/views/wkcrm/_render_crm_tabs.html.erb new file mode 100644 index 000000000..e5a44b011 --- /dev/null +++ b/app/views/wkcrm/_render_crm_tabs.html.erb @@ -0,0 +1,14 @@ +<%= javascript_include_tag 'index', plugin: "redmine_wktime" %> +<%= stylesheet_link_tag 'wk-time', plugin: "redmine_wktime" %> + + + +<%= render_tabs time_expense_tabs %> +<%= hidden_field_tag 'back_url', url_for(controller: params[:controller], action: params[:action]) %> diff --git a/app/views/wkcrmaccount/index.html.erb b/app/views/wkcrmaccount/index.html.erb index 68a1793ba..213e9beef 100644 --- a/app/views/wkcrmaccount/index.html.erb +++ b/app/views/wkcrmaccount/index.html.erb @@ -1,21 +1,4 @@ <%= title l(:label_accounts) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> - -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkcrm/render_crm_tabs" %> <%= render :partial => 'wkaccount/account_index'%> - diff --git a/app/views/wkcrmactivity/index.html.erb b/app/views/wkcrmactivity/index.html.erb index 39259d2fe..2e959f7a1 100644 --- a/app/views/wkcrmactivity/index.html.erb +++ b/app/views/wkcrmactivity/index.html.erb @@ -1,17 +1,5 @@ <%= title l(:label_activity_plural) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> - -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkcrm/render_crm_tabs" %> <% actType = ["", ""] %> <% actType << acttypeHash.to_a %> diff --git a/app/views/wkcrmcontact/index.html.erb b/app/views/wkcrmcontact/index.html.erb index d18c95381..4c97a15d7 100644 --- a/app/views/wkcrmcontact/index.html.erb +++ b/app/views/wkcrmcontact/index.html.erb @@ -1,14 +1,4 @@ <%= title l(:label_contact_plural) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkcrm/render_crm_tabs" %> + <%= render :partial => 'wkcrmcontact/contact_index' %> \ No newline at end of file diff --git a/app/views/wkcrmenumeration/_render_settings_tabs.html.erb b/app/views/wkcrmenumeration/_render_settings_tabs.html.erb new file mode 100644 index 000000000..54fdee781 --- /dev/null +++ b/app/views/wkcrmenumeration/_render_settings_tabs.html.erb @@ -0,0 +1,15 @@ +<%= javascript_include_tag 'index', plugin: "redmine_wktime" %> +<%= stylesheet_link_tag 'wk-time', plugin: "redmine_wktime" %> + + + +<%= render_tabs time_expense_tabs %> +<%= hidden_field_tag 'back_url', url_for(controller: params[:controller], action: params[:action]) %> diff --git a/app/views/wkcrmenumeration/index.html.erb b/app/views/wkcrmenumeration/index.html.erb index 660fb33b8..6c960ec44 100644 --- a/app/views/wkcrmenumeration/index.html.erb +++ b/app/views/wkcrmenumeration/index.html.erb @@ -1,17 +1,5 @@ <%= title l(:label_enumerations) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkcrmenumeration/render_settings_tabs" %> <%= form_tag({:controller => "wkcrmenumeration", :action => 'index'}, :method => :get, :id => 'query_form') do %> <%= hidden_field_tag "searchlist", controller_name %> diff --git a/app/views/wkdelivery/_edit_delivery_row.html.erb b/app/views/wkdelivery/_edit_delivery_row.html.erb index c650fb5fc..445cb4f63 100644 --- a/app/views/wkdelivery/_edit_delivery_row.html.erb +++ b/app/views/wkdelivery/_edit_delivery_row.html.erb @@ -1,5 +1,5 @@ - <% + <% inventoryTtem = entry.inventory_item productItem = inventoryTtem&.product_item || '' isDisable = entry.id.present? || @materialID.present? @@ -32,17 +32,17 @@
<% end %> - <%= radio_button_tag 'polymorphic_filter', '2', contactSelection, :onclick => " $('#account_id').attr('disabled', true);$('#contact_id').removeAttr('disabled');", :onchange => " getprojects(this, #{pjtChanged}, #{loadSIDD})" %> + <%= radio_button_tag 'polymorphic_filter', '2', contactSelection, :onclick => " $('#account_id').attr('disabled', true);$('#contact_id').removeAttr('disabled');if(#{controller.loadPurchaseDD}) { rfqTOQuoteChanged(#{User.current.id}, 'po_id');}", :onchange => " getprojects(this, #{pjtChanged}, #{loadSIDD})" %> <%= l(:label_contact) %> <%=h select_tag('contact_id', options_for_select(contactArr, :selected => contact_id.blank? ? contactArr : contact_id ), - :onchange => " if(#{pjtChanged}) { accProjChanged('', this.id, false, #{blankOptionForPjt}); } if(#{loadSIDD}) { getSupplierInvoice(#{User.current.id}, 'si_id'); } ") %> + :onchange => " if(#{pjtChanged}) { accProjChanged('', this.id, false, #{blankOptionForPjt}); } if(#{loadSIDD}) { getSupplierInvoice(#{User.current.id}, 'si_id'); } if(#{controller.loadPurchaseDD}) { rfqTOQuoteChanged(#{User.current.id}, 'po_id');} ") %> <%= radio_button_tag 'polymorphic_filter', '3', accountSelection, :onclick => " $('#account_id').removeAttr('disabled');$('#contact_id').attr('disabled', true);", :onchange => " getprojects(this, #{pjtChanged}, #{loadSIDD})" %><%= controller.getAccountDDLbl %><%= radio_button_tag 'polymorphic_filter', '3', accountSelection, :onclick => " $('#account_id').removeAttr('disabled');$('#contact_id').attr('disabled', true);if(#{controller.loadPurchaseDD}) { rfqTOQuoteChanged(#{User.current.id}, 'po_id');}", :onchange => " getprojects(this, #{pjtChanged}, #{loadSIDD})" %><%= controller.getAccountDDLbl %> <%=h select_tag('account_id', options_for_select(accountArr, :selected => account_id.blank? ? accountArr : account_id ), - :onchange => " if(#{pjtChanged}) { accProjChanged('', this.id, false, #{blankOptionForPjt}); } if(#{loadSIDD}) { getSupplierInvoice(#{User.current.id}, 'si_id'); } ") %> <%=h select_tag('project_id', options_for_select(projArr, :selected => project_id.nil? ? projArr : project_id)) %><%= submit_tag l(:button_apply), :class => "small", :name => nil %> <%= link_to l(:button_clear), {:tab => controller_name, clear: true}, :class => 'icon icon-reload' %>
<%= hidden_field_tag("location_id_#{row_index}", entry.location_id, id: "hidden" ) %> - <%= select_tag("location_id_#{row_index.to_s}", options_for_select(locationArr, selected: (entry.blank? ? locationArr : entry.location_id) ), disabled: isDisable, style: "width: 80px;", required: true) %> + <%= select_tag("location_id_#{row_index.to_s}", options_for_select(locationArr, selected: (entry.blank? ? locationArr : entry.location_id) ), onchange: "locationChanged(this.id, #{User.current.id}); ", disabled: isDisable, style: "width: 80px;", required: true) %> <%= hidden_field_tag("product_id_#{row_index}", productId, id: "hidden" ) %> - <%= select_tag("product_id_#{row_index.to_s}", options_for_select(productArr, selected: productId), disabled: isDisable, style: "width: 80px;") %> + <%= select_tag("product_id_#{row_index.to_s}", options_for_select(productArr, selected: productId), onchange: "productChanged(this.id, 'product_item_id_#{row_index.to_s}', #{User.current.id}, true, false, null, 'location_id_#{row_index.to_s}');setUOMValue(this.id)", disabled: isDisable, style: "width: 80px;") %> <%= hidden_field_tag("product_item_id_#{row_index}", entry.inventory_item_id, id: "hidden" ) %> - <%= select_tag("product_item_id_#{row_index.to_s}", options_for_select(productItemArr, selected: entry.blank? ? productItemArr : entry.inventory_item_id), disabled: isDisable, required: true, style: "width: 300px;", required: true) %> + <%= select_tag("product_item_id_#{row_index.to_s}", options_for_select(productItemArr, selected: entry.blank? ? productItemArr : entry.inventory_item_id), onchange: "deliveryitemChanged(this.id);", disabled: isDisable, required: true, style: "width: 300px;", required: true) %> diff --git a/app/views/wkexchangerate/index.html.erb b/app/views/wkexchangerate/index.html.erb index 1db0374fc..eabfb4416 100644 --- a/app/views/wkexchangerate/index.html.erb +++ b/app/views/wkexchangerate/index.html.erb @@ -1,16 +1,4 @@ <%= title l(:label_exchange_rate) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> +<%= render partial: "wkcrmenumeration/render_settings_tabs" %> <%= render :partial => 'wkexchangerate/exc_rate_index'%> \ No newline at end of file diff --git a/app/views/wkexpense/index.api.rsb b/app/views/wkexpense/index.api.rsb index ce8ceadcb..e0970b0d0 100644 --- a/app/views/wkexpense/index.api.rsb +++ b/app/views/wkexpense/index.api.rsb @@ -1,11 +1,16 @@ api.array :wk_expenses, api_meta(:total_count => @entry_count, :offset => @offset, :limit => @limit, unseen_count: @unseen_count) do @entries.each do |wk_expense| api.wk_expense do - api.id wk_expense.user_id unless wk_expense.user.nil? - api.name wk_expense.user.name unless wk_expense.user.nil? + api.id wk_expense.id + api.user_id wk_expense.user.id if wk_expense.user.present? + api.name wk_expense.user.name if wk_expense.user.present? api.amount wk_expense.amount api.startdate wk_expense.spent_on - api.status statusString(wk_expense.status) unless wk_expense.nil? + api.status statusString(wk_expense.status) if wk_expense.present? end end end + +api.headers do + api.start_of_week getStartOfWeek +end \ No newline at end of file diff --git a/app/views/wkgltransaction/_render_accounting_tabs.html.erb b/app/views/wkgltransaction/_render_accounting_tabs.html.erb new file mode 100644 index 000000000..9254fc92a --- /dev/null +++ b/app/views/wkgltransaction/_render_accounting_tabs.html.erb @@ -0,0 +1,11 @@ +<%= javascript_include_tag 'index', plugin: "redmine_wktime" %> +<%= stylesheet_link_tag 'wk-time', plugin: "redmine_wktime" %> + + + +<%= render_tabs time_expense_tabs %> +<%= hidden_field_tag 'back_url', url_for(controller: params[:controller], action: params[:action]) %> diff --git a/app/views/wkgltransaction/index.html.erb b/app/views/wkgltransaction/index.html.erb index 050c035eb..19e844c30 100644 --- a/app/views/wkgltransaction/index.html.erb +++ b/app/views/wkgltransaction/index.html.erb @@ -1,18 +1,10 @@ <%= title l(:label_transaction) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> - -<% transactionType = transTypeHash %> -<%= render_tabs time_expense_tabs %> - -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkgltransaction/render_accounting_tabs" %> <% ledgerid =session[controller_name].try(:[], :txn_ledger) showChart =session[controller_name].try(:[], :show_chart) width = "35%" if showChart && ledgerid && @from && @to + transactionType = transTypeHash %> <%= form_tag({:controller => controller_name, :action => 'index'}, :method => :get, :id => 'query_form') do %> <%= hidden_field_tag "searchlist", "#{controller_name}" %> diff --git a/app/views/wkgrouppermission/index.html.erb b/app/views/wkgrouppermission/index.html.erb index 7d302b2b5..aa5d3a387 100644 --- a/app/views/wkgrouppermission/index.html.erb +++ b/app/views/wkgrouppermission/index.html.erb @@ -1,29 +1,4 @@ <%= title l(:label_group) + " " + l(:label_permissions) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> +<%= render partial: "wkcrmenumeration/render_settings_tabs" %> - <%= render :partial => 'wkgrouppermission/group_edit'%> \ No newline at end of file diff --git a/app/views/wkinvoice/index.html.erb b/app/views/wkinvoice/index.html.erb index 3e8358a9f..b7b32dc0f 100644 --- a/app/views/wkinvoice/index.html.erb +++ b/app/views/wkinvoice/index.html.erb @@ -1,17 +1,4 @@ <%= title l(:label_invoice) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> -<%= javascript_include_tag 'invoice', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> +<%= render partial: "wkbilling/render_billing_tabs" %> -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> <%= render :partial => 'wkorderentity/order_index'%> \ No newline at end of file diff --git a/app/views/wklead/edit.api.rsb b/app/views/wklead/edit.api.rsb index 3c2362c84..2344debf0 100644 --- a/app/views/wklead/edit.api.rsb +++ b/app/views/wklead/edit.api.rsb @@ -15,6 +15,7 @@ api.lead do api.description @lead.contact.description api.assigned_user_id @lead.contact.assigned_user_id api.account_name @lead.account.name if @lead.account.present? + api.account_number @lead.account.account_number if @lead.account.present? api.address( address_id: @lead.contact.address.id, address1: @lead.contact.address.address1, diff --git a/app/views/wklead/index.html.erb b/app/views/wklead/index.html.erb index 9cd9f2515..ecdd4e1f7 100644 --- a/app/views/wklead/index.html.erb +++ b/app/views/wklead/index.html.erb @@ -1,15 +1,4 @@ <%= title l(:label_lead_plural) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkcrm/render_crm_tabs" %> <%= render :partial => 'lead_index'%> \ No newline at end of file diff --git a/app/views/wkledger/index.html.erb b/app/views/wkledger/index.html.erb index 4a16e4518..9a5dd526d 100644 --- a/app/views/wkledger/index.html.erb +++ b/app/views/wkledger/index.html.erb @@ -1,14 +1,5 @@ <%= title l(:label_ledger) %> -<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> - -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkgltransaction/render_accounting_tabs" %> <% wkaccounting_helper = Object.new.extend(WkaccountingHelper) %> <% ledgerType = wkaccounting_helper.getLedgerTypeHash diff --git a/app/views/wklocation/index.html.erb b/app/views/wklocation/index.html.erb index ea001d1e5..8ccecbb5f 100644 --- a/app/views/wklocation/index.html.erb +++ b/app/views/wklocation/index.html.erb @@ -1,19 +1,5 @@ <%= title l(:label_location) %> -<%= javascript_include_tag 'index', plugin: "redmine_wktime" %> -<%= stylesheet_link_tag 'wk-time', plugin: "redmine_wktime" %> - -<%= render_tabs time_expense_tabs %> -<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %> +<%= render partial: "wkcrmenumeration/render_settings_tabs" %> <%= form_tag({:controller => "wklocation", :action => 'index'}, :method => :get, :id => 'query_form') do %> <%= hidden_field_tag "searchlist", controller_name %> diff --git a/app/views/wknotification/index.html.erb b/app/views/wknotification/index.html.erb index 0194678a9..27ef94b67 100644 --- a/app/views/wknotification/index.html.erb +++ b/app/views/wknotification/index.html.erb @@ -1,15 +1,6 @@ -<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %> -<%= javascript_include_tag 'index', plugin: "redmine_wktime" %> - <%= title l(:label_notification_plural) %> -<%= render_tabs time_expense_tabs %> +<%= render partial: "wkcrmenumeration/render_settings_tabs" %> +