Skip to content

Commit

Permalink
Merge pull request #262 from dhanasingh/dev
Browse files Browse the repository at this point in the history
v4.5.1
  • Loading branch information
Arun-TAK authored Apr 4, 2022
2 parents 8254e4d + 53e7069 commit ff7a1cb
Show file tree
Hide file tree
Showing 90 changed files with 618 additions and 743 deletions.
23 changes: 9 additions & 14 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/wkaccountproject_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion app/controllers/wkbase_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -370,4 +370,8 @@ def updateWkuserVal
data = WkUser.showEncryptdData(params[:userID], params[:columnName])
render json: {data: data}
end

def loadPurchaseDD
false
end
end
44 changes: 22 additions & 22 deletions app/controllers/wkbilling_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/wkexpense_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions app/controllers/wkinventory_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -27,10 +27,8 @@ def check_admin_redirect
return false
end
end

def hasDeletePermission
validateERPPermission("D_INV")
end


end
62 changes: 23 additions & 39 deletions app/controllers/wkorderentity_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -746,15 +747,15 @@ 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)
height = pdf.get_string_height(80, entry.name)
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')
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -902,4 +883,7 @@ def get_project_tax

def storeInvoiceItemTax(totals)
end

def update_status
end
end
1 change: 1 addition & 0 deletions app/controllers/wkshipment_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit ff7a1cb

Please sign in to comment.