Skip to content

Instantly share code, notes, and snippets.

View guipdutra's full-sized avatar

Guilherme Dutra guipdutra

View GitHub Profile
class AccountingAccount < Accounting::Model
attr_accessible :account_plan_configuration_id, :function,
:title, :nature_balance, :nature_information, :contract_id,
:nature_balance_variation, :bookkeeping, :surplus_indicator,
:movimentation_kind, :debt_type, :detailing_required_thirteenth,
:bank_account_id, :retention_kind, :retention_subtype,
:regulatory_act_id, :parent_id, :child_code
attr_accessor :child_code
<%= f.input :code %>
<%= f.input :title %>
<%= label_tag "Conta Bancária?" %>
<%= select_tag "conta_bancaria", options_for_select([["Sim", true], ["Não", false]]), :include_blank => true %>
alias srspec="SCREENSHOT=true spring rspec"
alias test="bundle exec rspec spec/business &&
bundle exec rspec spec/controllers &&
bundle exec rspec spec/decorators &&
bundle exec rspec spec/enumerations &&
bundle exec rspec spec/helpers &&
bundle exec rspec spec/importers &&
bundle exec rspec spec/integrations &&
bundle exec rspec spec/lib &&
bundle exec rspec spec/models &&
<%= f.input :code %>
<%= f.input :title %>
<%= f.input :with_bank_account, :as => :select %>
class AccountingAccount < Accounting::Model
attr_accessible :account_plan_configuration_id, :function,
:title, :nature_balance, :nature_information, :contract_id,
:nature_balance_variation, :bookkeeping, :surplus_indicator,
:movimentation_kind, :debt_type, :detailing_required_thirteenth,
:bank_account_id, :retention_kind, :retention_subtype,
:regulatory_act_id, :parent_id, :child_code
attr_accessor :child_code, :with_bank_account
<%= f.input :code %>
<%= f.input :title %>
<%= f.input :with_bank_account, :selected => f.object.with_bank_account, :as => :select %>
<%= f.input :code %>
<%= f.input :title %>
<% locked_field = params[:locked_fields].try(:include?, "with_bank_account") %>
<%= f.input :with_bank_account, :as => :select, :required => false, :hint => false, :disabled => locked_field %>
<% if locked_field %>
<%= f.input :with_bank_account, :as => :hidden %>
<% end %>
function changeBudgetChangeDecreeTypeVisibility(event) {
var $BudgetChangeDecreeTypeWrapper = $budgetChangeDecreeTypeInput.closest('div');
if ($regulatoryActTypeInput.val() == '<%= RegulatoryActType::BUDGET_CHANGE %>' &&
$classificationInput.val() == '<%= RegulatoryActClassification::DECREE %>') {
$BudgetChangeDecreeTypeWrapper.show();
} else {
$BudgetChangeDecreeTypeWrapper.hide();
}
require 'controller_helper'
describe BudgetRevenueDeductionsController do
let(:detran_2012) { Descriptor.make!(:detran_2012) }
let(:secretaria_educacao_2012) { Descriptor.make!(:secretaria_de_educacao_2012) }
let(:bank_account) { BankAccount.make!(:itau_tributos) }
let(:main_nature) { RevenueNature.make!(:receitas_correntes) }
let(:revenue_nature) { RevenueNature.make!(:receitas_correntes, :main_nature => main_nature, :prefix => "93", :kind => RevenueNatureKind::ANALYTICAL) }
let(:budget_revenue) { BudgetRevenue.make!(:reforma, :code => 2, :revenue_nature => revenue_nature) }
class BudgetRevenueDeductionsController < CrudController
protected
def create_resource(object)
object.descriptor = current_descriptor
object.transaction do
if super
MovementsGenerator.new(object).generate!
Withdraw.new.withdraw_funds!(object.bank_account,