• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI for Accounting

#1
Hi Guys! I'm newbie here,

Would you like to help me about CI project in accounting?

Thank you... Wink
Reply

#2
I would like to help but my books are filled for the next 9 month. If you have specific question just ask them here and we all will try to help. But I dont have time for any actual coding tasks.
On the package it said needs Windows 7 or better. So I installed Linux.
Reply

#3
Learn PHP, Learn CI, Learn accounting and algorythms, Xd. Your post is just like... Xd. You didn't even type anything specific.
Just learn.
Study.
Think.
Code things.
Practise
Reply

#4
(09-29-2017, 08:15 AM)rtenny Wrote: I would like to help but my books are filled for the next 9 month. If you have specific question just ask them here and we all will try to help. But I dont have time for any actual coding tasks.

Ok thank you for your respond,
How to get your book...?
Reply

#5
(09-30-2017, 02:31 AM)krystian2160 Wrote: Learn PHP, Learn CI, Learn accounting and algorythms, Xd. Your post is just like... Xd. You didn't even type anything specific.
Just learn.
Study.
Think.
Code things.
Practise

Ok, thank for your advise,

I mean, when I try to build accounting project using codeigniter, what the best way to do first?

Any library in Codeigniter special about accounting? Or should I build it manually without any shortcut?
Reply

#6
The libraries and helpers in CI are general purpose, so yes they will help you a lot, but not for a specific purpose. They are general tools like hammers and screwdrivers will not specifically help you to build a playhouse in particular.

For an accounting app, you will need to spend a lot of time planning the database structure and your approach in terms of keeping concerns seperate. Any mistakes in that early on will kill you later and you will be rebuilding again and again.

My advice would be to keep the accounting functions and reporting functions and data acquisition functions completely separate. Try to keep everything as modular as possible, so that your unit testing can be thorough and rigorous. This sort of project could take years to get right.

Good luck and best wishes,

Paul
Reply

#7
(10-01-2017, 09:29 AM)PaulD Wrote: The libraries and helpers in CI are general purpose, so yes they will help you a lot, but not for a specific purpose. They are general tools like hammers and screwdrivers will not specifically help you to build a playhouse in particular.

For an accounting app, you will need to spend a lot of time planning the database structure and your approach in terms of keeping concerns seperate. Any mistakes in that early on will kill you later and you will be rebuilding again and again.

My advice would be to keep the accounting functions and reporting functions and data acquisition functions completely separate. Try to keep everything as modular as possible, so that your unit testing can be thorough and rigorous. This sort of project could take years to get right.

Good luck and best wishes,

Paul

Great! you gave me beautiful illustration about libraries in CI.

In a fews days, I try to collect some requirement to build the accounting app. And know more in accounting concepts be a part of the planning.

Thank you for your advice Paul, Wink
Reply

#8
akun table:
id int(11) NOT NULL
kode_akun varchar(10) NOT NULL
nama_akunvar char(60) NOT NULL
saldo_normal int(12) NOT NULL
saldo int(12) NOT NULL

akun_detail table:
idi nt(11) NOT NULL
induk varchar(10) NULL
akun varchar(7) NULL
nama varchar(45) NULL
golongan varchar(1) NULL
nr_lr varchar(2) NULL

those are my table.
Reply

#9
This is my akun CONTROLLER

<?php

if (!defined('BASEPATH'))
exit('No direct script access allowed');

class Akun extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('Akun_model');
$this->load->library('form_validation');
$this->load->library('datatables');
}

public function index()
{
$this->template->load('template','akun/akun_list');
}

public function json() {
header('Content-Type: application/json');
echo $this->Akun_model->json();
}

public function read($id)
{
$row = $this->Akun_model->get_by_id($id);
if ($row) {
$data = array(
'id' => $row->id,
'kode_akun' => $row->kode_akun,
'nama_akun' => $row->nama_akun,
'saldo_normal' => $row->saldo_normal,
'saldo' => $row->saldo,
);
$this->template->load('template','akun/akun_read', $data);
} else {
$this->session->set_flashdata('message', 'Record Not Found');
redirect(site_url('akun'));
}
}

public function create()
{
$data = array(
'button' => 'Create',
'action' => site_url('akun/create_action'),
'id' => set_value('id'),
'kode_akun' => set_value('kode_akun'),
'nama_akun' => set_value('nama_akun'),
'saldo_normal' => set_value('saldo_normal'),
'saldo' => set_value('saldo'),
);
$this->template->load('template', 'akun/akun_form', $data);
}

public function create_action()
{
$this->_rules();

if ($this->form_validation->run() == FALSE) {
$this->create();
} else {
$data = array(
'kode_akun' => $this->input->post('kode_akun',TRUE),
'nama_akun' => $this->input->post('nama_akun',TRUE),
'saldo_normal' => $this->input->post('saldo_normal',TRUE),
'saldo' => $this->input->post('saldo',TRUE),
);

$this->Akun_model->insert($data);
$this->session->set_flashdata('message', 'Create Record Success');
redirect(site_url('akun'));
}
}

public function update($id)
{
$row = $this->Akun_model->get_by_id($id);

if ($row) {
$data = array(
'button' => 'Update',
'action' => site_url('akun/update_action'),
'id' => set_value('id', $row->id),
'kode_akun' => set_value('kode_akun', $row->kode_akun),
'nama_akun' => set_value('nama_akun', $row->nama_akun),
'saldo_normal' => set_value('saldo_normal', $row->saldo_normal),
'saldo' => set_value('saldo', $row->saldo),
);
$this->template->load('template', 'akun/akun_form', $data);
} else {
$this->session->set_flashdata('message', 'Record Not Found');
redirect(site_url('akun'));
}
}

