This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= f.text_field :company_code %> | |
| it will create this: | |
| "customer"=>{"company_code"=>"aaa"} | |
| <%= text_field_tag("customer_code", @customer_code") %> | |
| it will create this: | |
| "customer_code"=>"aaa" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| code: | |
| logger.info "XXX:#{@account_category_maincat}:#{@account_category_subcat}" | |
| logger.info "XXX:#{@account_category.data[@account_category_maincat]}" | |
| logger.info "XXX:#{@account_category.data[@account_category_maincat][@account_category_subcat]}" | |
| maincatdata = @account_category.data[@account_category_maincat] | |
| if maincatdata.has_key?(@account_category_subcat) | |
| logger.info "XXX:haskey" | |
| else | |
| logger.info "XXX:hasnokey" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.ajax({ | |
| url : "<%= updatepayment_invoice_path(@invoice) %>", | |
| type: "PATCH", | |
| dataType: 'json', | |
| data : {"utf8":"✓", "authenticity_token":"DdPKAgDvH/x2HaT6JSxZTXrBuumV+glDWR7AT+zwFaU=", | |
| "id":"1", | |
| "company_id":"1", | |
| "payment_invoice":{"code":"test", | |
| "date":"test", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form accept-charset="UTF-8" action="/invoices/1" class="edit_invoice" id="edit_invoice_1" method="post"><div style="display:none"><input name="utf8" type="hidden" value="✓" /><input name="_method" type="hidden" value="patch" /><input name="authenticity_token" type="hidden" value="TpR56rhvriaX4eIucvybH6moEdLvtm290RQ4mRQuRZo=" /></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this doesnt work: (only takes in payment_total but not the rest) | |
| retval = @invoice.update(:payment_total => 20, :due_amount => 10, :data => clonedata) | |
| this works: | |
| retval = Invoice.where(:id => @invoice.id).update_all(:payment_total => 20, | |
| :due_amount => 10, | |
| :data => clonedata.to_json) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| issue this: | |
| retval = @invoice.update(:payment_total => clonedata["payment_total"], | |
| :due_amount => clonedata["due_amount"] , | |
| :data => clonedata.to_json) | |
| will output nothing. not UPDATE sql issued. i wonder why | |
| issue this: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [["Code", "Name", "Description", "Quantity", "Price", "Discount", "["ABD", "XYZ"]", "Amount"]] | |
| @invoice["data"]["items"].map do |key, value| | |
| [value["product_code"], | |
| value["product_name"], | |
| value["product_description"], | |
| value["product_quantity"], | |
| value["product_price"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jsondata ='{"1": | |
| {"name": "Tax Exempt", "abbreviation": "Tax Exempt", "description": "", | |
| "tax_percentage": "0.0", "tax_num": "", "recoverable": false, "compound_tax": false}, | |
| "2": | |
| {"name": "Tax on Purchases", "abbreviation": "GST Purchase", "description": "", | |
| "tax_percentage": "6.0", "tax_num": "", "recoverable": false, "compound_tax": false}, | |
| "3": | |
| {"name": "Tax on Sales", "abbreviation": "GST Sales","description": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @general_ledgers = GeneralLedger.where(:company_id => current_user.companies.first.id, | |
| :gl_date >= params["general_ledger"]["from_date"], | |
| :gl_date <= params["general_ledger"]["to_date"]).order(:gl_date) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def update | |
| from_account_category = JSON.parse(params["bank_cash_journal"]["from_account"]) | |
| @bank_cash_journal.from_account_maincat = from_account_category["maincat"] | |
| @bank_cash_journal.from_account_subcat = from_account_category["subcat"] | |
| @bank_cash_journal.from_account_code = from_account_category["code"] | |
| @bank_cash_journal.from_account_name = from_account_category["name"] | |
| retval = @bank_cash_journal.update ??? usually its @bank_cash_journal.update(bank_cash_journal_params) |