public function update_action()
{
$this->_rules();

if ($this->form_validation->run() == FALSE) {
$this->update($this->input->post('id', TRUE));
} else {
$data = array(
'kode_akun' => $this->input->post('kode_akun',TRUE),
'nama_akun' => $this->input->post('nama_akun',TRUE),
'saldo_normal' => $this->input->post('saldo_normal',TRUE),
'saldo' => $this->input->post('saldo',TRUE),
);

$this->Akun_model->update($this->input->post('id', TRUE), $data);
$this->session->set_flashdata('message', 'Update Record Success');
redirect(site_url('akun'));
}
}

public function delete($id)
{
$row = $this->Akun_model->get_by_id($id);

if ($row) {
$this->Akun_model->delete($id);
$this->session->set_flashdata('message', 'Delete Record Success');
redirect(site_url('akun'));
} else {
$this->session->set_flashdata('message', 'Record Not Found');
redirect(site_url('akun'));
}
}

public function _rules()
{
$this->form_validation->set_rules('kode_akun', 'kode akun', 'trim|required');
$this->form_validation->set_rules('nama_akun', 'nama akun', 'trim|required');
$this->form_validation->set_rules('saldo_normal', 'saldo normal', 'trim|required');
$this->form_validation->set_rules('saldo', 'saldo', 'trim|required');

$this->form_validation->set_rules('id', 'id', 'trim');
$this->form_validation->set_error_delimiters('<span class="text-danger">', '</span>');
}

public function excel()
{
$this->load->helper('exportexcel');
$namaFile = "akun.xls";
$judul = "akun";
$tablehead = 0;
$tablebody = 1;
$nourut = 1;
//penulisan header
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=" . $namaFile . "");
header("Content-Transfer-Encoding: binary ");

xlsBOF();

$kolomhead = 0;
xlsWriteLabel($tablehead, $kolomhead++, "No");
xlsWriteLabel($tablehead, $kolomhead++, "Kode Akun");
xlsWriteLabel($tablehead, $kolomhead++, "Nama Akun");
xlsWriteLabel($tablehead, $kolomhead++, "Saldo Normal");
xlsWriteLabel($tablehead, $kolomhead++, "Saldo");

foreach ($this->Akun_model->get_all() as $data) {
$kolombody = 0;

//ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
xlsWriteNumber($tablebody, $kolombody++, $nourut);
xlsWriteLabel($tablebody, $kolombody++, $data->kode_akun);
xlsWriteLabel($tablebody, $kolombody++, $data->nama_akun);
xlsWriteNumber($tablebody, $kolombody++, $data->saldo_normal);
xlsWriteNumber($tablebody, $kolombody++, $data->saldo);

$tablebody++;
$nourut++;
}

xlsEOF();
exit();
}

public function word()
{
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=akun.doc");

$data = array(
'akun_data' => $this->Akun_model->get_all(),
'start' => 0
);

$this->load->view('akun/akun_doc',$data);
}

}
Reply

#10
This is my akun model:

<?php

if (!defined('BASEPATH'))
exit('No direct script access allowed');

class Akun_model extends CI_Model
{

public $table = 'akun';
public $id = 'id';
public $order = 'DESC';

function __construct()
{
parent::__construct();
}

// datatables
function json() {
$this->datatables->select('id,kode_akun,nama_akun,saldo_normal,saldo');
$this->datatables->from('akun');
//add this line for join
//$this->datatables->join('table2', 'akun.field = table2.field');
$this->datatables->add_column('action', anchor(site_url('akun/read/$1'),'<span data-toggle="tooltip" title="Lihat Details" class=\'glyphicon glyphicon-eye-open\' aria-hidden=\'true\'></span>')." | ".anchor(site_url('akun/update/$1'),'<span data-toggle="tooltip" title="Edit Data" class=\'glyphicon glyphicon-edit\' aria-hidden=\'true\'></span>')." | ".anchor(site_url('akun/delete/$1'),'<span data-toggle="tooltip" title="Hapus Data" class=\'glyphicon glyphicon-trash\' aria-hidden=\'true\'></span>','onclick="javasciprt: return confirm(\'Are You Sure ?\')"'), 'id');
return $this->datatables->generate();
}

// get all
function get_all()
{
$this->db->order_by($this->id, $this->order);
return $this->db->get($this->table)->result();
}

// get data by id
function get_by_id($id)
{
$this->db->where($this->id, $id);
return $this->db->get($this->table)->row();
}

// get total rows
function total_rows($q = NULL) {
$this->db->like('id', $q);
$this->db->or_like('kode_akun', $q);
$this->db->or_like('nama_akun', $q);
$this->db->or_like('saldo_normal', $q);
$this->db->or_like('saldo', $q);
$this->db->from($this->table);
return $this->db->count_all_results();
}

// get data with limit and search
function get_limit_data($limit, $start = 0, $q = NULL) {
$this->db->order_by($this->id, $this->order);
$this->db->like('id', $q);
$this->db->or_like('kode_akun', $q);
$this->db->or_like('nama_akun', $q);
$this->db->or_like('saldo_normal', $q);
$this->db->or_like('saldo', $q);
$this->db->limit($limit, $start);
return $this->db->get($this->table)->result();
}

// insert data
function insert($data)
{
$this->db->insert($this->table, $data);
}

// update data
function update($id, $data)
{
$this->db->where($this->id, $id);
$this->db->update($this->table, $data);
}

// delete data
function delete($id)
{
$this->db->where($this->id, $id);
$this->db->delete($this->table);
}

}
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.